-
Notifications
You must be signed in to change notification settings - Fork 23
PB Ladderize
Steve Bond edited this page Feb 27, 2017
·
3 revisions
Reorder the branches of the tree based on the number of child nodes for every given subtree. Note that this does not change the actual structure of the tree, only the way it is drawn.
Optional. Passing in the word 'rev' will reverse the sort into descending order.
- ascending (default) = subtrees with a smaller number of child nodes will be listed first
- descending = subtrees with a larger number of child nodes will be listed first
((A,(B,(C,(D,E)))),(F,(G,H)));
/------------------------------------------- A
/----------+
| | /-------------------------------- B
| \----------+
| | /--------------------- C
| \----------+
+ | /---------- D
| \----------+
| \---------- E
|
| /--------------------- F
\--------------------------------+
| /---------- G
\----------+
\---------- H
$: pb test.tree -ld
((F:1.0,(G:1.0,H:1.0):1.0):1.0,(A:1.0,(B:1.0,(C:1.0,(D:1.0,E:1.0):1.0):1.0):1.0):1.0):1.0;
/--------------------- F
/--------------------------------+
| | /---------- G
| \----------+
+ \---------- H
|
| /------------------------------------------- A
\----------+
| /-------------------------------- B
\----------+
| /--------------------- C
\----------+
| /---------- D
\----------+
\---------- E
$: pb test.tree -ld rev
(((((D:1.0,E:1.0):1.0,C:1.0):1.0,B:1.0):1.0,A:1.0):1.0,((G:1.0,H:1.0):1.0,F:1.0):1.0):1.0;
/---------- D
/----------+
/----------+ \---------- E
| |
/----------+ \--------------------- C
| |
/----------+ \-------------------------------- B
| |
| \------------------------------------------- A
+
| /---------- G
| /----------+
\--------------------------------+ \---------- H
|
\--------------------- F