MCPcopy Create free account
hub / github.com/Qinbf/groundmap / nodeRadius

Function nodeRadius

web/components/GraphView.tsx:208–211  ·  view source on GitHub ↗

半径按「相对本图最高度数」映射:孤立 ~6 → 本图枢纽 ~48。 * 用相对度数(而非绝对)→ 无论稀疏图还是稠密图(度数都很高)都保持大小对比。

(deg: number, maxDeg: number)

Source from the content-addressed store, hash-verified

206/** 半径按「相对本图最高度数」映射:孤立 ~6 → 本图枢纽 ~48。
207 * 用相对度数(而非绝对)→ 无论稀疏图还是稠密图(度数都很高)都保持大小对比。 */
208function nodeRadius(deg: number, maxDeg: number): number {
209 const norm = maxDeg > 0 ? deg / maxDeg : 0;
210 return 6 + Math.pow(norm, 0.6) * 42;
211}
212
213function shortLabel(n: ApiNode): string {
214 if (n.title && n.title.length <= 30) return n.title;

Callers 1

GraphViewFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected