Function retworkx::digraph_dijkstra_shortest_paths[][src]

pub fn digraph_dijkstra_shortest_paths(
    py: Python<'_>,
    graph: &PyDiGraph,
    source: usize,
    target: Option<usize>,
    weight_fn: Option<PyObject>,
    default_weight: f64,
    as_undirected: bool
) -> PyResult<PyObject>

Find the shortest path from a node

This function will generate the shortest path from a source node using Dijkstra’s algorithm.

:param PyDiGraph graph: :param int source: The node index to find paths from :param int target: An optional target path to find the path :param weight_fn: An optional weight function for an edge. It will accept a single argument, the edge’s weight object and will return a float which will be used to represent the weight/cost of the edge :param float default_weight: If weight_fn isn’t specified this optional float value will be used for the weight/cost of each edge. :param bool as_undirected: If set to true the graph will be treated as undirected for finding the shortest path.

:return: Dictionary of paths. The keys are destination node indices and the dict values are lists of node indices making the path. :rtype: dict