GraphMatcher.subgraph_is_monomorphic#
- GraphMatcher.subgraph_is_monomorphic()[source]#
Returns
Trueif a subgraph ofG1is monomorphic toG2.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