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

Function visit

graph-ui/src/architecture/container-layout.ts:13–24  ·  view source on GitHub ↗
(id: string)

Source from the content-addressed store, hash-verified

11 const numbers = new Map<string, number>(), low = new Map<string, number>();
12 const stack: string[] = [], active = new Set<string>(), groups: string[][] = [];
13 const visit = (id: string) => {
14 numbers.set(id, numbers.size); low.set(id, numbers.get(id)!); stack.push(id); active.add(id);
15 for (const target of [...adjacent.get(id)!].sort()) {
16 if (!numbers.has(target)) { visit(target); low.set(id, Math.min(low.get(id)!, low.get(target)!)); }
17 else if (active.has(target)) low.set(id, Math.min(low.get(id)!, numbers.get(target)!));
18 }
19 if (low.get(id) === numbers.get(id)) {
20 const group: string[] = []; let next: string;
21 do { next = stack.pop()!; active.delete(next); group.push(next); } while (next !== id);
22 groups.push(group.sort());
23 }
24 };
25 services.forEach(service => { if (!numbers.has(service.id)) visit(service.id); });
26 const membership = new Map(groups.flatMap((group, index) => group.map(id => [id, index] as const)));
27 const outgoing = groups.map(() => new Set<number>()), incoming = groups.map(() => 0), layers = groups.map(() => 0);

Callers 1

layoutContainersFunction · 0.70

Calls 2

getMethod · 0.65
pushMethod · 0.45

Tested by

no test coverage detected