Function retworkx::digraph_distance_matrix[][src]

pub fn digraph_distance_matrix(
    py: Python<'_>,
    graph: &PyDiGraph,
    parallel_threshold: usize,
    as_undirected: bool
) -> PyResult<PyObject>

Get the distance matrix for a directed graph

This differs from functions like digraph_floyd_warshall_numpy in that the edge weight/data payload is not used and each edge is treated as a distance of 1.

This function is also multithreaded and will run in parallel if the number of nodes in the graph is above the value of parallel_threshold (it defaults to 300). If the function will be running in parallel the env var RAYON_NUM_THREADS can be used to adjust how many threads will be used.

:param PyDiGraph graph: The graph to get the distance matrix for :param int parallel_threshold: The number of nodes to calculate the the distance matrix in parallel at. It defaults to 300, but this can be tuned :param bool as_undirected: If set to True the input directed graph will be treat as if each edge was bidirectional/undirected in the output distance matrix.

:returns: The distance matrix :rtype: numpy.ndarray