visited set to handle shared nodes (e.g. a node reachable via multiple routes). Enumerates every path — suitable for small graphs; exponential for large ones.
dp[node] = Σ dp[children] (with dp[end]=1) in O(V+E). For must-visit filters, all orderings of waypoints are tried; only topologically consistent orderings contribute. Path count is the product of segment counts — no enumeration needed.