Mercurial > repos > shellac > sam_consensus_v3
comparison env/lib/python3.9/site-packages/networkx/algorithms/isomorphism/tests/test_isomorphism.py @ 0:4f3585e2f14b draft default tip
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
author | shellac |
---|---|
date | Mon, 22 Mar 2021 18:12:50 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:4f3585e2f14b |
---|---|
1 import networkx as nx | |
2 from networkx.algorithms import isomorphism as iso | |
3 | |
4 | |
5 class TestIsomorph: | |
6 @classmethod | |
7 def setup_class(cls): | |
8 cls.G1 = nx.Graph() | |
9 cls.G2 = nx.Graph() | |
10 cls.G3 = nx.Graph() | |
11 cls.G4 = nx.Graph() | |
12 cls.G5 = nx.Graph() | |
13 cls.G6 = nx.Graph() | |
14 cls.G1.add_edges_from([[1, 2], [1, 3], [1, 5], [2, 3]]) | |
15 cls.G2.add_edges_from([[10, 20], [20, 30], [10, 30], [10, 50]]) | |
16 cls.G3.add_edges_from([[1, 2], [1, 3], [1, 5], [2, 5]]) | |
17 cls.G4.add_edges_from([[1, 2], [1, 3], [1, 5], [2, 4]]) | |
18 cls.G5.add_edges_from([[1, 2], [1, 3]]) | |
19 cls.G6.add_edges_from([[10, 20], [20, 30], [10, 30], [10, 50], [20, 50]]) | |
20 | |
21 def test_could_be_isomorphic(self): | |
22 assert iso.could_be_isomorphic(self.G1, self.G2) | |
23 assert iso.could_be_isomorphic(self.G1, self.G3) | |
24 assert not iso.could_be_isomorphic(self.G1, self.G4) | |
25 assert iso.could_be_isomorphic(self.G3, self.G2) | |
26 assert not iso.could_be_isomorphic(self.G1, self.G6) | |
27 | |
28 def test_fast_could_be_isomorphic(self): | |
29 assert iso.fast_could_be_isomorphic(self.G3, self.G2) | |
30 assert not iso.fast_could_be_isomorphic(self.G3, self.G5) | |
31 assert not iso.fast_could_be_isomorphic(self.G1, self.G6) | |
32 | |
33 def test_faster_could_be_isomorphic(self): | |
34 assert iso.faster_could_be_isomorphic(self.G3, self.G2) | |
35 assert not iso.faster_could_be_isomorphic(self.G3, self.G5) | |
36 assert not iso.faster_could_be_isomorphic(self.G1, self.G6) | |
37 | |
38 def test_is_isomorphic(self): | |
39 assert iso.is_isomorphic(self.G1, self.G2) | |
40 assert not iso.is_isomorphic(self.G1, self.G4) |