Title: Spectral Analysis of Internet Topologies
1Lectures 7 and 8, Tue. Sept 9 03.
Thu. Sept 11 03.
Today Depth First Search in Undirected Graphs
tomorrow Connectivity,
Biconnectivity Algorithm Design Paradigm
Graph Theory , Recursion
Reading CLRS Paragraphs 22.1, 22.3 and
Problem 22-2 and
these lecture notes.
2Notation G(V,E) denotes a graph,
V is the set of nodes or vertices,
E is the set of links or edges.
V n , E Adjacency list
representation has size O(m)
a ? b,i b ? a,c,i c ? b,h i ? a,b h ?c
3An undirected graph is connected iff there is a
path between every pair of vertices.
A connected component of a graph is a maximal
subset of vertices such that the induced subgraph
is connected (maximal means that including any
other vertex No longer gives a connected induced
subgraph).
A connected graph.
A graph consisting of three connected components.
4procedure DFS G(V,E) identical for undirected and
directed graphs begin for all v in V do v
unvisited while there exists unvisited v in V
do begin SEARCH (v)
end end.
procedure SEARCH (v) begin v visited for each
w in L(v) do if w unvisited then
begin
SEARCH (w) end end.
5(No Transcript)
6By convention, a single edge is also biconnected.
Example of a biconnected graph. See, on the
right, how removing any single vertex leaves the
remaining vertices connected. This is very
important, for example, to ensure network
reliability under failure of individual nodes.
7An articulation point in an undirected graph is
a vertex whose removal disconnects the graph in
more than one connected components.
8Problem Given a graph in its adjacency
list representation, decide if the graph is
biconnected, if not, find the articulation points.
a
b
i
j
a ? b,i b ? a,c,h,i,j c ? b,h,d d ? b,c e ?
h,f,g f ? h,e g ? h,e h ? c,e,f,g i ? a,b j ?
b,k k ? b,j
k
c
d
h
e
g
f
9(No Transcript)
10procedure SEARCH (v) begin v
visited vertexcount vertexcount1
number(v) vertexcount for each w in L(v) do
if w is unvisited then
begin (v,w) traversed
(v,w) tree-edge
SEARCH (w) end
if w is visited and (w,v) untraversed then
begin (v,w)
traversed (v,w) back edge
end end.
11(No Transcript)
12procedure SEARCH (v) begin v visited time
time 1 start(v) time vertexcount
vertexcount1 number(v) vertexcount for
each w in L(v) do if w is unvisited
then begin
(v,w) traversed (v,w) tree-edge
SEARCH (w)
end if w is visited and (w,v)
untraversed then begin
(v,w) traversed (v,w)
back edge end time
time1 finish(v) time end.
13start time
finish time
1/22
FACT 1
a/1
number
name
If SEARCH(w) starts after SEARCH(v) starts
and before SEARCH(v) finishes
then SEARCH(w) finishes before SEARCH(v)
finishes start(v) lt start(w) lt
finish(v)
implies start(v) lt start(w) lt finsish(w) lt
finish(v)
15/16
17/20
2/21
b/2
i/9
j/10
k/11
c/3
d/8
3/14
18/19
12/13
4/11
h/4
8/9
5/10
e/5
g/7
f/6
5/7
14start time
finish time
1/22
a/1
number
name
15/16
17/20
2/21
b/2
i/9
j/10
k/11
c/3
d/8
3/14
18/19
12/13
4/11
h/4
8/9
5/10
e/5
g/7
f/6
5/7
15BASIC FACT
y
ALL BACK EDGES GO FROM NODES TO THEIR
PROPER ANCESTORS. (THERE ARE NO CROSS
EDGES.)
y
x
Proof By contradiction.
Suppose that x?y is a back-edge but y is not an
ancestor of x. First notice that
all back edges x?y have start(y) lt start(x).
There are two cases for the place of
finish(y) Case1 start(y) lt finish(y) lt
start(x). But this is impossible,
because how did y finish without trying to
traverse y?x ? Case2 start(y) lt start(x) lt
finish(y) therefore by FACT1 start(y) lt start(x)
lt finish(x) lt finish(y). And
consequently by FACT2 x is a descendant of y.
But this is also impossible because we
assumed that y is not an ancestor of x.
16Y
Idea to identify articulation points.
Consider the tree-edges of a DFS tree and a node
x. Suppose that we remove all tree-edges incident
to x. This will leave us with subtrees spanning
nodes Y , X1, X2, Xk, where
X1, X2, , Xk are the brunches hunging off of
x, and Y is the part of the tree from which we
enter x. Clearly Y also contains all ancestors of
x.
x
X2
X1
17Y
Idea to identify articulation points.
Consider the tree-edges of a DFS tree and a node
x. Suppose that we remove all tree-edges incident
to x. This will leave us with subtrees spanning
nodes Y , X1, X2, Xk, where
X1, X2, , Xk are the brunches hunging off of
x, and Y is the part of the tree from which we
enter x. Clearly Y also contains all ancestors of
x. Now let us put in the picture the
back-edges. If for some set of nodes X1 there
are no back-edges
from X1 to
Y then all paths between X1 and Y have to go
through x, and
therefore x is an articulation point. We may
think of the tree-edge x?x1 as a witness.
x
x2
x1
X2
X1
18Y
Idea to identify articulation points.
Consider the tree-edges of a DFS tree and a node
x. Suppose that we remove all tree-edges incident
to x. This will leave us with subtrees spanning
nodes Y , X1, X2, Xk, where
X1, X2, , Xk are the brunches hunging off of
x, and Y is the part of the tree from which we
enter x. Clearly Y also contains all ancestors of
x. Now let us put in the picture the
back-edges. If for
all sets of nodes X1, X2, , Xk
there are
back-edges to Y, then x
cannot be an articulation point.
To see this realize that there is no way of
choosing nodes u and v,
such that all the paths between u and v
go through x,
since back-edges can be always used
to bypass x.
x
x2
x1
X2
X1
19LOW identifies the presence of back-edges.
LOW(v) is the lowest number vertex that can
be reached from v following one or more tree
edges and a single back edge.
- FACT v is an articulation point iff
- For some child w of v LOW(w) gt number(v)
- (b) v is the root and has more than one
children
20procedure DFS G(V,E) Articulation points for for
undirected graphs begin for all v in V do v
unvisited for all e in E do e
untraversed vertexcount 0 while there exists
unvisited v in V do begin
v root SEARCH (v) if v
root and v has more than one children in DFS
tree then v
is an articulation point end end.
21(No Transcript)
22 A biconnected component is a
maximal subset of vertices such that the induced
edges form a biconnected
subgraph.
Two biconnected components share
at most one vertex.
The articulation points are precisely the
vertices shared by two or more
biconnected components.
23(No Transcript)
24procedure DFS G(V,E) Biconnected components for
for undirected graphs begin for all v in V do v
unvisited for all e in E do e
untraversed vertexcount 0 while there exists
unvisited v in V do begin
v root SEARCH (v) if v
root and v has more than one children in DFS
tree then v
is an articulation point end end.
25procedure SEARCH (v) begin v
visited vertexcount vertexcount1
number(v) vertexcount Low(v)
number(v) for each w in L(v) do
begin if v root and the stack is not
empty then a new biconnected
component has been found repeat
POPstack until the stack is empty
if (w,v) is not in the stack then PUSH(v,w),
stack if w is unvisited then
begin (v,w)
traversed (v,w) tree-edge
SEARCH (w) if LOW(w) gt
number(v) then
a new biconnected component, witnessed by
w, has been found
repeat POPstack until (v,w) is popped
LOW(v) min LOW(v) ,
LOW(w) end if w is
visited and (w,v) is untraversed then
begin (v,w) traversed
(v,w) back edge LOW(v)
min LOW(v) , number(w) end
end end.