Is there an edge that we can remove without turning off the graph?

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?

+5
source share
3 answers

, true, - node, , . O (| V |), , , , , , true.

, O (| V | + | E |), , - | E | = | V | -1, O (| V |). , | V | ( | V | +1 ), O (| V |).

, , node ( ) , node, , node.

+8

, , DFS O (| V |), , e, , , u v, DFS u, e, , e , v , , DFS O (| V |), , , O (| V |).

0

E . , , .

| V | , , .

In the worst case, it may happen that every time we take the edge, he will visit at least a new peak. Then there are | V | tops and we have to take | V | ribs for this particular edge.

The best case may be one with | V | / 2 + 1 e

0
source

All Articles