meanPathLength

meanPathLength()
Returns the (weighted) mean shortest path length of the network. The “length” of an edge is considered to be the inverse of its weight. Unweighted edges therefore are considered to have a length of 1. This routine only works, if the whole network is connected. Self connections are not taken into account.

Notes

If n is the number of nodes in the network, S_{ij} is the inverse of the weight of the edge connecting i and j (and \infty, if this edge does not exist), \mathcal{P}_{ij}^l \mathrel{\mathop:}= \left\{P \in \left\{1,\ldots,n\right\}^l \middle | P_1=i, P_l=j\right\} is the set of all paths of binary length l from i to j, the mean shortest path length is defined as:

\binom{n}{2}^{-1}
\sum\limits_{i=1}^n
\sum\limits_{j=1}^{i-1}
\min_l
\min_{P\in\mathcal{P}_{ij}^l}
\sum\limits_{k=1}^{l-1}
S_{P_k P_{k+1}}

Example (python-conedy)

import conedy as co

N = co.network()

N.cycle(99, 1, co.node(), co.weightedEdge(0.25))
print "Should be 100: %f" % N.meanPathLength()

Example (conedy)

network N;
N.cycle(99, 1, roessler(), weightedEdge(0.25));
print "Should be 100: " + N.meanPathLength() + newline;

Table Of Contents

Previous topic

meanDegree

Next topic

meanWeight