parameters: (self, start, ends)
return_statement: return False
docstring: Conducts a DFS from the start segment to see if it leads to any of the end segments.
          The start segment is signed, i.e. positive start and negative start will conduct the
          search in different directions. The end segments are not signed, i.e. the search is
          successful if it reaches either orientation of an end.
docstring_summary: Conducts a DFS from the start segment to see if it leads to any of the end segments.
          The start segment is signed, i.e. positive start and negative start will conduct the
          search in different directions. The end segments are not signed, i.e. the search is
          successful if it reaches either orientation of an end.
docstring_tokens: Conducts a DFS from the start segment to see if it leads to any of the end segments . The start segment is signed i . e . positive start and negative start will conduct the search in different directions . The end segments are not signed i . e . the search is successful if it reaches either orientation of an end .
function: def search(self, start, ends):
          """
          Conducts a DFS from the start segment to see if it leads to any of the end segments.
          The start segment is signed, i.e. positive start and negative start will conduct the
          search in different directions. The end segments are not signed, i.e. the search is
          successful if it reaches either orientation of an end.
          """
          end_set = set(ends)
          end_set.update(-x for x in ends)
          visited, stack = set(), [start]
          while stack:
              seg = stack.pop()
              if seg not in visited:
                  visited.add(seg)
                  if seg in self.forward_links:
                      for next_seg in self.forward_links[seg]:
                          if next_seg in end_set:
                              return True
                          if next_seg not in visited:
                              stack.append(next_seg)
          return False
function_tokens: def search ( self , start , ends ) : end_set = set ( ends ) end_set . update ( - x for x in ends ) visited , stack = set ( ) , [ start ] while stack : seg = stack . pop ( ) if seg not in visited : visited . add ( seg ) if seg in self . forward_links : for next_seg in self . forward_links [ seg ] : if next_seg in end_set : return True if next_seg not in visited : stack . append ( next_seg ) return False