(graph, source, target, seen = new Set())
| 18 | }; |
| 19 | |
| 20 | const hasRedundantConnection = (graph, source, target, seen = new Set()) => { |
| 21 | if (seen.has(source)) return false; |
| 22 | seen.add(source); |
| 23 | |
| 24 | const isEqual = source === target; |
| 25 | if (isEqual) return true; |
| 26 | |
| 27 | return dfs(graph, source, target, seen); |
| 28 | }; |
| 29 | |
| 30 | const dfs = (graph, source, target, seen) => { |
| 31 | for (const neighbor of graph[source]) { |
no test coverage detected