1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
|
Isomorph
========
>>> import networkx as NX
>>> from networkx.algorithms.isomorphism.isomorph import graph_could_be_isomorphic,fast_graph_could_be_isomorphic, faster_graph_could_be_isomorphic, is_isomorphic
>>> G1=NX.Graph()
>>> G2=NX.Graph()
>>> G3=NX.Graph()
>>> G4=NX.Graph()
>>> G1.add_edges_from([ [1,2],[1,3],[1,5],[2,3] ])
>>> G2.add_edges_from([ [10,20],[20,30],[10,30],[10,50] ])
>>> G3.add_edges_from([ [1,2],[1,3],[1,5],[2,5] ])
>>> G4.add_edges_from([ [1,2],[1,3],[1,5],[2,4] ])
>>> graph_could_be_isomorphic(G1,G2)
True
>>> graph_could_be_isomorphic(G1,G3)
True
>>> graph_could_be_isomorphic(G1,G4)
False
>>> graph_could_be_isomorphic(G3,G2)
True
>>> fast_graph_could_be_isomorphic(G3,G2)
True
>>> faster_graph_could_be_isomorphic(G3,G2)
True
>>> is_isomorphic(G1,G2)
True
>>> is_isomorphic(G1,G4)
False
|