# simple graph theory cycle problem

Looking for some hint on a question in an assignment

"Find a graph which has some vertices u, v and w such that there is a cycle containing both u and v, a cycle containing both v and w, but no cycle containing both u and w."

I don't get how that is even possible. a cycle containing both u and v, means there are path: u -> v path: v -> u.

a cycle for v and w, means there is path: v -> w path: w -> v

then shouldnt that imply there is a cycle containing u and w. because to get from u to w, we take path u->v, then v->w to get from w to u, we take path w->v, then v->u

I dont get how this question is possible

-

It appears that your assignment is using "cycle" to mean "simple cycle" whereas you're using the more general definition. Under the more general definition, your argument is correct. However, if "simple" is implied, the existence of a simple cycle containing $u$ and $v$ and of one containing $v$ and $w$ doesn't imply the existence of a simple cycle containing $u$ and $w$ – think of a figure eight with $v$ at the crossing point.
@joriki: A connected undirected graph on $\{a,b\}$ has a general cycle $a,b,a$, so it wouldn't be a tree under this definition. Nor evidently would any graph with more than one vertex, as one can always take some path and then walk back along it to form a cycle. In fact this example show that the "tree" definition not only assumes cycles to be simple, but also to contain at least three vertices (counting the starting/ending vertex only once). –  Marc van Leeuwen Mar 15 '12 at 10:04