MCPcopy Create free account
hub / github.com/algorithmicsuperintelligence/openevolve / getNodeRadius

Function getNodeRadius

scripts/static/js/graph.js:69–95  ·  view source on GitHub ↗
(d)

Source from the content-addressed store, hash-verified

67}
68
69export function getNodeRadius(d) {
70 let minScore = Infinity, maxScore = -Infinity;
71 let minR = 10, maxR = 32;
72 const metric = getSelectedMetric();
73
74 if (Array.isArray(allNodeData) && allNodeData.length > 0) {
75 allNodeData.forEach(n => {
76 if (n.metrics && typeof n.metrics[metric] === "number") {
77 if (n.metrics[metric] < minScore) minScore = n.metrics[metric];
78 if (n.metrics[metric] > maxScore) maxScore = n.metrics[metric];
79 }
80 });
81 if (minScore === Infinity) minScore = 0;
82 if (maxScore === -Infinity) maxScore = 1;
83 } else {
84 minScore = 0;
85 maxScore = 1;
86 }
87
88 let score = d.metrics && typeof d.metrics[metric] === "number" ? d.metrics[metric] : null;
89 if (score === null || isNaN(score)) {
90 return minR / 2;
91 }
92 if (maxScore === minScore) return (minR + maxR) / 2;
93 score = Math.max(minScore, Math.min(maxScore, score));
94 return minR + (maxR - minR) * (score - minScore) / (maxScore - minScore);
95}
96
97export function selectProgram(programId) {
98 const nodes = g.selectAll("circle");

Callers 4

updatePerformanceGraphFunction · 0.90
renderGraphFunction · 0.85

Calls 1

getSelectedMetricFunction · 0.70

Tested by

no test coverage detected