Commits

Anonymous committed 8c7f176

Optimised the connectivity DFS scan.

Comments (0)

Files changed (1)

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 (