DFS with memoization is efficient for computing cycle-related properties for all nodes. You process each node exactly once. The algorithm is simple and works in linear time. Tracking DFS state with colors helps detect cycles and avoid recomputation.
This pattern appears in many graph algorithms, not functional graphs. Functional graphs make DFS simpler because there is only one outgoing edge. You do not need recursion or complex backtracking. A simple iterative approach works.