def test_icdag_degree_caps(): dag = DAG.generate("ide_cozman", 10, burn_in=1000, max_indegree=2, seed=1) assert max(dag.indegree()) <= 2 assert 2 < max(dag.outdegree( )) <= 3, "Make sure out/degree isn't capped when indegree is set" dag = DAG.generate("ide_cozman", 10, burn_in=1000, max_outdegree=2, seed=1) assert max(dag.outdegree()) <= 2 assert 2 < max(dag.indegree( )) <= 3, "Make sure in/degree isn't capped when outdegree is set" dag = DAG.generate("ide_cozman", 10, burn_in=1000, max_degree=2, seed=1) assert max(dag.degree()) <= 2
def test_structure_types(structure_type): dag_1 = DAG.generate(structure_type, 10, seed=1) dag_2 = getattr(structure_generation, structure_type.lower().replace(" ", "_"))(10, seed=1) assert dag_1.is_dag() assert dag_1.nodes == dag_2.nodes == set(ascii_uppercase[:10]) assert dag_1.edges == dag_2.edges > set()
def test_copy(test_dag): dag = test_dag dag_copy = dag.copy() assert dag.nodes == dag_copy.nodes assert dag.edges == dag_copy.edges dag = DAG.generate("forest_fire", 10, seed=1) dag_copy = dag.copy() assert dag.nodes == dag_copy.nodes assert dag.edges == dag_copy.edges