in reply to Re: Finding Eulerian Path
in thread Finding Eulerian Path

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!

Replies are listed 'Best First'.
Re^3: Finding Eulerian Path
by Anonymous Monk on Jan 15, 2012 at 10:09 UTC
    And Forgot to add this modification too, in the if() statement:
    if ( $graph{$v} ) {
    to:
    if ( @{$graph{$v}} ) {