From a20b3593bd21fa4279c2ed9fbc18b43ef9df51dc Mon Sep 17 00:00:00 2001 From: Sanjaiyan Parthipan Date: Sun, 20 Sep 2026 22:01:24 +0530 Subject: [PATCH] fix(export): prevent vis-network stack overflow crash on HTML render Resolves the `BarnesHutSolver.js` maximum call stack size exceeded error. By explicitly initializing node X/Y coordinates using a sunflower spiral (Fermat's spiral) formula, nodes no longer spawn stacked on top of each other. This prevents `avoidOverlap` physics forces from dividing by zero and exploding into infinite values on the very first frame. --- graphify/exporters/html.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/graphify/exporters/html.py b/graphify/exporters/html.py index 62ba5b2a8..7806764fe 100644 --- a/graphify/exporters/html.py +++ b/graphify/exporters/html.py @@ -151,6 +151,8 @@ function esc(s) {{ const nodesDS = new vis.DataSet(RAW_NODES.map(n => ({{ id: n.id, label: n.label, color: n.color, size: n.size, font: n.font, title: n.title, + x: 30 * Math.sqrt(i) * Math.cos(i * 2.4), + y: 30 * Math.sqrt(i) * Math.sin(i * 2.4), _community: n.community, _community_name: n.community_name, _source_file: n.source_file, _file_type: n.file_type, _degree: n.degree, }})));