File tree 1 file changed +8
-8
lines changed
1 file changed +8
-8
lines changed Original file line number Diff line number Diff line change @@ -29,19 +29,19 @@ where
29
29
30
30
while let Some ( ( graph_ix, state) ) = q. pop ( ) {
31
31
let mut edges = 0 ;
32
- if visited. contains ( & graph_ix) {
33
- continue ;
34
- }
35
- visited. insert ( graph_ix) ;
32
+
36
33
for edge in graph. edges_directed ( graph_ix, Direction :: Outgoing ) {
34
+ if visited. contains ( & edge. target ( ) ) {
35
+ continue ;
36
+ }
37
37
if let Some ( result_of_edge_filtering) = edge_filter ( edge. weight ( ) ) {
38
38
final_states. push ( result_of_edge_filtering) ;
39
39
} else {
40
- let opposite_dir_of_edge_graph_ix = edge. target ( ) ;
41
- let ( new_state, keep_walking_this_path) =
42
- visitor ( & opposite_dir_of_edge_graph_ix , state . clone ( ) ) ;
40
+ let target = edge. target ( ) ;
41
+ let ( new_state, keep_walking_this_path) = visitor ( & target , state . clone ( ) ) ;
42
+ visited . insert ( target ) ;
43
43
if keep_walking_this_path {
44
- q. push ( ( opposite_dir_of_edge_graph_ix , new_state. clone ( ) ) ) ;
44
+ q. push ( ( target , new_state. clone ( ) ) ) ;
45
45
} else {
46
46
final_states. push ( new_state. clone ( ) ) ;
47
47
}
You can’t perform that action at this time.
0 commit comments