@@ -103,7 +103,7 @@ def filter_dfg_on_activities_percentage(dfg0, start_activities0, end_activities0
103103 activities_count = deepcopy (activities_count0 )
104104
105105 if len (activities_count ) > 1 and len (dfg ) > 1 :
106- activities_count_sorted_list = sorted ([(x , y ) for x , y in activities_count .items ()], key = lambda x : x [1 ],
106+ activities_count_sorted_list = sorted ([(x , y ) for x , y in activities_count .items ()], key = lambda x : ( x [1 ], x [ 0 ]) ,
107107 reverse = True )
108108 # retrieve the minimum list of activities to keep in the graph, according to the percentage
109109 min_set_activities_to_keep = set (
@@ -255,7 +255,7 @@ def filter_dfg_on_paths_percentage(dfg0, start_activities0, end_activities0, act
255255 all_edges = [(x , y ) for x , y in dfg .items ()] + [((start_node , x ), start_activities [x ]) for x in
256256 start_activities ] + [((x , end_node ), end_activities [x ]) for x in
257257 end_activities ]
258- all_edges = sorted (all_edges , key = lambda x : x [1 ], reverse = True )
258+ all_edges = sorted (all_edges , key = lambda x : ( x [1 ], x [ 0 ]) , reverse = True )
259259 # calculate a set of edges that could be discarded and not
260260 non_discardable_edges = list (
261261 x [0 ] for x in all_edges [:math .ceil ((len (all_edges ) - 1 ) * percentage ) + 1 ])
@@ -339,7 +339,7 @@ def filter_dfg_keep_connected(dfg0, start_activities0, end_activities0, activiti
339339 all_edges = [(x , y ) for x , y in dependency .items ()] + [((start_node , x ), 1.0 ) for x in
340340 start_activities ] + [((x , end_node ), 1.0 ) for x in
341341 end_activities ]
342- all_edges = sorted (all_edges , key = lambda x : x [1 ], reverse = True )
342+ all_edges = sorted (all_edges , key = lambda x : ( x [1 ], x [ 0 ]) , reverse = True )
343343 # calculate a set of edges that could be discarded and not
344344 non_discardable_edges = list (x [0 ] for x in all_edges if x [1 ] >= threshold )
345345 discardable_edges = list (x [0 ] for x in all_edges if x [1 ] < threshold )
0 commit comments