| 223 | namespace DirectedGraphPathDetector |
| 224 | { |
| 225 | inline bool hasPath(const DirectedGraph& graph, uint32_t from, uint32_t to) |
| 226 | { |
| 227 | DirectedGraphDfsTraversal dfs(graph, from, DirectedGraphDfsTraversal::Flags::IgnoreVisited); |
| 228 | uint32_t node = dfs.traverse(); |
| 229 | node = dfs.traverse(); // skip the root node |
| 230 | while (node != DirectedGraph::kInvalidID) |
| 231 | { |
| 232 | if (node == to) |
| 233 | return true; |
| 234 | node = dfs.traverse(); |
| 235 | } |
| 236 | return false; |
| 237 | } |
| 238 | |
| 239 | inline bool hasCycle(const DirectedGraph& graph, uint32_t root) |
| 240 | { |