Tune graph layout affinities

This commit is contained in:
2026-05-18 22:39:12 +02:00
parent b2165b5a2a
commit 5b6e4faf68
6 changed files with 349 additions and 76 deletions

View File

@@ -582,13 +582,30 @@ def graph_explorer_page() -> str:
updateUrlState();
};
const edgeIdealLength = (edge) => Number(edge.data("layoutIdealLength")) || 110;
const edgeElasticity = (edge) => Number(edge.data("layoutElasticity")) || 80;
const runLayout = () => {
if (!cy) return;
cy.elements().stop();
const name = layoutSelect.value || "cose";
const options = name === "breadthfirst"
? {name, directed: true, padding: 48, animate: false}
: {name, padding: 48, animate: false};
: name === "cose"
? {
name,
padding: 48,
animate: false,
randomize: false,
nodeOverlap: 12,
idealEdgeLength: edgeIdealLength,
edgeElasticity,
nodeRepulsion: 5000,
gravity: 1,
numIter: 1400,
}
: {name, padding: 48, animate: false};
cy.layout(options).run();
};