Академический Документы
Профессиональный Документы
Культура Документы
R. E. Tarjan
Stanford University
Stanford, California
ABSTRACT
Networks, 7: 25-35
@ 1977 by John Wiley & Sons, Inc. 25
26 TARJAN
A Zgozvithm BRANCh:
First Step:
F1: Choose any v e r t e x v w i t h an edge ( x , v ) of v a l u e
c ( x , v ) > 0.
F2: S e l e c t t h e edge ( u , v ) of l a r g e s t v a l u e .
F3: Add ( u , v ) t o H.
FINDING OPTIMUM BRANCHINGS 27
General Step:
GI: Choose any root component S of G(H) having an
unexamined edge (x,v) with v E S and c (x,v) > 0.
G2 : Find the largest unexamined edge (u,v) such
that v E S.
G3 : If U E S , discard the edge and stop. Otherwise
go to G4.
G4 : u $ s . Let W be the weakly connected component
of G(H) containing v. If u k W add (u,v) to H
and stop. Otherwise go to G5.
G5 : u$S, U E W . Find the sequence
-
s,l (x1IY11 ,S2, (X2,YZ), #Sk’(\,y,) such that
each S. is a strongly connected component of
1
G(H)t (Xi,Yi) E: H, Yi E Sit and Xi E Si+l for
all i, sk = s, (\,yk) = (u,v), and xk
’1’
G6 : Find the edge (x ,y.) with minimum value among
the (xi,yi) j i
A l g o s t h m ROOT:
3. EFFICIENT IMPLEMENTATION
The time required for 0(m) FINDS and 0(n) UNIONS is O(n log* n+m)
*
[131, where log n = minIi
.log ... log n<-l).
1 log
i times
We use one
&Ok&%m BRANCH:
begin
roots := 8 ;
60k i := 1 u n t i l n do
begin
INIT(i,I (ill;
i n i t i a l i z e an S-set named i c o n t a i n i n g i as i t s
only element;
i n i t i a l i z e a W-set named i c o n t a i n i n g i as i t s
only element;
e n t e r ( i ) := (0,O);
roots := roots u { i l i
m i n ( i ) := i;
end ;
H := 8;
r s e t := 8;
wkiee roots # do
begin
d e l e t e some e n t r y k from roots;
( i , j ) := MAX(k);
i d v ( i , j ) < 0 Xthen rset := r s e t U { k )
e&e i d SFykD(i) = k lthen roots := POOtsU {k)
e h e begin
H := H U { ( i , j ) } i
.id WFIND(~) # WIND(^) ,then
begin
WUNION (WIND(i) ,WIND (j) ) ;
e n t e r ( k ) := ( i , j ) i
end
&he
begin
vaZ := 01;
(x,y) := ( i , j ) ;
lokiee (x,y) # ( 0 ~ 0 )do
begin
id c ( x , y ) < vaZ t h e n
begin
vaZ := c ( x , y ) i
vertex := SFIND(y) ;
end i
(x,y) := enter (SFIND(x) 1 ;
end;
ADD(VaZ - c ( i , j ), k ) ;
:= min ( v e r t e x )i
min ( k )
(x,y) := enter (SFIND (i)) ;
wkiee (x,y) # (0,O) do
FINDING OPTIMUM BRANCHINGS 31
begin
-
ADD ( V a l c (x,y) ,SFIND (y) ) ;
QUNION (k,SFIND (y) ) ;
SUNION (k,SFIND (y) ) ;
(x,y) := enter(sFrND(x));
end;
roots := roots u(k};
end end end end BRANCH;
and
2
var(M) < - n-l1 4n
2
= O(n
2
1.
m = l (n-m)
6. REMARKS
5. Jour. of Research of
Edmonds, J., " O p t i m u m Branchings,"
the NationaZ Bureau of Standurds, 71B, 1967, pp. 233-240.
6. Erdijs, P. and A. Renyi, "On t h e Evolution of Random Graphs,"
Pub. of t h e Math. I n s t . of the Hung. Acad. of Sciences, 5 ,
1960, pp. 17-60.
11. Spira, P., "A New Algorithm for Finding All Shortest Paths
2 2
in a Graph of Positive Arcs in Average Time O(n log n),"
SIAM J . Cornput., 2, 1973, pp. 28-32.
13. Tarjan, R., "Efficiency of a Good but Not Linear Set Union
Algorithm," J . ACM, 1975, pp. 215-225.
14. I 1 I
Yao, A., "An 0 ( E log log Vl 1 Algorithm for Finding
Minimum Spanning Trees," Info. P O C . Letters, 4 , 1975,
pp. 21-23.