FIG Tarjan & None of the communication

Cut point: removing a point x, the non-directed graph is divided into two (or more)

Cutting edge: remove one edge x, without dividing the directed graph into two (or more)

Timestamp: Number dfn traverse the search tree

Retrospective values: subtree subtree and non-search tree up to the minimum point

Cutpoint determination and cutting edge

 1 void tarjan(int x, int in_edge) {
 2     dfn[x] = low[x] = ++num;
 3     for (int i = head[x]; i; i = nex[i]) {
 4         int y = ver[i];
 5         if (!dfn[y]) {
 6             tarjan(y, i);
 7             low[x] = min(low[x], low[y]);
 8             if (low[y] > dfn[x])
 9                 bridge[i] = bridge[i ^ 1] = true;
10         } else if (i != (in_edge ^ 1))
11             low[x] = min(low[x], dfn[y]);
12     }
13 }
 1 void tarjan(int x) {
 2     dfn[x] = low[x] = ++num;
 3     int flag = 0;
 4     for (int i = head[x]; i; i = nex[i]) {
 5         int y = ver[i];
 6         if (!dfn[y]) {
 7             tarjan(y);
 8             low[x] = min(low[x], low[y]);
 9             if (low[y] >= dfn[x]) {
10                 flag++;
11                 if (x != 1 || flag > 1) cut[x] = true;
12             }
13         } else low[x] = min(low[x], dfn[y]);
14     }
15 }

Reduced edge point: No labeled using dfs

Point Point reduction: %%%

https://github.com/lydrainbowcat/tedukuri/blob/master/%E9%85%8D%E5%A5%97%E5%85%89%E7%9B%98/%E6%AD%A3%E6%96%87%E5%8C%85%E5%90%AB%E7%9A%84%E7%A8%8B%E5%BA%8F%E7%89%87%E6%AE%B5/0x66%20tarjan_dcc_euler.cpp

Guess you like

Origin www.cnblogs.com/rign/p/11108844.html