Cut point diagram and cutting edge (ultra-detailed !!!)

· Percentage point

Cut point concept should be well understood:

In an undirected graph, if you delete a vertex , this figure is no longer in communication (can not reach each other between any two points), then the vertex that cut this figure. for example:

FIG. 2 vertices that cut, deleted after 2, 4, 5, barrier, and so does not pass 1,6

How to find cut point?

The method is easy to think of is: in order to delete each vertex, then dfs or bfs to check whether the map is still connected. If you delete a vertex, resulting diagrams are no longer communicating, then just delete the apex of that cut.

Time complexity of this method is O (N (N + M)).

Below find low complexity method to solve.

First, an arbitrary node from the drawing start dfs FIG traversals give a spanning tree, as shown, the vertex numbers are circled numbers, the number of top right vertex of the circle indicates the first number to be accessed, called when traversing " timestamp. "

Will encounter when traversing the cut point, the key is how to identify a cut vertex is the point of it? ? ?

When access to a depth-first traversal of u ( point 2 ) above, the case of FIG. U ( point 2 ) is divided into two parts, as part of the access point, the other part is not the access point. If u is a cut point, that the rest of the access point has not been at least a point back to the point in any case not have been accessed without passing through the point k.

The basic idea:

If u to the rear, the figure vertex v there is no point visited, how to judge any previously visited without going through the v in u of whether it can return to a point? u is v's father, and previously visited vertex is the ancestor. That is, how to detect without v u after his father's ancestors also could return. That is to once again v dfs, but the traversal without u, see if you can return to the ancestors. U can not cut is the point.

Then define an array to record each vertex low when the parent does not pass through the apex, to return to a minimum "time stamp."

For a vertex u, if at least one vertex V (u son) is present, so that Low [V]> NUM = [u] , i.e. not return ancestors, then the point u cut point.

 

 

· Cutting edge

There is also a cut point in addition to the problem is to find the cutting edge (also called bridge), i.e. in a direction of an edge without deleting the drawings, FIG no longer in communication.

 

 

How to get the cutting edge?

Simply cut point of seeking algorithm to modify a symbol on it. Simply low [v]> = num [u] to low [v]> num [u].

Why is this?

low [v] and num [u] is equal representation can also be returned to the father node; and low [v]> num [u ] indicates that even a father can not go back. If the vertex v can not return to the ancestors, and no other way can return to his father, then uv this edge is cutting edge.

 

 ·exercise

Luo Gu P3388 [template] point cut (top cut)

An exercise through 3. [template] Travel Channel (bridge)

---> recently lazy, every day a lot of work, so the problem is more likely to be the solution after the carbon parathion bar exam

Guess you like

Origin www.cnblogs.com/ljy-endl/p/11595161.html