Skip to content

Commit f9db25d

Browse files
committed
fix: added more descriptive comments for the changes required.
1 parent 675bf4e commit f9db25d

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
@@ -134,7 +134,10 @@ def __init__(self, dot_path: str = None, **attr):
134134
super().__init__(**attr)
135135
if dot_path:
136136
with open(dot_path, 'r', encoding='utf-8') as file:
137-
dot_content = file.read().replace('\n', '') # Remove any newlines before creating the pydot_graph.
137+
dot_content = file.read().replace('\n', '')
138+
# Previously, we used pydot_graph_from_file() to read in the dot_path directly, however,
139+
# this method does not currently have a way of removing spurious nodes.
140+
# Workaround: Read in the file using open(), remove new lines, and then create the pydot_graph.
138141
pydot_graph = pydot.graph_from_dot_data(dot_content)
139142
self.graph = nx.DiGraph(nx.drawing.nx_pydot.from_pydot(pydot_graph[0]))
140143
else:

0 commit comments

Comments
 (0)