Posted on 2005-02-18 00:12:54-08 by skrivnut
Edge Count Between Two Nodes
Hi there, I'd like to calculate the number of edges between two nodes, and am not sure the best way to go about it. I've tried using traverse a few different ways, with no luck. Just to prove I don't know what I'm doing, my first attempt was along the lines...
$count = $tree->traverse(\&edgeCount($a, $b));
I now see the folly of that way, and I suspect that I may need to write some kind of special Tree::Simple::Visitor::* sub class. It would be great if it already existed though! Thanks for your help in advance. Regards, e.
Direct Responses: Write a response
Perl Weekly newsletter
A free weekly newsletter for people who are busy to read all the blogs. click here to check it out.