Normal 0 7.8 lb 0 2 false false MicrosoftInternetExplorer4
Concept
(1) A graph with N vertices, after removing any k-1 vertex (1<=k<=n), is still connected
, and after removing the K vertex, the graph does not connect the general rule that G is connected, and K is called the point connectivity of graph G, and is recorded as K (g) Pilot design
(2) If at least remove the K-edge so that the graph is not connected, then K becomes the edge connectivity of graphs
Equivalence relation
(1) To seek the edge of the connectivity to the weight of each edge 1, arbitrary selection of source, enumeration meeting point, in order to minimize the cut, take the minimum value can be
(2) Given the source and meeting point how to seek the smallest cut, that is the maximum flow of the minimum cut theorem, that a graph of small cut equal to its source point and the largest flow between the store
(3) How to find the minimum cutting edge set of a graph: maximum flow minimum cut theorem, first obtain maximum flow. Then in the residual network, from the source point to start the depth first traversal, all the points that are traversed to constitute the point set SET1, the remaining points constitute the point set SET2. Then the edge<set1,set2> is the cutting edge set of the smallest cut.
(4) to find a given undirected graph point connectivity, can be converted to the edge connectivity, how to convert the following are as follows:
How do you build a graph when you convert point connectivity to edge connectivity?
1. Construct a network N
If G is a graph without direction:
(1) Each vertex v in the original G graph becomes the two vertices v ' and V ' in the N net, and the vertex v ' to V ' has an arc (there is a direction side) connection, the arc capacity is 1;
(2) Each side of the original G-Map e = UV, in the N-Net has two arcs e ' = u "V", E "=v" U "corresponding to it, E ' arc capacity is ∞, e" arc capacity is ∞
(3) A "is the source vertex, B ' is the sink vertex
Note: Arcs are with a forward edge
If G is a direction graph:
(I) Each vertex in the original G graph becomes the two vertices v ' and V ' in the N net, the vertex v ' to V ' has an arc connection, and the arc capacity is 1
(2) each arc e = UV in the original G figure becomes a forward rail u ' u ' V ' V ', wherein the capacity of the arc U "v" on the rail is ∞;
(3) A "is the source vertex, B ' is the sink vertex
2. Specify a source point a ", enumerate the meeting point, and ask for a" to B "maximum flow F
3. To find out all the enumerated source points and the minimum values in the meeting point, all the V vertices corresponding to the arc (V ', V ') with Flow 1 are composed of a fmin set, and the G graph becomes disconnected when the vertices are removed from the G graph.
4. The result if Fmin >= n means that the graph is a strongly connected graph, there is no cut point
Here's an example of a point connectivity POJ 1966 Cable TV Network
#include <iostream>
#define MAX_N 105
#define Max_val 99999999
#include <queue>
using namespace Std;
Char temp[20];
int n, m, Mincutnum;
Save side 1-2*n do not save the actual edges, but as the entrance to the adjacency table
struct Edge
{
int to;
int next;
}edges[max_n * max_n + max_n];
int Edgen;
int Graph[max_n][max_n];
int df[max_n][max_n], f[max_n][max_n];
int Pre[max_n];
BOOL V[max_n];
Queue<int> bfsq;
Insert Edge
void Insertedge (int from, int to)
{
edgen++;
Edges[edgen].to = to;
Edges[edgen].next = Edges[from].next;
Edges[from].next = Edgen;
}
BFS Find augmented path
int BFS (const int &source, const int &dest)
{
memset (V, 0, sizeof (v));
memset (pre, 0, sizeof (pre));
while (!bfsq.empty ()) Bfsq.pop ();
V[source] = true;
Bfsq.push (source);
while (!bfsq.empty ())
{
int curid = Bfsq.front ();
Bfsq.pop ();
if (Curid = = dest) break;
int next = Edges[curid].next, NextID;
while (next!= 0)
{
NextID = edges[next].to;
if (!v[nextid] && Df[curid][nextid] > 0)
{
V[nextid] = true;
Pre[nextid] = Curid;
Bfsq.push (NextID);
}
Next = Edges[next].next;
}
}
if (!pre[dest]) return-1;
int Preid, Curid = dest, curminw = Max_val;
while ((Preid = Pre[curid])!= 0)
{
if (Df[preid][curid] < CURMINW) curminw = Df[preid][curid];
Curid = Preid;
}
return CURMINW;
}
Maximum Flow algorithm
int admonskarp (const int &source, const int &dest)
{
int Val;
memcpy (DF, graph, sizeof (graph));
memset (f, 0, sizeof (f));
while ((val = bfs (source, dest))!=-1)
{
Update residual network and weights network
int Preid, curid = dest;
while ((Preid = Pre[curid])!= 0)
{
Df[preid][curid]-= Val;
Df[curid][preid] + = val;
F[preid][curid] + = val;
F[curid][preid] =-f[preid][curid];
Curid = Preid;
}
}
int next = Edges[source].next, toid, total = 0;
while (next!= 0)
{
Toid = edges[next].to;
Total + = f[source][toid];
Next = Edges[next].next;
}
return total;
}
int main ()
{
int I, p;
while (scanf ("%d%d", &n, &m)!= EOF)
{
Edgen = 2 * n;
Mincutnum = Max_val;
memset (edges, 0, sizeof (edges));
memset (graph, 0, sizeof (graph));
To build a graph to convert point connectivity to edge connectivity
for (i = 1; I <= m; i++)
{
scanf ("%s", temp);
int val1 = 0, val2 = 0;
p = 1;
while (Temp[p]!= ', ')
{
Val1 = val1 * + int (temp[p]-' 0 ');
p++;
}
p++;
while (Temp[p]!= ')
{
Val2 = val2 * + int (temp[p]-' 0 ');
p++;
}
val1++; val2++;
Graph[val1 + N][val2] = Max_val;
Graph[val2 + n][val1] = Max_val;
Insertedge (Val1 + N, val2);
Insertedge (Val2 + N, val1);
}
for (i = 1; I <= n; i++)
{
Graph[i][i + N] = 1;//= Graph[i + n][i] = 1;
Insertedge (i, i + N);
Insertedge (i + N, i);
}
int curcutnum;
for (i = 2; I <= n; i++)
{
Curcutnum = admonskarp (1 + N, i);
if (Curcutnum < mincutnum) Mincutnum = Curcutnum;
}
if (mincutnum >= N) printf ("%d/n", N);
else printf ("%d/n", mincutnum);
}
return 0;
}