Professional Documents
Culture Documents
Informs Operations Research: This Content Downloaded From 130.85.244.152 On Fri, 12 Apr 2019 03:57:09 UTC
Informs Operations Research: This Content Downloaded From 130.85.244.152 On Fri, 12 Apr 2019 03:57:09 UTC
REFERENCES
Linked references are available on JSTOR for this article:
https://www.jstor.org/stable/167886?seq=1&cid=pdf-reference#references_tab_contents
You may need to log in to JSTOR to access the linked references.
JSTOR is a not-for-profit service that helps scholars, researchers, and students discover, use, and build upon a wide
range of content in a trusted digital archive. We use information technology and tools to increase productivity and
facilitate new forms of scholarship. For more information about JSTOR, please contact support@jstor.org.
Your use of the JSTOR archive indicates your acceptance of the Terms & Conditions of Use, available at
https://about.jstor.org/terms
INFORMS is collaborating with JSTOR to digitize, preserve and extend access to Operations
Research
This content downloaded from 130.85.244.152 on Fri, 12 Apr 2019 03:57:09 UTC
All use subject to https://about.jstor.org/terms
ON THE RELATION BETWEEN THE TRAVELING-
SALESMAN AND THE LONGEST-PATH PROBLEMS
William W. Hardgrave
and
George L. Nemhauser
T'he Johns Hopkins University, Baltimore, Md.
Note that these requirements imply that the sequence is a cycle. A cycle
satisfying I whose length is finite will be called a feasible solution or a
feasible cycle, and a feasible cycle satisfying 2 will be called an optimal solu-
647
This content downloaded from 130.85.244.152 on Fri, 12 Apr 2019 03:57:09 UTC
All use subject to https://about.jstor.org/terms
648 William W. Hardgrave and George L. Nemhauser
tion or an optimal cycle. Alternatively one may relax 1 and only require
a tour solution. A feasible tour is such that its length is finite and each
node appears at least once in the sequence (i1, i2, ** *, im); a feasible tour
which minimizes the total length of the sequence will be called an optimal
tour. It will be shown that the tour version causes no conceptual diffi-
culty since it may be reduced to the problem of finding an optimal cycle,
although at the expense of possibly increasing the number of arcs in the
graph. However, it should be noted that the tour version, being a less re-
strictive problem, can in certain situations lead to a shorter length solution
(e.g., in Fig. 1 the optimal cycle in G has length 22, while the optimal tour
is of length 20).
The longest-path problem is similar to the well-known and frequently
solved shortest-route problem;E"0 the problem is to construct an efficient
algorithm for finding the longest path (i.e., a route containing no loops)
between two specified nodes of an arbitrary finite connected graph. For-
mally, given a finite set { 1, 2, ..*. *, i * *, n} of nodes, the distances d(i,j)
between every ordered pair (i,j), and two distinguished nodes, say nodes
1 and n, find a sequence (i1= 1, i2, * *, in=n) such that:
1. no node appears in the sequence more than once, i.e., the sequence is a path;
2. the total lengthEkI8-I d(ik, ik+l) of the path is maximized.
In both problems it is assumed that the distances satisfy d(i,j) ? 0 with
d(i,j) = 0 if i = j for all i and j, and that some of the d(i,j) may be arbi-
trarily large. The longest-path problem appears to be much more difficult
than the shortest-route problem but possibly easier than the traveling-
salesman problem.
Cycle Solution
Suppose that we wish to solve the cycle version of the traveling-salesman
problem for a graph G that has the following properties: G is finite, con-
nected (but not necessarily complete), and has n nodes I 1, 2, ..., , ... , nl};
arcs will be denoted by ordered pairs of node indices and associated with
each arc (i,j) is a 'distance' d(i,j) such that d(i,j) >0 and d(i,j) =0 if i-=j.
For convenience, we shall specify one node, say node 1, as a starting point
and furthermore shall assume that at least one feasible cycle exists in G.
The result that the traveling-salesman problem can be embedded in the
longest-path problem will be established by showing that for every such
graph G there exists a corresponding graph L(G) such that any longest
path in L(G) corresponds to an optimal cycle in G. L(G) is constructed
directly from G in the following manner:
This content downloaded from 130.85.244.152 on Fri, 12 Apr 2019 03:57:09 UTC
All use subject to https://about.jstor.org/terms
The Longest-Path Problem 649
1. the nodes of L(G) are the nodes of G plus one additioiial node, denoted by 1';
2. the arcs of L(G) are the arcs of G except for arcs of the form (j,1),
plus (directed) arcs (j,i') if and only if there is an arc (j,I) in G;
3. the distances D(i,j) in L(G) are defined by
(0 if i =j,
D(i,j) =K-d (i,j) if i j and jH 1',
K -d(i,j) if i j and j = 1',
iLG) 2s (12423222521'.L(G)
3 ~~~~~~31
37~~~~~3
4 4 2335 35
8 31
37 37
8 44
31
6 8 3
with K being a constant strictly greater than S, where S is the sum of the n greatest
d(i,j). From now on, path in L(G) will mean path between nodes 1 and 1' in L(G).
This content downloaded from 130.85.244.152 on Fri, 12 Apr 2019 03:57:09 UTC
All use subject to https://about.jstor.org/terms
650 William W. Hardgrave and George L. Nemhauser
K- / ~~-0 v
Proof. Let (i1 = 1, i2, * ** in) be a feasible cycle in G; then the sequence
(i1==1,i2, **.,in,inl= 1') in L(G) is clearly a path containing n arcs.
Similarly, if (i1 = 1, i2, , in,i n= 1' ) iS a path in L(G) with n arcs, then
(i1= 1, i2, ***, in) iS a feasible cycle in G. This correspondence is clearly
one-to-one.
THEOREM 1. A path in L(G) is a longest path if and only if the correspondfing
cycle in G is an optimal cycle.
Proof. Let P1 be a longest path in L(G) and P2 any path containing
n arcs (but not a longest path), let L1 and L2 be the lengths of P1 and P2
respectively. By Lemma 1, Pi has n arcs and hence by Lemma 2 there
are two distinct feasible cycles C1 and C2 in G corresponding respectivr
This content downloaded from 130.85.244.152 on Fri, 12 Apr 2019 03:57:09 UTC
All use subject to https://about.jstor.org/terms
The Longest-Path Problem 651
4~~~~~
I ~~~4 2
by Lemma 2 both P1 and P2 contain n arcs and by hypothesis Ecl d(i,j) <
ZC2 d(i,j) so that
Tour Solution
This content downloaded from 130.85.244.152 on Fri, 12 Apr 2019 03:57:09 UTC
All use subject to https://about.jstor.org/terms
652 William W. Hardgrave and George L. Nemnhauser
TABLE I
OPTIMAL CYCLES IN G' AND THE CORRESPONDING OPTIMAL TOURS IN G (see Figs. i and 3).
(I, 2, 5, 4, 3) (I, 3, 2, 5, 4, 3, I)
(IX 3, 2, 5, 4)
(I, 2, 5, 3, 4) (1, 3, 2, 5, 2, 3, 4, 3, I)
(I, 3, 5, 2, 4)
(I, 5, 2, 3, 4)
(I, 5, 2, 4, 3)
(I, 3, 4, 2, 5) (IX 3, 4, 3, 2, 5, I)
(I, 4, 3, 2, 5)
(I, 3, 4, 5, 2) (I, 3, 4, 3, 2, 5, 2, 3, I)
(I, 4, 2, 5, 3)
(I, 4, 3, 5, 2)
(I, 4, 5, 2, 3)
This content downloaded from 130.85.244.152 on Fri, 12 Apr 2019 03:57:09 UTC
All use subject to https://about.jstor.org/terms
The Longest-Path Problem 653
spondence as a function t from the set of cycles of G' into the set of tours
of G. To be explicit we shall assume in the remainder of this section that
the shortest path between any two nodes of G is unique.
LEMMA 4. If T is an optimal tour in G, then there exists a cycle C in G' such
that T=t(C).
Proof. As in the preceding lemma, write T as (il= 1, PI, i2, ,in
Pn, in+1- 1) where now ij is the first appearance of that node in the to
and Pj is the sequence of nodes between the first passage through ij and
first passage through ij+1. Note that P1 is empty, that P2 contains at m
ii, and that Pn may contain every node of G. Then Pj is a shortest pat
between nodes ij and ij+l since otherwise T would not be optimal. Hence
if C= (il = 1, i2, ** *, in), clearly T= t(C) by the definition of t. C may n
be unique, but this is unimportant for our purposes.
THEOREM 2. A cycle C in G' is optimal if and only if the tour T= t(C) is
optimal in G.
Proof. Let C be an optimal cycle in G' and let L be its length. Suppose
that t(C) is not optimal; then there exists another tour T* such that T* is
optimal and is of length L* <L. Then by Lemma 4 there is a cycle C*
such that t(C*) = T*. The length of C* is also L* and so C is not optimal,
which is a contradition.
Conversely, let T be an optimal tour, the length of which is L. Then
by Lemma 4 there exists a cycle C such that t(C) = T and by Lemma 3 the
length of C is also L. Suppose now that C is not optimal so that there
exists another cycle C* that is optimal and whose length is L*<L. Then
the length of t(C*) is L* and hence T is not optimal, which is again a
contradiction.
Theorem 2 implies that the tour problem for G is contained in the cycle
problem for G' and therefore is solvable by a longest-path algorithm. To
summarize, we now have established that to solve the cycle version of the
traveling-salesman problem, find the longest path in L(G); to solve the
tour version of the traveling-salesman problem, find the longest path in
L(G'). Of course, the practicality of these results rests upon an efficient
longest-path algorithm.
This content downloaded from 130.85.244.152 on Fri, 12 Apr 2019 03:57:09 UTC
All use subject to https://about.jstor.org/terms
654 William W. Hardgrave and George L. Nemhauser
of arcs in any path between nodes 1 and 1' is n', then we can find the longest
of those paths containing exactly n' arcs. The procedure is to replace the
lengths d(i,j) by new lengths K-d(i,j) where K is a sufficiently large con-
stant, and apply a shortest-path algorithm to the new graph. The diffi-
culty here is that in general the longest path will contain more than n' arcs
and there appears to be no way of proceeding from the longest path with
n' arcs to a path with more arcs. In fact this method may only be used to
find the general longest path when every path between nodes 1 and 1' con-
tains exactly the same number of arcs. However, it is interesting to note
that a duality exists between this method and our procedure for embedding
the traveling-salesman problem in the longest-path problem. Our interpre-
tation of the traveling-salesman problem was essentially to find the shortest
path between two specified nodes which contained the maximal number of
arcs (or equivalently the shortest path which passed through every node).
It was shown that one could replace the lengths d(i,j) by new lengths
K-d(i,j) and then apply a longest-path algorithm which, in a sense, is
the dual of the above procedure for finding the longest path containing the
minimal number of arcs.
There is also a special case in which the general longest-path problem
can be solved efficiently. If the graph is directed and contains no directed
cycles, its distance matrix D = [d(i,j)] is triangular (after permuting its
rows and columns suitably) and essentially the same algorithm that finds
the shortest path can be used to find the longest path also. [7] Graphs of
this type arise naturally in critical-path scheduling, which, prior to this
work, was the only other application of the longest-path problem in the
operations research literature known to the authors. t
Since it is always possible to construct a graph with a triangular distance
matrix from any given graph in such a way that there is a one-to-one
length-preserving correspondence between paths in the two graphs such a
'triangularization' theoretically would solve the general longest-path prob-
lem. However, triangularization greatly enlarges the graph and appears
to be a tedious process, hardly more efficient than enumeration of all possi-
ble paths. A rapid triangularization procedure that would ensure minimal
enlargement of the graph would be of great interest.
One possible approach to the general longest-path problem is to devise
an algorithm that determines one arc that is not in the longest path; then
this arc would be removed and the algorithm reapplied to the remaining
graph. Repetition of this process, until the removal of one more arc would
t Occasionally, in the Sunday newspaper there appear puzzle contests which
consist of finding the longest path through a finite connected graph. This rather
trivial, but potentially profitable, application stimulated our original interest in
the longest-path problem.
This content downloaded from 130.85.244.152 on Fri, 12 Apr 2019 03:57:09 UTC
All use subject to https://about.jstor.org/terms
The Longest-Path Problem 655
disconnect the remaining graph, would yield the longest path. In particu-
lar, if we could find one of the end arcs of the longest path, say (1,j), we
could eliminate all other arcs incident to node 1 and apply the procedure
to the remainder, using node j as a new end node. Alternatively, we know
that at least one arc of the shortest path is not in the longest path. If we
could find such an arc, repeated application in turn of such a procedure
and of a shortest-path algorithm would eventually yield the longest path.
This is similar to a proposal of POLLACK'S9' for finding the kth shortest
path and may suffer from the same limitations that Pollack recognizes in
his proposal.
.. . ........
This content downloaded from 130.85.244.152 on Fri, 12 Apr 2019 03:57:09 UTC
All use subject to https://about.jstor.org/terms
656 William W. Hardgrave and George L. Nemnhauser
suggestions, such as identifying the end nodes of the last arc to go taut and
repeating the stretching process, have fallen victim to counter-examples.t
A second type of approach has been analogous to finding the shortest-
path tree. Every graph of the type we are considering certainly possesses
a spanning tree that contains the longest path between nodes 1 and 1' and
such that, for instance, these nodes are also end-nodes of the tree. We
could attempt to construct an algorithm, then, which would move from one
spanning tree to another, increasing the length of the path between node 1
and node 1' at each step and terminating in, say, a spanning tree of the
type described above. This proposal, of course, is analogous to DANTZIG'S
algorithm for the shortest-path problem based on the simplex algorithm.t31
? - f3 62(p
,1-'' ~6 8 \
10 I .
I0
Fig. 5. A 'locally optimal' spanning tree that does not contain the longest
path, which is (1,2,5,6,3,4,7,8).
The example of Fig. 5 points out at least one of the difficulties here, namely
that great care must apparently be exercised in the choice of an initial
spanning tree. The spanning tree in the example, which also happens to
be a path, does not contain the longest path, but by any sort of reasonable
criterion does seem to be 'locally' optimal. HOFFMAN AND PAVLEY 561
describe a similar method for finding Kth shortest paths, but as pointed out
by POLLACK18] their procedure suffers from the paramount difficulty of the
longest-path problem in that their solutions can contain loops.
REFERENCES
This content downloaded from 130.85.244.152 on Fri, 12 Apr 2019 03:57:09 UTC
All use subject to https://about.jstor.org/terms
The Longest-Path Problem 657
This content downloaded from 130.85.244.152 on Fri, 12 Apr 2019 03:57:09 UTC
All use subject to https://about.jstor.org/terms