Cut-point algorithm of graphs and edge cutting algorithm of graphs

Source: Internet
Author: User
Tags dashed line

Cut Point algorithm

• In an undirected connectivity graph, if a vertex is removed, the graph is no longer connected (that is, any two points cannot reach each other), we call this vertex a cut point (or cut-top).

Judging whether a vertex is a cut point in addition to the definition, you can also start from the perspective of DFS (depth-first traversal). We first define two concepts through DFS.

Assuming that we have access to vertex v from vertex u in DFS (at which point V has not been accessed), we call vertex u the parent vertex of Vertex V, and V is the child vertex of U. The vertex you visited before vertex u is called the ancestor vertex of U.

Obviously if all the child vertices of the vertex u can access the ancestor vertices of u without the parent vertex u, then it is clear that the vertex u is not affected by the connectivity of the graph, and U is not a cut point. Conversely, if vertex u has at least one child vertex, you must pass the parent vertex u to access the ancestor vertex of u, then when you remove the vertex u, the ancestor vertex of vertex u and the child vertex are disconnected, indicating U is a cut point.

The arrows in indicate the order of DFS access (rather than the undirected graph), and for Vertex D, the child vertex of D can go back to the ancestor vertex C of D by the 1 red edge of the connected area (C has been visited at this time), so D is not a cut point at this point.

The vertex in the connected Region 2 in, must pass D to access to the ancestor vertex of D, so that at this point D is a cut point. Again, the arrows represent only the order in which the DFS is accessed, not the graph that is a forward graph.

Here we also need to consider a special case, that is, the root vertex of Dfs (typically a vertex numbered 0), because the root vertex does not have an ancestor vertex. In fact, the root vertex is not cut point is also very good judgment, if starting from the root vertex, a Dfs can access all the vertices, then the root vertex is not a cut point. Conversely, if you go back to the root vertex and have an unreachable vertex, you need to do DFS again on the adjacency vertex, which is the cut point.

Implementation details of the Tarjan algorithm

On the implementation of the Tarjan algorithm, we need to define an additional two arrays of dfn[],low[] in DFS (depth-first traversal).

4.1 num Array
The subscript of the NUM array represents the number of vertices, the values in the array indicate the order in which the vertices are traversed in DFS (or timestamps), and each access to an unreachable vertex, the value of the Access order (timestamp) increases by 1. the NUM value of a child vertex must be larger than the NUM value of the parent vertex (but not necessarily 1, such as when the parent vertex has two and more than two branches). After accessing a vertex, the value of its DFN is determined and no more changes are made.

4.2 Low array

The subscript of the low array represents the number of the vertex, and the value in the array represents the smallest sequential value (or timestamp) in the ancestor vertex that the vertex in DFS does not have access to from the parent vertex.

The initial low value of each vertex should be the same as the DFN value, and in DFS we keep updating the value of low as appropriate.

Assume that the vertex u accesses to the vertex v. When you trace from vertex v to vertex u,

If

NUM[V] < Low[u]

So

Low[u] = Num[v]

If the vertex u also has branches, and each branch is backtracking, the vertex low[u] represents the earliest ancestor node that is accessible from the parent node of the vertex U.

4.4 a concrete example

Now let's look at an example where the simulation program calculates the NUM and low values for each vertex. A solid blue arrow indicates a path that has been visited, and a dashed line with no arrows indicates an unreachable path. The vertices that have been visited are marked with yellow, the vertices that are not visited are marked with white, and the vertices currently being processed by DFS are represented in green. A blue dashed line with arrows indicates the return path when DFS is backtracking.

Basic ideas:

If we access the U point at DFS, the graph is split into two parts by the U point. Part is the point that has been visited, and the other part is the point that has not been visited. If the U-point is a cut point, then at least one of the remaining points that have not been visited will not be returned to the point that has already been visited without the U-point. If you go to the U, the figure also has a vertex v is not visited point, how to tell if V can not go through the U-case will be able to return to any of the points previously visited? You are the father of V, and the vertices you visited before are ancestors. That is, how to detect if V can go back to the ancestors without the Father U. That is to do DFS again, but this traversal does not go through U, to see if we can go back to the ancestors. You cannot be a cut point.

We need an array low to record the smallest "timestamp" that each vertex can return to without passing through the parent vertex.

For a vertex u, if there is at least one vertex v (son of U) that makes low[v]>=num[u], i.e. cannot return to the ancestor, then the U point is the cut point.

References

[1] Small site, the cut-point algorithm vs cutting Edge algorithm
[2] Trent, finding the cut point of the graph of the non-direction diagram
[3] geeksforgeeks, articulation Points (or Cut Vertices) in a Graph.

Cut-point algorithm of graphs and edge cutting algorithm of graphs

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.