brainconn.distance
.charpath¶
-
charpath
(D, include_diagonal=False, include_infinite=True)[source]¶ The characteristic path length is the average shortest path length in the network. The global efficiency is the average inverse shortest path length in the network.
Parameters: - D (NxN
numpy.ndarray
) – distance matrix - include_diagonal (bool) – If True, include the weights on the diagonal. Default value is False.
- include_infinite (bool) – If True, include infinite distances in calculation
Returns: - lambda (float) – characteristic path length
- efficiency (float) – global efficiency
- ecc (Nx1
numpy.ndarray
) – eccentricity at each vertex - radius (float) – radius of graph
- diameter (float) – diameter of graph
Notes
The input distance matrix may be obtained with any of the distance functions, e.g. distance_bin, distance_wei. Characteristic path length is calculated as the global mean of the distance matrix D, excludings any ‘Infs’ but including distances on the main diagonal.
- D (NxN