29
36
sort_cy= sorted(sorted(c) for c in cy[:-1]) + [sorted(cy[-1])]
30
37
assert_equal(sort_cy, [[0,1,2,3],[0,1,6,7,8],[0,3,4,5],['A','B','C']])
39
@raises(nx.NetworkXNotImplemented)
40
def test_cycle_basis(self):
42
cy=networkx.cycle_basis(G,0)
44
@raises(nx.NetworkXNotImplemented)
45
def test_cycle_basis(self):
47
cy=networkx.cycle_basis(G,0)
33
49
def test_simple_cycles(self):
34
50
G = nx.DiGraph([(0, 0), (0, 1), (0, 2), (1, 2), (2, 0), (2, 1), (2, 2)])
35
51
c=sorted(nx.simple_cycles(G))
36
assert_equal(c,[[0, 0], [0, 1, 2, 0], [0, 2, 0], [1, 2, 1], [2, 2]])
52
ca=[[0, 0], [0, 1, 2, 0], [0, 2, 0], [1, 2, 1], [2, 2]]
53
for (a,b) in zip(c,ca):
54
assert_true(self.is_cyclic_permuatation(a[:-1],b[:-1]))
56
@raises(nx.NetworkXNotImplemented)
38
57
def test_simple_cycles_graph(self):
40
assert_raises(nx.NetworkXError,nx.simple_cycles,G)
59
c = sorted(nx.simple_cycles(G))
42
61
def test_unsortable(self):
51
70
assert_equal(c,[[1,2,3,1]])
52
71
G.add_path([10,20,30,10])
53
72
c=sorted(nx.simple_cycles(G))
54
assert_equal(c,[[1,2,3,1],[10,20,30,10]])
73
ca=[[1,2,3,1],[10,20,30,10]]
74
for (a,b) in zip(c,ca):
75
assert_true(self.is_cyclic_permuatation(a[:-1],b[:-1]))
56
77
def test_simple_cycles_empty(self):