File: isomorph.txt

package info (click to toggle)
python-networkx 1.1-2
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 2,780 kB
  • ctags: 1,910
  • sloc: python: 29,050; makefile: 126
file content (31 lines) | stat: -rw-r--r-- 824 bytes parent folder | download
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