mirror of
https://github.com/eliasstepanik/core.git
synced 2026-01-11 10:08:27 +00:00
fix: reduce the graph iterations
This commit is contained in:
parent
159e003d2e
commit
665f98d7bf
@ -316,20 +316,16 @@ export const Graph = forwardRef<GraphRef, GraphProps>(
|
|||||||
// Calculate iterations based on complexity
|
// Calculate iterations based on complexity
|
||||||
const complexity = nodeCount + edgeCount;
|
const complexity = nodeCount + edgeCount;
|
||||||
let iterations: number;
|
let iterations: number;
|
||||||
if (complexity < 50) {
|
if (complexity < 500) {
|
||||||
iterations = 400;
|
iterations = complexity;
|
||||||
} else if (complexity < 200) {
|
|
||||||
iterations = 600;
|
|
||||||
} else if (complexity < 500) {
|
|
||||||
iterations = 800;
|
|
||||||
} else {
|
} else {
|
||||||
iterations = Math.min(1200, 1000 + complexity * 0.2);
|
iterations = Math.min(600, 500 + complexity * 0.2);
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
scalingRatio: Math.round(scalingRatio * 10) / 10,
|
scalingRatio: Math.round(scalingRatio * 10) / 10,
|
||||||
gravity: Math.round(gravity * 10) / 10,
|
gravity: Math.round(gravity * 10) / 10,
|
||||||
iterations: Math.round(iterations),
|
iterations: Math.round(complexity),
|
||||||
};
|
};
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user