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.


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:

S_{P_k P_{k+1}}

Example (python-conedy)

import conedy as co

N =

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


Next topic