summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--monkey/graph.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/monkey/graph.py b/monkey/graph.py
index 20a8a98..a8ad4b0 100644
--- a/monkey/graph.py
+++ b/monkey/graph.py
@@ -50,7 +50,8 @@ def graphviz(nodes, label=str, pos=None, node_attr=None, edge_attr=None):
gv_nodes = {}
for node in nodes:
gv_nodes[id(node)] = len(gv_nodes)
- node_str += '\t{} [label="{}"'.format(gv_nodes[id(node)], label(node).replace('"', '\\"'))
+ node_label = label(node).replace('\\', '\\\\').replace('"', '\\"')
+ node_str += '\t{} [label="{}"'.format(gv_nodes[id(node)], node_label)
if pos:
node_str += ', ' + 'pos="{},{}"'.format(*pos(node))
if node_attr: