Before you start, yes, this is homework. I would not post here if I had not tried my best to solve this problem in the last 14 hours and did not get anywhere.
The problem is this: I want to check if I can remove an edge from the linked undirected graph without disconnecting it or not in O (V), and not just linear.
What I have so far achieved:
The edge of the cycle can be deleted without disconnecting the graph, so I just check to see if the graph has a loop. I have two methods that can be used, one of them is DFS, and then checking for my trailing edges; another by counting Vs and Es and checking if | E | = | V | - 1, if this is true, then the graph is a tree and there is no node there, we can delete it without disconnecting it.
Both previous approaches solve the problem, but both of them need O (| E | + | V |), and the book talks about a faster way (which is probably a greedy approach).
Can I get any tips please?
EDIT: In particular, this is my question; given a connected graph G = (V, E), can we remove some edge e in E and associate the resulting graph?
source
share