Subject: | diameter and centre of a one vertex graph |
Date: | Mon, 25 May 2015 22:42:28 +1000 |
To: | bug-Graph [...] rt.cpan.org |
From: | Kevin Ryde <user42_kevin [...] yahoo.com.au> |
If a graph has just one vertex, diameter() returns undef and centre
returns an empty list. I expected diameter 0 and that vertex the
centre. Sample foo.pl below printing variously undef and empty.
Am I right 0 and one centre would be the usual definition for these
things? It would mean a line graph of n vertices would have diameter
n-1, and for n odd one centre.
(I struck this on a spot of code doing a layout which was to start work
at the centre of a tree.)
Message body is not shown because sender requested not to inline it.