grape.general_graph.GeneralGraph.construct_path_kernel

GeneralGraph.construct_path_kernel(nodes, predecessor)[source]

Reconstruct source-target paths starting from predecessors matrix, and populate the dictionary of shortest paths.

Parameters
  • nodes (list) – list of nodes for which to compute the shortest path between them and all the other nodes.

  • predecessor (numpy.ndarray) – matrix of predecessors, computed with Floyd Warshall APSP algorithm.

Returns

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

Return type

dict