code: def find(self, i):
          '''
          API:
              find(self, i)
          Description:
              Returns root of set that has i.
          Input:
              i: Item.
          Return:
              Returns root of set that has i.
          '''
          current = i
          edge_list = []
          while len(self.get_neighbors(current)) != 0:
              successor = self.get_neighbors(current)[0]
              edge_list.append((current, successor))
              current = successor
          if self.optimize:
              for e in edge_list:
                  if e[1] != current:
                      self.del_edge((e[0], e[1]))
                      self.add_edge(e[0], current)
          return currenf find(self, i):
          '''
          API:
              find(self, i)
          Description:
              Returns root of set that has i.
          Input:
              i: Item.
          Return:
              Returns root of set that has i.
          '''
          current = i
          edge_list = []
          while len(self.get_neighbors(current)) != 0:
              successor = self.get_neighbors(current)[0]
              edge_list.append((current, successor))
              current = successor
          if self.optimize:
              for e in edge_list:
                  if e[1] != current:
                      self.del_edge((e[0], e[1]))
                      self.add_edge(e[0], current)
          return current
docs: API:
              find(self, i)
          Description:
              Returns root of set that has i.
          Input:
              i: Item.
          Return:
              Returns root of set that has i.