Gregory R. Warnes
2015-Jan-01 23:35 UTC
[Rd] Reimplement stats:::plotNode as iterative to avoid recursion limits?
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. Anyone want to take this up as a programming challenge? -Greg
Martin Maechler
2015-Jan-02 18:26 UTC
[Rd] Reimplement stats:::plotNode as iterative to avoid recursion limits?
>>>>> 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