parameters: (self, anchor_segments, bridging_mode)
docstring: This function merges segments which are in a simple, unbranching path.
docstring_summary: This function merges segments which are in a simple, unbranching path.
docstring_tokens: This function merges segments which are in a simple unbranching path .
function: def merge_all_possible(self, anchor_segments, bridging_mode):
          """
          This function merges segments which are in a simple, unbranching path.
          """
          if anchor_segments is not None:
              anchor_seg_nums = set(x.number for x in anchor_segments)
          else:
              anchor_seg_nums = None
          while True:
              # Sort the segment numbers first so we apply the merging in a consistent order.
              seg_nums = sorted(list(self.segments.keys()))
              for num in seg_nums:
                  path = self.get_simple_path(num, anchor_seg_nums, bridging_mode)
                  assert len(path) > 0
                  if len(path) > 1:
                      self.merge_simple_path(path)
                      break
              else:
                  break
          self.renumber_segments()
function_tokens: def merge_all_possible ( self , anchor_segments , bridging_mode ) : if anchor_segments is not None : anchor_seg_nums = set ( x . number for x in anchor_segments ) else : anchor_seg_nums = None while True : # Sort the segment numbers first so we apply the merging in a consistent order. seg_nums = sorted ( list ( self . segments . keys ( ) ) ) for num in seg_nums : path = self . get_simple_path ( num , anchor_seg_nums , bridging_mode ) assert len ( path ) > 0 if len ( path ) > 1 : self . merge_simple_path ( path ) break else : break self . renumber_segments ( )