File tree 1 file changed +14
-7
lines changed
1 file changed +14
-7
lines changed Original file line number Diff line number Diff line change @@ -610,15 +610,22 @@ def __init__(self):
610
610
def remove_redundant_graphs (self ):
611
611
'''Removes possible graphs if they are equivalent to others.'''
612
612
graphs = self .graphs
613
- initial_num_graphs = len (graphs )
614
613
# Walk the list backwards so that popping elements doesn't
615
- # mess up indexing
616
- for i in range (len (graphs ) - 1 ):
617
- graph = graphs [initial_num_graphs - 1 - i ]
618
- for j in range (1 , len (graphs )):
619
- comparison_graph = graphs [initial_num_graphs - 1 - j ]
614
+ # mess up indexing.
615
+
616
+ # n.b. no need to test graph 0 as it will have been tested against
617
+ # all others by the time we get to it
618
+ for i in range (len (graphs ) - 1 , 0 , - 1 ):
619
+ graph = graphs [i ]
620
+
621
+ #test graph i against all graphs 0 to i-1
622
+ for j in range (0 , i ):
623
+ comparison_graph = graphs [j ]
624
+
620
625
if set (comparison_graph .keys ()) == set (graph .keys ()):
621
- graphs .pop (initial_num_graphs - 1 - i )
626
+ #graph[i] == graph[j]
627
+ #so remove graph[i] and continue on to testing graph[i-1]
628
+ graphs .pop (i )
622
629
break
623
630
624
631
def add (self , dependent , dependency ):
You can’t perform that action at this time.
0 commit comments