GraphMatcher.subgraph_is_monomorphic#

GraphMatcher.subgraph_is_monomorphic()[source]#

Returns True if a subgraph of G1 is monomorphic to G2.

Examples

When creating the GraphMatcher, the order of the arguments is important.

>>> G = nx.Graph([("A", "B"), ("B", "C")])
>>> H = nx.Graph([(0, 1), (1, 2), (0, 2)])

Check whether a subgraph of G is monomorphic to H:

>>> isomatcher = nx.isomorphism.GraphMatcher(G, H)
>>> isomatcher.subgraph_is_monomorphic()
False

Check whether a subgraph of H is isomorphic to G:

>>> isomatcher = nx.isomorphism.GraphMatcher(H, G)
>>> isomatcher.subgraph_is_monomorphic()
True