http://www.perlmonks.org?node_id=596258


in reply to Develop a Tree

There's a Graph module on CPAN. I haven't used it, but it looks like it's depth-first traversal would do for you.

Of course there's not usually just one path from a user's workstation to a server and the actual path depends on the state of each router's tables as the packet passes through them. But often--usually--the shortest path (in terms of # of edges or nodes) is the one taken.