shortest path algorithms using dynamic breadth-first search
TRANSCRIPT
Shortest Path Algorithms Using Dynamic Breadth-First Search* Donald Goldfarb Department of Industrial Engineering and Operations Research, Columbia University, New York, New York, 10027
Jianxiu Hao and Sheng-Roan Kai GTE Laboratories Incorporated, 40 Sylvan Road, Waltham, Massachusetts 02254
A new O(nm) label-correcting algorithm is presented for finding shortest paths from a given node to all other nodes in a network of n nodes and m arcs or finding a directed cycle of negative length. In this algorithm, a node is scanned on the k-th scanning step only if its “label depth”-i.e., the length of the path corresponding to the distance label - equals k . Variants of this algorithm are discussed. and computational results show that several of these are very efficient. A new criterion for detecting a negative cycle that is also based on the label depth of a node is given. and Computational tests show that it is extremely effective.
1. INTRODUCTION
We consider the problem of finding directed shortest paths from a given node r to all other nodes in a network, or finding a directed cycle of negative length. The shortest path (SP) problem described above is a fundamental and important optimization problem as many combinatorial optimization and network flow problems can be either formulated directly as SP problems or require the solution of SP subproblems (e.g., see [6,10,12]).
During the last 3 decades, numerous algorithms have been proposed for solving the SP problem. For general surveys, see [2,4, 131. Many of these methods are variants of the well-known Bellman-Ford-Moore (BFM) label- correcting algorithm [1,5,11].
In this paper, we present yet another variant of the BFM algorithm. Our algorithm has a worst-case complexity of O(nrn) and, hence, from a complexity viewpoint, it is neither better nor worse than the best existing methods. How- ever, it is designed to scan as few arcs as possible while retaining an @inn)
“This research was supported in part by NSF grants DMS-8s- 12277 and CDR-84-21402 and ONR contract N0014-87-K0214.
NETWORKS, Vol. 21 (1991) 29-50 @ 1991 John Wiley & Sons, Inc. CCC 0028-3045/91/01029-022$04.00
30 GOLDFARB, HAO, AND KAI
time bound. Consequently, it is efficient in practice as well as in theory, as is borne out by our computational tests.
The key idea underlying our algorithnm is the use of the “label depth” of a node, which is defined as the number of arcs in the path used to determine the current “distance” label of that node, to decide if a node should be scanned. Like breadth-first search, our algorithm performs a sequence of steps in which, on step k , only those nodes with depth (label depth in our algorithm) equal to k are scanned. Because the label depth of a node can change in our shortest path algorithm, we call it the Dynamic Breadth-First Search (DBFS) algorithm. We also use the label depths of nodes to provide a very effective criterion for detecting a negative cycle if one exists in the network.
In the next section, we introduce some preliminaries and review the BFM algorithm. The DBFS shortest path algorithm is presented and analyzed in Section 3. In Section 4, we discuss several variants of the DBFS algorithm that are designed to further reduce the number of nodes scanned, including one that is based on the simplex method. In Section 5 , we present the results of computational tests comparing the DBFS algorithm, variants of it, and other variants of the BFM algorithm on SP problems without negative cycles. These results estabalish the efficacy of our approach. Finally, in Sections 6 and 7, we present a new criterion for detecting negative cycles and some computational results that demonstrate that it is extremely effective.
2. PRELIMINARIES AND LABEL-CORRECTING ALGORITHMS
Let G = (N,A) denote a finite directed graph having node-set N of cardinality n and arc-set A of cardinality m. For each arc ( u , v ) E A , let cu,, be its length, which may be positive, zero, or negative. Given a fixed node r E N , called the root, the shortest path (SP) problem is to find directed paths from r to all other nodes in G of shortest length or to find a directed cycle of negative length (negative cycle). For the moment we shall assume that there is no negative cycle in G. The case where there are negative cycles is deferred until Section 6.
For each node u E N , we shall define its forward star or adjacency Zist as F(u) = { v E NI ( u , v ) E A } and use y*(u) to denote the length of a shortest path from r to u. From the principle of optimality of dynamic programming, these shortest path lengths satisfy the system of equations:
y ( v ) = minb(u) + cu,,l u # v , ( u , v ) E A } for all v E N\{r},
where y ( r ) = 0. The BFM algorithm solves this system by initially setting
SP ALGORITHMS USING BREADTH-FIRST SEARCH 31
and then successively computing better and better approximations yl(v) 2
yz(v) 2 y3(v) 2 . . . to y*(v) from
It is easily shown that this process terminates with yk(v) = y*(v), for all v E N, for k i n - 1 if and only if there are no negative cycles.
In the BFM algorithm, y k ( v ) is called the label of node v. Observe that during the k-th label-correcting step old labels yk(u), u # v are used in (2) to compute an improved label yk+,(v) for node v even if improved labels Yk+,(u) have already been computed for some nodes u.
As in successive approximation methods for solving systems of linear equa- tions, it is preferable to use improved labels if they are available during a label- correcting pass (the Gauss-Seidel method) instead of always using old labels (the Jacobi method). This is the idea behind several variants of the BFM method, including one due to Yen [15] that processes an ordered list of nodes alternatively forwards and backwards. During a forward (backward) scan, only the inward arcs of the node being scanned whose tails come before (after) it in the node list, and, hence, which have improved labels, are scanned. Conse- quently, each scan processes, on the average, half of the arcs in the network. Another variant, the Partitioning Shortest Path (PSP) algorithm due to Glover et al. [7] scans only the outward arcs of nodes whose distance labels were improved during the last step and uses improved labels as soon as they become available.
3. THE DYNAMIC BREADTH-FIRST SEARCH ALGORITHM
For each node v E N , let the smallest number of arcs in a shortest path from r to v be denoted by l(v) and let L ( k ) = {v E Nll(v) = k}. We shall say that a label-correcting algorithm satisfies Property D (D stands for “depth”) i f , for all k, on the k-th label-correcting step (or scan), all nodes in L(k) - i.e.. the forward stars of such nodes - are scanned. Clearly, any label-correcting algo- rithm that starts with the labels specified in (1) and satisfies Property D will terminate after at most n - 2 steps. Also, let the label depth of a node v , which we denote by d(v), be defined as the number of arcs in the path used to determine a label y(v).
The BFM algorithm satisfies Property D, but many variants of it do not. For example, the PSP algorithm in its most basic form that uses current labels and maintains a queue of scan-eligible nodes - i.e., those nodes whose labels have improved - does not. By thinking of the queue of scan-eligible nodes as two queues in tandem in the PSP algorithm, the end of a step is determined by the emptying of the first queue, at which point the two queues are interchanged. This algorithm does not satisfy Property D because it allows d(v) to become greater than k + 1 prior to the k-th step and, hence, allows nodes to prematurely become permanently labeled. In particular, a node v with shortest path depth
32 GOLDFARB, HAO, AND KAI
l(v) = k + 1 can become permanently labeled prior to step k , and, hence, such a node will not be scanned during step k .
Since such premature permanent labelings are fortuitous, it makes sense to scan on step k only those nodes with label depth k . This is the basic idea behind the DBFS algorithm given below. In it, p ( v ) denotes the predecessor of node v on the path used to determine the current node label y ( v ) . The set C1 contains nodes that are candidates for scanning on the current step, whereas C2 contains nodes that are candidates for scanning on the next step.
For the moment, we assume that the network has no negative cycles. In Section 6, we show how to modify the algorithm to detect negative cycles.
Algorithm DBFS
(0) Initialization : Set y ( v ) = c,,,, p ( v ) = r, and d ( v ) = 1, f o r all v E F ( r ) , and y ( v ) = a, p ( v ) = 0, and d ( v ) = 0, for all v 4 F(r) . Set y(r) = 0, C1 t F ( r ) , C2 t0, and k = 1.
If C1 = 0 , go to ( 3 ) ; otherwise select any node u E C1 and set C1 tC l \{u} . If d (u ) = k , go to (2) ; otherwise repeat this step.
For all v E F(u) , i f y , + cu,, < y,, set y , = y , + c,,, and p ( v ) = u, and if d ( v ) # k + 1, set C2 t C 2 U {v} and d ( v ) = k + 1. Return to (1).
If C2 = 0, stop; the SP problem is solved [ y ( u ) is the length of a shortest path f rom r to u and the tree of shortest paths can be recovered from p ( . ) ] . Otherwise, set C1 c C 2 , C2 t 0 and k t k + 1. Go to (1).
(1) Select a Node to Scan:
(2) Scan Forward Star of Selected Node:
( 3 ) Set Up Candidate Set f o r Next Stage:
Before proving that the DBFS algorithm satisfies Property D and, hence, that it has a worst-case complexity of O(mn), we note that d ( v ) in the algorithm is, in fact, the label depth of node v, if y ( v ) # a, since it is clear that d ( v ) is set equal to d ( u ) + 1 whenever y ( v ) is set equal to y ( u ) + cu,,. Moreover, at the start of step k , C1 consists entirely of those nodes u with d ( u ) = k , since on the previous step these nodes and only these nodes are put into C2. Since during step k a node u in C1 is scanned only if d ( u ) remains equal to k , the algorithm does what it was designed to do.
Lemma 1. At the start of step k , L (k ) C C1 and y ( v ) = y*(v) for all v E L(k) . Moreover, during step k , all nodes v in L(k) are scanned-i.e., Algorithm DBFS satisfies Property D.
Proof. It is clear from the initialization step that the lemma holds for k = 1. Now assume that it is true for k = k, and suppose that l ( v ) = I? + 1. Then, there is a shortest path from r to v that has (u,v) as its last arc and l(u) = k. By the induction hypothesis, at the start of iteration k u E C1, and u is scanned during
SP ALGORITHMS USING BREADTH-FIRST SEARCH 33
iteration k . Since there may be more than one shortest path to v of length k + 1. let u be the first node on such a path that is scanned by the algorithm. Before ii is scanned y(v) > y*(v); hence, y(v) will be set equal to y*(v) when u is scanned and v added to C2. Since C1 is set equal to C2 at the end of the iteration. the first part of the induction is proved. Since y(v) = y*(v), d(v) cannot increase during iteration k + 1; hence, d(v) = k + 1 during iteration k + 1 and node v will be scanned during that iteration. This completes the second part of the induction.
It now immediately follows from our remarks at the beginning of Section 3 and from the fact that each iteration of Algorithm DBFS requires at most O(m) operations that:
Theorem 1. Algorithm DBFS solves the SP problem in at most O(nm) time.
4. VARIANTS OF THE DBFS ALGORITHM
At any time during the execution of Algorithm DBFS, there is a unique tree T that is determined by the labeling process up to that point. Specifically, T is defined by the list of predecessor pointers p ( u ) . If we let yT(v) denote the length of the path in T from r to v, then the label y(v) is said to sharp if y(v) = v T ( v ) . In Algorithm DBFS, the labels y(v) are not necessarily sharp and the label depth d(v) is not necessarily equal to the depth of node v in T. If y(v) is not sharp, y T ( v ) < y(v); hence, the label of any node, say y ( w ) , that is reduced by scanning v, cannot become equal to y*(w), and clearly the effort expended in scanning v is wasted.
The number of nodes, and, hence, arcs, scanned by Algorithm DBFS can be reduced if only nodes with sharp labels are scanned. An efficient way to implement this strategy is through the simplex method. In the simplex method for the SP problem, T is the basis tree, the label y(v) = yT(v) of node v is the dual variable corresponding to that node, and d(v) is the depth in T of node
In step (2) of a DBFS simplex variant, if y(u) + cU,” < y(v) [i.e., the reduced cost C,,,, = c,,,,, + y(u) - y(v), of arc (u,v) is negative], then the labels of all nodes in the subtree T, that “hangs” from node v are decreased by lCu,v/, not just y(v). Consequently, the number of pivots (i.e., multinode label updates) required by the simplex variant is, in general, less than the number of single- node label updates required by the standard label-correcting version of Algo- rithm DBFS. For implementational purposes, usually a preorder thread and a reverse preorder thread are maintained in addition to the predecessor pointer p(v) and the depth d(v). This facilitates updating the basis tree T and the labels y(w) and depths d ( w ) of all nodes w in the subtree T,. Aside from these updating aspects, our DBFS simplex variant is identical to Algorithm DBFS, except that (i) we use a marker m(v) rather than d(v) to indicate whether or not v has been put into C2, since in stage k , d(v) = k + 1 does not guarantee that in v is in C2; (ii) we set m(v) = d(v) for all v E N , in step (0); and (iii) we replace step ( 2 ) by
V.
34 GOLDFARB, HAO, AND KAI
( 2 ’ ) For all v E F ( u ) , i fy (u) + cu,, I y ( v ) and m ( v ) # k + 1 , set C2 t C 2 U {v} and m ( v ) = k + 1 ; and i f y ( u ) + cU,” < y ( v ) , do a simplex pivot with (u ,v ) as the entering arc and the current basic arc whose head is v as the leaving arc, and update T and y ( w ) and d ( w ) for all w E T,. Return to ( 1 ) .
The major drawback of the simplex variant of the DBFS algorithm is that each pivot is expensive. Not only are the labels and depths of all nodes in the subtree T, updated, but the list structures, which are used to represent the basis tree T , need to be updated. In an attempt to avoid scanning the forward stars of nodes whose labels are not sharp, we also implemented a variant of Algorithm DBFS, in which the depth criterion “d(u) = k” for scanning a node after removal from the candidate set C1 was replaced by “ d ( p ( u ) ) = k - 1.” In the next section, this variant is referred to as Algorithm DBFS1. We also tried using the criteria “ d ( p ( p ( u ) ) ) = k - 2” (Algorithm DBFS2), “ d ( p ( p ( p ( u ) ) ) ) = k - 3” (Algorithm DBFS3), and “ d ( p ( p ( p ( p ( u ) ) ) ) ) = k - 4” (Algorithm DBFS4). Note that in order to efficiently implement Algorithms DBFS2, DBFS3, and DBFS4 we defined p ( r ) = r l and d(r1) = - 1 , p ( r 1 ) = r 2 and d(r2) = -2, and p ( r 2 ) = r3 and d(r3) = -3.
The likelihood that a node is sharp increases as the number predecessors used in the depth test is increased, but so does the work involved. As our computational results in the next section show, the greater the depth of the optimal shortest path tree, the more worthwhile it is to check further along the predecessor path of a node. We note that Desrochers [3] suggested following the predecessor path for a node all the way back to r in order to determine whether or not the label of a node is sharp. Clearly, the DBFS-simplex variant achieves the same effect with more efficiency unless the optimal shortest path tree is shallow. We also note that the DBFS simplex variant is essentially a specialization to the shortest path problem of the network simplex algorithm using the “restricted most negative” rule proposed by Roohy-Laleh [ 141 to prevent exponentially long sequences of degenerate pivots [S].
5. COMPUTATIONAL COMPARISONS
We computationally compared the performance of the DBFS algorithm and its variants described in the previous section with the BFM and PSP algorithms. In this section and those that follow, when we refer to the BFM algorithm we shall mean that version of the standard method that starts with the labels specified in ( 1 ) and that scans the forward stars of all nodes sequentially, always using current and, hence, possibly improved labels. All of the tests reported in this section were on shortest path problems without negative cycles. These problems were randomly generated as follows.
The number of nodes, n , the approximate maximum depth, d , of a node in the optimal tree T * of shortest paths, and the approximate average in-degree, 6, of a node, and average cost, C, of an arc in G were specified. Let t! = [ (n - l ) / d ] and ran[l ,q] represent a random integer uniformly distributed be- tween 1 and q. Specifying node 1 as the root, we first constructed an optimal
SP ALGORITHMS USING BREADTH-FIRST SEARCH 35
tree T * with approximate maximum depth d by assigning node 1 to layer zero and then successively choosing ran[ 1,2t] nodes randomly from those nodes in N\{l} that had not yet been selected, putting them in the next layer, and connecting each of them by a backward arc to a random node in the current layer. Then, for each node, an additional ran[1,26] arcs into it were generated with unique but randonm tails. Finally, each arc in T* was assigned a cost of zero and each arc not in T* was assigned a positive cost ran[l,2c].
By appropriately choosing node potentials ~ ( u ) for all nodes u E N , and replacing each arc cost cU.&. by ct4.,, + ~ ( u ) - ~ ( v ) , we can make some of the arc costs negative. Since all the algorithms that we tested are totally unaffected by the choice of ~ ( u ) , our test results also apply to problems with negative arc costs, even though the arc costs actually generated were all nonnegative.
For our computational tests we generated 200 random problems, comprising 10 replicates of 20 different problem types. The input specifications for each problem type and the average number of arcs, m , in the network, and the average maximum depth of T *, 2, are presented in Table I. The input parameter value of 25 for d has an asterisk next to it for the first four problem types, because in those problems, instead of assigning a cost of zero to each arc in T * , a cost of ran[l,2E] was assigned. Consequently, in these cases. T " was not an optimal tree of shortest paths, and the problems generated were similar to ones that would have resulted had we generated a random network with nonnegative costs, i.e., one that did not try to specify the maximum depth of an optimal tree. In such random networks, the longest length of a shortest path is very likely to be quite short, as the values of d for problem types 1-4 in Table I show.
In Table 11, we present the average time it took the DBFS algorithm, the variants of it described in Section 4, the BFM algorithm, and the PSP algorithm to solve the 10 problems of each problem type. The times given are CPU seconds for the SUN-3 and do not include input and output times. All algorithms were coded in FORTRAN and were compiled using the F 77-SUN FORTRAN Compiler (without optimization).
The ratios of the average times reported in Table I1 with respect to the average times required by the PSP algorithm are presented in Table 111. The results reported in Tables I1 and 111 show that there is very little difference between the performance of the DBFS and PSP algorithms on the problems tested. However, as the density of the network, or equivalently, the average degree of a node, increases, the performance of the DBFS algorithm relative to that of the PSP algorithm improves. The results for all the DBFS variants also indicate that as the density of the network increases it becomes more worthwhile to do extra work to try to avoid scanning nodes whose labels are not sharp and, hence, whose true depth at iteration k is not equal to k . As these tables illustrate, the relative improvement increases as more distant predecessors are checked and is greatest for the simplex variant, DBFSS, in which all labels are sharp.
As the total times in these tables show, Algorithm, DBFS4 was, on the average, about 20% faster than was the PSP algorithm. It is interesting that
36 GOLDFARB, HAO, AND KAI
TABLE I. Problem attributes.
Problem n d d E A d
1 1000 2 1000 3 1000 4 1000
5 lo00 6 1000 7 1000 8 1000
9 1000 10 1000 11 1000 12 1000 13 1000 14 1000 15 1000 16 1000
17 2500 18 2500 19 5000 20 5000
9 14 19 24
9 14 19 24
9 14 19 24
9 14 19 24
5 11 6
11
25 * 20,000 25 * 20,000 25 * 20,000 25 * 20,000 25 20,000 25 20,000 25 20,000 25 20,000
50 20,000 50 20,000 50 20,000 50 20,000
100 20,000 100 20,000 100 20,000 100 20,000
25 20,000 100 20,000 25 20,000
100 20,000
9795 11.1 14,384 10.4 20,130 11.0 25,335 11.5
9719 24.3 14,408 23.2 20,025 24.0 25,408 23.9
9764 47.2 14,451 49 .O 20,309 48.2 25,296 44.2
9754 95.2 14,445 95.2 19,946 91.7 25,408 94.1
14,244 24.8 29,942 98.2 28,423 24.4 59,912 96.5
our simplex variant, DBFSS, was not much slower than were any of the other algorithms tested; in fact, it was only about 10% slower than was the BFM algorithm on the average. As we shall see in the next section, Algorithm DBFSS is particularly effective when there are negative cycles.
For each set of 10 runs whose average CPU time is reported in Table 11, we present in Tables IV-VI the average number of nodes whose forward stars are scanned, the average number of nodes that become candidates for scanning [i.e., which are put on the candidate queue (Cl/C2)], and the average number of labels that are updated, respectively.
We gathered these statistics by repeating all of the timing runs reported in Table 11, after adding the appropriate code for each algorithm for this purpose. It is easily verified from Tables I1 and IV that the CPU times for Algorithm PSP and all of the DBFS algorithms other than the simplex variant are roughly proportional to the numbers of arcs scanned - i.e., to the numbers of nodes scanned multiplied by the average out-degree of a node.
The ratio of the total average number of nodes scanned to the total average number of nodes that are candidates (see Tables IV and V) is an interesting measure of how effective an algorithm is at only scanning nodes that “need” to be scanned - the smaller the ratio, the more effective the algorithm. This ratio is 1.0 for the PSP algorithm, since every node that is added to Cl/C2 is scanned. For the DBFS algorithm and variants of it, this ratio decreases as more effort is expended to avoid scanning nodes whose labels are not sharp.
TA
BL
E 1
1.
Prob
lem
B
FM
PSP
DB
FS
DB
FSl
DB
FS2
DB
FS3
DB
FS4
DB
FSS
Ave
rage
CPU
tim
e (i
n se
cond
s).
1 2 3 4 5 6 7 8 9 10
11
12
13
14
15
16
17
18
19
20
Tot
al
0.16
6 0.
238
0.32
8 0.
398
0.30
6 0.
388
0.53
6 0.
651
0.42
4 0.
616
0.74
3 0.
879
0.61
9 0.
799
0.97
4 1.
219
0.51
0 1.
778
1.01
5 3.
462
16.0
49
0.13
8 0.
203
0.27
8 0.
346
0.28
4 0.
347
0.49
7 0.
607
0.36
3 0.
545
0.71
4 0.
855
0. SO
6 0.
704
0.85
2 1.
134
0.41
2 1.
408
0.81
3 2.
758
13.7
63
0.14
0 0.
203
0.27
8 0.
339
0.28
5 0.
350
0.48
7 0.
596
0.38
1 0.
553
0.69
6 0.
842
0.50
8 0.
701
0.84
3 I.
123
0.43
1 1.
429
0.84
3 2.
780
13.8
08
0.12
9 0.
182
0.24
7 0.
301
0.24
6 0.
308
0.42
7 0.
518
0.32
0 0.
473
0.59
6 0.
711
0.45
2 0.
614
0.74
6 0.
963
0.38
8 1.
259
0.75
7 2.
493
12.1
31
0.13
0 0.
183
0.24
8 0.
298
0.22
3 0.
298
0.40
2 0.
496
0.30
4 0.
447
0.56
9 0.
663
0.43
5 0.
582
0.71
2 0.
910
0.37
6 1.
207
0.73
8 2.
361
11.5
91
0.13
2 0.
187
0.25
0 0.
301
0.22
6 0.
298
0.39
4 0.
477
0.29
7 0.
428
0.55
8 0.
652
0.42
7 0.
565
0.69
3 0.
863
0.37
1 1.
178
0.73
0 2.
306
11.3
32
0.13
4 0.
191
0.25
3 0.
304
0.22
7 0.
296
0.39
4 0.
473
0.29
7 0.
407
0.54
3
cn
W
0.26
4 0.
356
0.46
2 F B
0.64
8 1
0.54
8 t)
=i 0.
401
0.49
8
0.76
8 cn
!i
0.47
9 2
0.63
5 0.
814
R
0.63
1 0.
949
0.41
9 0.
601
0.55
3 0.
781
0.85
3 1.
161
0.37
3 0.
694
1.16
8 1.
705
0.73
4 1.
368
2.26
7 3.
318
11.1
97
17.4
17
D
0
0.68
0 0.
969
-I
w
00
G) P
Prob
lem
B
FM
PSP
DB
FS
DB
FSl
DB
FS2
DB
FS3
DB
FS4
DB
FSS
z 1
1.20
5 1.O
OO
1.01
6 0.
940
0.94
3 0.
961
0.97
8 1.
920
%i
TAB
LE 1
11.
Rat
io o
f av
erag
e C
PU
tim
e to
PSP
CPU
tim
e.
2 1.
168
1.OOO
0.
998
0.89
5 0.
897
0.91
8 0.
939
1.74
8 m
3
1.17
7 1.O
OO
0.99
7 0.
887
0.89
0 0.
898
0.90
9 1.
659
1
D
-0
4 1.
152
1 .OO
O 0.
981
0.87
1 0.
864
0.87
1 0.
879
1.58
5
D
5 1.
081
1.OOO
1.
006
0.86
8 0.
821
0.79
7 0.
801
1.41
4 6
1.12
0 1.O
OO
1.00
9 0.
888
0.86
0 0.
860
0.85
3 1.
436
2
7 1.
077
1.OOO
0.
980
0.85
7 0.
808
0.79
2 0.
792
1.30
3 0
8
1.07
2 1 .O
OO
0.98
2 0.
854
0.81
7 0.
786
0.78
0 1.
266
9 1.
168
1.OOO
1.
049
0.88
0 0.
838
0.81
7 0.
817
10
1.13
0 1.O
OO
1.01
4 0.
868
0.81
9 0.
785
0.74
7 1.
165
11
1.04
1 1.O
OO
0.97
5 0.
835
0.79
7 0.
782
0.76
1 1.
140
12
1.02
8 1.O
OO
0.98
5 0.
832
0.77
5 0.
763
0.73
8 1.
110
13
1.22
5 1.
000
1.00
4 0.
894
0.85
9 0.
844
0.82
9 1.
187
14
1.13
5 1 .O
OO
0.99
5 0.
872
0.82
7 0.
802
0.78
5 1.
109
15
1.14
4 1.O
OO
0.99
0 0.
876
0.83
6 0.
813
0.79
8 1.
137
16
1.07
5 1.O
OO
0.99
1 0.
849
0.80
2 0.
761
0.75
2 1.
023
17
1.23
9 1 .O
OO
1.04
7 0.
942
0.91
2 0.
900
0.90
6 1.
685
18
1.26
3 1.
000
1.01
5 0.
894
0.85
8 0.
837
0.83
0 1.
212
19
1.24
8 1 .O
OO
1.03
7 0.
931
0.90
8 0.
898
0.90
3 1.
682
20
1.25
5 1.O
OO
1.00
8 0.
904
0.85
6 0.
836
0.82
2 1.
203
Tot
al
1.16
6 1.O
OO
1.00
3 0.
881
0.84
2 0.
823
0.81
4 1.
266
1.31
9 E
TA
BL
E I
V.
Prob
lem
B
FM
PSP
DB
FS
DB
FSl
DB
FS2
DB
FS3
DB
FS4
DB
FSS
1 23
60
2003
19
68
1727
16
85
1679
16
79
1686
2
2582
21
93
2119
18
29
1785
17
78
1778
18
06
3 27
00
2249
21
88
1883
18
53
1848
18
47
1900
4
2699
22
91
2189
18
92
1846
18
40
1840
19
12
Ave
rage
num
ber
of n
odes
sca
nned
.
5 6 7 8 9 10
11
12
13
14
15
16
17
18
19
20
Tot
al
4407
41
55
4412
43
85
5804
64
09
5896
58
46
7724
77
97
7417
76
83
9960
19
,394
19
,760
37
,537
168,
927
4239
37
78
4111
40
46
5420
59
52
5829
57
29
7547
76
79
7074
76
05
9120
18
,026
18
,177
35
,346
158,
414
4157
37
25
3950
39
24
5547
59
21
5593
55
69
7383
75
10
6883
74
32
9202
17
,907
18
,183
34
,972
156,
322
3440
31
69
3365
33
32
4468
49
15
4676
46
02
6333
63
99
5959
62
50
7814
15
,150
15
,407
30
,245
132,
855
3129
29
89
3 105
31
28
4092
45
11
4373
42
20
5894
59
09
5579
58
09
7185
14
,191
14
,271
27
,857
123,
411
2966
28
92
2999
29
74
3919
42
41
4233
41
01
5653
56
35
5341
54
47
6872
13
,582
13
,806
26
,600
118,
406
2914
28
33
2960
29
20
3825
39
60
4065
39
25
5437
54
19
5177
53
20
6746
13
,217
13
,465
25
,770
11 5,
097
2771
26
96
2821
28
29
3412
35
60
3624
35
82
4397
44
92
4462
44
62
5678
10
,450
9,
660
18,2
95
94,4
95
TA
BL
E V
. A
vera
ge n
umbe
r of
can
dida
te n
odes
. P
P 0
Prob
lem
B
FM
PSP
DB
FS
DB
FSl
DB
FS2
DB
FS3
DB
FS4
DB
FSS
1
7992
20
03
2449
23
86
2376
23
75
2374
23
45
m
2 77
92
2193
27
71
2697
26
91
2688
26
88
2781
3
8091
22
49
2960
28
85
2878
28
77
2877
30
75
4 82
9 1
2291
30
53
2986
29
73
2973
29
73
3261
1
D
5 15
,584
42
39
4718
43
00
409 1
39
61
3927
37
15
-0
D
6 14
,985
37
78
4377
41
26
4027
39
65
3924
38
06
15,6
84
4111
47
50
4497
43
14
4240
42
16
4170
z
7 8 15
,184
40
46
4795
45
32
4419
43
02
4256
43
71
0
9 26
,273
54
20
6197
54
59
5195
50
68
4996
44
33
10
28,0
71
5952
67
08
6107
58
30
5624
53
74
4814
11
26
,573
58
29
6514
59
88
5788
56
91
5556
52
49
12
24,7
75
5729
65
98
604 1
57
70
5591
55
47
5344
13
49,9
50
7547
81
57
7563
72
59
7088
68
92
5633
14
48
,251
76
79
8426
77
80
7424
72
13
7038
59
94
15
48,6
51
7074
79
37
7467
72
16
704 1
69
10
6191
16
49
,150
76
05
8548
78
54
7561
72
64
7169
64
20
17
41,4
83
9120
10
,244
94
87
9048
88
22
8732
80
15
18
130,
197
18,0
26
20,0
28
18,4
44
17,8
24
17,3
82
17,1
08
14,4
12
19
85,4
82
18,1
77
20,3
15
18,7
93
18,0
48
17,7
30
17,4
71
16,2
50
20
260,
947
35,3
46
39,2
55
36,7
61
35,0
51
34,1
20
33,4
49
28,3
65
Tot
al
913,
406
158,
414
178,
800
166,
153
159,
783
156,
115
153.
477
138.
644
E F
TA
BL
E V
I.
Ave
rage
num
ber
of l
abel
upd
ates
.
Prob
lem
B
FM
PSP
1 39
27
3175
2
4840
37
85
3 54
86
4240
4
5717
45
72
5 63
32
5739
6
6586
56
51
7 72
98
6366
8
7749
65
98
9 79
15
7093
10
91
03
8113
11
92
31
8384
12
95
40
8586
13
10
,141
95
03
14
10,8
77
10,1
25
15
11,1
85
9863
16
11
,523
10
.714
17
12
,961
1 1
,544
18
26
,432
23
,622
19
25
,737
23
,077
20
51
,781
46
,634
T
otal
24
4,36
1 21
7,38
4
DB
FS
3162
36
95
4193
44
69
5665
55
80
6191
64
29
7223
80
76
8105
83
85
9367
99
19
9647
10
,470
11
,642
23
,529
23
,125
46
,310
21
5,16
4
DB
FSl
DB
FS2
DB
FS3
DB
FS4
DB
FSS
3054
35
51
4036
43
26
5153
52
31
5827
60
58
6365
73
34
7428
76
76
8613
91
21
8992
95
98
10,6
91
21,5
65
21,2
09
42,9
96
198,
824
3038
35
41
4026
43
07
4927
51
16
5626
59
29
6075
70
27
7206
73
75
8260
87
22
8705
92
65
10,2
00
20,8
49
20,3
64
41,1
39
191,
697
3036
35
37
4025
43
06
4787
50
51
5547
58
05
5939
68
12
7 102
72
87
8076
85
03
8520
89
57
9961
20
,363
20
,022
40
,148
18
7,78
4
3036
35
37
4025
43
06
4752
50
08
5520
57
56
5866
65
56
6964
71
40
7875
83
24
8383
88
57
9868
20
,076
19
,751
39
,455
18
5 ,05
5
3244
38
44
4377
46
83
5333
56
25
6161
65
00
6490
74
90
7713
80
75
8590
92
39
9356
97
68
10,9
00
22,4
94
21,7
51
43,0
33
204,
756
-
42 GOLDFARB, HAO, AND KAI
Specifically, this ratio is 0.891 for DBFS, 0.800 for DBFS1, 0.772 for DBFS2, 0.758 for DBFS3, 0.750 for DBFS4, and 0.682 for DBFSS. In the BFM algo- rithm, all nodes are considered in sequence; every node is a candidate when it is considered. The BFM algorithm has a low ratio of scanned to candidate nodes, not because it scans few nodes (it scans more nodes than any of the other algorithms), but rather because it considers so many nodes as candidates.
The average numbers of label updates required by the algorithms are reported in Table VI. These results are not very surprising except for those for Algorithm DBFSS. For this algorithm the number of updates computed for a run was the sum of the numbers of nodes in the subtrees T,, scanned over all pivots, i.e., every time a label (dual variable) changed it was counted. When compared with the most efficient algorithm, Algorithm DBFS4, Algorithm DBFSS is seen not to update many labels needlessly. In fact, in our tests, Algorithm DBFSS always updates fewer labels than does Algorithm BFM, and except on the first four sets of problems (which have low maximal depth), Algorithm DBFSS updates fewer labels than do both the generic PSP and DBFS algorithms.
6. NEGATIVE CYCLES
It is well known that if during the k-th stage of the BFM algorithm the node labels of at least n - k distinct nodes decrease, then the network contains a negative cycle (e.g., see [lo]; Theorem 11.2). This criterion also applies to the DBFS algorithm and its variants and to other polynomial-time variants of the BFM algorithm such as the PSP algorithm.
By using the label depth of a node, a much weaker condition can be given to test for a negative cycle in the DBFS, PSP, and BFM algorithms, enabling these algorithms to terminate much earlier when such cycles are present. If we let n( j ) equal the number of nodes with label depth d(v) = j , this condition is embodied in the following theorem.
Theorem 2. If during stage k of Algorithms DBFS (or any of its variants), PSP, or BFM, n( j ) = 0 for some j = 1, . . . ,k - 1, then the network contains a negative cycle.
Proof. This theorem is a consequence of the fact that for all of these algo- rithms y(v) = y*(v) for all v E L(k) at the start of stage k and, thereafter, if
rn there are no negative cycles in the network.
Clearly, the condition of this theorem will be satisfied if the labels of at least II - k distinct nodes decrease during stage k . Because the label depth of a node can only increase in the DBFS algorithm and if it does so during stage k it becomes equal to k + 1, implementing this condition within Algorithm DBFS is particularly simple. Specifically, we need to initialize n(1) = IF(r)l , n(0) = n - n(l), and n( j ) = 0, j = 1, . . . ,n in step (0) of Algorithm DBFS and replace the “if d(v) # k + 1” clause of step (2) by
SP ALGORITHMS USING BREADTH-FIRST SEARCH 43
Z f d ( v ) f k + 1, set n ( d ( v ) ) c n ( d ( v ) ) - 1.
If n ( d ( v ) ) = 0, stop; the network contains a negative cycle. Otherwise, set C2 t C 2 U { v } , d ( v ) = k + 1, and n ( k + 1) = n(k + 1) + 1.
It is obvious that Algorithm DBFS, modified in the above manner to detect negative cycles, satisfies Theorem 1 whether or not such cycles are present in the network. If the algorithm terminates because of the presence of a negative cycle, one such cycle can be identified by tracing a path from node v [corre- sponding to n(d(v)) = 01 using the predecessor pointer, marking each node visited, until a node is reached that was previously visited and consequently marked.
In the simplex variant of the DBFS algorithm, as in all shortest path simplex algorithms, a negative cycle is easily detected since y (u ) will decrease if and only if the fundamental cycle determined by the entering arc (u,v) and the basis tree T is a negative cycle. Consequently, shortest path simplex algorithms are particularly effective in detecting such cycles.
To implement the condition of Theorem 2 within the PSP algorithm and the BFM algorithm using current (i.e., improved) labels, we need to maintain and update the label depths of all nodes as is done in Algorithm DBFS. When the label y ( v ) and label depth d(v) of a node is changed during stage k , it is necessary to check whether d(v) (the old label depth) is less than k , as well as checking if n ( d ( v ) ) = 0. It is also necessary to check if n ( k ) = 0 at the start of stage k .
During stage k of the BFM and PSP algorithms, it is possible for n(j) to equal zero for j > k while there are nodes v with d(v) > j , even if the network has no negative cycles. This can occur because d(v) is not the “actual” depth of node v in the tree determined by the predecessor array p ( .). Therefore, it can appear form the label depth that there is a break, and, a cycle, in this tree when there is none.
To illustrate this, consider the network corresponding to the directed graph G = (N,A), where N = {1,2,3,4,5,6,7}, A = A l U A4, A l = {(1,2),(1,5),(2,3), (3,4),(4,7),(5,4),(7,6)}, and A4 = {(1,3),(1,4),(3,6)}, and cu,,. = 1 for all arcs ( u , v ) E A l and c,,,, = 4 for all arcs (u ,v ) E A4. If the BFM and PSP algorithms are applied to this network, where the initial queue of scan eligible nodes in the latter algorithm is {2,3,4,5}, then during stage 1 of the BFM algorithm and during stage 2 of the PSP algorithm immediately after arc (7,6) is scanned and node 6 is relabeled, d(1) = 0, 4 2 ) = 4 5 ) = 1, 4 3 ) = 4 4 ) = 2, 4 7 ) = 4, and 4 6 ) = 5. This situation cannot occur in the DBFS algorithm because d(v ) 5 k + 1 for all nodes v during stage k .
7. COMPUTATIONAL COMPARISONS ON NETWORKS WITH NEGATIVE CYCLES
We now present results of computational tests comparing versions of the BFM, PSP, and DBFS algorithms that use the depth condition of Theorem 2 to detect a negative cycle with versions that use the standard condition for detecting such a cycle based on the number of node labels that change at each stage. The former versions are distinguished by a “D” at the end of their names.
44 GOLDFARB, HAO, AND KAI
We also included the simplex variant DBFSS of the DBFS algorithm in our tests.
For our tests, we generated sets of 10 random problems for each of 24 different problem types, using the generation procedure described in Section 5. Specifically, the 24 problem types were obtained by generating the four types of problems listed as Problems 5-8 in Table I and then adding one arc of negative cost between a randomly chosen pair of nodes in the “optimal” tree T*, a specified number of arcs apart in T*. For each of the four original problem types (without negative cycles), we obtained six different types of problems by setting the negative cost of the additional arc to -1, -3000, or - 10,000, and specifying the difference in depths of the head and tail of this arc as either 5 or 15 and, hence, the length of the resulting negative cycle as 6 or 16. The attributes of the resulting 24 problem types are listed in Table VII.
In the first eight problems, the created cycle had a cost of -1; hence, the networks in these problem had exactly one cycle. Because of the large negative cost of the created cycle in the remaining problems, the networks in these problems had many negative cycles. In general, those problems with a negative
TABLE VII. Problem attributes (with negative cycles). Cycle Cycle
Problem cost length n m E
1 2 3 4
5 6 7 8 9
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
-1 -1 -1 -1
-1 -1 -1 -1
- 3000 - 3000 - 3000 -3000 -3000 - 3000 -3000 - 3000
- 10,000 -10,Ooo - 10,000 - 10,000 - 10,000 -10,Ooo -10,000 - 10,000
6 6 6 6
16 16 16 16 6 6 6 6
16 16 16 16 6 6 6 6
16 16 16 16
1000 1000 1000 1000
1000 1000 1000 1000
1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000
9719 14,408 20,025 25,408
9719 14,408 20,025 25,408
9719 14,408 20,025 25,408
9719 14,408 20,025 25,408
9719 14,408 20,025 25,408
9,719 14,408
25,408 20,025
20,000 20,000 20,000 20,000
20,000 20,000 20,000 20,000 20,000 20,000 20,000 20,000 20,000 20,000 20,000 20,000 20,000 20,000 20,000 20,000 20,000 20,000 20,000 20,000
SP ALGORITHMS USING BREADTH-FIRST SEARCH 45
cycle cost of -10,000 had more negative cycles than did the problems with a negative cycle cost of -3000.
In Table VIII, we present the average time it took each of the seven algo- rithms to detect a negative cycle in the 10 problems in each problem type. The times given and CPU seconds for the SUN-3, and all codes were compiled using the F77-SUN FORTRAN compiler (with optimization). The times given do not include the time required to identify a negative cycle when one was detected.
The simplex variant DBFSS was clearly the best-performing algorithm, with Algorithm DBFSD a close second. On the average, the versions of the DBFS and PSP algorithms that used the depth condition to detect a negative cycle- henceforth, referred to as “D-versions” - were approximately 30 times faster than were the versions that detected a negative cycle based on the number of label changes. The latter versions took extremely long amounts of time to solve the last 16 types of problems-i.e., those with many negative cycles. As can be seen from Table IX, which gives the average number of stages for each
TABLE VIII. Average CPU time (before detecting a negative cycle).
Problem BFM BFMD PSP
1 4.578 2 7.494 3 5.834 4 9.260 5 4.944 6 6.184 7 7.860 8 8.938 9 5.962
10 6.128 11 4.457 12 5.368 13 6.058 14 7.776 15 2.126 16 6.572 17 2.214 18 1.688 19 0.572 20 0.708 21 1.842 22 1.560 23 0.445 24 0.542
0.438 0.514 0.680 0.694 0.418 0.478 0.608 0.657
0.352 0.390 0.529 0.570
0.388 0.394 0.530 0.567
0.278 0.312 0.384 0.380 0.272 0.320 0.373 0.398
1.020 2.996 2.048 4.137 1.480 2.172 3.502 3.838
12.940 16.612 23.140 25.646
11.108 15.154 21.728 22.718 12.852 15.326 19.308 18.156 12.384 15.278 17.552 21.252
PSPD DBFS DBFSD DBFSS
0.316 0.406 0.529 0.570 0.320 0.416 0.528 0.572
0.338 0.414 0.534 0.579
0.336 0.410 0.528 0.592 0.282 0.334 0.398 0.412 0.266 0.332 0.396 0.435
1.006 2.928 1.962 4.054
1.466 2.120 3.394 3.731
12.250 14.948 20.234 21.279
9.966 14.438 19.170 19.786 11.010 12.236 11.390 12.150
10.508 12.340 14.678 15.074
Total 109.11 10.92 302.35 10.24 252.12
0.262 0.342 0.446 0.496 0.258 0.344 0.450 0. 505
0.278 0.344 0.456 0.520
0.278 0.356 0.448 0.523 0.228 0.292 0.350 0.376 0.236 0.292 0.332 0.384
8.80
0.242 0.310 0.374 0.462 0.286 0.366 0.458 0.507 0.246 0.294 0.352 0.406
0.246 0.320 0.396 0.443 0.216 0.256 0.332 0.394 0.214 0.282 0.350 0.400
8.15
46 GOLDFARB, HAO, AND KAI
be seen from Table IX, which gives the average number of stages for each algorithm and problem type, these versions took a long time to solve all problem types because so many stages were necessary before a negative cycle could be detected. These algorithms required fewer stages for the last 16 types of prob- lems-i.e., those with many cycles- than for the first eight types of problems- i.e., those with exactly one cycle. But as Tables X and XI show, the number of nodes that were scanned and nodes that were candidates increased substan- tially for these algorithms when the number of negative cycles in the network increased.
These tables also show that the D-versions of the DBFS and PSP algorithms, on the other hand, performed slightly better, in general, the more negative cycles there were in the network, as did Algorithms BFMD and DBFSS. More- over, a comparison with the results reported in Section 5 shows, taking into account the fact that those results were obtained from code that was compiled without optimization, the performance of all of the “D” algorithms and Algo- rithm DBFSS does not degrade when there are negative cycles.
TABLE IX. Average number of stages (before detecting a negative cycle). Problem BFM BFMD PSP PSPD DBFS DBFSD DBFSS
1 935 2 793 3 893 4 825 5 907 6 896 7 887 8 864
9 198 10 131 11 70 12 71
13 228 14 196 15 33 16 90 17 62 18 31 19 8 20 9
21 50 22 30 23 7 24 7
Total 8221
26 970 28 970 29 24 925 25 924 27 27 970 29 970 30 24 933 26 932 28 22 950 34 949 34 21 937 32 937 34 20 922 29 924 31 18 920 29 92 1 30
10 594 16 576 18 8 498 12 459 14 8 496 12 461 13 7 413 11 370 12
11 524 17 496 18 8 533 14 55 1 15 8 486 12 456 13 7 384 11 336 13 6 448 8 402 10 5 390 7 349 9 5 331 6 222 8 5 244 5 206 8 6 429 8 392 10 6 351 7 334 9 5 276 6 284 8 4 290 6 247 8
29 1 14,214 390 13,668 429
11 12 11 14
21 21 20 20
13 10 8
10
14 14 11 12 9 7 7 9 9 9 9 9
290
TA
BL
E X
.
Prob
lem
B
FM
BF
MD
PS
P P
SPD
D
BF
S D
BF
SD
DR
FS
S
Ave
rage
num
ber
of n
odes
sca
nned
(be
fore
det
ectin
g a
nega
tive
cycl
e).
1
2 3 4 5 6 7 8 9 10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
Tot
al
40,1
86
85,4
33
38.4
81
73,2
32
49,9
32
57,4
75
64,5
10
67,9
11
125,
980
96,3
07
53,2
34
54,5
71
126,
918
121,
351
25,1
28
69,1
66
47,4
16
26,5
06
6800
72
66
39,9
85
25,0
91
5281
54
98
1.31
3.6S
8
4758
46
79
4693
45
96
463 1
45
20
4699
44
47
4675
40
63
4162
41
21
5022
40
35
4242
38
80
3437
30
54
2802
25
46
3477
31
49
2603
24
27
94,7
18
17.4
01
38,4
22
19.6
23
35,4
54
25,4
78
27,6
73
34,0
49
31,9
51
224,
918
213,
793
226,
s 28
215,
012
193,
249
196,
047
212,
653
192,
232
219,
933
194,
077
187,
375
150,
574
2 14,
886
195,
966
170,
885
176,
297
3,41
4,47
6
4161
41
65
4244
40
53
4172
42
2 1
4309
40
70
4734
45
12
4689
45
98
4622
44
55
4605
45
53
3810
37
42
358 1
34
44
3822
37
19
3559
35
29
99.4
40
17,2
85
38,0
86
19,3
83
35,1
76
25,3
43
27,4
44
33,7
83
31,7
56
214,
448
194,
731
200,
179
180,
410
174,
350
189,
388
190,
796
170,
064
187,
336
156,
091
110,
475
99,9
26
182,
499
158,
550
143,
314
126,O
O 1
2,90
6.8 1
4
4059
40
43
4087
39
24
4086
41
05
4095
39
34
4432
40
25
4132
40
76
4360
42
25
4097
41
43
3488
33
01
305 1
28
93
3447
33
94
2987
29
47
91,3
31
2072
22
17
2126
23
88
2649
26
98
2701
26
96
2060
20
22
1888
20
58
2125
22
43
2159
22
03
1755
17
27
1783
19
41
1810
18
71
1883
19
35
51,0
10
% F B 5 G) =i
cn c
v, z G)
W
W
U
-I
I!
W
VJ
-I
VJ
W F ? F B P
U
TA
BL
E X
I.
Ave
rage
num
ber
of c
andi
date
nod
es (
befo
re d
etec
ting
a ne
gativ
e cy
cle)
. ~~
Prob
lem
B
FM
BFM
D
PSP
PSPD
D
BFS
D
BFS
D
1 2 3 4 5 6 7 8 9 10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
Tot
al
933,
565
792,
007
891,
907
823,
176
905,
193
894,
304
885,
413
862,
636
197,
202
129,
969
69,1
30
70,4
29
227,
672
195,
604
31,9
68
89,0
10
61,5
38
30,2
69
7592
79
92
49,2
50
29,3
70
5994
61
93
8,19
7,38
3
25,1
74
23,0
76
26,8
73
23,5
76
21,2
78
20,6
79
19,3
80
17,8
82
9890
74
92
7492
67
93
10,8
89
7892
72
92
6593
5894
48
95
4395
39
96
5894
51
94
4195
38
96
280,
610
17,4
01
38,4
22
19,6
23
35,4
54
25,4
78
27,6
73
34,0
49
31,9
51
224,
9 18
213,
793
226,
528
215,
012
193,
249
196,
047
212,
653
192,
232
219,
933
194,
077
187,
375
150,
574
214,
886
195,
966
170,
885
176,
297
3,41
4,47
6
4161
41
65
4244
40
53
4172
42
2 1
4309
40
70
4734
45
12
4689
45
98
4622
44
55
4605
45
53
3881
37
42
3581
34
44
3822
37
19
3559
35
29
99,4
40
17,9
22
38,8
55
20,2
10
36,0
95
26,0
04
28,2
04
34,6
62
32,6
89
227,
679
21 1,
923
222,
636
207,
632
179,
954
200,
178
203,
902
187,
357
21 7,
349
188,
070
140,
239
135,
591
202,
282
182,
198
176,
949
161,
910
3,28
0,49
0
4682
47
56
4892
47
82
4703
48
20
4922
48
08
5401
51
55
5449
55
72
5253
52
95
5368
56
02
4694
47
28
4734
47
66
4644
48
23
4668
47
87
119,
301
DB
FSS
c)
0
3101
c :
3535
3744
3685
38
32
3389
D
rn m
3951
,O
4028
b
2
3088
0
3160
2
x
31
80
3452
3183
34
23
3507
35
93
2830
29
46
3190
33
50
2886
30
97
3271
33
42
80,5
81
TA
BL
E X
U.
Ave
rage
num
ber
of l
abel
upd
ates
(be
fore
det
ecti
ng a
neg
ativ
e cy
cle)
. Pr
oble
m
BFM
B
FMD
P
SP
PS
PD
DB
FS
DB
FSD
D
BFS
S
1 2 3 4 5 6 7 8 9 10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
Tot
al
42,1
17
87,9
33
41,3
65
76,4
29
51,8
77
59,9
14
67,4
05
71,0
90
145,
854
120,
788
76,3
91
137,
286
138,
446
31,8
44
87,6
15
65,1
32
44,0
29
13,4
17
15,4
30
54,1
87
39,0
65
10,6
29
11,7
69
1.56
0.21
8
70,2
06
6673
70
97
7539
74
60
6552
69
54
7588
76
1 1
7361
74
10
8263
83
48
7566
72
06
8172
81
80
6744
69
44
7465
73
18
6600
71
04
7334
75
97
177,
372
18,9
41
40,3
52
21,9
43
37,9
80
27,0
14
29,6
04
36,3
68
34,4
76
254,
622
252,
133
282,
569
276,
871
204,
857
217,
494
241,
654
229,
610
297,
824
284.
985
295,
852
250,
873
263,
122
256,
577
247,
098
286,
540
4,38
9,35
9
5702
60
96
6566
65
81
5709
61
52
6629
65
96
6383
66
04
7232
74
19
6224
65
08
7129
73
76
5763
62
0 1
6474
67
29
5671
61
40
6539
67
67
155,
190
18,8
69
40.0
89
21.6
83
37,7
52
26,9
52
29,4
39
36,1
35
34,3
46
245,
210
233,
418
254,
815
241,
425
186,
864
21 1,
704
219,
822
206,
611
261,
259
236,
933
183,
436
182,
778
228,
095
215,
625
2 18,
475
2 13,
840
3,78
5,60
4
563 1
59
91
6366
64
4 1
5652
60
55
6397
64
65
6406
64
69
705 1
74
02
6234
66
06
6962
74
18
5838
63
09
6605
69
12
5758
63
97
6594
69
37
154,
896
4935
54
32
5619
62
6 1
5724
61
70
6635
68
50
4988
55
43
5830
63
71
5560
61
98
6582
68
39
5054
56
96
6458
65
49
522 1
59
66
6569
66
72
143,
722
50 GOLDFARB, HAO, AND KAI
REFERENCES [1] R. Bellman, On a route problem. Q. Appl. Math 16 (1958) 87-90. [2] N. Deo and C. Pang, Shortest path algorithms: Taxonomy and annotation. Net-
[3] M. Desrochers, A note on the partitioning shortest path algorithm. Operations Res.
[4] S . E. Dreyfus, An appraisal of some shortest path algorithms. Operations Res. 17
[5] Ford, L. R., Jr., Networks flow theory. The Rand Corporation (1956) P-923. [6] L. R. Ford and D. R. Fulkerson, Flows in Networks. Princeton University Press,
Princeton, NJ (1962). [7] F. Glover, D. Klingman, and N. Phillips, A new polynomially bounded shortest
path algorithm. Operations Res. 33 (1985) 65-73. [8] D. Goldfarb, J . Hao, and S. R. Kai, Anti-stalling rules for the network simplex
algorithm. Networks, 20 (1990) 79-91. [9] D. Goldfarb, J. Hao, and S. R. Kai, Efficient shortest path simplex algorithms.
Operations Res. 38 (1990) 624-628. [ 101 E. L. Lawler, Combinatorial Optimization: Networks and Matroids. Holt, Rinehart
and Winston, New York (1976). [ l l ] Z . F. Moore, The shortest path through a maze. Proceedings of the International
Symposium on Theory of Switching, Part I1 (1957) 285-292. [12] C. Papadimitriou and K. Steiglitz, Combinatorial Optimization: Algorithms and
Complexity. Prentice-Hall, Englewood Cliffs, NJ (1982). [13] A. R. Pierce, Bibliography on algorithms for shortest path, shortest spanning tree
and related circuit routing problems. Networks 5 (1975) 129-143. [14] E. Roohy-Laleh, Improvements to the theoretical efficiency of the simplex method.
Ph.D. Thesis, Carleton University, Ottawa (1981). Dissertation Abstract Inter- national 13, 48B.
[15] J. Yen, An algorithm for finding shortest routes from all source nodes to a given destination in general networks. Q. Appl. Math. 27 (1970) 526-530.
works 14 (1984) 275-323.
Lett 6(4) (1987) 183-187.
(1969) 393-412.
Received November 1989 Accepted March 1990