MCPcopy Create free account
hub / github.com/FlowiseAI/Flowise / dfs

Function dfs

packages/agentflow/src/core/validation/flowValidation.ts:106–121  ·  view source on GitHub ↗
(nodeId: string)

Source from the content-addressed store, hash-verified

104 })
105
106 function dfs(nodeId: string): boolean {
107 colors[nodeId] = 1 // Mark as in progress
108
109 for (const neighbor of graph[nodeId] || []) {
110 if (colors[neighbor] === 1) {
111 // Back edge found - cycle detected
112 return true
113 }
114 if (colors[neighbor] === 0 && dfs(neighbor)) {
115 return true
116 }
117 }
118
119 colors[nodeId] = 2 // Mark as done
120 return false
121 }
122
123 // Run DFS from all unvisited nodes
124 for (const node of nodes) {

Callers 1

detectCycleFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected