NetworkX

Previous topic

networkx.bidirectional_dijkstra

Next topic

networkx.single_source_dijkstra_path_length

Quick search

networkx.single_source_dijkstra_path

single_source_dijkstra_path(G, source)

Returns the shortest paths 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.