Subject: | docs of average_path_length($u,$v) |
Date: | Tue, 14 Mar 2017 10:58:40 +1100 |
To: | bug-Graph [...] rt.cpan.org |
From: | Kevin Ryde <user42_kevin [...] yahoo.com.au> |
In Graph.pm 0.9704, the pod for average_path_length($u,$v) says "between
two vertices". That suggested to me the single (shortest) path $u to
$v, which would be the same as path_length($u,$v).
I see the code is average of all paths which either start at $u, or end
at $v, or something like that. Eg.
use strict;
use Graph;
my $graph = Graph->new(undirected=>1);
$graph->add_path(1,2,3);
print $graph->average_path_length(1,2),"\n";
prints 1.333, being average of 1--2, 1--3, 3--2.
Perhaps the docs could be massaged for clarity.
I wondered actually if giving both a start and end would be slightly
unusual, but then thought in a directed graph $u==$v could be paths both
to and from that vertex or some such which might be interesting.