-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathfind_articul.cpp
More file actions
32 lines (29 loc) · 882 Bytes
/
find_articul.cpp
File metadata and controls
32 lines (29 loc) · 882 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
void DFSArticul(ALGraph G, int v0) {
visited[v0] = min = ++count;
for (p = G.vertives[v0].firstarc; p; p = p->nextarc) {
w = p->adjvex;
if (0 == visited[w]) {
DFSArticul(G, w);
if (low[w] < min) min = low[w];
if (low[w] >= visited[v0]) printf(v0, G.vertices[v0].data);
} else if (visited[w] < min)
min = visited[w];
}
low[v0] = min;
} // DFSArticul
void FindArticul(ALGraph G) {
count = 1;
visited[0] = 1;
for (i = 0; i < G.vexnum; ++i) visited[i] = 0;
p = G.vertices[0].firstarc;
v = p->adjvex;
DFSArticul(G, v);
if (count < G.vexnum) {
printf(0, G.vertices[0].data);
while (p->nextarc) {
p = p->nextarc;
v = p->adjvex;
if (0 == visited[v]) DFSArticul(G, v);
}
}
}