Skip to content

Commit

Permalink
Merge 20a7c8d into 36120f2
Browse files Browse the repository at this point in the history
  • Loading branch information
krassowski committed Mar 30, 2018
2 parents 36120f2 + 20a7c8d commit 946b8a9
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion pygraphviz/agraph.py
Original file line number Diff line number Diff line change
Expand Up @@ -1280,7 +1280,7 @@ def _get_prog(self, prog):
# private: get path of graphviz program
progs = ['neato', 'dot', 'twopi', 'circo', 'fdp', 'nop',
'wc', 'acyclic', 'gvpr', 'gvcolor', 'ccomps', 'sccmap', 'tred',
'sfdp']
'sfdp', 'unflatten']
if prog not in progs:
raise ValueError("Program %s is not one of: %s." %
(prog, ', '.join(progs)))
Expand Down Expand Up @@ -1334,6 +1334,19 @@ def _run_prog(self, prog='nop', args=''):
warnings.warn(b"".join(errors).decode(self.encoding), RuntimeWarning)
return b"".join(data)

def unflatten(self, args=''):
"""Adjust directed graphs to improve layout aspect ratio.
>>> A = AGraph()
>>> A_unflattened = A.unflatten('-f -l 3')
>>> A.unflatten('-f -l 1').layout()
Use keyword args to add additional arguments to graphviz programs.
"""
data = self._run_prog('unflatten', args)
self.from_string(data)
return self

def layout(self, prog='neato', args=''):
"""Assign positions to nodes in graph.
Expand Down

0 comments on commit 946b8a9

Please sign in to comment.