From e3ea01b57e93c6c686e70f07a0560250c453628b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugo=20H=C3=B6rnquist?= Date: Tue, 23 Apr 2019 22:47:33 +0200 Subject: Change how branch length is calculated. --- module/util/tree.scm | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'module/util/tree.scm') diff --git a/module/util/tree.scm b/module/util/tree.scm index 103888cc..8d3e7805 100644 --- a/module/util/tree.scm +++ b/module/util/tree.scm @@ -27,8 +27,11 @@ ;; Length includes current node, so the length of a leaf is 1. (define (length-of-longst-branch tree) (if (null? tree) - 0 (1+ (max (length-of-longst-branch (left-subtree tree)) - (length-of-longst-branch (right-subtree tree)))))) + ;; Having the @var{1+} outside the @var{max} also works, + ;; but leads to events overlapping many other to be thinner. + ;; Having it inside makes all events as evenly wide as possible. + 0 (max (1+ (length-of-longst-branch (left-subtree tree))) + (length-of-longst-branch (right-subtree tree))))) (define (tree-map proc tree) (if (null? tree) '() -- cgit v1.2.3