class_docstr: VF2 isomorphism checker for undirected graphs.
class_docstr_tok: ["VF2","isomorphism","checker","for","undirected","graphs","."]
docstr: Initialize graph matcher.
  
  Parameters
  ----------
  G1, G2: graph
      The graphs to be tested.
  
  node_match: callable
      A function that returns True iff node n1 in G1 and n2 in G2
      should be considered equal during the isomorphism test. The
      function will be called like::
  
         node_match(G1.nodes[n1], G2.nodes[n2])
  
      That is, the function will receive the node attribute dictionaries
      of the nodes under consideration. If None, then no attributes are
      considered when testing for an isomorphism.
  
  edge_match: callable
      A function that returns True iff the edge attribute dictionary for
      the pair of nodes (u1, v1) in G1 and (u2, v2) in G2 should be
      considered equal during the isomorphism test. The function will be
      called like::
  
         edge_match(G1[u1][v1], G2[u2][v2])
  
      That is, the function will receive the edge attribute dictionaries
      of the edges under consideration. If None, then no attributes are
      considered when testing for an isomorphism.
docstr_tok: ["Initialize","graph","matcher",".","Parameters","--","--","--","--","--","G1",",","G2",":","graph","The","graphs","to","be","tested",".","node_match",":","callable","A","function","that","returns","True","iff","node","n1","in","G1","and","n2","in","G2","should","be","considered","equal","during","the","isomorphism","test",".","The","function","will","be","called","like",":",":","node_match","(","G1.nodes","[","n1","]",",","G2.nodes","[","n2","]",")","That","is",",","the","function","will","receive","the","node","attribute","dictionaries","of","the","nodes","under","consideration",".","If","None",",","then","no","attributes","are","considered","when","testing","for","an","isomorphism",".","edge_match",":","callable","A","function","that","returns","True","iff","the","edge","attribute","dictionary","for","the","pair","of","nodes","(","u1",",","v1",")","in","G1","and","(","u2",",","v2",")","in","G2","should","be","considered","equal","during","the","isomorphism","test",".","The","function","will","be","called","like",":",":","edge_match","(","G1","[","u1","]","[","v1","]",",","G2","[","u2","]","[","v2","]",")","That","is",",","the","function","will","receive","the","edge","attribute","dictionaries","of","the","edges","under","consideration",".","If","None",",","then","no","attributes","are","considered","when","testing","for","an","isomorphism","."]
code: def __init__(self, G1, G2, node_match=None, edge_match=None):
      """Initialize graph matcher.
  
      Parameters
      ----------
      G1, G2: graph
          The graphs to be tested.
  
      node_match: callable
          A function that returns True iff node n1 in G1 and n2 in G2
          should be considered equal during the isomorphism test. The
          function will be called like::
  
             node_match(G1.nodes[n1], G2.nodes[n2])
  
          That is, the function will receive the node attribute dictionaries
          of the nodes under consideration. If None, then no attributes are
          considered when testing for an isomorphism.
  
      edge_match: callable
          A function that returns True iff the edge attribute dictionary for
          the pair of nodes (u1, v1) in G1 and (u2, v2) in G2 should be
          considered equal during the isomorphism test. The function will be
          called like::
  
             edge_match(G1[u1][v1], G2[u2][v2])
  
          That is, the function will receive the edge attribute dictionaries
          of the edges under consideration. If None, then no attributes are
          considered when testing for an isomorphism.
  
      """
      vf2.GraphMatcher.__init__(self, G1, G2)
  
      self.node_match = node_match
      self.edge_match = edge_match
  
      # These will be modified during checks to minimize code repeat.
      self.G1_adj = self.G1.adj
      self.G2_adj = self.G2.adj
  
file_path: networkx/networkx/algorithms/isomorphism/vf2userfunc.py
imports: from .None import isomorphvf2
label_desc: Use image node_id 1 to create a new GraphMatcher object from inherited base classes: vf2 with example: obj = GraphMatcher(G1, G2, node_match, edge_match)