Para l l e l Ear Decomposition Search (EDS)An d ST-N um berin g In G raph s
by
Yael M a on1
Baruch Sch ieberl '3
Uz i Vishkin
Ultracomputer N o te 1 02
Compu te r Sc ien ce D epartme n t Te ch n ica l R e po r t #222Fe b ru ar y , 1 986
NewYorkUn ivers i'
iyinstitute ofMathematicalSciences
Division ofComputerScience251 Me v
cerStreet, NewYork, NY 10012
Para l l e l Ear Decomposi tion S earch (EDS)An d ST-N um berin g In Graph s
by
Yael M aon1
Ba ruch Sch ieberl ’3
Uz i Vishkinl ’z ‘3
Ultracompu ter No te # 1 02
Compu te r Sc i e n ce D e pa r tm e n t Te ch n ica l R e po r t # 222Fe b ru ar y , 1 986
1D e p ar tme n t o f Compu te r Sc ie n ce Schoo l o f M a t h ema t ica l Sc i e n ce s Te l A v iv Un iv e r s i ty
Te l A v iv , I s r a e l 69978 .
2D e pa r tme n t o f C ompu t e r Sc i e n ce C o u r an t In s t i tu t e o f M a t hemat i ca l Sc i e n ce s N ew York
U n iv e r s it y 25 1 M e r ce r St . , N ew York , N . Y . 100 1 2 . Th e r e s e ar c h of t h i s a u th o r wa s
s uppo r t e d by N SF gr an t N SF-DCR -83 1 -8874 an d ON R gr an t N 00 14-85 -K-0046 .
3 Th e r e s e ar c h o f th e s e au th o r s wa s su ppo r t e d by th e A pp l i e d M a t h emat i ca l Sc i en ce s
sub p ro gr am o f th e O ffi ce of En eroy R e se a r ch , U . S . D e pa r tm e n t of E n e rgy un d e r con t ra ct
n umbe r DE ACO2-76BROBO7 7 .
ABSTRACT
[LEC-67 ] l i n e ar t ime s e r ia l a lgo r i thm fo r te s t in g p l an ar i t y o f gr aph s u s e s th e l i n e a rt ime se r ia l a l go r i thm of [ET-76 ] fo r sr-n um b e r in g . Th i s sr-n umbe r in g a l go r i thm i sba s ed on de p th - fi r s t s e a r ch (DFS) . A known co nje ctu r e s ta t e s t h a t DFS , wh ich i s a
key te ch n iqu e i n de s ign in g s e r i a l algo eithm s , i s n o t am e n ab l e to po ly- lo g t im e
pa r a l l e l i sm u s in g"
aro un d l in e a r l y ( or e v e n po l yn om ia l l y ) man y p ro ce s so r s . Th e
fi r s t con t r ib u t io n of t h i s'
p ap e r i s a ge n e r a l m e tho d fo r s e ar ch in g e ff ic i e n t ly in
pa ra l l e l u nd ir e ct e d g r a ph s , ca l l e d ea r-decomp os ition sea rch (ED S) .
The s e co n d co n tr ibu t io n d emo n s t r a t e s th e app l i cab i l i t y o f th i s s e a r ch me tho d . We
pre s en t a n e ffi c i e n t pa r a l l e l a l go r i t hm fo r s t -numbe r in g in a b ico n n e cte d gr ap h . Th e
a l go r i thm ru n s in l o ga r it hm ic t im e u s i n g a l i n e ar n umb e r o f p ro ce s so r s o n a
con cu r r e n t-r e a d co ncu r r e n t-wr i t e (CRCW ) PRAM . A h e ff ic i e n t pa r a l l e l a l go r it hm
fo r th e prob le m d id no t e x i s t b e fo r e . Th e prob lem wa s no t e ve n kn own to b e in
1 . In trodu c tion
We de fin e th e p rob l e m s co n s i d e r e d in th i s pa pe r . Fo r a l l t h e s e p rob l em s we u s e th e
s ame in pu t .
Inp ut . A n u n d ir e cte d gr ap h G (V ,E ) an d som e spe c i fie d e dge e i n E . (D e n o te n = V
an d m E
Let P0 b e th e pa th th a t co n s i s t s of t h e e d ge e . A h ea r decomp os it ion o f G s ta rtin g w ith
P 0 i s a de co mpo s i t io n E = P0 U P I U U Pk , whe r e P i + 1 i s a s imp l e pa th who s e
e n dpo in t s b e long to P 0 U U P i , b u t i t s i n t e r n a l ve r t ice s do n o t . A s imp l e pa th P,i s
ca l l e d a n ea r . It i s c a l l e d a n op en ea r i f th e two e nd po in t s o f P,~ do no t co in c id e , and a
c los ed e a r o th e rw i s e . A h e a r d e compo s i t i o n i s ca l l e d op en i f a l l i t s e a r s ar e Ope n .
The ea r decomp os i tion p roblem . F in d a n e ar d e compo s i t io n s t a r t i n g w ith P0 .
The op en ear decomp os ition p roblem . F in d an ope n e a r d e compo s it io n s tar t in g w ith P0 .
A h on e -t o -on e fu nct i o n f fr om V to { 1 n } i s ca l l e d a n s t—n umberin g i f i t s a t i s fi e s
( i) f( s ) = 1 an d and ( i i ) for e a ch th e r e e x i s t a dj a ce n t ve r t i ce s v 1 an d v 2
s uch th a t
The sr-n umbering p roblem . F in d an sr-n um berm o o f G .
A gr aph G ha s an Ope n e a r d e compo s it ion s ta r t in g w i th an e d ge iff G is b i co n n e cte d
( s e e [W-3 2l) . A graph G i s b ic o n n e ct e d i ff it h a s an sr-numb e r in g for e v e rv g iv e n e d ge
( S J ) ( s e e [LEC -67 j ) .
The mo de l of pa r a l le l compu ta t io n u s e d in th i s p ap e r i s t h e con cu r r e n t-r e ad
co n cu r r e n t-w r i te (CRCW ) pa ra l l e l r a ndom acce s s mach in e (PRA M ) . A PR A M emp lo y s p
syn ch ro nou s proce s s o r s a l l h av in g acce s s to a common memo ry . A CRCW PRAM a l lows
s imu l ta n e ou s acce s s by mo re t h an on e p roce s s o r to th e s ame memo ry lo ca t io n fo r e ith e r
r e ad s or wr i te s . We u s e th e fo l l o w ing con cu r r e n t-wr i te con ve n t io n . In ca s e s e v e ra l
p r o ce s s o r s s e ek acce s s to th e s ame memo ry l o ca t io n for wr it e p u rp o s e s , o n e o f th em
su cce e d s bu t we do no t kno w in advan ce wh i ch . See [V -83 ] fo r a s ur ve y of r e su l t s
co n ce r n ing PRAM s .
Fo r e ach o f th e th r e e p ro b l em s me n t io n e d ab ove we g iv e a par a l l e l a lgo r i thm wh ich
run s in O ( log n ) t ime u s in g m+m p roce s s o r s on a CRCW PRA M . A lte r n a t iv e p ar a l l e l
imp l emen tat ion s at ta in in g op t im a l s pe e d up wh e r e m > rz logn a re a l s o g i ve n for e ach
(3 )pro b l em . The s e a l t e r n a t i ve a l go r i t hm s ru n in t ime O ( logn log (2 )n log n ) , whe r e log
“) i s t h ekm i t e r a te of th e l o g funct io n .
[L -85 ] s howed tha t t h e e a r d e compo s i t io n p ro b l e m ha s a pa ra l le l a l go r i t hm wh ich run s
in po l y-l o g t ime u s i n g a po lvn om ial n umbe r o f proce s s o r s a n d i s th e r e fo r e in t h e c l a s s N C
A r ema rk a t the e nd o f Se ct io n e xp la in s whv we b e l i e v e th at it wa s n o t known whe th e r
th e op en e a r de compo s i t io n pro b l e m i s i n th e c la s s N C . We ar e a l s o n ot awa re o f auv
pa r a l l e l a l go r i thm for sr-numb e r in g . A ppar e n t l y , i t wa s n o t e v e n kn own if sr-numbe r in g i s
in N C . H er e , we do no t o n ly d e te rm in e tha t th e s e two pro b l em ar e in N C ,bu t a ctu a l l y g ive
ve r y e ffic ie n t pa ra l l e l a l go r i thm s . E a ch o f t he s e a l go r i thm s ru n s in l o ga r i thm ic t im e u s in o a
l i n e ar n umb e r of proce s so r s
Ser ia l gr ap h a lgo r it hms u s e two ma in te chn iqu e s for s e a r ch in g gr aph s : D e p th -Fi r s t
Se ar ch (DFS) and B r eadth -F ir s t Se a r ch ( BFS) . B o th te ch n i que s s e em to b e no t id e a l for
pa ra l l e l computat io n . Th e mo s t e ffi c i e n t po ly-l o g t ime pa ra l l e l imp l em e n ta t io n s o f BFS
r e qu ir e a numbe r of proce ssci rs wh ich i s cu b i c i n th e n um b e r o f ve r t ice s . M an y re s e a r che r s
have co nj ectu r e d tha t D FS i s n o t e v e n in XC . O n e o f th e mo s t ch a l le n g in g ta sk s in p ar a l l e l
compu ta t io n i s to cope to wi t h th i s ap pa re n t in tractab ilitv o f DFS . O n e ap p ro ach i s n e t to
g i v e u p an d trv to get th e mo s t ou t of B FS a s in {A -SS ] . Th i s a pp roa ch i s in t e r e s t i n g from
the the o re t i ca l po in t of v ie w s in ce i t bou nd s t h e l im i t s o f DFS i n pa r a l l e l . We be l ie ve.
ho we ve r , th a t whe n it come s to acrua ilv des ign in cJ e ffic ie n t par a l l e l a l go r i thm s ,a more
ealisric app roach sh ou ld b e take n . Tha t i s . BFS and DFS s ho u ld b e r e p l a ce d bv ne w
Ultracom pu ter No te 1 02 Pa ge 2
THREE LAY ERS OF S IM ULATION
F IG. 1
Page 2A
t e ch n ique s wh ich a r e ame nab l e to par a l l e l compu ta t io n . Th i s appr oa ch of l o ok in g fo r n e w
t e chn iq u e s to r e p l a ce DPS ha s b e e n pr a ct ice d in d e s i gn in g e ffi c ie n t p a ra l l e l a l go r i thm s fo r
b icon n ect iv ity [TV -85 ] an d s t ron g or i e n ta t io n [V O b s e r ve , howeve r , th a t un l ik e ou r
pr o b l em s,i t wa s t r iv i a l to e s tab l i s h th e m emb e r sh ip of b icon n eCtiv ity and s t ron g o r ie n ta t io n
in N C u s in g s imp l e tr an s i t iv e c l o su r e a lgo r ithm s .
Ear-de compo s it io n h a s th e flav or o f a gen era l s e a r ch te chn iq u e in gr ap h s . I t ar r an ge s
th e ve r t ice s o f th e gr ap h b y pa r t it io n in g th em in to pa th s . Th i s e n a b l e s fu r t h e r e xp lo r a t io n
o f th e graph in an ord e r ly manne r . We ca l l t h i s s e a r ch te ch n iqu e ea r—decomp os it ion
s ea rch (E DS) .
For mo re mot i v at io n fo r co n s id e r in g th e e a r d e compo s it io n p ro b l em s , we r e fe r th'
e
r e ade r to [L-85 ]
The s e r ia l a l go r i thm for sr-n urn bet‘ in 0 1 5 co n s id e r e d a s on e o f th e c l a s s ica l s e r ia l g ra ph
a l go r i thm s ( s e e [E -79l) . Th e l in e a r t im e a l go r i thm fo r th e prob lem [ET -76 ] i s h e av i l y ba s e d
on DFS . Th e pr e s e n t p ap e r cope s w i th th e a pp a r e n t in tr a ct ab i l i ty of DFS for p ar a l l e l
compu ta t ion b y “
pro v id in g a n e w a l go r i thm for the p rob l em . Th e n ew a l go r i t hm i s b a s e d
on the ne w ED S te chn iqu e fo r e ar de compo s i t io n of a gr ap h , t h e r e by demon str a t in g i t s
app l icab i l i ty . The a l gor i thm i s a l s o b a s e d o n r e fin e d in s i gh t s i n to th e sr-numb e r in g
pro b l em . In te r e s t in g ly our a l gor i thm p ro v id e s a l s o a n e w l in e a r t ime s e r i a l a l go r i t hm fo r
sr-numb e r ing .
The sr-numb e r in g i s u s ed a s an impo r tan t compon e n t in s e v e ra l s e r ia l a l go r i thm s
M o s t kn own i s th e p la n a r i ty te s t in g a l go r i thm o f [LEC -6 7 ] wh ich wa s impro ve d to r un in
l in e ar t ime , fo l l owin g th e l i n e ar t ime a lgo r i thm for s r-n um b e r in g of [ET O ur a lgo r i thm
g ive s hop e for find in g e ffic i e n t p ara l l e l p lan a r ity t e s t i n g u s in g t he app roach of [LEC I t
i s y e t un r e so l ve d whe th e r th e r e e x i s t s a n e ff i c i e n t p ar a l l e l a lgo r it hm for p lana r i ty te s t in o
No te tha t th e in vo lv e d p l a n a r i ty te s t in o of [I S-82 ] s t i l l l e aves much to b e de s i r e d , a s it ru n s“s
3
on O ( 10 0“
n ) t ime usmg pro ce s so r s.
An o the r app l i ca t io n fo r Sr-n umbe rin o i s“
me n t ion e d in [IR -84 ] for th e fo llowm o
pr ob l em . Give n an u n d ir e cte d b i conn e c te d G rap h fin d two s pa n n in o t r e e s T l an d T« w h ich
a r e r oo t e d at th e same v e r te x r so tha t th e pa th s fr om r to v i n T an d T7 ar e ve r te x
d i sjo in t ( e xce p t r and V ) Th is p rob l e m i s im p o r tan t for re l iab l e commun ica t io n a s was
in d ica te d in tha t pape r .
L'
ltracom pu ter N o te 1 02 P a ge 3
In Se ct io n 2 we pr e s e n t a p ar a l l e l a lgo r it hm fo r comput in g an e a r -de compo s i t io n a nd
an o pe n e a r -de compo s i t io n . I n Se ct io n 3 we u s e th e op e n ea r de compo s i t i o n to compu t e
sr-n umbe r in g of a b ico n n e cte d gr ap h G . Th e numbe r in g i s don e in two s ta ge s : ( 1 ) We
o r ie n t th e e dge s o f th e in pu t gr a ph . A s a r e su l t we ge t a d i r e ct e d a cyc l i c gr ap h s uch th a t
e ach of i t s v e r t i ce s i s on a pa th fr om s t o t . ( 2 ) We topo lo g ic a l l y s o r t o f th i s d i g r ap h to ge t
th e sr-numb e r in g . The who l e su b t l e ty o f t h e a lgo r it hm l i e s i n th e o r i e n ta t io n o f Stage 1 .
Th rou gh a ca r e fu l ca s e a n a ly s i s we p e r fo rm th i s o r i e n ta t io n b a s e d on con s i d e r a t io n s wh ich
a r e e s s e n t i a l l y l o c a l . We we r e su r p r i s e d by th e fac t t h a t th e s e lo ca l co n s ide r a t io n s we r e
su ffic i e n t . A no th e r in t r i gu in g comme n t i s t h a t o n e o f t h e in t e r e s t i n g Ope n p ro b lem s in
pa r a l l e l compu tat io n i s wh e the r t h e r e i s a po ly - l o g t im e a l go r i thm for topo lo g ica l s o r t th a t
u s e s l in e a r l y man y p ro ce s s o r s . We h ave e xamp le s wh e r e ou r topo lo g ica l s o r t a l go r i thm
fa i l s o n s ome acyc l i c d igr aph s . H owev e r , we can p ro ve t ha t th i s topo lo g ic a l s o r t a lgo r i thm
w i l l wo rk co r r e ct l y on a ll acyc l ic d igr ap h s wh ich can b e o b ta in e d a s o u tcome o f th e fi r s t
s ta ge .
2 . Ear-Decompos ition In Para l l e l
Let G (V ,E ) b e a n u nd ir e ct e d b icon n e ct e d gr ap h . We g i v e an a l go r i thm fo r fin d in g an
ope n e ar de compo s it io n of G s ta r t in g wit h whe r e A par a l l e l
imp l emen ta t io n o f th i s a lgo r ithm i s d e s cr ib e d a t th e e n d of t h e s e ct io n .
Defin ition s : Le t T( V ,E ) b e a t r e e wh ich i s r o o te d a t t .
( 1 ) Fo r v 6 V , LEVEL( v ) i s t h e l e n gth , cou n t in g ed ge s , o f t h e u n ique pa th in T fr om t t o v .
( 2) Fo r v 6 V , F ( v ) i s t h e fa th e r of v i n T .
( 3) Fo r u ,v EV , LCA ( u ,
v ) i s t h e lowe s t common an ce s to r o f u an d v i n T .
(4 ) Le t u ,v EV , whe r e u i s n o t a n an ce s to r o f v . We d e n o te b y e th e fi r s t e dge in th e
un iqu e pa th in T fr om LCA ( u ,v ) to u .
In o r d e r to compute an Ope n e a r -de compo s it io n , we fi r s t fin d an e a r -de compo s it i on o f
G wh ich i s n o t n e ce s s ar i l y o pe n . Th i s i s d e s c r ib ed in t h e fi r s t s u b s e ct io n b e lo w . Th e s e co nd
sub s e c t io n sho w s how to mod i fy t h i s e a r—de compo s i t io n in t o a n o pe n e ar—de compo s it io n .
Ultracompu te r No te 1 02 Pa ge 4
F in d in g an ear-decom pos ition
In s te ad o f d e s ign in g a n e w a l go r i thm fo r fin d in g an ea r d e compo s it io n . we u s e a
pa r a l l e l a l go r i thm fo r a d i ffe r e n t p r o b lem wh ich was g ive n in [V The r e , t h e a l go r i thm
a s s ign s d i r e ct io n s to th e e dge s o f a con n e cte d b r idge le s s un d i r e c te d gr ap h so th a t th e
r e s u l t i n g d ir e ct e d gr aph i s s t r o n g ly co n n e cte d . We no te th a t we o b ta in th e same e a r
d e compo s i t io n a s in [L Howe ve r , o u r pa r a l l e l a l go r i thm i s mo r e e ff i c ie n t . Fo r
comp le t e n e s s of th e p r e s e n ta t io n , we ou t l i n e be lo w the a l gor i t hm for fi n d in g an e a r
d e compo s it ion .
S tep 11 . Fin d a span n in g t r e e T( V ,ET) roo te d at I of G su ch th a t ( s t ) wi l l b e t h e o n ly t r e e
e d ge who s e e ndpo in t i s t . Th i s is do n e a s fo l l o w s : Fi r s t . fin d a spa nn in g t r e e o f the
s u b gr ap h indu ce d by the v e r t i ce s V F in a l ly , a dd th e ve r t e x 1 and th e e d ge ( S J ) to t h e
t r e e (Remark : The fac t t h at G i s b ic on ne cte d imp l ie s t ha t t h e sub graph i ndu ced b y V— {t }
i s conn e cte d . ) Ste p 1 i s th e on l y s te p in th i s su b s e ct io n wh ich i s n o t comp l e t e ly i de n t ica l to
t h e a l go r i thm o f [V Th e re . a ny sp ann in g t r e e w i l l do
E dge s in ET wi l l b e r e fe r r e d to a s t r e e e dge s . Edge s in E — ET wi l l b e
r e fe r r e d to a s n on -tr e e ed ge s . Th e e dge w i l l h ave a spe c i a l S ta tu s .
In St e p 2 we a s s ign a numb e r to e ach n on - t r e e e dge .
S tep 2
( a ) Fo r e ach v 6 V ,compute LEVELW) and H i )
Fo r each n on - tr e e e dge ( u ,v ) compu te
( b ) A s sume tha t e ach edge e é E ha s a s e r ia l n umb e r I S SERIAL( e ) S m . Fo r e ach no n
tr ee e dge e , l e t
We de fin e a le x i co gr ap h ic o r d e r <L on t h e se n um b e r s a s fo l l o w s . Le t e ,e
'
b e no n
t r e e e dge s . i f o r
an d w he r e
s ta n ds fo r th e 1“coord in ate of t h e pa i r N UJ'IBERLH
Le t f be a n on - t r e e ed ge . We ca l l the s imp le cyc l e wh ich i s fo rme d by f to o e ther w i th
th e e d ge s in ET t h e Cyc le off .
S tep 3 . Ea ch t re e e d ge e'
o n s iders'
a il n o n - t r e e e d ge s f s uch tha t e i s in th e ir cyc l e
A mon g them e s e l e c t s a n e d ge f w h o s e i s m in ima l ( acco rd in o to < L 1 to b e i t s
Ultracom pu ter Note [ 02 Pa ge 5
mas ter edge . Th e e dge f i s de n o te d M ASTER ( e ) .
Propo sition E ach n o n -t r e e e d ge e to ge th e r w i th a l l t h e t r e e e d ge s wh ich s e l e c t e d it a s
th e i r ma s t e r e dge fo rm a s im p le pa t h o r a s imp l e cyc l e . We ca l l t h i s pa th o r cyc l e t h e ear
of e .
O b s e rv e th a t th e or d e r <L o n t h e n o n -t r e e e d ge s in du ce s a n o rd e r o n th e de fi n e d e a r s . I n
add i t io n , de fin e th e e dge ( s ,t ) a s t h e f i r s t e a r .
Proposition The de fin ed ea r s a n d th e o rde r v ie ld a n e a r -de compo s i t io n .
Note t h a t s ome o f t h e s e e a r s may be s imp l e cv cle s an d th e r e fo r e th e r e su l t e d e a r
d e compo s i t io n may b e no t o pe n . A c l o s e d e a r may occu r whe n a non - t r e e ed ge ( u ,v ) i s a
ma s te r e d ge o f a l l th e tr e e e dge s i n it s cyc l e . ( Fo r an e x amp l e whe r e a n ar b it r a r y o r de r o n
th e se r ia l n umbe r s o f th e n o n-t r e e e d ge s imp ly s u ch a c lo s ed e a r , s e e e dge n z in F ig .
a s sum in g th a t th e s e r i a l n umbe r of H 2 i s sm a l l e r th an t ha t o f n l . )
Rema rk : U n l ike a r emark i n Lov asz ’
s pa pe r , F ig . demon s tr at e s th at i t i s po s s ib l e to ge t
a c lo se d e a r who s e e n dpo in t i s n e i th e r th e r o o t n o r a s ep ar a t i n g ve r te x . Th e ope n ea r
d e compo s i t io n p ro po s e d in [L-85 ] i s b a s e d o n th i s e r ro n e o u s r emark .
Fin din g an open ear-decom pos ition
In o r d e r to h ave a de compo s i t io n i n to op en e a r s we h ave to d e fin e a su b t l e r o r d e r on
th e n on -t r e e e d ge s . We show how to do i t b y r e o r d e r in g t h e n on - t r e e e dge s wh ich h ave the
s ame LCA . Spe c i fica l l y , th is r e o r d e r in g i s a ch ie v e d by ch a ng in g o n l y t h e s e con d compon e n t
in th e pa ir Fi r s t . we take a c lo s e r l o ok a t th e s i tu a t io n whe r e
a c lo s e d e a r o ccu r s . Le t ( u ,v ) EE
— ET a n d an d su ppo s e x ¢ u . I f v = x t h e n th e
e a r o f ( u ,v ) i s c l o s e d i ff e ,m ch oo s e s ( u ,v ) a s it s ma s t e r . O t h e rw i s e v ¢ x an d he n ce
em i s d e fin e d ) , th e e a r o f ( u .v ) i s c lo s e d i ff b o t h e a ". and e”,
choo s e ( u ,v ) a s th e ir ma ste r .
Suppo s e , fo r in s t a n ce , t h at e“ ( or e i s o n th e cyc le o f a n on - tr e e e dge f such th a t
H e r e , no ma t te r how un fo r tu n a te we a r e w it h th e
in i t i a l iz a t io n o f SERIAL , t h e e a r of e can no t b e c lo s e d s in ce wi l l n e ve r b e th e maste r
of Th e r e fo re , w e ca n ch a r ac t e r i z e a l l th e d ifficu lt ca s e s . a s th e o n e s in w h ich
i f i r ¢ x an d —‘ x
o th e r w is e . i s t h e s ame a s in th e pr e v io u s su b s e c t i o n . ) Th i s l e ad s to the
fo l lo win g o b s e r v a t io n . wh ich mom'
ated u s i n chan g in g t h e above e a r -de compo s i t io n in to an
Ultracom pu te r Note 1 02 P a ge 6
op e n e a r -d e compo s i t io n .
Obse rv at ion . C o n s ide r a n y a s s i gnme n t of numbe r s in to SERIAL o f t h e n o n -t r e e e d ge s so
t h a t fo r e ach non - tr e e e d ge a t l e a s t o n e o f e“, o r em doe s n o t ch o o s e ( u ,v ) a s i t s
m a s t e r . The n , th e above e a r -d e compos i t i o n mu s t b e ope n .
Th i s cha n ge i s d one u s in g a n au x i l ia r y ( no t n e ce s s ar i l y co n n e cte d ) gr ap h HJrfo r e ve r y
ve r t e x x in V {t} .
S tep 4 . Fo r e ve r y ve r t e x x i n V we con s t r u ct th e b ip ar t i t e un d i r e ct e d graph
Hx ( VX ,Ex) as fo l l o ws
GE - ET an d U
I n wo r d s , t h e ve r t ic e s Vx a r e a l l non -t r e e e dge s who s e LCA i s x ( t o b e ca l l e d n on -tree
ver t ices ) an d a l l t r e e e d ge s co n n e ct i n g x with a so n in t h e tr e e ( t o b e ca l l e d tree vert ices ) .
Le t [u ,v ] b e a n on -t r e e v e r t e x in V.
s uch tha t u i s n o t an an ce s to r of v in T . Let e b e th e
t r e e ed ge Th e n th e e d ge i s in EX
.
Th e gr aph H5wh ich re l a t e s to th e gr a p h G of F ig . i s g iv e n in F ig .
S tep 5 . For e ach gr ap h Hx , compu te it s co n n e cte d compon e n t s a n d a s p an n in g fo r e s t .
M a in Lemma . Con s ide r a sp an n in g t r e e o f a con n e cte d compon e n t o f on e o f t he s e aux i l ia ry
g rap h s Hx
. Th e n , a t le a s t o n e o f i t s t r e e v e r t ice s [w ,x ] (whe r e mu s t s a t i s fy
< LEVEL (x )
Rele va n ce of M a in Lemma . Le t [u ,v ] b e a n o n -t r e e v e r te x in HJran d l e t (w ,
x ) b e a tr e e
v e r te x in th e spann in g t r e e o f th e con n e cte d compon en t o f [n ,v ] i n Hx
who s e e x i s t e n ce i s
gua r a n te e d by th e M a i n Le mma . Con s ide r t h e pa th l e a d in g fr om [w ,x ] to [a ,v ] i n th i s
s p a n n in g t r e e . Th is p at h a l t e r n a t e s b e twe e n t r e e an d n on - tr e e v e r t i ce s . Le t u s de no te i t
t 1 (= whe re t
,s t a nd s fo r a tr e e v e r t e x a nd n
,fo r a n on -t r e e
ve r t e x . O b s e r ve th at th e e dge ( r e pr e s e n t e d bv ) t,b e lo n g s to th e cyc l e o f ( th e e dge
r e p r e s e n te d by ) n fo r l s i s a , an d to the cy c le of n i_ 1 , fo r Z S i S a . We a im th a t n on e of
t h e e a r s of wi l l b e c l o s e d . In v i ew o f th e ab ove O b s e r v a t io n . w e s imp ly take
ca r e t h at th e ed o e of e a ch t r e e ve r te x t w i l l n o t s e le ct t h e edo e o f th e n o n -t r e e ve r te x h , a s
i t s ma s te r . For th i s , Ste p 6 b e lo w numbe r s th e no n -t r e e v e r t ice s on th i s p a th in a sce nd in o
o rd e r so tha t SERIAL ( n SERIALM Q ) . Th i s imp l i e s tha t for ?_S i S on. the
Ultracom pu ter No te 102 P a ge 7
o f ti wi l l n o t s e l e c t t h e e d ge o f n ,~ a s i t s mas te r . In add it io n , t h e M a in Lemma imp l i e s th a t
imp ly in g t h a t t l wh ich b e lo n g s to t h e cyc le o f n 1
i s n o t i n c lu d e d i n t h e e ar of in .
Proof of M a in Lemma . Take an y span n in g tr e e a s in th e Lemma . The proo f proce e d s a s
fo l lo ws . We de f in e a n o n emp ty sub gr aph 6 1 o f G wh i ch i s a fun ct io n o f th i s s pa n n in g
t r e e . We sh o w th a t i f t h e Lemma do e s n o t h o l d w it h r e sp e ct to th i s s pa n n in g tr e e th e n
G 1 ¢ G and 6 1 i s a b ico n n e ct e d compo n e n t o f G . Th i s wou ld co n t r ad ic t th e bicon n ectiv ity
o f G an d th e r e fo r e t h e Lemma i s co r r e c t . Le t u s de fin e R e ca l l t h a t a l l t h e tr e e
v e r t i ce s in th e s pan n in g t r e e a r e of t h e fo rm whe r e The ve r t i ce s of 6 1
a re : ( 1 ) A l l th e v e r t i ce s v su ch th a t [v ,x ] i s a t r e e ve r t e x i n t h e sp an n in g t r e e . ( 2 ) A ll
ve r t ice s o f G wh ic h a r e d e s cen dan t s o f th e ve r t ice s i n I t em ( 1 ) i n th e sp an n in g t r e e o f G
wh ic h wa s fo un d in Ste p 1 . ( 3 ) x i t s e l f .
6 1 i s in duce d b y th e s e v e r t ice s . Th at i s , t h e ed ge s of G I ar e a l l t h e e d ge s o f G wh ich ar e
in c ide n t to two ve r t i ce s in G l .
Suppo s e Hxha s mo r e t h a n on e co n n e cte d compon en t . Let G Z( V2 ,E 2) b e a s im i la r su b gr ap h
o f G wh ic h i s de fin e d fo r t h e span n i n g tr e e o f an o th e r co n n e ct e d compo n en t o f Hx
. We
fir s t s h ow tha t i t i s im p o s s ib l e to h ave an e dge ( u ,v ) in E co n n e ct in g an y ve r te x u o f
V l— {x} with an y ve r te x v o f Vz C le a r l y , LCA ( u ,
v ) mu s t b e it i t s e l f . Th e e dge e,m i s
i n th e co n n e ct e d compo n e n t o f C l in H.and i s i n th e co n ne cte d compon e n t o f G ; in
Hx
. The r e fo r e , i f ( u ,v ) e x is t s , t h e n i t mu s t b e co n n e cte d to th e t r e e ve r t ice s o f e“ and em
and th e r e fo r e 6 1 an d G ; ar e th e s ame , con tr ary t o our a s s ump t io n .
H en ce , i f th e r e i s n o e dge ( u ,v ) i n E s u ch t h a t u i s a ve r te x o f Vl
— {x } a nd
in th e tr e e of G , t h e n the remova l o f x wi l l d i s co n n e ct G . Th i s
co n t r a d ic t s th e b icon n ecriv ity o f G .
S tep 6 .
( a ) For th e s pan n in g t r e e of e ach co n n e cte d compon e n t in e ach au x i l ia ry graph H rin d a
t r e e edo e (w ,x ) ( whe r e F ( w = x ) s uc h th at
( I t s e x i s te n ce i s 0 u aran teed by th e M a in Lemma . ) Th i s t r e e e dge wi l l be r e fe r r e d to a s
Ultrac om pu ter N o te 1 02 Pa ge 8
the edg e of i t s compon e n t .
( b ) R oo t e ach su ch span n in g t r e e a t t h e ed ge of i t s compon e n t . Compute th e n um b e r in g o f
th e n on - t r e e ed ge s in a pr e o r de r t r a ve r sa l of t h e span n in g tr e e . For e ve r y n on -t re e
ed ge e ,t h i s numbe r in g w i l l b e s to r e d in PREORDER ( e ) .
( c ) Fo r ea ch n on - t r e e e dge e , l e t A'
EWN UM BER ( e )
For e x amp le ,no t ice tha t th e e dge o f t h e compon en t g iv e n in F ig . i s ( 1 .
S t e p 7 . E ach tr e e e dge r e s e l e ct s a ma s t e r ed ge acco r d in g to N EWN UM BER in th e s ame way
a s t h e s e le ct io n of a ma s te r e d ge in Ste p 3 abo ve .
Pr o po s i t i on E ach n on -t r e e e dge e t o ge th e r w i th a l l t h e t r e e ed ge s wh ich s e l e c te d i t a s
the ir ma s te r e dge fo rm a s imp le pa th ( w h ich i s no t a cyc le ) . Th i s pa th i s th e ear of e
A ga in , ob s e r v e th a t th e o rde r < L o n th e n on -t r ee e dge s in duce s a n o rd e r o n th e s e e a r s . I n
add i t io n , de fi n e th e e dge a s t h e f i r s t e a r .
Pr opo s it ion Th e s e e a r s an d o rde r y i e l d an op e n e a r-de compo s i t io n .
Rema rks :
( 1 ) Th i s a l go r i t hm can b e e x te n de d to che ck i f G is b i co n ne cte d . I n ca s e th a t G i s n ot
b ico nn e cte d it can b e mod i fi e d t o compute th e Ope n e ar -de compo s it io n o f e ach b i co n n e cte d
compo n e n t .
( 2 ) Fo r t h e s t -numb e r in g a lgo r i thm , w e may om it e ach non -t r e e e dge e o f G wh ich form s
an e a r that co n s i s t s of e on ly .
Para l le l Im plem en ta tion
We fi r s t p r e se n t an imp l eme n ta t io n wh ich run s in O ( logn ) t ime u s in g n +m
pro ce s s o r s . A ppend ix 1 p r e s e n t s an a l te rn a t ive imp leme n ta t ion wh ich r un s in t ime
( logn logahi logoht ) u s in g an Op t ima l num be r o f p ro ce s s o r s wh e n m > n lo gn .
Ste p s 1 , 2 and 3 are e s s e n t ia l l y ta ke n from [V -SS ] . The s e s te p s take O ( logn ) t ime
u s in g it m pro ce s s o r s
Rema rk . Th e a lgo r i thm of [V -8 5 ] imp l eme n t s rteps 2 and 3 in thr e e s ta ge s : i i ) E a ch ve r te x
v s e l e ct s a s in g le n on - t re e e d ge ru ns ) su ch tha t i s th e lo w e s t comm on an ce s to r o f
J w he re 1 3 . a r e a ll th e ve r t i ce s w h ich a re ad iace n t to b y an ed o e inA
5 — 5 7 . ( 2 ) The o r i g in a l s e r ia l num b e r s of the n o n - t r e e ed ge w h ich w e r e s e t a rb i t r ar i ly,
(l:
Ultracom pu te r N o te 102 P a ge 9
The input o f ou r a l go r i thm i s a s fo l l ow s
( 1 ) A gr aph G ( V ,E ) and a sp e c i fie d e dge ( s ,r) EE .
( 2 ) A n op en e ar de compo s it io n G = PO U P 1 U U P, s uch th a t a n d th e
e ndpo in t s of e a ch P ,a re in P
jan d Pk , whe re i> j 2 k 2 0 (O b s e r ve th at j a nd k de pe nd
on i , Th e de compo s it io n i s g ive n in th e fo l lo w in g fo rm .
’
E a ch e dge
i n P,knows th e in d e x i , and ha s p o in te r s to i t s n e i ghbo r in P,
le ad in g to P_,an d to i t s
n e ighbo r in P i l e ad in g to Pk . U n l e s s o th e rw i s e s ta te d , whe ne ve r we sa y a n ea r , we
w i l l me an o n e of th e s e o p e n e a r s .
D efi n i t i o n s :
( 1 ) The e ndpo in t o f a n e ar P wh ic h b e lon g s to P}. ( r e sp . Pk ) , i s de n o te d by L (P i ) ( re sp .
(R e ca l l t h a t , in t h e a bo ve n o ta t io n , j Z k . ) In add i t io n , 5 ( r e sp . t ) i s de fin e d
to b e L(Po) ( r e sp .
( 2 ) Th e ve r te x in a n e ar P i , 12 1,wh ich i s adj ace n t to UH) ( r e sp . i s de no ted by
LS (P, ( r e sp . RS (P ,
( 3 ) The ve r te x L (P;) i s ca l l e d th e a n chor of
( 4 ) A ve r te x v o f an ea r P; ( de not e d by VEP,wi l l b e ca l l e d a n in tern a l ve r te x of P ' if v
i s n e i th e r L(P,no r R (P i ) .
Rema rk . In o u r a l go r i thm fo r sr-n um b e r in g , e ach e a r i s r e spo n s ib l e fo r pro v i d in g th e
num b e r in g o f i t s in t e rn a l ve r t ice s o n ly . The re fo re ,we can ign o r e e a r s P wh ich in c lud e
o n ly o n e e dge . The e ar P0 , w ho s e o n l y ed ge i s ( S J ) , i s t he on ly e ar o f t h i s typ e wh ich i s
n o t ign o r e d . Th is me an s tha t we have 0 02 ) r e l e van t e dge s in th e gr aph G
In th e n e x t sub s e ct io n we g iv e a h igh - le ve l de s cr ip t io n o f t he a lgo r it hm . A de s cr ip t io n
o f th e pa r a l l e l imp leme n ta t io n i s g iv en in t h e se que l
High -leve l des cr ipt ion of the a lgorithm
Th e numb e r i n g i s do ne in two s ta ge s . In Stage 1 we o r ie n t th e edo e s of t h e in p u t graph
s o tha t the r e su lt in g d ir e cte d gr aph i s a cy c l ic a nd ea ch o f i t s ve r t ic e s i s o n a path fr om s to
t . In Sta ge 2 w e com p u te a topo lom ca l s o r t of th i s d ig rap h . Th i s r e su l t s in as s ign in o
n um b e r s tr om l to n to the ve r t i ce s o f the d igraph Th e s e n um be r s y i e ld a va l id sr
n umberin o
Ultrac om pu te r N o te 1 02 P a ge 1 1
Rema rk : The to po lo g ica l s o r t o f Sta ge 2 i s app l i cab l e to d i g rap h s ob ta i n e d in Stage 1 , bu t
n o t to ge n e ra l acyc l ic d i gr a ph s .
For th e or ie n ta t io n of t h e e dge s o f Sta ge 1 we u s e th e ear—tree ET(VT ,ET) wh ich i s
d e fin e d a s fo l lo ws :
VT= {P, IP, i s an e ar o f G Th a t i s , e ve r y e a r i s a ve r te x in ET
-,Pj ) i s an in t e r n a l v e r te x o f P
jwhe r e
O b serva t ion : ET i s a d i r e ct e d t r e e , r o ote d a t P0 .
Th e de sce n danc e re l a t io n i n th e t r e e ET e x te n d s n a tu r a l l y to th e ve r t ic e s of G . I n
p a r t icu l a r , i f a n e ar P ,i s a d e s ce n dan t o f a n e a r P, ( it m ight b e P i i t s e lf) i n ET, we s ay tha t
e a ch ve r te x in P,i s a des cen dan t o f L(P 1 ) , th e a n cho r o f P 1 . Conve r s e ly , s uc h L (P,) i s
ca l l e d an an chor—artees ror o f e a ch ve r te x i n P,
In ord e r to mo t iv a t e t h e o r i e n ta t io n of th e e a r s in Sta ge 1 , wh ich i s qu i t e in vo lved ,we
s ta r t by pr e s e n t ing t h e ma in id e a s o f Sta ge 2 ( t h e n umb e r in g a l go r i thm ) . Th i s w i l l be
fo l lo we d b y a de s cr ip t io n o f Sta ge 1 .
The p r in c ip l e s of th e num b erin g algorit hm (S tage
We a s sume th a t e a ch e a r P, ( i z 1 ) wa s o r ie n te d , in Stage 1 , e i th e r fr om L (Pf) t o R (P ,
o r from R (P,) t o Th e e a r P0 wa s o r i e n t e d fr om s to t .
Defin ition : A n e a r P i wh ich i s d i r e ct e d fr om L (P,to M E ) ( r e s p . fr om to i s
ca l l e d an ou tgoin g ( r e sp . in com in g ) e ar ofL (P ,
We g ive two r u le s wh ich imp ly a u n iqu e n umbe r in g o f th e ve r t i ce s o f G . Th e s e ru le s
imp l y actu a l l y a s e r i a l a lgo r ithm wh ich pro v id e s th i s numb e r in g . We re fe r o ft e n in ou r
p r e s e n ta t io n to it a s th e s e r ial n umb e r in g a lgo r i thm . Pa r a l le l imp leme n ta t io n o f bo th s tage s
i s d i s cu s s e d in th e n e x t su b s e ct i o n
R u l e 1 r e l a te s to t h e r e la t i v e numbe r in g o f th e in te rn a l ve r t i ce s o f an e a r .
Defin ition : Le t P,be an e a r , an d l e t u , v be in t e r n a l v e r t ic e s of P ,
We say tha t u p recedes
v if. whe n mov in g o n P,accord in e to i t s d ir e ct ion . we en coun te r it b e fo r e e n coun te r in g v .
Ru l e 1 . Le t P,b e an e a r , and l e t u . b e in te rn a l ve r t ic e s s uch tha t u pr e ce de s v . Th e sr
num b e r in g of u and e ach o f i t s d e sce n dan t s i s sm a l l e r th an the s r-num be r in g of v an d e ach
o f i t s de s ce n dan t s .
Ultracom pu te r No te 102 P a ge 1 2
R u l e 1 gua r an te e s tha t fo r e ach e a r P i , a l l i t s in t e r n a l v e r t i ce s , e xc lu d in g
an d PS (F ,ar e a s s ign e d a va l id s t ~ n umberin g . Th i s h o l d s , s in ce e a ch o f th e s e ve r t i ce s w i l l
have a ne i ghbo r in P,~ who se numb e r i s sma l l e r and a n e igh bo r in P i who s e n um b e r i s
gr e a t e r than i t s own numbe r . H e nce , t h e d i fficu l ty in pro v id in g Sr-num b e r in g i s r e du ce d to
a s s ign in g a va l id sr-n umb e r in g to and RS (P,fo r e a ch e a r P
,Note howe ve r , th a t i f
P, i s a n in com in g ( r e sp . ou tgo ing ) e ar w i th mor e th an on e in t e r n a l v e r t e x . t h e n R u l e 1
gua r an te e s tha t w i l l h ave a n e i ghbo r w ho s e n um be r i s sma l l e r ( r e s p . gr e a te r ) t h an
it s own num b e r,an d RS (P,
wi l l ha ve a n e igh b o r w ho s e n um b e r i s gr e a t e r ( r e sp . sma l l e r )
t h an it s own numb e r
R u le 2 r e la t e s to t h e r e lat i v e n umb e r i ng of e a r s wh ich h ave th e same an cho r .
D efi n i t i o n : Le t v b e an in te r n a l ve r t e x o f s ome ear . We de fin e a to ta l o r d e r o n th e
in com in g an d outgomg e a r s of v a s fo l l o w s
( i) A n i n com in g e ar I o f v i s before a no th e r in com in g e a r I ' o f v i ff th e e dge
i s before i n th e a djac en cy l i s t of v i n G . (A n y o th e r a r b i t r a r y o rde r on
th e e dge s w i l l do . We on l y n e e d some co n s i s t e n t o rd e r . )
( i i ) A n ou tgo in g ea r 0 o f v i s before ano the r o u tgo in g e ar 0 '
of V i ff th e e dge
appe a r s after in th e adj a ce n cy l i s t of v i n G .
( i i i) Each in com in g e a r I o f v i s before e ach outgo in g e a r 0 o f v .
Remark: Note tha t th e in t e r n a l o rd e r d e fin e d on th e o utgo in g e a r s i s Opp os i te t o th e in t e r n a l
o r de r d e fin e d on the in com in g e a r s . In t e r e s t in g l y , t h i s s ub t l e d e fin i t i o n i s e s s e n t ia l fo r th e
co r r e ctn e s s of t h e a lgor ithm .
R u l e 2 . Le t v b e an in t e rn a l ve r te x o f s ome e a r .
R u le Th e sr-n umbe rin o a s s ign e d to e a ch of th e v e r t ice s b e lo n g in g to in com in g
e ar s o f v i s sma l l e r than the s t -num b e r in g a s s ign e d to v .
Ru l e The sr-n um berin o ass io n ed to i s sma l l e r th an the s t -num b e r in g a s s i gn e d to
e ach of th e ve r t ic e s b e l on g in g to ou t go in g ea r s o f v
Ru l e I f an e ar P o f 1 " i s be fo r e a n o th e r e a r P '
of th e n th e s r-n um b e r in g asswn ed to
e ach of th e in te r n a l ve r t i ce s in P i s sma l le r than the s r-num be r in g a s s i gn e d to e ach of th e
in te rn a l ve r t i ce s in P ’
.
Ultrac om pu te r No te 1 02 P age 1 3
Con s ide r no w a s e r ia l imp l eme n ta t io n o f th e numbe r in g wh ich obe y s R u l e 2 . Upon
a r r iv in g a t a v e r te x v,we fi r s t a s s ign n umbe r s to e ach o f it s in com in g e a r s ( and th e i r
d e s ce n d an t s ) i n o r d e r . Th e n we n umb e r v, and fin a l l y we a s s i gn n umb e r s to e ach o f i t s
ou tgo i n g e ar s ( an d the ir d e s ce n da n t s ) i n o rd e r . (We u s e th e o r de r d e fin e d ab ov e . )
R u le s an d gu ar a n te e th a t fo r e ach in com in g ( r e sp . ou tgo in g ) e a r P,wh ich
h av e mo r e tha n on e in te r n a l v e r t e x , i s a s s ign e d a va l i d sr-n umbe r in g ; Sin ce th e
n umb e r of L (P,i s gr ea t e r ( r e sp . sma l l e r ) t han th e n umb e r o f LS (P,
R e ca l l t h a t R u l e 1
imp l i e s tha t th e n umbe r of th e n e ighbo r o f in P , i s sma l le r ( r e s p . gr e a te r ) th an th e
n umb e r o f LS (P ,Th e r e fo r e , t h e d i fficu l ty in pr o v id in g sr-numb e r in g i s fu r th e r r e duce d
to a s s i gn in g va l id sr-n umbe r i n g to fo r e a ch e ar P,Th i s w i l l b e t he ta sk o f th e
o r ie n ta t io n a lgo r it hm (wh ich w i l l make u s e o f R u l e
We a l r e ady me n t io n e d th a t R u l e s 1 an d 2 de fin e a un iqu e numbe r in g o f th e v e r t ic e s o f
t h e o r i e n t e d gr ap h . Th i s s e r ia l n umbe r in g a lgo r i th m s ta r t s a t e a r P0 , wh ich i s d ir e cte d
fr om 5 to r, and ar r iv e s to e a ch e a r t h ro ugh the e a r -t r e e ET . A n e a r i s a lway s e n te r e d"
t h r o u gh it s a n cho r
F ig . 3 . 1 ( a) g ive s a n e xamp l e o f a grap h wi th d ir e c t io n s on t h e e a r s . Spe c i fica t io n o f
fo r a l l e a r s i s om it t e d . F ig . 3 . 1 ( b) demon s t r a te s t h e r e su lt o f an app l ica t io n of th e
n umbe r in g p roce s s .
The orien ta t ion of th e ears (S tage
We shou ld r ememb e r th a t th e o r ie n tat io n o f th e e ar s ( Sta ge wh ich i s d e scr ib e d
b e lo w , i s a ime d a t th e numbe r in g a l go r i thm ( Sta ge wh ich wa s ou t l in ed a bove . A s wa s
me n t io n e d b e fo r e , t h e ma in t a sk o f th e or i e n tat io n a l go r i thm i s to gua r an t e e th a t , fo r e ach
e a r P i , th e n um b e r wh ich w i l l b e a s s ign ed to R(P i) i s con s is ten t with th e n umbe r wh ich wi l l
b e a s s ign ed to RS (P,Spe c i f ic a l ly , t h i s me an s t h a t : ( i) I f P ,
ge t s a d ir e ct io n fr om U P) to
R (P,) t h e n t h e ta sk i s to take ca r e th a t th e n umbe r of R (P i ) wi l l b e gr e a te r th an th e n umbe r
ofRS (P, ( i i) I f P ,ge t s a d i r e c t io n fr om R (P ,) to L (P ,
t h e n th e ta sk i s to t ak e car e th a t th e
numbe r o f P (P i) wi l l b e sma l l e r t h an th e numbe r o f RS (P ,
Th e r e l a t io n b e twe e n th e n umb e r s ass io n ed to R (P;) an d RS ( P i s d e te rm in e d by t he
fo l lo w in g eve n t : Wi l l th e s e r i a l n um b e r in g a lgo r i t hm v i s i t t h e ( in t e r n a l ve r t i ce s o f th e ) ea r
P, b e fo r e or a fte r v i s i t in o t h e ve r t e x R (P i) ? O ur cr u c ia l o b s e rv a t i o n i s t ha t we can make
Ultracom pu te r Note 1 02 Pa ge 1 4
t h i s e v e n t de pe nd on l y on th e d ir e c t io n wh ic h wi l l b e g iv e n to s ome s in gle e a r Pm . A s wi l l
b e come c le ar la te r , Pm i s a lway s c lo s e r t h a n P, to P 0 i n th e e a r-t r e e . i s n o t n e ce s s a r i l y
a n an ce s to r o f P i . ) Th i s e a r Pm wi l l b e ca l l e d th e hin ge o f P i . (O b s e rv e t h a t m i s a fu n ct io n
o f i ,
D efi n i tion : We say th a t th e e a r P,ge t s th e same d ir e c t io n a s i t s h in ge P if ou r o r i e n ta t io n
a l go r i thm imp l ie s t ha t bo th a r e d i re ct e d e i th e r fr om to o r fr om to
S im i la r ly , th e e a r P,ge t s a d ir e ct io n opp os ite t o Pm , i f th e a l go r i thm imp l ie s t h a t o n e o f
t h em i s d ir e ct e d fr om to i ff th e o t h e r i s d i r e c te d fr om to
B e low we d e sc r ib e how th e h in ge i s fo un d , and how to de te rm in e whe th e r P,wi l l
ha ve th e s ame or t h e op po s i t e d i r e ct io n a s S in ce th i s de scr ip t io n i s n o t s h o r t we s h ow
fir s t Ste p 2 ( t h e l a s t s te p ) of Sta ge 1 . Tha t i s , how to de te rm in e th e o r i e n ta t io n o f e ach e a r,
on ce we know fo r e a ch e a r i t s h in ge an d i t s d ir e ct io n w ith r e sp e ct to th e h in ge .
We de fin e th e h in ge—tree HT(VHT ,EHT) a s fo l l ows
VHT= {P,
P,i s a n e a r ofG That i s , e ve r y e a r i s a ve r te x in HT
-
,Pm) Pm i s t h e h in ge o f P ,
Fac t : HT i s a d i r e ct e d tr e e ro o te d a t P0 .
S tep 2 . Let P0 b e d ir e c ted from L (PO) to R (PO) from s to t ) . Fo r e ac h 12 1 , co n s ide r
th e e a r P i and th e pa th from P,to P0 i n HT . Coun t th e n umbe r o f e a r s o n th i s p a t h wh ich
ge t a d i r e ct io n Oppo s it e to t h e i r h inge . I f th i s n umb e r i s ev e n th e n P,~ i s d i r e ct e d from L (P ,
to R (P i) ; O the rw is e , i t i s d i r e cte d fr om R (P i ) to U P) .
S tep 1 . Fin d in g th e h in ge Pm o f e ar Pi .
D efi n i tion : We say th a t a ve r t e x v EPi a pp e a r s to th e left o f a € P,~ o n P
,if v appe a r s p r io r to
it whe n mov ing o n P, fr om L(P,to R (P i) .
For find in g th e h in ge o f P i , we con s id e r s e ve r a l ca s e s .
Case 1 . Th e ve r t i ce s an d L (P ,a r e bo th o n th e same ea r P
j ,s e e F ig .
ln s true tion s : In th i s ca s e , t h e e a r P ,i s s e t to b e the hm o e of P and P
,G e t s t he sam e
d ir e ct i o n a s Pji ff L (P i ) appe ar s to the le ft o f i n P
].
Ultrac om pu te r No te 1 02 P a ge 1 5
Fi g . Cas e 1 .
I\)
Ca s e
Page 1 5A
l i s t o f v i n G . I f ejappe a r s be fo r e ek i n th i s l i s t , th e n th e h in ge o f P i i s s e t to b e Pj r an d P
,
ge t s a d ir e ct io n oppo s it e to Pj'
. If ek appe a r s b e fo r e ej , t h en th e h in ge of P, i s s e t to b e Pk i
a nd P,ge t s th e same d ir e ct io n a s Pk '
D isc us sion : The fo l lo w in g c l a im s hows th a t a l s o in th i s ca s e t h e v e r te x i s aSS i e-n e d a
va l id s r-n umbe r in g
Cla im 1 . The ea r P,i s d i r e cte d from L (P,
to R(P i ) P,i s a n o utgo i n g e a r ) i ff th e
n umb e r a s s ign e d to RS (P,i s sma l l e r th an th e n umb e r a s s ign e d to R (P
To p rove C l a im 1 w e nee d th e to ta l o r de r de f in e d on t h e in com in g an d o u tgo in g ea r s
o f a v e r te x v . Th i s i s s i n ce th i s o r de r d e te rm in e s th e o r de r of numbe r in g t h e v e r t ice s i n th e
s e r i a l n um b e r in g a l gor i thm (by R u l e Th e cru c ia l p o in t i s th a t C la im 1 ho ld s
regardless o f th e d ir e ct io n s wh ich wi l l actua l l y b e g ive n to Pj' an d Pk r
.
Proof of C la im 1 . We have two po s s ib i l i t i e s to con s id e r .
Poss ibility (a ) : The e dge ej appe ar s b e fo re th e e dge e k i n th e adj ace n cy l i s t o f v .
I n Po s s ib i l ity ( a) , Pj' and e a ch of i t s de s ce n dan t s a r e n umb e r e d b e fo r e Pk , an d each of i t s
d e sce n d an t s i ff P}
. i s an incomin g e a r ( r e gar d l e s s o f t h e d ir e c t io n o f k ) Bu t , th e
in s t r uct io n s o f C a se imp ly th at Pfi s a n in com in g ea r i ff P, i s a n ou tgo in g e a r .
R e ca l l n ow th at RS (P,i s a de sce ndan t of P
jv
, an d R(P i ) i s a d e sce n da n t of Pk '. C omb in in g
th e above to ge the r we ob ta in th a t P,i s an o utgo in g e ar i ff th e n umb e r a s s i gn e d to
i s sma l l e r t han the n umb e r a s s ign e d to R ( P,a s r e qu i r ed .
Pos s ibility (b) : The e dge ek appe a r s be fo r e th e e dge ej i n th e adj acen cy l i s t o f v
I n Po s s ib i l i ty (b ) , P jr an d e ach o f i t s d e s cen dan t s a r e n umbe r e d b e fo r e Pk , an d e ach o f it s
d e sce n dan t s i ff Pk , i s an outgo in g e ar ( r e ga rd l e s s o f th e d ir e ct io n o f Pi. ) Bu t , t h e
i n s t ru ct io n s of C a s e imp ly th at Pk » i s an o utgo in g e a r i ff P,i s a n out go in g e a r .
R e ca l l , aga in , th a t RS (P ,i s a de s ce nd an t o f P t an d R (P i ) i s a de s ce n dan t of Pk
'
C omb in in g t he above to ge the r w e ob ta i n th a t P,i s a n outgo in o e a r i ff th e num b e r a s s i gn ed
to RS (P ,i s sma l le r than t h e n um be r a s s ign e d to comp le t in g t h e p roo f of th e c la im .
C a se POLi s Pk s e e Fi o ( No t e th a t P
aca n n or b e P
ja s th i s imp l i e s tha t j <k
w h i l e th e de fin i t io n o f L i P ; i an d R ( P - i im p l i e s tha t j Z k . )
Ultracom pu ter Note 1 02 P a ge 1 7
Le t v be th e a n ch o r-an ce s to r of P ,ih P
a. U s i n g th e s ame a r gume n t s a s ab ove , we ge t
th e fo l lo w in g .
C as e v afiR (P,s e e F ig . 3 .4 ( a)
In s truc tion s : I n t h i s ca s e t h e h in ge o f P,~ i s s e t to b e P and P ,
ge t s t h e s ame d ir e ct io n a s Pa
i ff v appe a r s to t h e l e ft o f R (P,) in P a.
E s t ab l i s h in g t h e va l id i ty o f th e n umb e r in g o f RS (P,in th i s ca s e i s s im i l a r to C a s e 1 .
C ase v = R (P,s e e F ig . 3 .4(b )
In s truc tion s : Le t Pj
' be th e fi r s t e ar o n th e p a th i n ET fr om Pat o P
). The h in ge ofP
,i s s e t
to b e Pj
'
, an d P,ge t s a d ir e ct io n Oppo s i t e to P
jr
.
D is cuss ion : The ea r P,wi l l b e d ir e ct e d fr om U P ) t o R(P i ) i ff P] , wi l l b e d ir e ct e d fr om
R (Pj to I f bo th co nd i t io n s h o l d , t h e n um b e r a s s i gn e d to RS (P,wi l l b e sma l l e r
t han th a t o f an d i f n on e ho l d s t h e n t h e num b e r a s s ign e d to RS (P,wi l l b e
gr e a te r t h an t ha t o f Th i s w i l l p r ov ide a co n s i s t e n t n umb e r i n g fo r
Th i s comp le t e s Ste p 1 o f Sta ge 1 .
The above p r e s e n ta t io n s ho ws th a t a l l t h e v e r t ice s , e x c lu d in g s an d I , wi l l b e g ive n a
va l id sr-n um b e r in g . In o r de r to e s ta b l i s h co r r e c t n e s s of th e a l go r i t hm it r ema in s to s h ow
th a t s an d t a r e a l s o a s s i gn e d a va l id s t -n um b e r in g .
Cla im 2 . The a l go r i thm a s s ign s t h e n umbe r 1 to th e ve r t e x 5 , a n d th e n umbe r n to th e
ve r te x I .
Proof of Cla im 2 . R e ca l l t h a t P0 i s d i r e ct e d fr om s to t . Co n s i d e r a n e a r P,wh ich is a so n
o f P0 in th e e a r - t r e e . Th e de fin i t i o n of L (P i) an d R(P i) imp l i e s t h a t b o th L (P i) an d M P)
mu s t b e lon g to P 0 . (Th i s de fin it i o n s ta t e s th a t i f L (Pi) i s in P] and R (P i ) i s i n Pk th e n
j z k . ) Th is me an s th a t a l l t h e e a r s P,s uc h th a t ( r e s p . mu s t s a t i s fy
R (P ,
= t ( r e sp . R (P ,)= s ) . Th u s , b y C a s e 1 o f t h e o r i e n tat io n a lgo r it hm , fo r a l l P, s u ch th a t
P i i s a n ou tgo i n g e a r , an d for a l l P,s u ch tha t P i i s an in com in g e a r .
H e n ce , from Ru le s a n d 2 7 i t fo l lo ws th at 1 i s a s s ign ed to s ,an d n i s a s s i gn e d to t .
Ultracom pu ter No te 1 02 P a ge 1 8
Parallel Im p lem en ta tion
We de s cr ib e a par a l l e l imp l eme n ta t io n of t h e two s ta ge s o f t h e sr-numbe r in g
a lgo r i thm .
S tage 1 . In Stage 1 we s tar t b y co n s t r u ct in g th e e a r tr e e ET. Le t 1 b e th e n um b e r o f e a r s
tha t h av e a t l e a s t on e in t e rn a l ve r te x . O b s e r ve the 1 5 h . F in d in g th e e dge s o f ET from the
ou tpu t of th e ope n e a r de co mpo s i t i o n a l go r i thm can b e do ne i n 0 ( 1 ) t im e u s in g it
p ro ce s s o r s . C omput in g th e adj ac e n cy l i s t s of ET n e e d s O ( logn ) t ime with n p roce s s o r s
u s in g in t e ge r so r t in g a l go r i thm s . e .0
. [AK S R e fe r e n ce s to o th e r p o s s ib l e s o r t in gO
a lgo r i t hm s may b e fo und in th e r ema rk a t t h e e nd o f Se ct io n 2 F in d in g th e h in ge s r e qu ir e s
1 compu tat io n s of l owe s t common an ce s to r in ET. Th i s ca n b e d on e in O ( logl) t ime u s in g 1
pro ce s s o r s , s e e [V Th e o th e r compu t a t io n s o f Sta ge 1 , i n c l u d in g th e compu ta t io n o f th e
d ir e ct io n of th e e a r s ba s ed o n t h e h in ge t r e e , ca n a l s o b e do ne in O( logl) t im e u s in g 1
pro ce s s o r s . Th e re fo re , Sta ge 1 tak e s O ( logn ) t im e u s in g it p roce s s o r s
S tage 2 . We now de scr ib e how to im p l eme n t th e n umb e r in g ru l e s in p a r a l l e l . We
co n s t r uct a tr e e , who se p re o r de r n umbe r in g ob e y s t h e n um b e r in g ru le s . Th i s
n umberin g—tree N T i s de fin ed a s fo l l o w s . Le t v b e a ve r t e x o f G . The ve r te x v in duce s
two ve r t ice s v i" and v0“, in N T . A l so . an d v
ow a r e bo th co nn e cte d b y an e dge . The re s t
o f th e e d ge s ofN T are de fin e d b y th e fo l l o w in g ru l e s
( 1 ) A s sume tha t v i s in P, an d l e t u b e t h e n e i ghb o r o f v i n P i wh ich p re ce d e s v ( if s uch a
ve r t e x e x i s t s ) . The n uou, i s con n e cte d to v i" .
( 2 ) Fo r e a ch in com in g e a r P ,who s e anch o r i s v t h e ve r t e x 1“ 1 5 co n ne ct e d to w whe r e
Fo r e a ch o utgo in g e ar Pjwho se an cho r i s v t h e v e r t e x v is co n n e cte d to w . whe r e
F ig . i l l u s t ra t e s t he co n s t r uct i o n of N T fo r a n e xamp le of a pa r t of an e a r- t r e e .
We n ow pe r fo rm a p r e o rd e r t r a ve r s a l o f s t a r t i n g a t t h e r oo t 5m. We o b s e rv e tha t
th e o r de r in w h ich ve r t ice s o f th e fo rm row a r e v i s i te d du r in g t he t r ave r sa l o b e y s th e ru le s
o f th e n um be r i n g a lgo r i thm . Tha t i s . for e ach r in G we fi r s t v i s it Y in an d a l l th e ve r t ic e s o f
in com in o e a r s w h o se an cho r i s an d th e i r d e sce nd an t s . Th e n w e v i s i t rm . F in a l ly,w e V IS IT
a l l th e ve r t i ce s o f ou t go in g e a r s w ho s e an cho r i s v an d the i r de sce nd an t s . Th e o rde r i n
Ultracom pu te r No te 102 Page 1 9
wh ich th e in com in g ( an d o u t go in g ) e ar s o f v a r e v i s i t e d i s a s d e fin e d in R u l e 2 . N ow th a t
fo r e ach ve r te x v i n G , i t s v e r t ice s in N T a r e tr av e r s e d in t h e o rd e r : fi r s t v i" , an d th e n vow .
D ur in g th e tr av e r s a l we a s s i gn pr e o r d e r n um b e r s to th e ve r t i ce s o f th e fo rm vow ,
i gn o r in g a l l th e v e r t i ce s o f t h e fo rm v,The s e n umbe r s p ro v id e th e s t-n umb e r in g o f t h e
graph G .
The co n s t ruct io n o f N T ca n b e don e in O ( logn ) t im e u s i ng it p ro ce s so r s . Th e pr e o rd e r
n umb e r in g can b e do n e u s in g th e E u le r tou r te ch n iqu e fo r compu t in g t r e e fun ct io n s g iv e n
in [V—85 ] in O ( logn ) t ime u s in g it p ro ce s so r s
To sum up , g iv e n a b i co nn e ct e d grap h G , we p r e s e n t a pa r a l le l a l go r i thm wh ich fin d s
a n s t -n um be r in g o f G . The fi r s t p a r t o f t he a lgo r i thm fin d s an op e n e a r -de compo s i t io n o f
G . Th i s i s don e e i th e r in O ( logn ) t ime u s i n g m + n pr o ce s s o r s , or in
( 2 ) mm) pr o ce s s o r s . The s e co n d pa r t fin d s an s rt ime u s in g n l o g
numbe r in g of G in O ( logn ) t im e u s in g n p r o ce s s o r s . Th e r e fo r e , th e who le s r-num b e r in g
a lgo r i thm take s e i th e r O ( log n ) t im e u s i n g n +m p r oce s so r s o r t ime
u s in g ( ( n logn pro ce s s o r s .
Ult i'
ac om pu te r No te 1 02 Pa ge 20
[A -85 ]
REFEREN CES
A n de r so n , R . , A Pa r a l l e l A lgo r i t hm fo r th e M a x ima l Pa th Pro b l em Pr o c .
ACM Sym p . on The o r y o f C omput i n g pp . 33-37 .
[AKS—83 ] A j ta i , M . , Kom l o s , J. a n d Sz emeredi, E . , A n O ( n logn ) So r t in g N e twork
[CV -86 ]
[E -79 ]
[ET-76 ]
[FL-80]
[IR -84]
[JS-82 ]
[L -85 ]
Comb in atorica 3 pp . 1 - 19 .
C o l e , R . an d V i s hk in , U . , D e te rm in i s t ic C o in To s s in g and A cce l e r a t in g
C a s cade s : M i cr o a n d M ac r o Te ch n iqu e s fo r D e s ign in g Pa r a l le l A l go r i thm s"
,
Pr o c . 1 8’hACM Symp . o n Theo r y o f C ompu t in g to appe a r .
E v e n , S . ,
“G r ap h A lgo r it hm s C ompu te r Sc i e n ce Pr e s s , 1 979
Ev e n , S . and Ta rj an , R .E . , Comput in g an sr-n umb e r in g Th . Comp . Sc ie n ce 2
pp . 339-344
F i s h e r , M . and La dn e r , L . ,
“Par a l l e l Pr e fix Computa t io n JA CM 27 pp .
83 1 -8 38
It a i , A . an d R ode h , M . , Th e M u l t i T r e e A ppr o a ch to R e l i a b i l i ty in D i s t r ibu te d
N e two rk s Pr o c . 25”Symp . o n Found a t io n s o f C omp . Sc ie n ce pp . 1 37
147 .
Ja’
Ja’
, J. and Simo n , J. ,
‘
Pa r a l l e l A l go r i t hm s in G r ap h The o ry : P l a n ar i ty
Te s t in g“
SIAM J. Compu t . 1 1 pp . 3 14-328 .
Lova s z , L . , Compu t in g E a r s a n d B r an ch in g s in Pa r a l l e l Pr o c . 26“Symp . on
Fo unda t io n s o f C omp . Sc i e n ce pp . 464-467 .
[LEC-67 1 Lem pe l, A . , E v e n , S . an d C ederbaum , I . ,
“A n A lgo r ithm fo r P l an ar i ty Te s t in g
[R -85 ]
[SV -82 ]
of G r ap h s”
, Th eo r y o f G r ap h s , In t . Svmp . , R om e , Julv 1 966 . P . Ro sen stiehl,
Ed . , G o r don an d B r e a ch , N Y pp . 2 1 5 -232 .
R e i f , I .H . ,
“A n O p t im a l Pa r a l l e l A l go r i thm fo r In t e ge r So rt in g Pr o c . 26
”
Symp . o n Founda t ion s o f C omp . Sc i e n ce pp . 496-503 .
Sh i lo a ch . Y . an d V i s hk in , U . .
”
A h O ( lo g n ) Par a l l e l Con n ect iv itv A lgor ithm”
, J
of A l go r i thm s 3 pp . 5 7 -6 3
Ultracom pu te r N ote 1 02 P a ge 2 1
[T-83 ] Thomp son C .D . , Th e VLSI C omp le x i ty o f So r t in g IEEE Tra n s . C ompu te r s
32 pp . 1 1 7 1 - 1 1 84
[TV -85 ] Ta rjan , R E . an d V i s hk in , U . ,
'
A n Effic ie n t Par a l l e l B icon n ec t iv ity A lgo r i thm
SIA M J. Comput . 1 4 pp . 862-874 .
[V -83 1 V i s hk in , U . , Syn ch r on ou s Pa r a l l e l Computa t io n a Su r vey TR # 7 1 , D ep t . o f
C ompute r Sc i e n ce , C o ur a n t In s t . , N Y U , 1 983 .
V i s hk in , U .,
“O n E ffic ie n t Pa ra l l e l St r o n g O r ie n ta tion In fo rm at io n Pr o c .
Le t t e r s 20 pp . 2 35 -240 .
Wh itn ey , H . ,
“Non -s e pa ra b l e an d P l an a r G r a ph s Tran s . Ame r . M a t h . So c . 34
pp . 339-362 .
Ultracom pu te r N o te 1 02
de s ce n d an t o f Ad—LCA ( u )
For t h e s e mod i f ie d aux i l i a r y gr aph s we have th e fo l l o w in g Lemma .
M odified M a in Lemma . C o n s id e r a span n in g tr e e o f a c on n e cte d compone n t o f on e o f th e
aux i l ia r y gr ap h s Hx
. Th e n e i t h e r it co n ta in s x o r a t le a s t o n e o f i t s t r e e ve r t ic e s [w ,x ]
( wh e r e mu s t sa t i s fy
No t ice t ha t i f th e e dge ( [u ,i i s in E
,th e n the e a r o f ( u ,
v ) mus t b e ope n
We de s cr ib e how to co n s t r u ct th e s e au x i l ia r y gra ph s in p ar a l l e l . F ir s t we compute
Ad “ LCA ( 1 fo r e ach ve r t e x v . Th i s i s do n e a s in the imp leme n ta t io n o f St e p 2 ( g ive n in
[V i n O ( logn ) u s in g n p roce s so r s . For e ach ve r te x w e a l s o compu te
Sub —Ad—LCA ( v ) wh ich i s t h e fi r s t v e r te x on the pa th fr om Ad — LCA ( v ) to Th i s a l s o ca n
b e do ne in O ( logn ) t ime u s in g it p ro ce s so r s .
Fo r a g ive n n on -t re e e d ge i f [a ,v ] i s a v e r t e x o f an au x i l i a r y gr ap h HJr
th e n x ha s
to be e i t h e r Ad—LCA ( u ) o r Ad Th i s g iv e s a t mo s t two aux i l i a r y grap h s in wh ich
[n , v ] ca n b e a ve r te x . It t ake s O ( l) t ime u s in g a s in g le p ro ce s s o r to id e n t i fy th e s e two
aux i l ia r y gr aph s .
Suppo s e x = Ad Th e ve r t e x [a ,v l i s i n H,
on ly i f We fin d ou t
wh e th e r b y ch e ck i n g wh e th e r v i s a de s ce n dan t of Sub - Ad — LCAW) . [V -85 ]
s ho ws th a t g iv e n two ve r t i ce s u an d v i n G , i t i s po s s ib l e to d e te rm in e whe t he r v i s a
d e s ce nd an t of u in T in O ( l ) t ime u s in g on e pro ce s s o r . (Th i s i s do n e u s in g th e pr e o rde r
an d po s to r d e r numb e r in g o f th e ve r t ice s . wh ich we r e compute d in th e imp l eme n ta t io n of
St e p 2 i n [V Thus , we can de te rm in e whe the r i s in H, in O ( l) t im e u s in g on e
pro ce s s o r . Suppo s e an d [a ,vJ i s a ve r t e x in HX
. We show how to fin d the
th e adjac en t ve r t ice s o f [a ,v l i n Hx. R e ca l l th a t , by t h e de fin it io n o f th e a u x i l ia ry gr aph s .
[u v ] i s co nn e cte d to th e tr e e v e r t e x [5’
itb — Ad Suppo s e fu r th e r th a t v i s n o t an
an ce s to r o f u x ¢ v ) . I f x = .—’1d th e n [ 14 ,
i'
J i s co n n e c te d by an e dge to th e tr e e
ve r t e x [Sub — Ad o th e r w i s e [um] i s co n n e cte d to x . So , fin d in g th e adj a ce n t
ve r t ice s of in H,take s co n s tan t t im e u sm o on e p ro ce s s o r .
Th e ca s e x = Ad i s t r e a te d s im i l a r ly
The pa ra l l e l conn e c t iv i t y a io or ithm o f [C\'
-86’
n e e d s an adja ce n cy li s t r e pr e s e n ta t io n
o f the au x i l i a ry gr aph s H We sh ow how to o b t a in su ch re p re se n ta t io n . No t e that n a ive
Ultracom pu te r No te 1 02 P a ge 24
s o r t in g o f th e e dge s ca n n o t b e app l ie d w it h in th e comp l e x i ty boun d s th a t we s e ek
Th e adjace n cy l is t s o f t h e n o n -t r e e v e r t ic e s can be ob ta in e d , a s d e s cr ib e d abo ve , i n con s ta n t
t ime u s in g on e p ro ce s s o r .
We s how how to compu t e th e adja ce n cy l i s t s o f th e tr e e v e r t i ce s . Le t v b e a ve r te x in G
a nd l e t x b e Ad R e ca l l t h a t a n o n -t r e e e dge ( u ,v ) i s a n o n -t r e e ve r t e x in H,
i f
a n d o n ly i f M o r e o ve r , if [a ,v ] i s a n o n -t r e e ve r t e x in Hx
t h e n i t i s co n n e ct e d
b y an e dge to th e t r e e v e r t e x [Sub —Ad So , for e ac h ve r t e x v in G we con s id e r
a l l e d ge s ( u ,v ) s uc h t h at — LCA ( v ) a s o n e b l o ck an d app ly a so r t in g
a l go r i thm to th e s e b lo ck s fo r o b ta in in g t h e a dj a ce n cy l i s t s of th e t r e e v e r t i ce s . Th i s s o r t in g
t ake s O ( logn ) t ime u s i n g it p roce s s o r s s in ce we have o n ly n b l o ck s . Th in n in g o u t th e s e
b l o ck s to in c l u de o n l y r e le v an t e d ge s i s e a sy a nd can b e don e b y a pa r a l l e l p r e fix s um
computa t io n ( g iv e n th e adj ac e n cy l i s t r e p r e s e n ta t io n o f G ) i n O ( log n ) t im e u s in g m/logn
p ro ce s so r s .
Th e computa t io n o f t h e adj a ce n cy l i s t o f th e h ype r -v e r t ic e s i s s im i l a r . Le t v be a ve r t e x in
G a nd le t x be Ad R e ca l l th a t a n on - t r e e e dge ( u ,v ) i s co n n e cte d by an e dge to x
i n Hzi f an d on l y i f So , fo r e ach ve r te x v i n G we con s ide r a l l
e dge s ( u ,v ) s uch tha t —LCA ( u ) a s o n e b l o ck an d proce e d a s
fo r th e t r e e ve r t i ce s .
S tep 5 . I n Ste p 5 we comput e th e con n e ct e d compon e n t s a nd a s pan n in g fo r e s t of e ach
a ux i l ia ry gr aph . Note th a t th e to ta l num b e r o f ve r t i ce s in t he s e gr ap h s i s O (m ) . Thu s , i t
s e em s th a t O (m ) ope r a t io n s wi l l n o t b e e n ou gh . Howeve r , we can pe r fo rm o n ly O (m )
op e r a t io n s u s in g the fo l l o w in g Fact .
Fac t . Th e de gr e e o f e a ch non -tre e ve r te x in th e au x i l ia r y gr ap h s i s a t mo s t two .
Th u s , we mav s h r in k e ach n on -t re e ve r t e x [n ,v ] o f d egre e two an d th e two e dge s
eman a t in g from it in to a n e w e dge co n n e ct in g the two n e i ghb o r s o f The re su l t i n g
gr aph s h ave O ( h ) ve r t i ce s an d O (m ) e d ge s , an d he n ce we mav app l y th e con n ect iv itv
a l go r i thm of [CV -86 ] to G e t th e s ame r e su l t s a s i n St e p 1 . No t ice tha t th e co n ne cte d
compon e n t s a nd th e sp an n in g fo r e s t of t h e o r i g in a l gr ap h s can b e r e cove r e d fr om th e t he
co n n e c t e d compon e n t s an d th e s pan n in o fo r e s t o f t he s h runk e n gr ap h s in co n s tan t t im e
u s in g O (m'
i p ro ce s s o r s .
Ultracom pu te r Note 1 02 P a ge 25
S tep 6 . Th i s s t e p can be imp l em e n te d u s in g th e Eu l e r t o u r te chn iqu e app lyin o t h e n e wOp t ima l r ank in g a l gor i thm of [CV -86 ] in t ime O ( logn 10 g
(2
p ro ce s s o r s .
)n ) us in g ni/logn logmn
In summa ry , we have s h own an imp l eme n ta t io n wh ich -ru n s in O ( logn logm
0
n logm
n )t ime W i th ( ( n logn proce s so r s .
his book m ay be kep t
FO URTEE N D A YS
fin e w ill be char ged for each day th e bongQVep tlogmz-ggg
L O RD 1 4 2 P R I N T ED IN U . S . A .
Ultracom pu te r N o te 1 02P a ge 26
NY U con p scr TR- 2 2 2
Mao n , Ya e lPa ra l l e l e a r de c ompo s i t i ons e a rc h (EDS ) an d ST
1n umb e r i n g i n g rap h s 0 .
U BRARYN Y U Couran f In s titute ofM athematical Scie n ce s
2 5 1 M e rce r Sf.N ew Yo rk, N . Y . 10012