

def test_cycle_basis(self):
    G = self.G
    cy = networkx.cycle_basis(G, 0)
    sort_cy = sorted((sorted(c) for c in cy))
    assert_equal(sort_cy, [[0, 1, 2, 3], [0, 1, 6, 7, 8], [0, 3, 4, 5]])
    cy = networkx.cycle_basis(G, 1)
    sort_cy = sorted((sorted(c) for c in cy))
    assert_equal(sort_cy, [[0, 1, 2, 3], [0, 1, 6, 7, 8], [0, 3, 4, 5]])
    cy = networkx.cycle_basis(G, 9)
    sort_cy = sorted((sorted(c) for c in cy))
    assert_equal(sort_cy, [[0, 1, 2, 3], [0, 1, 6, 7, 8], [0, 3, 4, 5]])
    G.add_cycle(list('ABC'))
    cy = networkx.cycle_basis(G, 9)
    sort_cy = (sorted((sorted(c) for c in cy[:(- 1)])) + [sorted(cy[(- 1)])])
    assert_equal(sort_cy, [[0, 1, 2, 3], [0, 1, 6, 7, 8], [0, 3, 4, 5], ['A', 'B', 'C']])

dataset/ETHPy150Open gkno/gkno_launcher/src/networkx/algorithms/tests/test_cycles.py TestCycles.test_cycle_basis/original