MCPcopy
hub / github.com/lightningpixel/modly / visit

Function visit

src/areas/workflows/workflowRunStore.ts:71–81  ·  view source on GitHub ↗
(id: string)

Source from the content-addressed store, hash-verified

69 const result: WFNode[] = []
70
71 const visit = (id: string): void => {
72 if (visited.has(id)) return
73 for (const e of edges) {
74 if (e.target === id && !visited.has(e.source) && nodeMap.has(e.source)) return
75 }
76 const node = nodeMap.get(id)
77 if (!node) return
78 visited.add(id)
79 result.push(node)
80 for (const childId of adj.get(id) ?? []) visit(childId)
81 }
82
83 for (const node of nodes) if ((inDeg.get(node.id) ?? 0) === 0) visit(node.id)
84 for (const node of nodes) if (!visited.has(node.id)) visit(node.id)

Callers 1

topoSortFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected