add traverse_graph_withlog (tested)