MCPcopy Create free account
hub / github.com/DeusData/codebase-memory-mcp / limitGraphRender

Function limitGraphRender

graph-ui/src/galaxy/graph-scope.ts:338–344  ·  view source on GitHub ↗
(data: GraphData, nodeLimit: number, edgeLimit: number, required: ReadonlySet<number> = new Set())

Source from the content-addressed store, hash-verified

336}
337
338export function limitGraphRender(data: GraphData, nodeLimit: number, edgeLimit: number, required: ReadonlySet<number> = new Set()): GraphData {
339 const nodes = [...data.nodes.filter(node => required.has(node.id)), ...data.nodes.filter(node => !required.has(node.id))]
340 .slice(0, Math.max(0, Math.floor(nodeLimit)));
341 const ids = new Set(nodes.map(node => node.id));
342 const edges = data.edges.filter(edge => ids.has(edge.source) && ids.has(edge.target)).slice(0, edgeLimit);
343 return { ...data, nodes, edges };
344}
345
346/** Hierarchy constants for a Galaxy scope (hand test K5). Labels are NodeLabels sprites at font 12. */
347export const SCOPED_HIERARCHY_LEVEL_GAP = 160;

Callers 2

GalaxyPanelFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected