Skip to content

Commit b04ea06

Browse files
Load graphs using pydot rather than pygraphviz
1 parent d673d0a commit b04ea06

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

causal_testing/specification/causal_dag.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
from typing import Union
99

1010
import networkx as nx
11+
import pydot
1112

1213
from causal_testing.testing.base_test_case import BaseTestCase
1314

@@ -133,7 +134,9 @@ class CausalDAG(nx.DiGraph):
133134
def __init__(self, dot_path: str = None, **attr):
134135
super().__init__(**attr)
135136
if dot_path:
136-
self.graph = nx.DiGraph(nx.drawing.nx_agraph.read_dot(dot_path))
137+
pydot_graph = pydot.graph_from_dot_file(dot_path)
138+
self.graph = nx.DiGraph(nx.drawing.nx_pydot.from_pydot(pydot_graph[0]))
139+
self.graph2 = nx.DiGraph(nx.drawing.nx_agraph.read_dot(dot_path))
137140
else:
138141
self.graph = nx.DiGraph()
139142

0 commit comments

Comments
 (0)