nocad.distances.geodesic_distances#
- nocad.distances.geodesic_distances(adj, weighted=False)[source]#
Matrix of shortest-path lengths \(\ell_{ij}\) from \(x_i\) to \(x_j\).
- Parameters:
- adjarray_like or
sparse,shape(N,N) - weightedbool, default=False
Use edge weights as lengths (Dijkstra); otherwise every edge has length one.
- adjarray_like or
- Returns:
- dist
ndarrayofshape(N,N),infwherenopathexists,zerodiagonal.
- dist
Examples
>>> geodesic_distances([[0, 1, 0], [0, 0, 1], [0, 0, 0]]) array([[ 0., 1., 2.], [inf, 0., 1.], [inf, inf, 0.]])