in reply to How do I use Graph::Traversal?
Update: that still wouldn't give you what you expect though...I think BFS would return A, B, b, C, c, D, d, E, e).
Last Update?: What you want is DFS, but use $t->preorder instead of $t->dfs. This returns (A, b, c, d, e, B, C, D, E) which maybe acceptably close to what you are expecting.
Aha, and use the next_alphabetic option:
my $trav = Graph::Traversal::DFS->new($graph, next_alphabetic=>1); my $v; print "$v\n" while $v = $trav->preorder; __END__ A B C D E b c d e
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: How do I use Graph::Traversal?
by thor (Priest) on Jul 07, 2005 at 02:54 UTC | |
by runrig (Abbot) on Jul 07, 2005 at 16:40 UTC | |
by thor (Priest) on Jul 07, 2005 at 18:17 UTC |