in reply to Finding Eulerian Path

Graph and/or chapter 8 of Mastering Algorithms with Perl (ISBN 9781565923980) might also be of interest.

The cake is a lie.
The cake is a lie.
The cake is a lie.

Replies are listed 'Best First'.
Re^2: Finding Eulerian Path
by Anonymous Monk on Jan 15, 2012 at 05:44 UTC
    The splice/shift trick worked. Just replace the 2 lines of delete with:
    splice @{ $graph{$u} }, $index, 1; shift @{ $graph{$v} };
    and it worked great!
      And Forgot to add this modification too, in the if() statement:
      if ( $graph{$v} ) {
      to:
      if ( @{$graph{$v}} ) {