dijkstra_single_source_shortest_paths#

dijkstra_single_source_shortest_paths(graph, source, targets, direction=..., weight='weight')#

Finds the shortest paths from a single source to multiple targets in a graph.

Parameters:
  • graph (GraphView) – The graph to search in.

  • source (NodeInput) – The source node.

  • targets (list[NodeInput]) – A list of target nodes.

  • direction (Direction) – The direction of the edges to be considered for the shortest path. Defaults to “both”.

  • weight (str) – The name of the weight property for the edges. Defaults to “weight”.

Returns:

Mapping from nodes to a tuple containing the total cost and the nodes representing the shortest path.

Return type:

NodeStateWeightedSP