Beispiel #1
0
def test_update(nodes):
    """Test update node attributes."""
    v, w = nodes
    vw = Edge(v, w, length=5)

    assert vw['length'] == 5

    vw.update(length=10, capacity=6)

    assert vw['length'] == 10
    assert vw['capacity'] == 6
def create_edges(pathpy=True, iterations=1000):
    """ Create nodes without attributes. """
    a = Node('a')
    b = Node('b')

    if pathpy:
        for i in range(iterations):
            e = Edge(a, b)
    else:
        for i in range(iterations):
            e = {}
            e.update(uid=None, v=a, w=b, nodes=set())
            e['nodes'].add(a)
            e['nodes'].add(b)

    return True