dijkstra_predecessor_and_distance¶
-
dijkstra_predecessor_and_distance
(G, source, cutoff=None, weight='weight')[source]¶ Compute shortest path length and predecessors on shortest paths in weighted graphs.
Parameters: Returns: pred,distance – Returns two dictionaries representing a list of predecessors of a node and the distance to each node.
Return type: dictionaries
Notes
Edge weight attributes must be numerical. Distances are calculated as sums of weighted edges traversed.
The list of predecessors contains more than one element only when there are more than one shortest paths to the key node.