GraphMatcher.subgraph_monomorphisms_iter#
- GraphMatcher.subgraph_monomorphisms_iter()[source]#
Generator over monomorphisms between a subgraph of
G1andG2.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)])
Yield monomorphic mappings between
Hand subgraphs ofG:>>> isomatcher = nx.isomorphism.GraphMatcher(G, H) >>> list(isomatcher.subgraph_monomorphisms_iter()) []
Yield monomorphic mappings between
Gand subgraphs ofH:>>> isomatcher = nx.isomorphism.GraphMatcher(H, G) >>> next(isomatcher.subgraph_monomorphisms_iter()) {0: 'A', 1: 'B', 2: 'C'}