Skip to content

Commit

Permalink
Fixed bug when exporting to graphviz dot format as undirected graph (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
tsoj authored Mar 27, 2023
1 parent f11c146 commit 226dd03
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion treelib/tree.py
Original file line number Diff line number Diff line change
Expand Up @@ -971,7 +971,8 @@ def to_graphviz(self, filename=None, shape='circle', graph='digraph',

for c in self.children(nid):
cid = c.identifier
connections.append('"{0}" -> "{1}"'.format(nid, cid))
edge = '->' if graph == 'digraph' else '--'
connections.append(('"{0}" ' + edge + ' "{1}"').format(nid, cid))

# write nodes and connections to dot format
is_plain_file = filename is not None
Expand Down

0 comments on commit 226dd03

Please sign in to comment.