Ejemplo n.º 1
0
def test_build_graph_graph():
    data = _test_data()
    G = case_tree.build_graph(data, 'cluster', 'case_id', 'pltdate', 'cluster', 1, 1)

    assert len(G.node) == 6
    edges = [(0, 0), (1, 1), (0, 2), (2, 3), (1, 4), (4, 5)]
    assert len(G.edges()) == len(edges)
    for tup in G.edges():
        assert tup in edges
Ejemplo n.º 2
0
def test_build_graph_generation():
    data = _test_data()
    G = case_tree.build_graph(data, 'cluster', 'case_id', 'pltdate', 'cluster', 1, 1)

    assert G.node[0]['generation'] == 0
    assert G.node[1]['generation'] == 0
    assert G.node[2]['generation'] == 1
    assert G.node[3]['generation'] == 2
    assert G.node[4]['generation'] == 1
    assert G.node[5]['generation'] == 2