class_docstr: Internal representation of state for the DiGraphMatcher class.
  
  This class is used internally by the DiGraphMatcher class.  It is used
  only to store state specific data. There will be at most G2.order() of
  these objects in memory at a time, due to the depth-first search
  strategy employed by the VF2 algorithm.
class_docstr_tok: ["Internal","representation","of","state","for","the","DiGraphMatcher","class",".","This","class","is","used","internally","by","the","DiGraphMatcher","class",".","It","is","used","only","to","store","state","specific","data",".","There","will","be","at","most","G2.order","(",")","of","these","objects","in","memory","at","a","time",",","due","to","the","depth-first","search","strategy","employed","by","the","VF2","algorithm","."]
docstr: Initializes DiGMState object.
  
  Pass in the DiGraphMatcher to which this DiGMState belongs and the
  new node pair that will be added to the GraphMatcher's current
  isomorphism mapping.
docstr_tok: ["Initializes","DiGMState","object",".","Pass","in","the","DiGraphMatcher","to","which","this","DiGMState","belongs","and","the","new","node","pair","that","will","be","added","to","the","GraphMatcher","'s","current","isomorphism","mapping","."]
code: def __init__(self, GM, G1_node=None, G2_node=None):
      """Initializes DiGMState object.
  
      Pass in the DiGraphMatcher to which this DiGMState belongs and the
      new node pair that will be added to the GraphMatcher's current
      isomorphism mapping.
      """
      self.GM = GM
  
      # Initialize the last stored node pair.
      self.G1_node = None
      self.G2_node = None
      self.depth = len(GM.core_1)
  
      if G1_node is None or G2_node is None:
          # Then we reset the class variables
          GM.core_1 = {}
          GM.core_2 = {}
          GM.in_1 = {}
          GM.in_2 = {}
          GM.out_1 = {}
          GM.out_2 = {}
  
      # Watch out! G1_node == 0 should evaluate to True.
      if G1_node is not None and G2_node is not None:
          # Add the node pair to the isomorphism mapping.
          GM.core_1[G1_node] = G2_node
          GM.core_2[G2_node] = G1_node
  
          # Store the node that was added last.
          self.G1_node = G1_node
          self.G2_node = G2_node
  
          # Now we must update the other four vectors.
          # We will add only if it is not in there already!
          self.depth = len(GM.core_1)
  
          # First we add the new nodes...
          for vector in (GM.in_1, GM.out_1):
              if G1_node not in vector:
                  vector[G1_node] = self.depth
          for vector in (GM.in_2, GM.out_2):
              if G2_node not in vector:
                  vector[G2_node] = self.depth
  
          # Now we add every other node...
  
          # Updates for T_1^{in}
          new_nodes = set()
          for node in GM.core_1:
              new_nodes.update(
                  [
                      predecessor
                      for predecessor in GM.G1.predecessors(node)
                      if predecessor not in GM.core_1
                  ]
              )
          for node in new_nodes:
              if node not in GM.in_1:
                  GM.in_1[node] = self.depth
  
          # Updates for T_2^{in}
          new_nodes = set()
          for node in GM.core_2:
              new_nodes.update(
                  [
                      predecessor
                      for predecessor in GM.G2.predecessors(node)
                      if predecessor not in GM.core_2
                  ]
              )
          for node in new_nodes:
              if node not in GM.in_2:
                  GM.in_2[node] = self.depth
  
          # Updates for T_1^{out}
          new_nodes = set()
          for node in GM.core_1:
              new_nodes.update(
                  [
                      successor
                      for successor in GM.G1.successors(node)
                      if successor not in GM.core_1
                  ]
              )
          for node in new_nodes:
              if node not in GM.out_1:
                  GM.out_1[node] = self.depth
  
          # Updates for T_2^{out}
          new_nodes = set()
          for node in GM.core_2:
              new_nodes.update(
                  [
                      successor
                      for successor in GM.G2.successors(node)
                      if successor not in GM.core_2
                  ]
              )
          for node in new_nodes:
              if node not in GM.out_2:
                  GM.out_2[node] = self.depth
  
imports: import sys
label_desc: Use image node_id 1 to create a new DiGMState object  with example: obj = DiGMState(GM, G1_node, G2_node)