Asimple Optimal Parallel Algorith for Reporting Paths in a Tree.1.1.31
-
Upload
phamminhngoc -
Category
Documents
-
view
230 -
download
0
Transcript of Asimple Optimal Parallel Algorith for Reporting Paths in a Tree.1.1.31
-
8/12/2019 Asimple Optimal Parallel Algorith for Reporting Paths in a Tree.1.1.31
1/13
A S i m p l e O p t i m a l P a r a l l e l A l g o r i t h m f o r R e p o r t i n g
P a t h s i n a T r e e
A n d r z e j L i n g a s
D e p a r t m e n t o f C o m p u t e r S c i e n c e
L u n d U n i v e r s i t y
B o x 1 1 8 , L u n d . S - 2 2 1 0 0 , S w e d e n
A n d r z e j . L i n g a s @ d n a . l t h . s e
A n i l M a h e s h w a r i
C o m p u t e r S y s t e m s a n d C o m m u n i c a t i o n s G r o u p
T a t a I n s t i t u t e o f F u n d a m e n t a l R e s e a r c h
H o m i B h a b h a R o a d
B o m b a y - 4 0 0 0 0 5 , I n d i a
m a n i l @ t i f r v a x . t i f r . r e s . i n
1
-
8/12/2019 Asimple Optimal Parallel Algorith for Reporting Paths in a Tree.1.1.31
2/13
R u n n i n g t i t l e : P a r a l l e l a l g o r i t h m f o r R e p o r t i n g P a t h s i n T r e e .
M a i l i n g a d d r e s s :
A n d r z e j L i n g a s
D e p a r t m e n t o f C o m p u t e r S c i e n c e
L u n d U n i v e r s i t y
B o x 1 1 8 , L u n d , S - 2 2 1 0 0 , S w e d e n .
A n d r z e j . L i n g a s @ d n a . l t h . s e
2
-
8/12/2019 Asimple Optimal Parallel Algorith for Reporting Paths in a Tree.1.1.31
3/13
A b s t r a c t
W e p r e s e n t o p t i m a l p a r a l l e l s o l u t i o n s t o r e p o r t i n g p a t h s b e t w e e n p a i r s o f n o d e s
i n a n n ? n o d e t r e e . O u r a l g o r i t h m s a r e d e t e r m i n i s t i c a n d d e s i g n e d t o r u n o n a n
e x c l u s i v e r e a d e x c l u s i v e w r i t e p a r a l l e l r a n d o m - a c c e s s m a c h i n e ( E R E W P R A M ) . I n
p a r t i c u l a r , w e p r o v i d e a s i m p l e o p t i m a l p a r a l l e l a l g o r i t h m f o r p r e p r o c e s s i n g t h e
i n p u t t r e e s u c h t h a t t h e p a t h q u e r i e s c a n b e a n s w e r e d e c i e n t l y . O u r a l g o r i t h m
f o r p r e p r o c e s s i n g r u n s i n O ( l o g n ) t i m e u s i n g O ( n = l o g n ) p r o c e s s o r s . U s i n g t h e
p r e p r o c e s s i n g , w e c a n r e p o r t p a t h s b e t w e e n k n o d e p a i r s i n O ( l o g n + l o g k ) t i m e
u s i n g O ( k + ( n + S ) = l o g n ) p r o c e s s o r s o n a n E R E W P R A M , w h e r e S i s t h e s i z e o f
t h e o u t p u t . I n p a r t i c u l a r , w e c a n r e p o r t t h e p a t h b e t w e e n a s i n g l e p a i r o f d i s t i n c t
n o d e s i n O ( l o g n ) t i m e u s i n g O ( L = l o g n ) p r o c e s s o r s , w h e r e L d e n o t e s t h e l e n g t h o f
t h e p a t h .
3
-
8/12/2019 Asimple Optimal Parallel Algorith for Reporting Paths in a Tree.1.1.31
4/13
1 I n t r o d u c t i o n
I n m a n y p r o b l e m s i n c o m p u t e r s c i e n c e , t h e u n d e r l y i n g s t r u c t u r e i s a t r e e . F o r s e v e r a l
f u n d a m e n t a l a l g o r i t h m i c p r o b l e m s o n t r e e , o p t i m a l p a r a l l e l a l g o r i t h m s a r e k n o w n . F o r
e x a m p l e , c o m p u t i n g E u l e r t o u r a n d s e v e r a l f u n c t i o n s o n t r e e 1 3 ] , e v a l u a t i n g e x p r e s s i o n
t r e e 2 ] , l o w e s t c o m m o n a n c e s t o r 1 1 ] , d i c t i o n a r i e s o n 2 - 3 t r e e s 1 0 ] .
E n u m e r a t i n g p a t h s b e t w e e n p a i r s o f n o d e s i s o n e o f t h e f u n d a m e n t a l o p e r a t i o n o n t r e e s .
F o r i n s t a n c e , a r e q u e s t f o r r e p o r t i n g a p a t h f r o m a v e r t e x i n a c o n n e c t e d g r a p h t o a n o t h e r
v e r t e x i n t h e g r a p h c a n b e r e d u c e d t o t h e c o r r e s p o n d i n g p a t h q u e r y o n a n y s p a n n i n g t r e e
o f t h e g r a p h 1 2 ] . A n a l o g o u s l y , a r e q u e s t f o r a s h o r t e s t p a t h f r o m a d i s t i n g u i s h e d v e r t e x v
o f a g r a p h o r a g e o m e t r i c s t r u c t u r e t o a n o t h e r v e r t e x r e d u c e s t o t h e c o r r e s p o n d i n g q u e r y
i n t h e t r e e o f s h o r t e s t p a t h s t h a t i s r o o t e d a t v 6 ] . A l s o , i n c o m p u t a t i o n a l g e o m e t r y ,
d o m i n a n c e p r o b l e m s r e q u i r e e n u m e r a t i n g p a t h s b e t w e e n p a i r s o f n o d e s a s o n e o f t h e
b a s i c r o u t i n e s 3 , 5 , 7 ] . I n t h e s e p r o b l e m s a r a n g e - r a n g e p r i o r i t y s e a r c h t r e e i s c o m p u t e d
o v e r t h e g i v e n p l a n a r p o i n t s e t . T h e d o m i n a n c e r e l a t e d p r o b l e m s a r e s o l v e d b y c o m p u t i n g
p a t h s f r o m m a n y l e a v e s t o t h e r o o t o f t h e s e a r c h t r e e a n d a t e a c h i n t e r n a l n o d e o n t h e
p a t h c e r t a i n c o m p u t a t i o n s a r e c a r r i e d o u t . I n 4 ] , D j i d j e v e t a l . u s e d p a t h q u e r i e s f o r
t r e e s a s s u b r o u t i n e s i n t h e i r p a r a l l e l s o l u t i o n s t o s h o r t e s t p a t h q u e r i e s f o r p l a n a r d i g r a p h s .
A f t e r a n O ( l o g n ) - t i m e a n d O ( n = l o g n ) - p r o c e s s o r p r e p r o c e s s i n g o n a n E R E W P R A M t h e y
a c h i e v e d O ( L ) t i m e f o r r e p o r t i n g a p a t h o f l e n g t h L i n t h e i n p u t t r e e o n n n o d e s , u s i n g
s i n g l e p r o c e s s o r .
I n t h i s p a p e r w e p r e s e n t n e w r e s u l t s o n p a t h q u e r i e s i n t r e e s w h i c h y i e l d s u b s t a n t i a l
i m p r o v e m e n t s o v e r t h e a f o r e m e n t i o n e d r e s u l t s . W e p r o v i d e a s i m p l e o p t i m a l ( i n t h e t i m e -
p r o c e s s o r p r o d u c t s e n s e , s e e 8 , 9 ] ) l o g a r i t h m i c - t i m e a l g o r i t h m f o r p r e p r o c e s s i n g t h e i n p u t
t r e e s u c h t h a t t h e p a t h q u e r i e s c a n b e a n s w e r e d e c i e n t l y . U s i n g t h e p r e p r o c e s s i n g , w e
c a n r s t l y r e d u c e t h e t i m e o f r e p o r t i n g a p a t h o f l e n g t h L t o O ( l o g n ) b y u s i n g t h e o p t i m a l
n u m b e r o f E R E W P R A M p r o c e s s o r s , i . e . , O ( L = l o g n ) . O u r m e t h o d a v o i d s a p p l y i n g t h e
s t a n d a r d c o n c u r r e n t - r e a d p o i n t e r - j u m p i n g t e c h n i q u e . T h i s e n a b l e s u s t o d e r i v e o u r m a i n
r e s u l t o n p a r a l l e l p a t h q u e r i e s i n t h e E R E W P R A M m o d e l : w e a n s w e r k p a t h q u e r i e s
i n p a r a l l e l i n O ( l o g n + l o g k ) t i m e u s i n g O ( k + ( n + S ) = l o g n ) p r o c e s s o r s o n a n E R E W
P R A M , w h e r e S i s t h e s i z e o f t h e o u t p u t .
I n o u r a l g o r i t h m s , w e a s s u m e t h e s o - c a l l e d a d j a c e n c y l i s t r e p r e s e n t a t i o n o f t h e i n p u t
t r e e . T h e p a t h s a r e r e p o r t e d i n a n a r r a y .
O u r a l g o r i t h m s u s e a n o u t p u t s e n s i t i v e n u m b e r o f p r o c e s s o r s . T h e o u t p u t s i z e , i . e . ,
S i s n o t k n o w n i n a d v a n c e . W e c o m p u t e t h e s i z e o f t h e o u t p u t o n t h e y a n d a l l o c a t e
t h e r e q u i r e d n u m b e r o f p r o c e s s o r s i n t h e s p i r i t o f 5 ] . T h e p r o c e s s o r s a r e ` s p a w n e d '
d e p e n d i n g o n t h e o u t p u t s i z e . W h e n n e w p r o c e s s o r s a r e a l l o c a t e d , a g l o b a l a r r a y o f
p o i n t e r s i s c r e a t e d . A p r o c e s s o r c a n k n o w t h e e x a c t l o c a t i o n f r o m w h e r e i t s h o u l d s t a r t
w o r k i n g b y a c c e s s i n g t h i s a r r a y . F o r t h e d e t a i l s o f t h i s c o m p u t a t i o n m o d e l , s e e G o o d r i c h
5 ] .
I n o u r o p t i m a l p a r a l l e l s o l u t i o n s , w e u s e t h e f o l l o w i n g t o o l s p r e v i o u s l y d e v e l o p e d i n
t h e a r e a o f p a r a l l e l c o m p u t i n g : p a r a l l e l m e r g e - s o r t 1 ] , l i s t r a n k i n g a n d d o u b l i n g , p a r a l l e l
4
-
8/12/2019 Asimple Optimal Parallel Algorith for Reporting Paths in a Tree.1.1.31
5/13
p r e x s u m s ( e . g . , s e e 8 , 9 ] ) , t r e e o p e r a t i o n s i n c l u d i n g t h e E u l e r t o u r t e c h n i q u e 1 3 ] , l o w e s t
c o m m o n a n c e s t o r i n a t r e e 1 1 ] , s e a r c h i n g i n s e a r c h t r e e s 1 0 ] .
T h e r e m a i n d e r o f t h e p a p e r i s o r g a n i z e d a s f o l l o w s . I n S e c t i o n 2 , w e p r o v e s e v e r a l
b a s i c t e c h n i c a l l e m m a s . I n S e c t i o n 3 w e d e s c r i b e a n d a n a l y z e t h e t r e e p r e p r o c e s s i n g s t e p
a n d t h e n p r o v i d e t h e o p t i m a l a l g o r i t h m s f o r r e p o r t i n g p a t h s r e l y i n g o n t h e p r e p r o c e s s i n g .
I n S e c t i o n 4 w e c o n c l u d e w i t h a f e w o p e n p r o b l e m s .
2 P r e l i m i n a r i e s
L e t T d e n o t e t h e n - n o d e r o o t e d b i n a r y t r e e a n d l e t u s f u r t h e r a s s u m e t h a t T i s r e p r e s e n t e d
i n s u c h a w a y t h a t t h e E u l e r t o u r o f T c a n b e c o m p u t e d i n O ( l o g n ) t i m e u s i n g O ( n = l o g n )
p r o c e s s o r s 1 3 ] ( e . g . , a d j a c e n c y l i s t r e p r e s e n t a t i o n ) . L e t s i z e ( v ) , p o s t o r d e r ( v ) a n d l e v e l ( v )
r e s p e c t i v e l y d e n o t e t h e n u m b e r o f v e r t i c e s i n t h e s u b t r e e r o o t e d a t v , p o s t o r d e r n u m b e r
o f v i n t h e p o s t o r d e r t r a v e r s a l a n d l e v e l n u m b e r o f v , w h e r e v i s a n o d e o f T . T o f a c i l i t a t e
o u r d i s c u s s i o n , w e p r o v e t h e f o l l o w i n g l e m m a s .
L e m m a 2 . 1 L e t A b e a n a r r a y o f O ( l o g n ) e l e m e n t s . W e c a n m a k e k c o p i e s o f A i n
O ( l o g n + l o g k ) t i m e u s i n g O ( k ) p r o c e s s o r s o n a n E R E W P R A M .
P r o o f : T h e p r o o f u s e s t h e t e c h n i q u e o f p i p e l i n i n g . F i r s t c o m p u t e a b a l a n c e d b i n a r y
t r e e o n k n o d e s . A s s u m e t h a t t h e r e i s a p r o c e s s o r a t e a c h n o d e o f t h e t r e e . N o w c o p y
t h e r s t e l e m e n t o f t h e i n p u t a r r a y A i n t o t h e z e r o t h l e v e l , i . e . , t h e r o o t o f t h e t r e e . I n
t h e n e x t s t e p t h i s e l e m e n t i s c o p i e d i n t o e v e r y n o d e o n t h e r s t l e v e l o f t h e t r e e , a n d s o
o n . F i n a l l y i n O ( l o g k ) s t a g e s t h e r e a r e k c o p i e s o f t h i s e l e m e n t a n d e a c h l e a f o f t h e t r e e
c o n t a i n s o n e c o p y . W h i l e t h e r s t e l e m e n t o f A i s g e t t i n g c o p i e d t o n o d e s i n t h e r s t
l e v e l , w e c a n i n i t i a t e t h e p r o c e s s f o r t h e s e c o n d e l e m e n t o f A . C l e a r l y i n O ( l o g n + l o g k )
s t a g e s , c o p y o f e a c h e l e m e n t o f A w i l l r e s i d e i n e v e r y l e a f o f t h e b i n a r y t r e e .
1 . C o n s t r u c t a n E u l e r t o u r o f T . F o r e a c h n o d e v o f T c o m p u t e l e v e l ( v )
2 . F o r e a c h l e a f n o d e v o f T , c r e a t e a l i n e a r a r r a y A
v
o f s i z e l e v e l ( v )
3 . L a b e l t h e l e a v e s o f T b y d i s t i n c t c o n s e c u t i v e n u m b e r s .
4 . F o r e a c h n o d e v o f T , c o m p u t e t h e i n t e r v a l , r a n g e ( v ) , o f t h e l a b e l s o f t h e l e a v e s i n
i t s s u b t r e e .
5 . F o r e a c h z 2 r a n g e ( v ) , A
z
l e v e l ( v ) ] : = v
A l g o r i t h m 1 : A n a l g o r i t h m f o r r e p o r t i n g p a t h s f r o m a l l l e a v e s t o t h e r o o t
5
-
8/12/2019 Asimple Optimal Parallel Algorith for Reporting Paths in a Tree.1.1.31
6/13
L e m m a 2 . 2 L e t T b e a r o o t e d b i n a r y t r e e o n n - n o d e s . A l g o r i t h m 1 c o r r e c t l y c o m p u t e s
a l l p a t h s f r o m l e a v e s t o t h e r o o t i n T i n O ( l o g n ) t i m e u s i n g O ( S = l o g n ) p r o c e s s o r s o n a n
E R E W P R A M , w h e r e S i s t h e t o t a l s u m o f n o d e s i n t h e p a t h s f r o m a l l l e a v e s t o t h e r o o t
( i . e . , t h e s i z e o f t h e o u t p u t ) .
P r o o f : F i r s t w e s h o w t h e c o r r e c t n e s s o f t h e a l g o r i t h m a n d t h e n w e a n a l y z e i t s
c o m p l e x i t y . C l e a r l y , f o r a n y l e a f v o f T , t h e p a t h t o t h e r o o t i s o f l e n g t h l e v e l ( v ) . F o r a n y
i n t e r n a l n o d e v o f T , o n l y l e a v e s i n i t s s u b t r e e a r e i n r a n g e ( v ) . H e n c e , f o r a n y i n t e r n a l
n o d e v o f T , w e k n o w p r e c i s e l y w h e r e v i s g o i n g t o a p p e a r i n t h e p a t h s f r o m t h e l e a v e s i n
r a n g e ( v ) t o t h e r o o t .
N o w w e a n a l y z e t h e c o m p l e x i t y s t e p w i s e .
S t e p 1 t a k e s O ( l o g n ) t i m e u s i n g O ( n = l o g n ) p r o c e s s o r s 1 3 ] .
C o n s i d e r S t e p 2 . L e t S b e t h e s u m o f l e v e l ( v ) o v e r a l l v , w h e r e v i s a l e a f o f T . T h e
s u m S c a n b e c o m p u t e d i n O ( l o g n ) t i m e u s i n g O ( n = l o g n ) p r o c e s s o r s . C l e a r l y S i s ( n )
N e x t , b y u s i n g p a r a l l e l p r e x s u m s , t h e o p t i m u m n u m b e r o f p r o c e s s o r s t o c o m p u t e t h e
a r r a y s A
v
c o r r e s p o n d i n g t o e a c h l e a f v o f T c a n b e r e s p e c t i v e l y a s s i g n e d . H e n c e t h i s s t e p
c a n b e p e r f o r m e d i n O ( l o g n ) t i m e u s i n g O ( S = l o g n ) p r o c e s s o r s o n a n E R E W P R A M .
C o n s i d e r S t e p 3 . W e c a n l a b e l t h e l e a v e s b y u s i n g t h e E u l e r t o u r t e c h n i q u e a s f o l l o w s .
F i r s t c o m p u t e t h e E u l e r t o u r o f T . T h e n m a r k a l l l e a v e s i n t h e t o u r . N o w c o m p u t e t h e
p o s t o r d e r n u m b e r i n g o f o n l y t h e m a r k e d n o d e s i n t h e t r e e t r a v e r s a l . S o , t h i s s t e p c a n b e
p e r f o r m e d i n O ( l o g n ) t i m e u s i n g O ( n = l o g n ) p r o c e s s o r s .
C o n s i d e r S t e p 4 . W e c a n c o m p u t e r a n g e ( v ) f o r e v e r y n o d e v b y u s i n g t h e E u l e r t o u r
o f T a n d p a r a l l e l l i s t r a n k i n g . H e n c e t h i s s t e p r e q u i r e s O ( l o g n ) t i m e u s i n g O ( n = l o g n )
p r o c e s s o r s .
F i n a l l y c o n s i d e r S t e p 5 . N o t e t h a t t h e t o t a l s i z e o f t h e o u t p u t t o b e w r i t t e n i s S
U s i n g p a r a l l e l p r e x s u m s a l l o c a t e O ( S = l o g n ) p r o c e s s o r s s u c h t h a t e a c h p r o c e s s o r , w i t h
o n l y e x c l u s i v e r e a d c a p a b i l i t i e s , w r i t e s i n t h e a p p r o p r i a t e l o c a t i o n o f t h e a r r a y s A
z
i n
O ( l o g n ) t i m e , w h e r e z 2 r a n g e ( v )
L e m m a 2 . 3 L e t T b e a r o o t e d b i n a r y t r e e o n n - n o d e s a n d w i t h k n d i s t i n c t m a r k e d
n o d e s . W e c a n c o m p u t e p a t h s i n T f r o m a l l m a r k e d n o d e s t o t h e r o o t o f T i n O ( l o g n )
t i m e u s i n g O ( ( n + S ) = l o g n ) p r o c e s s o r s o n a n E R E W P R A M , w h e r e S i s t h e t o t a l s u m o f
n o d e s i n t h e p a t h s f r o m t h e m a r k e d n o d e s t o t h e r o o t ( i . e . , t h e s i z e o f t h e o u t p u t ) .
P r o o f : T h e a l g o r i t h m a n d t h e p r o o f a r e a n a l o g o u s t o A l g o r i t h m 1 a n d t h e p r o o f o f
L e m m a 2 . 2 , r e s p e c t i v e l y . T h e m a r k e d n o d e s p l a y t h e r o l e o f l e a v e s . N o t e t h a t t h e p o s -
t o r d e r n u m b e r i n g r e s t r i c t e d t o t h e m a r k e d n o d e s t a k e s l o g a r i t h m i c t i m e u s i n g O ( n = l o g n )
p r o c e s s o r s . A s S m a y b e s m a l l e r t h a n n ; t h e t o t a l n u m b e r o f p r o c e s s o r s u s e d b y t h e
a l g o r i t h m i s O ( ( n + S ) = l o g n )
L e m m a 2 . 4 L e t T b e a r o o t e d b i n a r y t r e e o n n - n o d e s . T h e r e e x i s t s a n i n t e g e r m
0
2
0 ; d l o g n e ) s u c h t h a t t h e r e a r e a t m o s t d n = l o g n e n o d e s v o f T , s a t i s f y i n g m
0
= l e v e l ( v )
6
-
8/12/2019 Asimple Optimal Parallel Algorith for Reporting Paths in a Tree.1.1.31
7/13
m o d d l o g n e . F u r t h e r m o r e , i t c a n b e c o m p u t e d i n O ( l o g n ) t i m e u s i n g O ( n = l o g n ) p r o -
c e s s o r s o n a n E R E W P R A M .
P r o o f : F i r s t w e s h o w t h e e x i s t e n c e o f m
0
. P a r t i t i o n t h e n o d e s o f T i n t o s e t s S
i
,
w h e r e v 2 S
i
i f a n d o n l y i f i = l e v e l ( v ) m o d d l o g n e . T h e r e a r e i n a l l l o g n s e t s , t h e r e f o r e
t h e r e e x i s t s a s e t S
m
0
c o n s i s t i n g o f a t m o s t d n = l o g n e e l e m e n t s .
N o w w e s h o w t h a t m
0
c a n b e c o m p u t e d w i t h i n t h e c l a i m e d c o m p l e x i t y b o u n d s . F i r s t ,
t h e s e t o f n o d e s o f T i s d i v i d e d i n t o O ( n = l o g n ) s u b s e t s U k e p t i n a r r a y s o f s i z e O ( l o g n ) ;
b y a p p l y i n g t h e o p t i m a l E R E W p a r a l l e l p r e x s u m s a l g o r i t h m 8 , 9 ] . N e x t , f o r e a c h
s u b s e t U ; t h e i n t e g e r s l e v e l ( v ) m o d d l o g n e o v e r n o d e s i n U a r e b u c k e t s o r t e d b y a s i n g l e
p r o c e s s o r i n O ( l o g n ) t i m e . T h e n , f o r a l l i n t e g e r s m i n 0 ; d l o g n e ) , t h e n u m b e r s n
m
( U ) o f
t h e o c c u r e n c e s o f m i n t h e s o r t e d s e q u e n c e f o r U a r e c o m p u t e d , a g a i n i n O ( l o g n ) t i m e
u s i n g a s i n g l e p r o c e s s o r . N o w , i t i s s u c i e n t t o c o m p u t e t h e s u m s
P
U
n
m
( U ) i n p a r a l l e l
f o r a l l m i n 0 ; d l o g n e ) i n o r d e r t o s e t m
0
t o a n m m i n i m i z i n g
P
U
n
m
( U ) . I t t a k e s O ( l o g n )
t i m e a n d t o t a l l y O ( ( ( n = l o g n ) = l o g n ) l o g n ) p r o c e s s o r s .
L e m m a 2 . 5 A b i n a r y t r e e o n n - n o d e s c a n b e p r e p r o c e s s e d i n O ( l o g n ) t i m e u s i n g
O ( n = l o g n ) p r o c e s s o r s s u c h t h a t k l o w e s t c o m m o n a n c e s t o r q u e r i e s c a n b e a n s w e r e d i n
O ( l o g k ) t i m e u s i n g O ( k ) p r o c e s s o r s o n t h e E R E W P R A M .
P r o o f : S c h i e b e r a n d V i s h k i n 1 1 ] h a v e p r o p o s e d a n a l g o r i t h m f o r p r e p r o c e s s i n g a
b i n a r y t r e e i n O ( l o g n ) t i m e u s i n g O ( n = l o g n ) p r o c e s s o r s s u c h t h a t a s i n g l e p r o c e s s o r c a n
a n s w e r a l o w e s t c o m m o n a n c e s t o r q u e r y i n O ( 1 ) t i m e . H e n c e k q u e r i e s c a n b e a n s w e r e d i n
O ( 1 ) t i m e u s i n g O ( k ) p r o c e s s o r s o n a C R E W P R A M . B y u s i n g t h e s t a n d a r d s i m u l a t i o n
o f t h e C R E W P R A M o n a n E R E W P R A M , w e g e t t h e d e s i r e d c o m p l e x i t y .
L e m m a 2 . 6 ( P a u l , V i s h k i n a n d W a g e n e r 1 0 ] ) A s e q u e n c e o f k k e y s c a n b e s e a r c h e d i n
a n n ? n o d e b i n a r y s e a r c h t r e e i n O ( l o g n + l o g k ) t i m e u s i n g O ( k ) p r o c e s s o r s o n a n E R E W
P R A M .
3 T h e p r e p r o c e s s i n g a n d t h e q u e r i e s
I n t h i s s e c t i o n r s t w e s t a t e a n a l g o r i t h m ( A l g o r i t h m 2 ) f o r p r e p r o c e s s i n g t h e n - n o d e
b i n a r y t r e e T . T h e n w e s h o w t h a t t h e p a t h q u e r i e s c a n b e a n s w e r e d e c i e n t l y u s i n g t h e
d a t a c o m p u t e d i n t h e p r e p r o c e s s i n g s t e p .
L e m m a 3 . 1 A l g o r i t h m 2 p r e p r o c e s s e s a n n - n o d e b i n a r y t r e e i n O ( l o g n ) t i m e u s i n g
O ( n = l o g n ) p r o c e s s o r s o n a n E R E W P R A M a n d t h e r e s u l t i n g d a t a s t r u c t u r e i s o f l i n -
e a r s i z e .
7
-
8/12/2019 Asimple Optimal Parallel Algorith for Reporting Paths in a Tree.1.1.31
8/13
1 . P r e p r o c e s s T f o r a n s w e r i n g t h e l o w e s t c o m m o n a n c e s t o r q u e r i e s .
2 . P e r f o r m a n E u l e r t o u r t r a v e r s a l o f T a n d c o m p u t e p o s t o r d e r ( v ) a n d l e v e l ( v ) f o r
e a c h n o d e v 2 T
3 . F i n d m
0
2 0 ; d l o g n e ) s u c h t h a t t h e r e a r e O ( n = l o g n ) n o d e s v o f T s a t i s f y i n g m
0
=
l e v e l ( v ) m o d d l o g n e a n d m a r k a l l s u c h n o d e s .
4 . G r o u p t h e m a r k e d n o d e s a c c o r d i n g t o t h e i r l e v e l n u m b e r i n T a n d l e t G
i
d e n o t e t h e
m a r k e d n o d e s a t l e v e l i i n T , w h e r e m
0
= i m o d d l o g n e
5 . F o r e a c h g r o u p G
i
, c o m p u t e a b i n a r y s e a r c h t r e e B
i
, w h e r e t h e l e a f n o d e s i n B
i
a r e
t h e n o d e s a t l e v e l i i n T . T h e l e a f n o d e s i n B
i
a r e s o r t e d i n t h e i n c r e a s i n g o r d e r b y
p o s t o r d e r ( v )
A l g o r i t h m 2 : A n a l g o r i t h m f o r p r e p r o c e s s i n g a b i n a r y t r e e
P r o o f : S t e p s 1 , 2 c a n b e i m p l e m e n t e d i n O ( l o g n ) t i m e u s i n g O ( n = l o g n ) p r o c e s s o r s
1 1 , 1 3 ] .
S t e p 3 c a n b e i m p l e m e n t e d a s f o l l o w s . F i r s t c o m p u t e m
0
u s i n g L e m m a 2 . 4 a n d t h e n
m
0
i s b r o a d c a s t e d t o e a c h v e r t e x i n l o g a r i t h m i c t i m e u s i n g O ( n = l o g n ) p r o c e s s o r s 8 , 9 ] .
A v e r t e x v m a r k s i t s e l f i f l e v e l ( v ) m o d d l o g n e = m
0
T o i m p l e m e n t S t e p 4 , t h e m a r k e d v e r t i c e s a r e e x t r a c t e d u s i n g t h e o p t i m a l p a r a l l e l
p r e x s u m s a l g o r i t h m 8 , 9 ] a n d t h e n s o r t e d a c c o r d i n g t o t h e i r l e v e l n u m b e r . S i n c e t h e
n u m b e r o f m a r k e d n o d e s i s a t m o s t O ( n = l o g n ) , t h e s o r t i n g c a n b e d o n e i n l o g a r i t h m i c
t i m e w i t h O ( n = l o g n ) p r o c e s s o r s i n t h e E R E W P R A M m o d e l 1 ] . T h u s t h e g r o u p s G
i
c a n
b e c o m p u t e d i n O ( l o g n ) t i m e u s i n g O ( n = l o g n ) p r o c e s s o r s .
T o i m p l e m e n t S t e p 5 , w i t h i n e a c h g r o u p G
i
t h e n o d e s a r e s o r t e d i n t h e i n c r e a s i n g
o r d e r b y p o s t o r d e r ( v ) A n a l o g o u s l y a s i n S t e p 5 , t h e s o r t i n g t a k e s l o g a r i t h m i c t i m e a n d
O ( n = l o g n ) p r o c e s s o r s t o t a l l y . F u r t h e r , b i n a r y s e a r c h t r e e s o n O ( n = l o g n ) n o d e s a r e c o m -
p u t e d i n O ( l o g n ) t i m e u s i n g O ( n = l o g n ) p r o c e s s o r s .
W e c o n c l u d e t h a t t h e a l g o r i t h m c a n b e i m p l e m e n t e d t o r u n w i t h i n t h e c l a i m e d t i m e
a n d p r o c e s s o r b o u n d s . S i n c e e a c h s t e p o f t h e a l g o r i t h m r e q u i r e s o n l y l i n e a r s p a c e , t h e
s p a c e c o m p l e x i t y f o l l o w s .
F i r s t w e d i s c u s s t h e p r o b l e m o f a n s w e r i n g a p a t h q u e r y a n d t h e n p r e s e n t a n a l g o r i t h m
f o r a n s w e r i n g k p a t h q u e r i e s u s i n g t h e a b o v e p r e p r o c e s s i n g s t e p .
L e t t h e q u e r y b e a p a i r o f n o d e s ( a ; b ) i n T W e a r e a s k e d t o c o m p u t e t h e p a t h
b e t w e e n n o d e s a a n d b , d e n o t e d a s p a t h ( a ; b ) . I n t h e f o l l o w i n g w e s h o w t h a t p a t h ( a ; b )
c a n b e c o m p u t e d i n O ( l o g n ) t i m e u s i n g O ( m a x f 1 ; p a t h ( a ; b ) = l o g n g ) p r o c e s s o r s , w h e r e
p a t h ( a ; b ) d e n o t e s t h e n u m b e r o f n o d e s i n p a t h ( a ; b )
8
-
8/12/2019 Asimple Optimal Parallel Algorith for Reporting Paths in a Tree.1.1.31
9/13
F i r s t c o m p u t e t h e l o w e s t c o m m o n a n c e s t o r n o d e o f a a n d b i n T D e n o t e i t b y c . N o w
t h e p r o b l e m r e d u c e s t o r e p o r t i n g t h e p a t h s p a t h ( a ; c ) a n d p a t h ( b ; c ) . S o , f o r s i m p l i c i t y
a s s u m e t h a t b i s a n a n c e s t o r o f a
1 . C o m p u t e t h e l e v e l a n d t h e p o s t o r d e r n u m b e r s o f n o d e s a a n d b i n T
2 . C o m p u t e t h e s e t i n d e x ( a ; b ) = f i m
0
= i m o d d l o g n e a n d l e v e l ( b ) i l e v e l ( a ) g
L o c a t e t h e g r o u p s G
i
, w h e r e i 2 i n d e x ( a ; b )
3 . F o r e a c h B
i
, w h e r e i 2 i n d e x ( a ; b ) , u s i n g t h e p o s t o r d e r n u m b e r o f a ; l o c a t e t h e l e a f
l
i
o f B
i
, s u c h t h a t a i s i n t h e s u b t r e e r o o t e d a t l
i
4 . C o m p u t e p a t h s i n T f r o m e a c h l
i
t o l
i + d l o g n e
w h e n e v e r b o t h i a n d i + d l o g n e a r e i n
i n d e x ( a ; b ) F u r t h e r , c o m p u t e p a t h ( a ; l
i
) f o r t h e l a r g e s t v a l u e o f i 2 i n d e x ( a ; b ) a n d
a n a l o g o u s l y c o m p u t e p a t h ( l
i
; b ) f o r t h e s m a l l e s t v a l u e o f i 2 i n d e x ( a ; b )
5 . C o m p o s e t h e p a t h s c o m p u t e d i n S t e p 4 t o o b t a i n p a t h ( a ; b )
A l g o r i t h m 3 : A n a l g o r i t h m f o r c o m p u t i n g p a t h ( a ; b )
T h e o r e m 3 . 2 A l g o r i t h m 3 c o m p u t e s t h e p a t h b e t w e e n t w o q u e r y n o d e s a a n d b , p a t h ( a ; b ) ,
i n O ( l o g n ) t i m e u s i n g O ( m a x f 1 ; p a t h ( a ; b ) = l o g n g ) p r o c e s s o r s o n t h e E R E W P R A M ,
w h e r e b i s a n a n c e s t o r o f a a n d p a t h ( a ; b ) d e n o t e s t h e n u m b e r o f n o d e s i n p a t h ( a ; b )
( s e e F i g u r e 1 . )
P r o o f : T h e c o r r e c t n e s s o f A l g o r i t h m 3 i m m e d i a t e l y f o l l o w s f r o m t h e f a c t t h a t r s t
w e c o m p u t e e v e r y l o g n t h n o d e o n t h e p a t h a n d t h e n c o m p u t e t h e r e s t o f t h e p a t h .
T h e n u m b e r o f n o d e s i n p a t h ( a ; b ) i s p a t h ( a ; b ) = l e v e l ( a ) ? l e v e l ( b ) . S o , w e a s -
s i g n O ( m a x f 1 ; p a t h ( a ; b ) = l o g n g ) p r o c e s s o r s t o c o m p u t e p a t h ( a ; b ) i n O ( l o g n ) t i m e .
T h e s e t i n d e x ( a ; b ) c a n b e c o m p u t e d i n O ( l o g n ) t i m e . N o t e t h a t i n d e x ( a ; b )
m a x f 1 ; p a t h ( a ; b ) = l o g n g . T h e b i n a r y s e a r c h t r e e s B
i
a r e o f h e i g h t O ( l o g n ) . T h e r e -
f o r e , t h e i t h p r o c e s s o r c a n s e a r c h f o r t h e l e a f n o d e l
i
; w i t h t h e s m a l l e s t p o s t o r d e r n u m b e r
g r e a t e r t h a n t h a t o f a ; i n B
i
i n O ( l o g n ) t i m e . N o t e t h a t a
i
i s i n t h e s u b t r e e r o o t e d a t
s u c h a l
i
O n c e t h e l e a v e s l
i
a r e l o c a t e d i n e a c h B
i
, w h e r e i 2 i n d e x ( a ; b ) , t h e r e m a i n i n g
t a s k i s t o c o m p u t e t h e p a t h s f r o m n o d e s l
i
t o l
i + d l o g n e
f o r t h e a p p r o p r i a t e v a l u e s o f i i n
T . S i n c e t h e n u m b e r o f n o d e s i n e a c h p a t h i s a t m o s t l o g n , e a c h o f t h e s e p a t h s c a n b e
c o m p u t e d i n O ( l o g n ) t i m e . N o t e t h a t t h i s m e t h o d r e q u i r e s o n l y e x c l u s i v e r e a d a n d w r i t e
c a p a b i l i t i e s , s i n c e t h e n o d e s i n e a c h B
i
a r e p a i r w i s e d i s t i n c t .
N o w u s i n g t h e t h e o r y d e v e l o p e d s o f a r , w e d i s c u s s t h e m a i n r e s u l t o f t h i s p a p e r . T h e
p r o b l e m i s t o s o l v e k - p a t h q u e r i e s s i m u l t a n e o u s l y . U s i n g L e m m a 2 . 5 , c o m p u t e t h e l o w e s t
c o m m o n a n c e s t o r o f e a c h q u e r y p a i r . A s b e f o r e , w e c a n n o w a s s u m e t h a t e a c h q u e r y i s a
p a i r o f n o d e s a
i
a n d b
i
o f T , w h e r e b
i
i s a n a n c e s t o r o f a
i
, f o r i = 1 k
9
-
8/12/2019 Asimple Optimal Parallel Algorith for Reporting Paths in a Tree.1.1.31
10/13
b
i m
0
G
l
i
a
F i g u r e 1 : F i g u r e f o r A l g o r i t h m
1 . F o r e a c h q u e r y p a i r ( a
i
; b
i
) c o m p u t e l e v e l ( a
i
) , l e v e l ( b
i
) , p a t h ( a
i
; b
i
) a n d
p o s t o r d e r ( a
i
)
2 . C o m p u t e S =
P
i = k
i = 1
p a t h ( a
i
; b
i
)
3 . F o r e a c h q u e r y p a i r ( a
i
; b
i
) , l o c a t e t h e b i n a r y s e a r c h t r e e s B
j
s u c h t h a t m
0
= j m o d
d l o g n e a n d l e v e l ( b
i
) j l e v e l ( a
i
) . L e t i n d e x ( a
i
; b
i
) b e t h e s e t o f v a l u e s w h i c h j
t a k e s . F o r e a c h j 2 i n d e x ( a
i
; b
i
) , g e n e r a t e a s e a r c h p a i r ( B
j
; a
i
)
4 . F o r e a c h s e a r c h p a i r ( B
j
; a
i
) , m a r k t h e l e a f l
j
o f B
j
, s u c h t h a t a
i
i s i n t h e s u b t r e e
r o o t e d a t l
j
5 . F o r e a c h q u e r y p a i r ( a
i
; b
i
) c o m p u t e p a t h s i n T f r o m l
j
t o l
j + d l o g n e
, f o r a l l j 2
i n d e x ( a
i
; b
i
) w h e r e j + d l o g n e 2 i n d e x ( a
i
; b
i
) F u r t h e r , c o m p u t e p a t h ( a
i
; l
j
) f o r t h e
l a r g e s t v a l u e o f j 2 i n d e x ( a
i
; b
i
) a n d a n a l o g o u s l y c o m p u t e p a t h ( l
j
; b
i
) f o r t h e s m a l l e s t
v a l u e o f i 2 i n d e x ( a
i
; b
i
)
6 . C o m p o s e t h e p a t h s c o m p u t e d i n S t e p 5 t o o b t a i n p a t h ( a
i
; b
i
)
A l g o r i t h m 4 : A n a l g o r i t h m f o r c o m p u t i n g k - p a t h q u e r i e s .
1 0
-
8/12/2019 Asimple Optimal Parallel Algorith for Reporting Paths in a Tree.1.1.31
11/13
T h e o r e m 3 . 3 A l g o r i t h m 4 c o r r e c t l y c o m p u t e s p a t h s b e t w e e n k - q u e r y n o d e s i n O ( l o g n +
l o g k ) t i m e u s i n g O ( k + ( n + S ) = l o g n ) p r o c e s s o r s o n a n E R E W P R A M , w h e r e S i s t h e
s i z e o f t h e o u t p u t .
P r o o f : T h e c o r r e c t n e s s i s s t r a i g h t f o r w a r d a n d f o l l o w s f r o m t h e f a c t t h a t f o r a n y
p a i r o f q u e r y n o d e s a
i
a n d b
i
, r s t w e c o m p u t e e v e r y l o g n t h n o d e o n t h e p a t h a n d t h e n
d e t e r m i n e t h e r e m a i n g l o g a r i t h m i c - l e n g t h p a t h s e g m e n t s .
N o w w e a n a l y z e t h e c o m p l e x i t y o f t h e a l g o r i t h m . U s i n g L e m m a 2 . 5 , t h e l o w e s t c o m -
m o n a n c e s t o r s o f k n o d e p a i r s c a n b e c o m p u t e d i n O ( l o g k ) t i m e u s i n g O ( k ) p r o c e s s o r s .
C o n s i d e r S t e p 1 o f t h e a l g o r i t h m . F o r e a c h p a i r o f q u e r y n o d e s , w e c a n c o m p u t e l e v e l
a n d p o s t o r d e r i n f o r m a t i o n i n O ( 1 ) t i m e o n t h e C R E W P R A M . H e n c e i n O ( l o g k ) t i m e
u s i n g O ( k ) p r o c e s s o r s , w e c a n c o m p u t e t h e r e q u i r e d q u a n t i t i e s i n S t e p 1 o n a n E R E W
P R A M f o r a l l q u e r i e s .
T h e s u m o f k n u m b e r s , i n S t e p 2 , c a n b e c o m p u t e d i n O ( l o g k ) t i m e u s i n g O ( k = l o g k )
p r o c e s s o r s . O n c e w e k n o w t h e v a l u e o f S , w e a s s i g n O ( S = l o g n ) p r o c e s s o r s i n O ( l o g S )
t i m e t o p e r f o r m o u r t a s k . A s s i g n m a x f 1 ; p a t h ( a
i
; b
i
) = l o g n g p r o c e s s o r s t o e a c h p a i r o f
q u e r y n o d e s ( a
i
; b
i
)
C o n s i d e r S t e p 3 . U s i n g a m a x f 1 ; p a t h ( a
i
; b
i
) = l o g n g p r o c e s s o r s , w e c a n c o m p u t e t h e
s e t i n d e x ( a
i
; b
i
) a n d g e n e r a t e t h e s e a r c h p a i r ( B
j
; a
i
) f o r e a c h j 2 i n d e x ( a
i
; b
i
) i n O ( l o g n )
t i m e .
C o n s i d e r S t e p 4 . W e w r i t e ( B
j
; a
i
) ( B
p
; a
l
) i f a n d o n l y i f e i t h e r j < p o r j = p
a n d p o s t o r d e r ( a
i
) p o s t o r d e r ( a
l
) . S o r t a l l s e a r c h p a i r s a c c o r d i n g t o t h e l e x i c o g r a p h i c
o r d e r b y t h e a l g o r i t h m o f C o l e 1 ] . W e h a v e a t m o s t O ( S = l o g n ) s e a r c h p a i r s , s i n c e f o r
a n y p a t h ( a
i
; b
i
) , i n d e x ( a
i
; b
i
) m a x f 1 ; p a t h ( a
i
; b
i
) = l o g n g . H e n c e , s o r t i n g o f t h e s e a r c h
p a i r s r e q u i r e s O ( l o g S ) t i m e u s i n g O ( S = l o g n ) p r o c e s s o r s . N o w t h e t a s k i s t o m a r k t h e
l e a v e s i n t h e s e a r c h t r e e B
j
c o r r e s p o n d i n g t o q u e r y n o d e s a
i
, f o r a l l d e s i r e d v a l u e s o f i a n d
j . C o n s i d e r o n e s u c h s e a r c h t r e e , s a y B
j
a n d l e t t h e r e b e l s e a r c h p a i r s i n v o l v i n g B
j
. U s i n g
L e m m a 2 . 6 , w e c a n m a r k t h e l e a v e s c o r r e s p o n d i n g t o t h e s e a r c h p a i r s i n O ( l o g B
i
+ l o g l )
t i m e u s i n g O ( l ) p r o c e s s o r s . S i n c e w e s e a r c h f o r a t o t a l o f a t m o s t O ( S = l o g n ) s e a r c h p a i r s
a n d t h e n u m b e r o f n o d e s i n a l l t h e s e a r c h t r e e s i s a t m o s t O ( n ) , t h e o v e r a l l c o m p l e x i t y
o f t h i s s t e p i s O ( l o g n + l o g S ) t i m e u s i n g O ( S = l o g n ) p r o c e s s o r s .
C o n s i d e r S t e p 5 . W e h a v e s e v e r a l m a r k e d n o d e s i n T , w h i c h a r e e i t h e r t h e l e a v e s l
j
,
m a r k e d i n t h e p r e v i o u s s t e p o r t h e n o d e s a
i
. T h e t a s k i s t o r e p o r t t h e p a t h s t a r t i n g f r o m
e a c h m a r k e d n o d e x , u p t o a n o d e y , s u c h t h a t i ) y i s o n t h e p a t h f r o m x t o t h e r o o t o f
T i i ) l e v e l ( y ) m o d d l o g n e = m
0
o r y = b
i
a n d i i i ) p a t h ( x ; y ) d l o g n e . W e a c c o m p l i s h
t h e t a s k a s f o l l o w s . F i r s t p a r t i t i o n t h e t r e e i n t o s u b t r e e s T
i
b y c u t t i n g t h e t r e e a t t h e
m
0
l e v e l , a n d t h e n a t e v e r y d l o g n e t h l e v e l . T h e r e s u l t i n g s u b t r e e s h a v e h e i g h t a t m o s t
d l o g n e a n d t h e r o o t r
i
o f a n y s u b t r e e T
i
; d i e r e n t f r o m t h e t o p o n e r o o t e d a t t h e r o o t o f
T ; s a t i s e s l e v e l ( r
i
) m o d d l o g n e = m
0
. N o w t h e p r o b l e m r e d u c e s t o t h a t o f r e p o r t i n g a l l
p a t h s f r o m t h e m a r k e d n o d e s i n T
i
t o t h e r o o t r
i
o f T
i
, f o r e v e r y s u b t r e e T
i
o f T . U s i n g
L e m m a 2 . 3 , w e c a n c o m p u t e p a t h s i n e a c h T
i
f r o m e a c h m a r k e d n o d e t o r
i
. N o t e t h a t
i n a l l w e h a v e O ( n ) v e r t i c e s p a r t i t i o n e d a m o n g T
i
s a n d t h e t o t a l n u m b e r o f n o d e s t o b e
r e p o r t e d i n a l l q u e r y p a t h s i s S . H e n c e t h e o v e r a l l c o m p l e x i t y o f c o m p u t i n g p a t h s f r o m
1 1
-
8/12/2019 Asimple Optimal Parallel Algorith for Reporting Paths in a Tree.1.1.31
12/13
e a c h m a r k e d n o d e t o t h e r o o t o f i t s s u b t r e e w i l l b e O ( l o g n ) t i m e u s i n g O ( ( n + S ) = l o g n )
p r o c e s s o r s .
C o n s i d e r S t e p 6 . F o r e a c h q u e r y p a t h p a t h ( a
i
; b
i
) , w e h a v e c o m p u t e d s u b p a t h s c o n -
s i s t i n g o f a t m o s t O ( l o g n ) n o d e s . N o t e t h a t a s u b p a t h m a y b e c o m m o n t o s e v e r a l p a t h
q u e r i e s . I f a s u b p a t h i s c o m m o n t o l p a t h q u e r i e s , w e c a n r e p l i c a t e i t l t i m e s u s i n g t h e
r e s u l t s o f L e m m a 2 . 1 . T h e n u m b e r o f t i m e s a s u b p a t h n e e d s t o b e r e p l i c a t e d c a n b e
c o m p u t e d a s f o l l o w s . W h i l e s e a r c h i n g f o r t h e l e a f n o d e s i n t h e s e a r c h t r e e i n S t e p 4 , w e
c a n c o m p u t e h o w m a n y t i m e s e a c h l e a f i s m a r k e d . S i n c e e a c h l e a f i s m a r k e d o n c e f o r e a c h
s e a r c h q u e r y , t h e n u m b e r o f t i m e s i t g e t s m a r k e d g i v e s t h e n u m b e r o f t i m e s a s u b p a t h
n e e d s t o b e r e p l i c a t e d . O n c e w e k n o w a l l t h e s u b p a t h s f o r a p a i r o f q u e r y n o d e s , w e c a n
e a s i l y o u t p u t t h e w h o l e p a t h .
A l l t h e s t e p s o f t h e a l g o r i t h m u s e o n l y e x c l u s i v e r e a d a n d e x c l u s i v e w r i t e c a p a b i l i t i e s ,
w h i c h p r o v e s o u r r e s u l t .
4 C o n c l u s i o n
I n t h i s p a p e r w e h a v e p r e s e n t e d o p t i m a l p a r a l l e l s o l u t i o n s t o r e p o r t i n g p a t h s b e t w e e n
p a i r s o f n o d e s i n a t r e e . U s i n g o u r r e s u l t s w e c a n a l s o c o m p u t e t h e w e i g h t o f t h e p a t h
b e t w e e n q u e r y n o d e s i n a w e i g h t e d t r e e w i t h i n t h e s a m e c o m p l e x i t y b o u n d s . T h e r e
a r e s e v e r a l r e l a t e d p r o b l e m s w h i c h m i g h t b e o f i n t e r e s t . O n e o f t h e m i s t o c o n s i d e r
t h e d y n a m i c v e r s i o n w h e r e i n s e r t i o n s a n d d e l e t i o n s o f t r e e n o d e s a r e p o s s i b l e . O t h e r
i n t e r e s t i n g p r o b l e m i s t o s t u d y t h e l o w e s t c o m m o n a n c e s t o r q u e r y p r o b l e m i n t h e d y n a m i c
s e t t i n g .
A c k n o w l e d g e m e n t s
T h e a u t h o r s t h a n k u n k n o w n S T A C S ' 9 4 - r e f e r e e s f o r v a l u a b l e c o m m e n t s o n L e m m a t a
2 . 1 , 3 . 1 .
R e f e r e n c e s
1 ] R . C o l e . P a r a l l e l m e r g e s o r t . S I A M J . C o m p u t i n g , 1 7 , ( 1 9 8 8 ) , p p . 7 7 0 - 7 8 5 .
2 ] R . C o l e a n d U . V i s h k i n . T h e a c c e l e r a t e d c e n t r o i d d e c o m p o s i t i o n t e c h n i q u e f o r o p t i m a l p a r -
a l l e l t r e e e v a l u a t i o n i n l o g a r i t h m i c t i m e . A l g o r i t h m i c a , 3 ( 1 9 8 8 ) , p p . 3 2 9 - 3 4 6 .
3 ] A . D a t t a , A . M a h e s h w a r i , J . - R . S a c k . O p t i m a l p a r a l l e l a l g o r i t h m s f o r d i r e c t d o m i n a n c e
p r o b l e m s . F i r s t A n n u a l E u r o p e a n S y m p o s i u m o n A l g o r i t h m s , L e c t u r e N o t e s i n C o m p u t e r
S c i e n c e , V o l . 7 2 6 , p p . 1 0 9 - 1 2 0 , S p r i n g e r - V e r l a g , 1 9 9 3 .
4 ] H . N . D j i d j e v , G . E . P a n t z i o u a n d C . D . Z a r o l i a g i s . C o m p u t i n g S h o r t e s t P a t h s a n d D i s -
t a n c e s i n P l a n a r G r a p h s . P r o c e e d i n g s 1 8 t h I C A L P , M a d r i d , 1 9 9 1 , L N C S 5 1 0 , p p . 3 2 7 - 3 3 8 ,
S p r i n g e r V e r l a g .
1 2
-
8/12/2019 Asimple Optimal Parallel Algorith for Reporting Paths in a Tree.1.1.31
13/13
5 ] M . T . G o o d r i c h . I n t e r s e c t i n g l i n e s e g m e n t s i n p a r a l l e l w i t h a n o u t p u t - s e n s i t i v e n u m b e r o f
p r o c e s s o r s . S I A M J . C o m p u t i n g , 2 0 , ( 1 9 9 1 ) , p p . 7 3 7 - 7 5 5 .
6 ] L . J . G u i b a s a n d J . H e r s h b e r g e r . O p t i m a l s h o r t e s t p a t h q u e r i e s i n a s i m p l e p o l y g o n . J . o f
C o m p u t e r a n d S y s t e m S c i e n c e s 3 9 , p p . 1 2 6 - 1 5 2 , 1 9 8 9 .
7 ] R . G u t i n g , O . N u r m i a n d T . O t t m a n n . F a s t a l g o r i t h m s f o r d i r e c t e n c l o s u r e s a n d d i r e c t
d o m i n a n c e s . J . A l g o r i t h m s 1 0 ( 1 9 8 9 ) , p p . 1 7 0 - 1 8 6 .
8 ] J . J a J a A n I n t r o d u c t i o n t o P a r a l l e l A l g o r i t h m s . A d d i s o n - W e s l e y , 1 9 9 2 .
9 ] R . M . K a r p a n d V . R a m a c h a n d r a n , P a r a l l e l A l g o r i t h m s f o r S h a r e d - M e m o r y M a c h i n e s ,
H a n d b o o k o f T h e o r e t i c a l C o m p u t e r S c i e n c e , E d i t e d b y J . v a n L e e u w e n , V o l u m e 1 , E l s e v i e r
S c i e n c e P u b l i s h e r s B . V . , 1 9 9 0 .
1 0 ] W . P a u l , U . V i s h k i n a n d H . W a g e n e r . P a r a l l e l d i c t i o n a r i e s o n 2 - 3 t r e e s . P r o c . 1 0 t h I C A L P ,
L e c t u r e N o t e s i n C o m p u t e r S c i e n c e , V o l . 1 5 4 , p p . 5 9 7 - 6 0 9 , 1 9 8 3 .
1 1 ] B . S c h i e b e r a n d U . V i s h k i n . O n n d i n g l o w e s t c o m m o n a n c e s t o r s : S i m p l i c a t i o n a n d P a r -
a l l e l i z a t i o n . S I A M . J . C o m p u t i n g , 1 7 ( 1 9 8 8 ) , p p . 1 2 5 3 - 1 2 6 2 .
1 2 ] R . E . T a r j a n . D a t a S t r u c t u r e s a n d N e t w o r k A l g o r i t h m s . S I A M , P h i l a d e l p h i a , 1 9 8 3 .
1 3 ] R . E . T a r j a n a n d U . V i s h k i n . A n e c i e n t p a r a l l e l b i c o n n e c t i v i t y a l g o r i t h m . S I A M J . C o m -
p u t i n g , 1 4 ( 1 9 8 5 ) , p p . 8 6 2 - 8 7 4 .