class_docstr: A class to maintain the state during planarity check.
class_docstr_tok: ["A","class","to","maintain","the","state","during","planarity","check","."]
code: def add_constraints(self, ei, e):
      P = ConflictPair()
      # merge return edges of e_i into P.right
      while True:
          Q = self.S.pop()
          if not Q.left.empty():
              Q.swap()
          if not Q.left.empty():  # not planar
              return False
          if self.lowpt[Q.right.low] > self.lowpt[e]:
              # merge intervals
              if P.right.empty():  # topmost interval
                  P.right = Q.right.copy()
              else:
                  self.ref[P.right.low] = Q.right.high
              P.right.low = Q.right.low
          else:  # align
              self.ref[Q.right.low] = self.lowpt_edge[e]
          if top_of_stack(self.S) == self.stack_bottom[ei]:
              break
      # merge conflicting return edges of e_1,...,e_i-1 into P.L
      while top_of_stack(self.S).left.conflicting(
          ei, self
      ) or top_of_stack(self.S).right.conflicting(ei, self):
          Q = self.S.pop()
          if Q.right.conflicting(ei, self):
              Q.swap()
          if Q.right.conflicting(ei, self):  # not planar
              return False
          # merge interval below lowpt(e_i) into P.R
          self.ref[P.right.low] = Q.right.high
          if Q.right.low is not None:
              P.right.low = Q.right.low
  
          if P.left.empty():  # topmost interval
              P.left = Q.left.copy()
          else:
              self.ref[P.left.low] = Q.left.high
          P.left.low = Q.left.low
  
      if not (P.left.empty() and P.right.empty()):
          self.S.append(P)
      return True
  
imports: from collections import defaultdict
  import networkx
label_desc: Use image node_id 8 for calling the LRPlanarity obj's underlying member method code with example usage: obj.add_constraints(ei, e) and returns: True, False, False