Fix bugs: visited is an array, and dfs takes graph and target node as args.