(from: string, to: string)
| 181 | const visited = new Set<string>(); |
| 182 | |
| 183 | function hasPath(from: string, to: string): boolean { |
| 184 | if (from === to) return true; |
| 185 | if (visited.has(from)) return false; |
| 186 | |
| 187 | visited.add(from); |
| 188 | |
| 189 | const outgoingEdges = existingEdges.filter((edge) => edge.source === from); |
| 190 | return outgoingEdges.some((edge) => hasPath(edge.target, to)); |
| 191 | } |
| 192 | |
| 193 | return hasPath(target, source); |
| 194 | } |