walkccc / CLRS

📚 Solutions to Introduction to Algorithms Third Edition
https://walkccc.me/CLRS
MIT License
4.75k stars 1.26k forks source link

Problem 22.3 (Euler Tour) #214

Open stet-stet opened 4 years ago

stet-stet commented 4 years ago

The page I am talking about: https://walkccc.github.io/CLRS/Chap22/Problems/22-3/

I have issues with solutions of (b). Consider a graph which has five vertices and with edges from&to vertices 1 to 2, 2 to 3, 3 to 1, 3 to 4, 4 to 5, and 5 to 6. If we "arbitrarily walk any way", as suggested in the solution, We could end up with 1 to 2, 2 to 3, 3 to 1, the end. I believe this is not a valid Euler tour. In short, I believe that the explanation is a bit insufficient.

Furthermore, it was written on the page that "This is implemented in the following algorithm, \text{EULERTOUR}(G)EULERTOUR(G) which takes time O(|E|)O(∣E∣)." However, no algorithm of the name "EULERTOUR" seems to exist on the page.

Thank you!

walkccc commented 4 years ago

I've added the EULER-TOUR pseudocode here

Jex97 commented 2 years ago

I've added the EULER-TOUR pseudocode here

I think this pseudocode can only find the circles including start point v but can't visit all the edges in G.