class_docstr: Implementation of VF2 algorithm for matching directed graphs.
  
  Suitable for DiGraph and MultiDiGraph instances.
class_docstr_tok: ["Implementation","of","VF2","algorithm","for","matching","directed","graphs",".","Suitable","for","DiGraph","and","MultiDiGraph","instances","."]
docstr: Iterator over candidate pairs of nodes in G1 and G2.
docstr_tok: ["Iterator","over","candidate","pairs","of","nodes","in","G1","and","G2","."]
code: def candidate_pairs_iter(self):
      """Iterator over candidate pairs of nodes in G1 and G2."""
  
      # All computations are done using the current state!
  
      G1_nodes = self.G1_nodes
      G2_nodes = self.G2_nodes
      min_key = self.G2_node_order.__getitem__
  
      # First we compute the out-terminal sets.
      T1_out = [node for node in self.out_1 if node not in self.core_1]
      T2_out = [node for node in self.out_2 if node not in self.core_2]
  
      # If T1_out and T2_out are both nonempty.
      # P(s) = T1_out x {min T2_out}
      if T1_out and T2_out:
          node_2 = min(T2_out, key=min_key)
          for node_1 in T1_out:
              yield node_1, node_2
  
      # If T1_out and T2_out were both empty....
      # We compute the in-terminal sets.
  
      # elif not (T1_out or T2_out):   # as suggested by [2], incorrect
      else:  # as suggested by [1], correct
          T1_in = [
              node for node in self.in_1 if node not in self.core_1
          ]
          T2_in = [
              node for node in self.in_2 if node not in self.core_2
          ]
  
          # If T1_in and T2_in are both nonempty.
          # P(s) = T1_out x {min T2_out}
          if T1_in and T2_in:
              node_2 = min(T2_in, key=min_key)
              for node_1 in T1_in:
                  yield node_1, node_2
  
          # If all terminal sets are empty...
          # P(s) = (N_1 - M_1) x {min (N_2 - M_2)}
  
          # elif not (T1_in or T2_in):   # as suggested by  [2], incorrect
          else:  # as inferred from [1], correct
              node_2 = min(G2_nodes - set(self.core_2), key=min_key)
              for node_1 in G1_nodes:
                  if node_1 not in self.core_1:
                      yield node_1, node_2
  
imports: import sys
label_desc: Use image node_id 2 for calling the DiGraphMatcher obj's underlying member method code with example usage: obj.candidate_pairs_iter() without return types