gives the mean distance between all pairs of vertices in the graph g.


uses rules vw to specify the graph g.

Details and Options


open allclose all

Basic Examples  (2)

Find the mean distance between vertices in a graph:

Mean graph distance of the WattsStrogatz model as a function of rewiring probability:

Scope  (7)

MeanGraphDistance works with undirected graphs:

Directed graphs:

Weighted graphs:


Mixed graphs:

Use rules to specify the graph:

MeanGraphDistance works with large graphs:

Options  (2)

Method  (2)

By default, edge weights are used to determine graph distance:

Use Method->"UnitWeight" to ignore edge weights:

Applications  (4)

A network of American football games between Division IA colleges during regular season fall 2000. The average number of games linking one team to another is about 2.5:

It takes a few more than five clicks on average to navigate from one symbol to another using the See Also links in the Wolfram Language documentation:

Distribution of the number of co-appearances linking two randomly selected actors in a small-size Kevin Bacon game:

Average number of co-appearances linking two actors:

Distribution of the average number of relations connecting two people in a WattsStrogatzGraphDistribution social network model:

Compute the probability that the average exceeds 3:

Properties & Relations  (5)

MeanGraphDistance gives the off-diagonal mean of GraphDistanceMatrix:

Compute the off-diagonal mean when the diagonal of GraphDistanceMatrix is 0:

The mean graph distance is greater than or equal to 1:

It can be less than 1 for weighted graphs:

The mean graph distance of g is 1 iff g is a complete graph:

Use CompleteGraphQ to test for complete graphs:

The mean graph distance of a disconnected graph is Infinity:

Use ConnectedGraphQ to test for connected graphs:

MeanGraphDistance can be used to find the GraphLinkEfficiency:

Wolfram Research (2012), MeanGraphDistance, Wolfram Language function, (updated 2015).


Wolfram Research (2012), MeanGraphDistance, Wolfram Language function, (updated 2015).


Wolfram Language. 2012. "MeanGraphDistance." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2015.


Wolfram Language. (2012). MeanGraphDistance. Wolfram Language & System Documentation Center. Retrieved from


@misc{reference.wolfram_2023_meangraphdistance, author="Wolfram Research", title="{MeanGraphDistance}", year="2015", howpublished="\url{}", note=[Accessed: 01-October-2023 ]}


@online{reference.wolfram_2023_meangraphdistance, organization={Wolfram Research}, title={MeanGraphDistance}, year={2015}, url={}, note=[Accessed: 01-October-2023 ]}