csgraph : array, matrix, or sparse matrix, 2 dimensions
The N x N array of distances representing the input graph.
method : string [‘auto’’FW’’D’], optional
Algorithm to use for shortest paths. Options are:
 ‘auto’ – (default) select the best among ‘FW’, ‘D’, ‘BF’, or ‘J’
based on the input data.
 ‘FW’ – FloydWarshall algorithm. Computational cost is
approximately O[N^3]. The input csgraph will be
converted to a dense representation.
 ‘D’ – Dijkstra’s algorithm with Fibonacci heaps. Computational
cost is approximately O[N(N*k + N*log(N))], where
k is the average number of connected edges per node.
The input csgraph will be converted to a csr
representation.
 ‘BF’ – BellmanFord algorithm. This algorithm can be used when
weights are negative. If a negative cycle is encountered,
an error will be raised. Computational cost is
approximately O[N(N^2 k)], where k is the average
number of connected edges per node. The input csgraph will
be converted to a csr representation.
 ‘J’ – Johnson’s algorithm. Like the BellmanFord algorithm,
Johnson’s algorithm is designed for use when the weights
are negative. It combines the BellmanFord algorithm
with Dijkstra’s algorithm for faster computation.
directed : bool, optional
If True (default), then find the shortest path on a directed graph:
only move from point i to point j along paths csgraph[i, j].
If False, then find the shortest path on an undirected graph: the
algorithm can progress from point i to j along csgraph[i, j] or
csgraph[j, i]
return_predecessors : bool, optional
If True, return the size (N, N) predecesor matrix
unweighted : bool, optional
If True, then find unweighted distances. That is, rather than finding
the path between each point such that the sum of weights is minimized,
find the path such that the number of edges is minimized.
overwrite : bool, optional
If True, overwrite csgraph with the result. This applies only if
method == ‘FW’ and csgraph is a dense, cordered array with
dtype=float64.
