Tree-Simple - Edge Count Between Two Nodes

Posted on Fri Feb 18 02:12:54 2005 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.
Write a response