Add graphic hooks to DFS algorithm