What would the following algorithm look like:
a linear-time algorithm which, given an undirected graph G, and a particular edge e in it, determines whether G has a cycle containing e
I have following Idea:
for each v that belongs to V, if v is a descendant of e and (e,v) has not been traversed then check following:
if we visited e before v and left v before we left e then the graph contains cycle