NetworkX

Previous topic

networkx.dijkstra_path

Next topic

networkx.bidirectional_dijkstra

Quick search

networkx.dijkstra_path_length

dijkstra_path_length(G, source, target)

Returns the shortest path length from source to target in a weighted graph G.

Uses a bidirectional version of Dijkstra’s algorithm.

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

See also bidirectional_dijkstra for more information about the algorithm.