Skip to content

Commit

Permalink
Fixed bug in drawing of graphviz edges from interaction nodes by repl…
Browse files Browse the repository at this point in the history
…acing colons in node names with ampersands. (#3414)

Ampersands are a safe replacement: they will not cause accidental node name collisions because they aren't allowed in python names (nor, by extension, in patsy formulas).
  • Loading branch information
Jeroen authored and aloctavodia committed Mar 20, 2019
1 parent f60dc1d commit f113178
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pymc3/model_graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ def _make_node(self, var_name, graph):
distribution = 'Deterministic'
attrs['shape'] = 'box'

graph.node(var_name,
graph.node(var_name.replace(':', '&'),
'{var_name} ~ {distribution}'.format(var_name=var_name, distribution=distribution),
**attrs)

Expand Down Expand Up @@ -167,7 +167,7 @@ def make_graph(self):

for key, values in self.make_compute_graph().items():
for value in values:
graph.edge(value, key)
graph.edge(value.replace(':', '&'), key.replace(':', '&'))
return graph


Expand Down

0 comments on commit f113178

Please sign in to comment.