From maechler at stat.math.ethz.ch  Fri Jan  2 19:26:39 2015
From: maechler at stat.math.ethz.ch (Martin Maechler)
Date: Fri, 2 Jan 2015 19:26:39 +0100
Subject: [Rd] Reimplement stats:::plotNode as iterative to avoid
	recursion	limits?
In-Reply-To: <09472B94-FD68-421A-9A06-A29C5D5E6025@warnes.net>
References: <09472B94-FD68-421A-9A06-A29C5D5E6025@warnes.net>
Message-ID: <21670.58079.665812.472494@stat.math.ethz.ch>

>>>>> Gregory R Warnes <greg at warnes.net>
>>>>>     on Thu, 1 Jan 2015 18:35:23 -0500 writes:

    > Hi All, I've gotten a number of reports from users
    > about gplots::heatmap.2 generating 'node stack
    > overflow' errors.  As it turns out, these errors
    > originate in stats:::plotNode, and are triggered when
    > it is passed a dendrogram that is too deeply nested.

    > While increasing the stack size (which is a
    > compile-time option for byte coded functions) can
    > allow a particular instance to succeed, a better
    > solution would be to modify stats:::plotNode to use a
    > recursive, rather than iterative algorithm.

of course you mean the contrary: reprogram stats:::plotNode() to
use a *non*-recursive algorithm {"iterative" as you say in the 'Subject' line}

    > Anyone want to take this up as a programming
    > challenge?

Yes, please,  patches are very welcome -- if they are tested.

Please start from
       https://svn.r-project.org/R/trunk/src/library/stats/R/dendrogram.R
i.e. send patches with respect to that,
i.e., the result of
      diff -ubBw <old-dendrogram>.R <new-dendrogram>.R

With thanks in advance,
Martin Maechler



[Rd] Reimplement stats:::plotNode as iterative to avoid recursion limits?
Martin Maechler