The Black Book providesAlgorithmBut it is vague. I read the relevant information on the network, understood the process of finding a point cutover set, and wrote the followingCodeAnd write some simple proofs.
Definition of Cut Point Set: If a graph is not connected after a certain point is removed from the connected graph G, this point is the cut point of G, and the set of all cut points is the cut point set.
Method for Finding a point cutover set: using the idea of the Tarjan algorithm, we use the array dfn [v] to store the time when DFS traverses the point v, array low [v] storage point V can be traced back to the earliest ancestor node.
If the conclusion is as follows for point V:
1. If point V is the root node of the DFS sequence, if point V has more than one child, it is a cut point.
2. if V is not the root node of the DFS sequence, and any successor U of vertex v can be traced back to the earliest ancestor node low [u]> = dfn [v], then V is a cut point.
Proof 1:
Assume that the first node v in DFS traversal is not a cut point, then low [v] = dfn [v] = 1 continues to traverse the U of the child node in v, there must be a low [u]> = dfn [v]. According to the second property, V is the cut point, but we have assumed that V is not the cut point. This is because V is the starting node of DFS traversal. In the traversal sequence, V has no ancestor node, and all its successor nodes can trace back to the earliest ancestor node, that is, V at most, it cannot be earlier than v. Therefore, the first node v of DFS traversal must be considered separately. How can we determine whether V is a cut point?
For example, if V is the first node accessed by the DFS sequence, after all the child nodes U and U of V are traversed by DFS and marked as accessed, if another child node K of V is not marked as accessed, there must be no edge between U and K. That is to say, the connection between U and K must be v, therefore, if V is the first node in DFS traversal, the method for determining whether V is a cut point is: Check whether V has multiple children. If yes, V is a cut point.
Proof 2:
If V is not the first node to be traversed by DFS, if v is not a cut point for all subsequent nodes of V (that is, if the vertex v is deleted, the remaining graph is a connected graph ), then, the successor node of V must be traced back to the ancestor node of V in the DFS traversal sequence, that is, the ancestor path of V in the successor node of V to the DFS sequence, therefore, when DFS traces back to the V node, for all subsequent node u of V, there is a low [u] <dfn [v].
If V is a cut point, after DFS is performed on the successor node u of all V, there must be low [u]> = dfn [v] because, after traversing V and locking it, the path of the ancestor node arriving at V is blocked, and the successor node of V cannot access the ancestor node of V. Therefore, there must be low [u]> = dfn [v].
With the above analysis, the code for finding an undirected graph point cutover is as follows:
# Include <iostream> <br/> using namespace STD; </P> <p> struct L <br/>{< br/> int V; L * next; <br/>}; </P> <p> class head <br/>{< br/> Public: <br/> int ID; L * next; <br/> head () {id = 0; next = NULL ;}< br/>}; </P> <p> head [1000]; int dfn [1000], low [1000], T; bool lock [1000], C [1000]; </P> <p> void find (INT father, int V) <br/>{< br/> int COUNT = 0; /* count the number of children of V */<br/> dfn [v] = low [v] = ++ T; /* grant the access time to dfn [v] and low [v] */<br/> lock [v] = Fal Se;/* Mark V point has been accessed and cannot be accessed again */<br/> for (L * P = head [v]. Next; P! = NULL; P = p-> next) <br/>{< br/> If (Lock [p-> V]) /* If the direct successor node of V has not been accessed, traverse it */<br/> {<br/> Find (V, p-> V ); /* Direct subsequent traversal of V */<br/> count ++; /* Number of Children + 1 */<br/> If (low [v]> low [p-> V])/* If V's child can be traced back to earlier ancestor, then V can be traced back to */<br/> low [v] = low [p-> V]; <br/>}< br/> else if (p-> V! = Father & low [p-> V] <low [v]) /* If V's direct child node has been accessed */<br/> low [v] = low [p-> V]; </P> <p> If (! Father & COUNT> 1)/* if the current node is the first node traversed by DFS, determine whether there are multiple children */<br/> C [v] = true; <br/> else if (father & dfn [v] <= low [p-> V]) /* Otherwise, determine whether the successor can be traced back to V's ancestor */<br/> C [v] = true; <br/>}</P> <p> int main () <br/>{< br/> int N, I, A, B; <br/> CIN> N; </P> <p> while (CIN> A> B & A & B)/* Create an adjacent table, input an undirected graph edge of each a B, ending with 0 x/<br/> {<br/> L * P = New L; <br/> P-> next = head [B]. next; <br/> head [B]. next = P; <br/> P-> V = A; <br/> P = New L; <br/> P-> next = head [A]. next; <br/> head [A]. next = P; <br/> P-> V = B; <br/> head [B]. id ++; <br/> head [A]. id ++; <br/>}< br/> memset (lock, true, sizeof (LOCK); <br/> memset (dfn, 0, sizeof (INT) * 1000); <br/> memset (C, 0, sizeof (c);/* The C array is used to mark the vertices as cut points, set all to false at the beginning */<br/> T = 0;/* Access time */<br/> Find ();/* start to DFS, the first traversal precursor node is set to 0 */<br/> for (I = 1; I <= N; I ++) /* input cut point */<br/> If (C [I]) <br/> cout <I <''; <br/> cout <Endl; </P> <p>}