Commits

shl...@b384bcd7-cfd4-0310-aca0-d78b80f7b91b  committed 8c7f176

Optimised the connectivity DFS scan.

  • Participants
  • Parent commits d99c576

Comments (0)

Files changed (1)

File abc-path/generator/generate-abs-path.pl

             while (@connectivity_stack)
             {
                 my $int = pop(@connectivity_stack);
-                $connected{$int} = 1;
+                if (!exists($connected{$int}))
+                {
+                    $connected{$int} = 1;
 
-                push @connectivity_stack, 
-                    (grep { !exists($connected{$_}) } 
-                        @{ $self->_get_next_cells($l, $int) }
-                    );
+                    push @connectivity_stack, 
+                        (grep { !exists($connected{$_}) } 
+                            @{ $self->_get_next_cells($l, $int) }
+                        );
+                }
             }
 
             if (