PayPal Checkout services are represented as a directed graph, where each edge connects two services and has a nonnegative processing cost. Given a source service and a destination service, return the minimum total cost and the corresponding route.
Implement Dijkstra's algorithm with a min-heap. The route must include the source and destination in order. If the destination cannot be reached, return [-1, []].
Implement shortest_path(n, edges, source, target).
n is an integer representing nodes numbered from 0 through n - 1.edges is a list of [from_node, to_node, cost] records representing directed edges.source and target are integer node identifiers.[minimum_cost, path], where minimum_cost is an integer and path is a list of node identifiers.def shortest_path(n, edges, source, target):