Warning

This documents an unmaintained version of NetworkX. Please upgrade to a maintained version and see the current NetworkX documentation.

__init__

DiGraphMatcher.__init__(G1, G2, node_match=None, edge_match=None)[source]

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.node[n1], G2.node[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.