Example #1
0
def test_add_edges():
    edges = graph_algos.graph({'a': set(['b', 'c'])})
    graph_algos.add_edges(edges, [('a', 'd'), ('b', 'c')])
    assert edges == {'a': set(['b', 'c', 'd']), 'b': set(['c'])}
Example #2
0
def test_reversedict():
    edges = graph_algos.graph({'a': set(['b', 'c'])})
    r_edges = graph_algos.reverse_edges(edges)
    assert r_edges == {'b': ('a',), 'c': ('a',)}
Example #3
0
def test_toposort():
    edges = graph_algos.graph({'a': set(['b', 'c']), 'b': ('c',)})
    assert graph_algos.toposort(edges) == ['a', 'b', 'c']