articulation points in graph

savitchandra 768 views 11 slides Mar 25, 2015
Slide 1
Slide 1 of 11
Slide 1
1
Slide 2
2
Slide 3
3
Slide 4
4
Slide 5
5
Slide 6
6
Slide 7
7
Slide 8
8
Slide 9
9
Slide 10
10
Slide 11
11

About This Presentation

application of graph theory in data structures


Slide Content

Lecture6:AnApplicationofDFS:
Articulationpoints
RecallDFSalgorithm:
DFS{G}{
foreachvinVdo//Initialize
visit[v]=false;
foreachvinVdo
if(visit[v]==false)RDFS(v);
}
RDFS(v){
visit[v]=true;
foreachwinAdj(v)do
if(visit[w]==false){
RDFS(w);
}
}
}
1

DFSExample
B
b
e
f
a
b
e
f
B
d
gc
a d
gc
GivenagraphG=(V;E),ittraversesallverticesof
Gand
constructsaforest(acollectionofrootedtrees),to-
getherwithasetofsourcevertices(theroots).
2

AdditionalInformation
discover[u]–thediscoverytime,acounterindi-
catingwhenvertexuisdiscovered.
pred[u]–thepredecessorofu,whichdiscovered
u.
DFS{G}{
foreachvinVdo//Initialize
visit[v]=false;
pred[v]=NULL;
time=0;
foreachvinVdo
if(visit[v]==false)RDFS(v);
}
RDFS(v){
visit[v]=true;
discover[v]=++time;
foreachwinAdj(v)do
if(visit[w]==false){
pred[w]=v;
RDFS(w);
}
}
}
3

ClassicationofEdges
Treeedges:whicharetheedgesfpred[v],vgwhere
DFScallsaremade.
Backedges:whicharetheedgesfu,vgwherevis
anancestorofuinthetree.
4

AnApplicationofDFS:Articulationpoints
Denition:LetG=(V;E)beaconnectedundi-
rectedgraph.Anarticulationpoint(orcutvertex)ofG
isavertexwhoseremovaldisconnectsG.
GivenaconnectedgraphG,howtondallarticulation
points?
5

Articulationpoints:Easysolution
Theeasiestsolutionistoremoveavertex(andits
correspondingedges)onebyonefromGandtest
whethertheresultinggraphisstillconnectedornot
(saybyDFS).TherunningtimeisO(V(V+E)).
6

Articulationpoints:Observations
1.TherootoftheDFStreeisanarticulationifithas
twoormorechildren.
2.AnyotherinternalvertexvintheDFStree,ifit
hasasubtreerootedatachildofvthatdoesNOT
haveanedgewhichclimbs'higher'thanv,thenv
isanarticulationpoint.
7

Articulationpoints:Howtoclimbup
Observethatforanundirectedgraph,itcanonlyhas
treeedgesorbackedges.Asubtreecanonlyclimb
totheupperpartofthetreebyabackedge,anda
vertexcanonlyclimbuptoitsancestor.
v
. . . .
k
w
1
w
2
w
8

Articulationpoints:Tackleobservation2
WemakeuseofthediscoverytimeintheDFStree
todene'low'and'high'.Observethatifwefollowa
pathfromanancestor(high)toadescendant(low),
thediscoverytimeisinincreasingorder.
Ifthereisasubtreerootedatachildrenofvwhich
doesnothaveabackedgeconnectingtoaSMALLER
discoverytimethandiscover[v],thenvisanarticula-
tionpoint.
Howdoweknowasubtreehasabackedgeclimbing
toanupperpartofthetree?
DeneLow[v]bethesmallestvalueofasubtreerooted
atvtowhichitcanclimbupbyabackedge.
Low[v]=minfdiscover[v];discover[w]:(u;w)
isabackedgeforsomedescendantuofvg
9

RDFS_Compute_Low(v) {
visit[v]=true;
Low[v]=discover[v] =++time;
foreachwinAdj(v)do
if(visit[w]==false){
pred[w]=v;
RDFS_Compute_Low(w);
//WhenRDFS_Compute_Low(w)returns,
//Low[w]storesthe
//lowestvalueitcanclimbup
//forasubtreerootedatw.
Low[v]=min(Low[v],Low[w]);
}elseif(w!=pred[v]){
//{v,w}isabackedge
Low[v]=min(Low[v],discover[w]);
}
}
10

Articulationpoints
Articulationpointsarenowdeterminedasfollows:
1.TherootoftheDFStreeisanarticulationpointif
ithastwoormorechildren.
2.AnyotherinternalvertexvintheDFStreeisan
articulationpointifvhasachildwsuchthatLow[w]
discover[v].
ArticulationPoints{
foreachvinVdo
if(pred[v]==NULL){//visaroot
if(|Adj(v)|>1)
articulation_point(v)=true;
}else{
foreachwinAdj(v)do{
if(Low[w]>=discover[v])
articulation_point(v)=true;
}
}
}
Runningtime=?
11
Tags