count
to 0 to keep track of edges to be reversed.adj
to represent the graph, including both original and artificial edges.0
.
dfs
that takes the current node and its parent as arguments.count
by the edge's value (1 for original, 0 for artificial) and recursively call dfs
with the neighbor as the new node.count
.