def start_with_graph(): global dag dag = DAG() dag.from_dict({'a': ['b', 'c'], 'b': ['d'], 'c': ['d'], 'd': []})
def test_all_downstreams_pass_graph(): dag2 = DAG() dag2.from_dict({'a': ['c'], 'b': ['d'], 'c': ['d'], 'd': []}) assert dag.all_downstreams('a', dag2.graph) == ['c', 'd'] assert dag.all_downstreams('b', dag2.graph) == ['d'] assert dag.all_downstreams('d', dag2.graph) == []
def inital_graph(): dag = DAG() #dag.from_dict({0:[2], # 1:[2,3], # 2:[4], # 3:[4,5], # 4:[], # 5:[]}) dag.from_dict({0: [], 1: [], 2: [], 3: [0, 2], 4: [0], 5: [0, 2, 3]}) return dag
def test_all_downstreams_pass_graph(): dag2 = DAG() dag2.from_dict({"a": ["c"], "b": ["d"], "c": ["d"], "d": []}) assert dag.all_downstreams("a", dag2.graph) == ["c", "d"] assert dag.all_downstreams("b", dag2.graph) == ["d"] assert dag.all_downstreams("d", dag2.graph) == []
def start_with_graph(): global dag dag = DAG() dag.from_dict({"a": ["b", "c"], "b": ["d"], "c": ["d"], "d": []})
# -*- coding: utf-8 -*- from dag import DAG dag = DAG() dag.from_dict({'a': ['b', 'c'], 'b': ['d'], 'c': ['d'], 'd': [], 'e': ['d']}) val = dag.all_downstreams('a') ind_node = dag.ind_nodes() print(ind_node)