The Tarjan algorithm is required to add at least a few edges to make the undirected connected graph a side double connected graph.

Source: Internet
Author: User

This blog is reproduced from http://blog.csdn.net/lyy289065406/article/details/6762370
First build the Model:
Given a connected undirected graph G, it is necessary to add at least a few edges to make it a double-connected graph.

The model is very simple, the road under construction we can think that side was deleted. Then a graph G is able to delete any edge, still connected, when and only if figure G is at least two-connected.
PS: Don't ask me why not 3-connected, 4-connected ... People asked, "at least add a few sides," okay ...

Obviously, when figure G has a bridge (cut edge), it must not be double-connected. The two endpoints of the bridge must belong to the two "side Two connected components" (note not the point of the two connected components), once the bridge is removed, the two "side two connected components" must be disconnected, the figure g is not connected. However, if you add an edge between the two "side two-connected components", the bridge is no longer a bridge, and the two "edge-to-double-connected components" are doubly connected.

So what if figure G has multiple "edge-to-double-connected" components? At least how many edges should be added in order to make any two "edge two connected components" are double connected (that is, figure G is a double-connected).

This problem is the problem of the subject. To solve this problem:
1, the first to find out all the "side of the double-connected components of Figure G."
The Tarjan algorithm is the simplest and most efficient method for finding all "side-connected" components of figure g, because the Tarjan algorithm generates a low value for all nodes of graph G during the DFS process, and since the topic has shown that no heavy edges occur between any two nodes, Therefore, the two nodes with the same low value must be in the same "side double connected component". (If there is a heavy edge, then the different low value is likely to belong to the same side of the two connected components, this time the other way to solve the side of the dual-connected components.) But this is not the subject to be discussed)

2, each "side of the two connected components" as a point (that is, "shrinking point")
There are also those who say "pinch" is "block", all the same. In fact, the shrinking point is not the real contraction point, as long as the use of low value of the figure G point classification processing, it has shrunk point.

Example 1, sample 1 obtained by the figure G is the upper left,
where LOW[4]=LOW[9]=LOW[10]
LOW[3]=LOW[7]=LOW[8]
LOW[2]=LOW[5]=LOW[6]
LOW[1] alone for politics ....
The low value of the same point divided into a class, each of which is a "side of the two connected components", that is, "shrinking point", it is not difficult to find that the connection between the "contraction point" between the side, are the bridge of the graph G, then we get the upper right to shrink point as the node, has been bridged to the tree

3. The problem is again converted to "at least how many tree edges are added to the indent tree, making the tree a double connected graph".
First you know an equation:
To make any tree, after adding several edges, becomes a double connected graph, then
At least the number of edges added = (the tree has a total degree of 1 nodes + 1)/2
(Prove not to prove that, you draw a few trees to make a few gestures will know)

Then we only need to shrink the number of nodes in the tree with a total degree of 1 (that is, leaves). In other words, we only need the degree of all the indentation, and then determine the degree of 1 of the indentation has a few, the problem is solved.

4. The method of calculating the degree of all the shrinkage points
22 enumerates the directly connected points of figure g, so long as the two points are not in the same "indent", the degrees of their respective "indents" are +1. Note that since the graph G is not a graph, this will make all the "indentation" of the degree is twice times the true degree, must be in addition to 2 before judging the leaves.

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.