grape.general_graph.GeneralGraph.dijkstra_single_source_shortest_path

GeneralGraph.dijkstra_single_source_shortest_path()[source]

Serial SSSP algorithm based on Dijkstra’s method. The nested dictionaries for shortest-path, length of the paths and efficiency attributes are evaluated.

Note

Edges weight is taken into account. Edge weight attributes must be numerical. Distances are calculated as sums of weighted edges traversed.

Returns

nested dictionary with key corresponding to source, while as value a dictionary keyed by target and valued by the source-target shortest path; nested dictionary with key corresponding to source, while as value a dictionary keyed by target and valued by the source-target shortest path length.

Return type

dict, dict