brainconn.distance.distance_bin

distance_bin(G)[source]

The distance matrix contains lengths of shortest paths between all pairs of nodes. An entry (u,v) represents the length of shortest path from node u to node v. The average shortest path length is the characteristic path length of the network.

Parameters:A (NxN numpy.ndarray) – binary directed/undirected connection matrix
Returns:D – distance matrix
Return type:NxN

Notes

Lengths between disconnected nodes are set to Inf. Lengths on the main diagonal are set to 0. Algorithm: Algebraic shortest paths.