Professional Documents
Culture Documents
Implementation and Efficiency of For The Shortest Route Problem
Implementation and Efficiency of For The Shortest Route Problem
Implementation and Efficiency of For The Shortest Route Problem
U. PAPE
Technische Universitd't Berlin, W. Berlin, Germany
in the last 15 years, a good deal of effort has been devoted to the study of the shortest
route problem. More than 200 publications are known but little has been reported concerning
relative efficiencies. For a long time the Dijkstra method was considered the most efficient one.
Programming work, using different data structures and implementation techniques for several
algorithms, has shown that a variant of Moore's method seems to be most efficient for different
types of graph structures.
The main objective of this paper is to show the strong relationship between an algorithm and
its implementation.
1. Problem
Consider a network with node set X, IXI = n, and directed arcs (i, j)
having distances di/. Let J = (Jl, ..., Jt } c X, and K = X \ J, where t. < n.
The problem is to determine the lengths mix of the shortest routes to
each k ~ K from t h a t ] =fg (g ~ { 1, ..., t}), which is nearest to k.
The case t = 1 is the well-known problem for determining the lengths
of the shortest routes from one node to all other nodes. The case of
several roots can be solved by adding to the network one node Jn+l con-
nected to all roots by arcs of length zero. The multiple root problem
may then be regarded as a single root problem; however, this trick is in-
efficient when parameters in the network are subsequently altered and
the new problem must be solved [3].
step v:
Sv := Y ' ( S u - 1 ) ;
S, := (k: k ~ S , , m ] ( [ ) ¢ m j ( k ~ - l ) } ;
Sv_ 1 denotes the set of current nodes, and S~ the set of successors o f
nodes in S~_ 1 .
The initial condition of this algorithm is:
mj! °) := 0 g=1 t.
S, := P(S~_ 1) ;
R v := Rv_ 1 U Sv_ 1 ;
i f S , nH4= 0 then (S v := S, u H; H := 0)
else
ifS~ n R , 4= 0 then (H : = H u (S, \ (S~ n R ~ ) ) ;
S~ := S~ n R~)
else
/fS~ = O A H ¢ O then(S, :=H;H:=0)
S0 := (Jl' "'" ]t } ;
rnj!~g°) := 0 g = 1, ..., t ,
Ro :=0; H:=0.
1 5c mt n
Ind I I ~ S / / ~ I [
The queue moves from left to right through the array. If mt becomes n,
the next element of the queue is stored in Ind 1 again. As the temporary
length of the sequence of nodes is never longer than n and all indices
are stored without gaps, no overlapping of beginning and end of the
sequence occurs.
The use of this list structure in graph algorithms has two main advan-
tages:
(1) Fixed length of the array induced by the number of nodes in the
network,
(2) small access time to the following nodes in the queue without
any search.
Moreover, one must know the following information about each node
k , k = 1, ...,n:
(i) The list contains node k, or
U. Pape, Moore-algorithms for the shortest route problem 215
The codes need the following basic operations on the arrays Ind and
KList:
(i) Addition of a node k at the t e m p o r a r y end (indicated by rot) of
the list,
(ii) Addition of a node k at the temporary beginning (indicated by sc)
of the list,
(iii) Progression from the temporary beginning to the next element
of the list.
Computer codes MOORE1 and D'ESOPO1 incorporate these opera-
tions (cf. [4]). For testing the algorithms ten networks were con-
structed. Five of them (series 70 000 in Table 1) are traffic networks
and represent parts of the road net of Braunschweig (W. Germany). In-
degree and out-degree are on an average 3. The networks are asym-
metric, but of course most streets are not one-way streets. The arc dis-
tances correspond to topographic distances. The other five networks
(series 71 000 in Table 1) are project networks, and hence are anti-
symmetric and acyclic with in-degree and out-degree of approximately
2.
The main difference between the computing time of the 70 000 and
71 000 examples is due to the different density of the networks and the
different degree of asymmetry. The times in Tables 1 - 3 (for t = 1) were
obtained on an ICL 1907 computer of the Technical University of
Braunschweig.
Avoiding the redundant array, KList leads to a considerable increase
in computing time (see Table 2).
The computer code based on the algorithm of d'Esopo produced
much better results (see Table 3). The average values of the series
70 000 in the third columns of Tables 1 and 3 are shown in Fig. 1.
216 U. Pape, Moore-algorithms for the shortest route problem
t cseq
.1 SERIES 70,000
MOORE I ~.
MOORE2 -~ ~ ~ / ~
D'ESOPO I ~ " - - _ J ~
..)
n
I
$0 100 150 250 5NO ~00
Fig. 1.
Table 1
(MOORE 1)
Table 2
Table 3
(D'ESOPO 2)
1 a~ ~ @ fa 5 n
nj II Iq II
Table 4
(MOORE 2)
Table 5
(D'ESOPO 2)
The results of the code based on d'Esopo are the most impressive
ones for (t = 1) and are given in Table 5.
Both algorithms ( M O O R E 2 and D'ESOPO2), which seem to be the
most efficient methods for solving the shortest path problem, were run
for t > 1, too. For each t, 10 runs with randomly obtained roots were
made. The results of this testing are given in Tables 6 and 7.
The times in Tables 6 and 7 show a high dependence on the dimen-
sion of the networks and the number of roots. This is particularly true
for large n and small t. Additionally, the results indicate that the
M O O R E 2 code yields slight better results than the D'ESOPO 2 code for
large t. This is due to the fact that the randomly determined arrange-
ment of the roots does not permit the D'ESOPO 2 code to take advan-
tage of the root arrangement; consequently, the smaller number of com-
parisons involved in the M O O R E 2 code makes it superior.
220 U. Pape, Moore-algorithms for the shortest route problem
¢¢3
¢.q
© ©
,gz
z
U. Pape, Moore-algorithms for the shortest route problem 221
09 09
t-- :~
¢¢3
09 09
¢ZJ
¢} 09
¢4
0
r..©
e~
z
222 U. Pape, Moore-algorithms for the shortest route problem
References
[1] S.E. Dreyfus, "An appraisal of some shortest path algorithms", Operations Research 17
(1969) 395-412.
[2] E.F. Moore, "The shortest path through a maze", in: Proceedings of an international sym-
posium on the theory of switching, Part 1I, Apr. 2 - 5 , 1957 (Harvard University Press,
Cambridge, Ma., 1959).
[3] U. Pape, "Netzwerkver~inderungen und Korrektur kiirzester Wegl~ngen yon einer Wurzel-
menge zu allen anderen Knoten", Technical University of Berlin, Department of Cyber-:
netics, Tech. Rept. 73-17.
[4] U. Pape, "Implementierung und Wirtschaftlichkeit von Moore-Algorithmen zur Bestimmung
kfirzester Wegl~ngen in einem Netzwerk", Technical University of Berlin, Department of
Cybernetics, Tech. Rept. 73-06.
[5] M. Pollack and W. Wiebenson, "Solutions of the shortest route problem - a review",
Operations Research 8 (1960) 224-230.