@@ -180,12 +180,8 @@ def run(self, data, convert=True, instrumentation: Instrumentation=None, data_fo
180180 best_candidate = max (partition_candidates .values (), key = lambda part : part .score )
181181 for real_node , partition_node in best_candidate .red_mapping .items ():
182182 real_node .transitions = partition_node .transitions
183+ real_node .predecessor = partition_node .predecessor
183184 real_node .prefix_access_pair = partition_node .prefix_access_pair
184-
185- for access_pair , t_info in real_node .transition_iterator ():
186- if t_info .target not in red_states :
187- t_info .target .predecessor = real_node
188- # t_info.target.prefix_access_pair = access_pair # not sure whether this is actually required
189185 instrumentation .log_merge (best_candidate )
190186 # FUTURE: optimizations for compatibility tests where merges can be orthogonal
191187 # FUTURE: caching for aggregating compatibility tests
@@ -234,7 +230,6 @@ def _partition_from_merge(self, red: GsmNode, blue: GsmNode) -> Partitioning:
234230 # when compatibility is determined only by future and scores are disabled, we need not create partitions.
235231 if self .compatibility_on_futures and not self .score_calc .has_score_function ():
236232 def update_partition (red_node : GsmNode , blue_node : Optional [GsmNode ]) -> GsmNode :
237- partitioning .red_mapping [red_node ] = red_node
238233 return red_node
239234 else :
240235 def update_partition (red_node : GsmNode , blue_node : Optional [GsmNode ]) -> GsmNode :
@@ -291,9 +286,12 @@ def update_partition(red_node: GsmNode, blue_node: Optional[GsmNode]) -> GsmNode
291286 q .append ((partition_transition .target , blue_transition .target ))
292287 partition_transition .count += blue_transition .count
293288 else :
294- # blue_child is blue after merging if there is a red state in blue's partition
289+ # blue child is blue after merging if there is a red state in blue's partition
295290 partition_transition = TransitionInfo (blue_transition .target , blue_transition .count , None , 0 )
296291 partition_transitions [out_sym ] = partition_transition
292+ # update predecessor of blue child
293+ blue_target_partition = update_partition (blue_transition .target , None )
294+ blue_target_partition .predecessor = red
297295
298296 partitioning .score = self .score_calc .score_function (partitioning .full_mapping )
299297 return partitioning
0 commit comments