DiGraphMatcher.subgraph_is_monomorphic#

DiGraphMatcher.subgraph_is_monomorphic()[source]#

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

Examples

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

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

Check whether a subgraph of G is monomorphic to H:

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

Check whether a subgraph of H is isomorphic to G:

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