NetworkX

Previous topic

networkx.single_source_dijkstra_path

Next topic

networkx.single_source_dijkstra

Quick search

networkx.single_source_dijkstra_path_length

single_source_dijkstra_path_length(G, source)

Returns the shortest path lengths from source to all other reachable nodes in a weighted graph G.

Uses Dijkstra’s algorithm.

Returns a dictionary of shortest path lengths keyed by source.

Edge data must be numerical values for XGraph and XDiGraphs. The weights are assigned to be 1 for Graphs and DiGraphs.

See also single_source_dijkstra for more information about the algorithm.