Prove edges travelling algorithm

44 Views Asked by At

Exercise: Let $G$ be a connected graph. Prove that using method shown below, you will traverse all graph's edges, starting from vertex $v$:

  1. do not traverse the same edge twice in the same direction

  2. if found vertex $x\neq v$, in which we haven't been before, then mark the edge that was used to get there

  3. use marked edge to leave $x$ only if it's the only option left

Also show that, after traversing all the edges, we return to $v$.

My tries: I proved the second statement.

Prove: Let's assume that we don't have any possible moves left and we are in $w\neq v$ vertex. For us to not be able to do any movements here, there must be $deg(w)$ used in outside direction edges. For it to be possible, we had had to use $deg(w)+1$ edges in inside $w$ direction or $w=v$, both resulting with contradiction.

My thoughts: I fought hard to prove the main statement, but nothing seems working. I am looking for a hint. From many examples it seems like algorithm will always leave the graph with all edges traversed in both directions. I saw a pattern, like if you traverse the edges in some order, then you will be returning in reversed order. There are some exceptions, when you can choose between more options (but anyway you'll be back to the reversed order or similar at least).