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

Function frontierCallCount

graph-ui/src/galaxy/graph-scope.ts:261–280  ·  view source on GitHub ↗
(client: GraphQueryClient, project: string, scoped: ScopedGraph, direction: TraceDirection,
    edgeTypes: readonly string[] | undefined, signal?: AbortSignal)

Source from the content-addressed store, hash-verified

259 * zaehlt der Index so nicht; ohne CALLS gibt es keine Zahl.
260 */
261export async function frontierCallCount(client: GraphQueryClient, project: string, scoped: ScopedGraph, direction: TraceDirection,
262 edgeTypes: readonly string[] | undefined, signal?: AbortSignal): Promise<number | undefined> {
263 if (scoped.exhausted || scoped.partial || !scoped.frontier?.length || (edgeTypes && !edgeTypes.includes('CALLS'))) return undefined;
264 const frontier = new Set(scoped.frontier), byId = new Map(scoped.data.nodes.map(node => [node.id, node]));
265 const names = [...frontier].map(identity => byId.get(identity)?.qualified_name).filter((name): name is string => Boolean(name));
266 let calls = 0;
267 for (let at = 0; at < names.length; at += BATCH_SIZE) {
268 const rows = await readGraphPages(client, project, `MATCH (n) WHERE ${anyNames('n', names.slice(at, at + BATCH_SIZE))} RETURN id(n) AS id, n.in_degree AS calls_in, n.out_degree AS calls_out`, 'id', signal);
269 for (const row of rows) {
270 if (!frontier.has(id(row.id))) continue;
271 calls += (direction !== 'outbound' ? number(row.calls_in) ?? 0 : 0) + (direction !== 'inbound' ? number(row.calls_out) ?? 0 : 0);
272 }
273 }
274 for (const edge of scoped.data.edges) {
275 if (edge.type !== 'CALLS') continue;
276 if (direction !== 'outbound' && frontier.has(edge.target)) calls -= 1;
277 if (direction !== 'inbound' && frontier.has(edge.source)) calls -= 1;
278 }
279 return Math.max(0, calls);
280}
281
282/** Eine Schaetzung der naechsten Ebene, bevor sie geladen wird (K8): so viele
283 * Knoten stehen an ihrem Rand, und so viele neue brachte jeder Knoten der

Callers 2

useGraphScopeFunction · 0.90

Calls 5

readGraphPagesFunction · 0.85
anyNamesFunction · 0.85
idFunction · 0.85
numberFunction · 0.70
getMethod · 0.65

Tested by

no test coverage detected