by g. b. dantzig. w. 0. blattner. and m. r. rao · g. b. dantzig*, w. 0. blattner,** and m.r. rao**...

14
.: nr- :.<. \ ., ALL SHORTEST ROUTES FROM A FIXED ORIGIN IN A GRAPH BY G. B. DANTZIG. W. 0. BLATTNER. AND M. R. RAO TECHNICAL REPORT NO. 66-2 NOVEMBER 1966 D D C JULJWJL^J 'A OPERATIONS RESEARCH HOUSE drüüijloilüu C/Iiä 'I Stanford University CALIFORNIA r r

Upload: others

Post on 23-Aug-2020

4 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: BY G. B. DANTZIG. W. 0. BLATTNER. AND M. R. RAO · G. B. Dantzig*, W. 0. Blattner,** and M.R. Rao** TECHNICAL REPORT NO. 66-2 November 1966 ^ f *Operations Research House Stanford

.: nr- • ■:.<. \ .,

ALL SHORTEST ROUTES FROM A FIXED ORIGIN IN A GRAPH

BY

G. B. DANTZIG. W. 0. BLATTNER. AND M. R. RAO

TECHNICAL REPORT NO. 66-2

NOVEMBER 1966

D D C

JULJWJL^J 'A

OPERATIONS RESEARCH HOUSE

■drüüijloilüu C/Iiä

'I

Stanford University

CALIFORNIA

r

r

Page 2: BY G. B. DANTZIG. W. 0. BLATTNER. AND M. R. RAO · G. B. Dantzig*, W. 0. Blattner,** and M.R. Rao** TECHNICAL REPORT NO. 66-2 November 1966 ^ f *Operations Research House Stanford

ALL SHORTEST ROUTES FROM A FIXED ORIGIN IN A GRAPH

BY

G. B. Dantzig*, W. 0. Blattner,** and M.R. Rao**

TECHNICAL REPORT NO. 66-2

November 1966

^ f

*Operations Research House Stanford University Stanford, California

**United States Steel Corporation

Research Of G. B. Dantzig partially supported by Office of Naval Research, Contract ONR-N-00014-67-A-0112-0011, U. S. Atomic Energy Commission, Contract No. AT(OA-3)-326 PA #18, and National Science Foundation Grant GP 6431; reproduction in whole or in part for any purpose of the United States Government is permitted.

Page 3: BY G. B. DANTZIG. W. 0. BLATTNER. AND M. R. RAO · G. B. Dantzig*, W. 0. Blattner,** and M.R. Rao** TECHNICAL REPORT NO. 66-2 November 1966 ^ f *Operations Research House Stanford

[ r

ALL SHORTEST ROUTES FROM A FIXED ORIGIN IN A GRAPH

by

G. Bo Dantzig*, W« Blattner** and M» R. Rao**

A shortest route is sought between a fixed origin node i = 0

to n other nodes in a graph when directed arc distances c. . are

given and the values of c.. may be positive, negative, or zero

i ^ J . No values c . are specified unless there is an arc from

i to j o This problem (as is well known) includes the

travelling salesman problem with distances d.. > 0 becauae one can

set [c.. = d.. - K] where K > E. E d.. and look for a minimum

route from 0 back to itself. Therefore our objective will be more

modest: To find a negative cycle in a graph if one exists or if none

exists then to find all the shortest paths from the origin.

e

The method is inductive. On step k , there is a set S.

consisting of the origin and k - 1 other nodes. Restricting arcs

to those that belong to the subgraph of S, , the minimum distances

from the origin along these arcs to nodes i € S. are assumed

known and have value II . It is also assumed that no negative

cycles exist in the subgraph of S. . It follows that

(l) IL + c.. > IT. for all i € S, , J € S..

* Stanford University ** U. S. Steel

■^^^"-"•*•■"

•• •

Page 4: BY G. B. DANTZIG. W. 0. BLATTNER. AND M. R. RAO · G. B. Dantzig*, W. 0. Blattner,** and M.R. Rao** TECHNICAL REPORT NO. 66-2 November 1966 ^ f *Operations Research House Stanford

Theorem 1; Let D.. denote the length of the shortest route from i

to J aljng arcs of the subgraph of S. containing no negative

cycles and let (l) hold, then

(2) Dy > V n,

Proof: Let the sequence (l ; 1, , 1 ,...,1. ; j) denote the nodes

along a minimum route from 1 to J in S. , then by (l) ,

1 i^ - ^ ^ 1^2 - 12 ix 1XJ - J

Adding these Inequalities together yields the desired relation.

Assuming now that we know the minimal distances IT. for S, ,

we wish to augment S, by Including a node q /^ S. . We denote

S, , = Is, , ql and wish to determine minimal distances II* from

the origin along arcs of the subgraph of S, ., to nodes

i € S. , . The theorem below permits us to determine IT*

immediately.

Theorem 2: Let q jt S, , and S. . = is. , qi then a shortest

route from 0 to q in S. , has as last arc of the route

(p , q) where P € S. satisfies

(3) H + c = Min (n^ + c. ) P ^ 1 € Sk ^ ^

and II* = II + c is the minimum distance from the origin to q q P pq ß H

in Sk+1 0

- j

Page 5: BY G. B. DANTZIG. W. 0. BLATTNER. AND M. R. RAO · G. B. Dantzig*, W. 0. Blattner,** and M.R. Rao** TECHNICAL REPORT NO. 66-2 November 1966 ^ f *Operations Research House Stanford

r F r r r r r

r'

)

i

i.

L [

Proof; Suppose false and a shorter route is via P € S. * then

n- + c- < n + c p pq P pq

contradicting (3) • This theorem is true even if S. has negative

cycles. The It* and n would then represent the shortest

distance without cycles from the origin.

Knowing 11* , Theorem {k) below may now be applied to

determine for another node JL e S. , > i*3 minimum distance Uf

from the origin along arcs of the subgraph of S. - . Knowing II*

P and IIJ we reapply Theorem {k) again and again, each time 11

finding a least distance for another node in S. , . This is done

until all nodes are exhausted in S. , or the optimality coadition

6.. > 0 of Theorem 3 below is satisfied in which cese the

remaining II. values are also optimal for S. . , or the negative

cycle condition of Theorem 5 is satisfied.

Theorem 3: Let T be any subset of nodes i whose minimum distance

II* from the origin along routes in the subgraph of S. . is known,

let q € Tj let S and T contain no negative cycles; let

(4) B1J " ^ + C1J - nj i € T , ^ T

then, if

(5) 6ii ^ 0 for all i € T , J / T

the minimum distance for all remaining nodes is

(6) n* = n for all J /f T

• • ■^rm,.-,'

Page 6: BY G. B. DANTZIG. W. 0. BLATTNER. AND M. R. RAO · G. B. Dantzig*, W. 0. Blattner,** and M.R. Rao** TECHNICAL REPORT NO. 66-2 November 1966 ^ f *Operations Research House Stanford

This theorem is true even if T contains negative cycles "but requires a

different proof.

Proof; The conditions for optimality in S. , analogous to (l) are:

(7) ^-nj + c.j -n^o i CT, j^ T

1^ + c^ - IIj > 0 1 /^ T , J / T

n* + c^^. - n» > o i e T , j c T

n1 + ci - n» > 0 i /^ T , J e T

The first of these holds "by hypothesis (5), the second by (l), the

third by hypothesis that the T set is optimal in S. , (and there

are no negative cycles in T); finally the fourth because

n*<n and (1) holds. J J

On the other hand if the optimality conditions 6,. > 0 of

Theorem 3 does not hold for all i € T, J / T , then 5.. ■ Min b±.< 0

holds for some t € T and X /t 1. It will be shown in Theorem k,

that the minimum distance from the origin along arcs of the subgraph

of S. , to node x is given by II? = II| + 5. . . Thus Theorem k

may be reapplied until there are no longer any nodes in S. , not in

T or condition (5) holds, or a negative cycle is detected, but we

will speak more about this later in Theorem 5»

Theorem h: Let S. and T contain no negative cycles where T is

any subset of nodes i whose minimum distances from the origin in

Page 7: BY G. B. DANTZIG. W. 0. BLATTNER. AND M. R. RAO · G. B. Dantzig*, W. 0. Blattner,** and M.R. Rao** TECHNICAL REPORT NO. 66-2 November 1966 ^ f *Operations Research House Stanford

lb •

II

n fi

i

i

]

[

i

S. , is II* If for some t € T, Z/ T 'k+1

(8) 5t = Min 8i. < 0 1 € T, J / T

then

(9) TI? = ni+ \lsT[t+c tl

is the minimal distance from the origin along arcs in the subgraph of

Proof; On the contrary, if there is a shorter route to X , then this

route raust include the node q and perhaps some other nodes of T

(otherwise II. would be minimum but we know II* < IL by (8) and

(9)° Along this shorter route let (t , Z) be the last arc such

that t € T , X /^ T» then the distance along the route from J

to X, may be denoted by Dr« (see Theorem l) because

the nodes from jf to/, are all elements of S, . By Theorem (l)

do) T>ü>nr ^

On the other hand by virtue of the assumed shorter route through 1 ■

I

'This theorem also holds if T contains negative cycles and II* are the shortest distances from the origin along routes without cycles o

*•'' «nu.iii • ' ^

Page 8: BY G. B. DANTZIG. W. 0. BLATTNER. AND M. R. RAO · G. B. Dantzig*, W. 0. Blattner,** and M.R. Rao** TECHNICAL REPORT NO. 66-2 November 1966 ^ f *Operations Research House Stanford

Subtracting (10) from (ll) and rearranging

n* + c£l -nl < n* + cti - n^

or &£x < 6tn ty W which contradicts hypothesis (8) of

Theorem k.

Theorem ||; If Skv T contain no negative cycles and the shortest

distance from the origin in S. ., for ie T is II* < IT. and T is

augmented to T* = - TM where J? is as defined in Theorem k, then a

a necessary and sufficient condition that T* contain a negative

cycle Is

(12) II* + cfl - n* bn < 0

Proof i Since IT* < IL holds the optimal route from the origin to JL

in S, , passes through q » If (12) holds, then the cycle

consisting of the optimal route from q toji and then arc (JL, q, )

has negative length. This may be seen by summing the relations

II* + c. . ~ H* along the route from q tojt and then adding it

to (12) c. If, on the other hand, (12) does not hold, then

we will show that II* + c > II* for all i€ T*, J € T* which

implies that no negative cycle in T* exists (as one can see by ■

summing such relations over the arcs of a cycle»)

We need now only rule out for some i and j ^ q that o o

II* + c „ < II* o This would mean we could lower the value of Wt 1 L j ^ j o e o o o

by making i the node that precedes J , along the optimal e o

route instead of some i. . This deletion of the arc (i, j ) from 1 ' 1 o

6

■ .

Page 9: BY G. B. DANTZIG. W. 0. BLATTNER. AND M. R. RAO · G. B. Dantzig*, W. 0. Blattner,** and M.R. Rao** TECHNICAL REPORT NO. 66-2 November 1966 ^ f *Operations Research House Stanford

I *********,

1

1 1 *

2) the tree ' of optimal routes and entering the arc (i J ) into the

O O

tree either would provide a shorter route to j or it would cause o

a cycle to form which (by an earlier argument) is negative.

However neither is possible because the former implies a shorter

route to J (because II* was lowered) while the latter implies • d e

a negative cycle not involving q . The cycle cannot involve q

because all shortest routes i c T* from the origin pass through q

and there are no directed arcs into q along the tree of optimal

routes in T* . But a negative cycle in S. is contrary to

assumption*

Thus a negative cycle will always be found if there is one by

(12)« If one is found the inductive process terminates«

The following theorem due to M. Sakarovitch (verbal

communication) permits one to find the minimal distance in S, , to

several nodes at once.

Theorem 6 (Sakarovitch); Let L be the nodes in the tree of

optimal routes in S. which are successors ^ of JL as defined in

Theorem k, then

(13) n* = 1^ + btg for i € L .

'Note; If there are no negative cycles in Sj^ and T in S^ there is a tree of optimal routes to i e T branching out from the origin; also the added arc (t,-L) with t € T, -i/ T still yields a tree of shortest routes without cycles in i € T* .

*) s ^'The tree of optimal routes from the origin forms a partially ordered set« The "successors" of JL are those nodes reached through JL .

-v., •-^"'

Page 10: BY G. B. DANTZIG. W. 0. BLATTNER. AND M. R. RAO · G. B. Dantzig*, W. 0. Blattner,** and M.R. Rao** TECHNICAL REPORT NO. 66-2 November 1966 ^ f *Operations Research House Stanford

■.■ V<

Proof; One notes first that the distance II. + 6. * can be realized

by first going along the optimal route to JL and then along the

former route from Jc to 1 € L . Now assume on the contrary that

there Is a better route to 1 • As In proof of Theorem k, let tJL

be the last arc of a better route such that t e T and L jt T ,

then Kr + err + D*^ < II. + B.n , Subtracting Vj* > IIjj - 11? ,

yields Brx < 6. . contrary to (8) .

For completeness ve give the following well known theorem, [3]»

Theorem 7; If c.. > 0 and II. _of S. are known to be the

minimal distances from the origin for the k nodes of S. using

arcs of the full n-node problem, then II « II + c Is the minimal * ^ . P W-

distance for ^ /^ Sj, vhere

Proof; If not, then q Is reached via some shorter route that

has nodes In common with S. (since S. Includes the origin). Let

(t , q) ^ "t^6 las* arc on the shorter route with t 6 S. and

q / S, , then A.

(15) Ilr + cr- + (mln distance q to q) < II + c^. v ^/ t tq P P<1

but this relation contradicts {lk) because minimum distance from

q to q Is non-negative when c.. > 0 .

We are now In a position to give a count on the number of

8

.

Page 11: BY G. B. DANTZIG. W. 0. BLATTNER. AND M. R. RAO · G. B. Dantzig*, W. 0. Blattner,** and M.R. Rao** TECHNICAL REPORT NO. 66-2 November 1966 ^ f *Operations Research House Stanford

additions. Associated with each set of additions such as for (Ik)

is the same number of comparisons (or possibly one less). In the case

c.. > 0 , the same sums occur in S. and S. , for the same (i, j).

Since at step k+1 ve do not need to consider the arcs back to S. *

the total additions do not exceed the total number of arcs. We will

denote this total by A . The procedure Is to sort the II. + c .

values as generated from low to high. Let the lowest sum on this

list be K« + C4 * • This sum on the list is deleted if II. o e

has previously "been determined; if not then II. " ni + cii • ' o

Next the sums II. +c.. «. * a * 11 /*IN J j j k are computed for all arcs (J, k) and

made part of the sorted list. The process is then repeated. Sorting

requires effort, however, and so that the two theorems that follow

are misleading.

Theorem 8; If all distances c. . > 0 , then the number of additions

using formula (ik) does not exceed A , the number of arcs.

Theorem 9' The number of additions in the general case, when

formula (3) and (8) is used does not exceed

(16) A + nf-L + (n - 1) f2 + . . . fn

where n is the number of nodes, f. is number of arcs directed

forward from the k-th node to enter the induction.

This suggests preordering from low to high the nodes by the

number of their forward arcs. If this is done, the bound reduces to

(17) A + n^ + (n - 1) f2 + ...fn < (n + 3) A/2

■'" S ^ ^ ^^^^"" ■ wmr^mmr*

Page 12: BY G. B. DANTZIG. W. 0. BLATTNER. AND M. R. RAO · G. B. Dantzig*, W. 0. Blattner,** and M.R. Rao** TECHNICAL REPORT NO. 66-2 November 1966 ^ f *Operations Research House Stanford

REFERENCES

[1] Dantzig, G. Bo, Blattner, W. 0., and Rao, M. R., "Finding a

Cycle in a Graph vith Minimum Cost to Time Ratio vith

Application to a Ship Routing Problem," Technical Report No. 66-1,

November 1966, Operations Research House, Stanford University.

[2] Dantzig, Go B., "All Shortest Routes in a Graph," Technical

Report No» 66-3, Operations Research House, Stanford

University, November 1966.

[3] Dantzig, G» B», "On the Shortest Route Through a Network,"

Management Science^ Vol. 6, No. 2, January, i960, also in

Linear Programming and Extensions, Princeton University Press,

Princeton, N. J., 1963^ pages 361-66,

[h] Hu, To C, "Revised Matrix Algorithms for Shortest Paths,"

IBM Watson Research Center, Research Paper, RC-IV78*

September 28, 1965.

[5] Murchland, J. D., "Bibliography of the Shortest Route Problem,"

LSE-TNT-6, June 1966, (Revision)

10

i

Page 13: BY G. B. DANTZIG. W. 0. BLATTNER. AND M. R. RAO · G. B. Dantzig*, W. 0. Blattner,** and M.R. Rao** TECHNICAL REPORT NO. 66-2 November 1966 ^ f *Operations Research House Stanford

I [ r r

r

r

[ 1

Utaclassifled fcouity O—»Iflcrttoir

DOCUMINT CONTROL DATA • R&D tt WH». gj# ti ***** mt

%. OMMINATIM« ACTIVITY Stanford university Operations Research Eouse Stanford, California

t»m m» mmmtt mptti to «IM«MM>

I«. mtpomr •«CUNITV e LMtinaATMH unclassified

a*- «NOW»

I- MMRT TITL« All Shortest Routes from a Fixed Origin In a Orajh

4- OUCRIPTIVI NOTtt (Tim «f ««mt mt ***••<«• «IÄMT

Technical Report •• AUTNOIim(LMliiM»«i*laMw.MltaO

Dantzig, George, B. , Blattner, V« 0. , and Rao, M. R,

•rnSPoRTOATf November 1966

•«. SONTNACT ON «HAMT NO. H-OOO14-67-A-0112-00U

a »IMJMT «Ml.

IIR-047-064

10 »». no. «r mrt

••. am«iN*TeM<s RBVORT MUMSCMJ

Technical Report Kb. 66-2

• A. tTHAWIIfAOAT NOW r4iir«aMri

I» A VAIkASIUTV/LIMITATION MOTICU

Distribution of this document is unlimited

II. •Um.KMINTAIIY NOTU ia. iMMaewM MLITANV ACTIVITV Logistics and Mathematical Statistics Branch, Mathematical Sciences Division, Office of Waval Research, Washington. D. C» 20360

II. ASATNACT

'A shortest route la sought between a fixed origin to other nodes in a graph when directed arc distances are given vhich nay be positive, negative, or aero. Oils problem as stated Includes the difficult travelling salesman problem. A less difficult problem is considered Instead, namely: To find a negative cycle in a graph if one exists or if none exists then to find all the shortest paths from the origin. The method is inductive on nodes. \ .

1 \

DO rosa t JAN «4 1473 Unclassified

UeuAtf CUulfiealtae

• 1

Page 14: BY G. B. DANTZIG. W. 0. BLATTNER. AND M. R. RAO · G. B. Dantzig*, W. 0. Blattner,** and M.R. Rao** TECHNICAL REPORT NO. 66-2 November 1966 ^ f *Operations Research House Stanford

Unnlnnslfled Security ClMBiflciitioa

«4 KEY WORDS

Shortest - route Graph

LINK A MOLI «T

LINK' NOLI «T

LINKC ROLK WT

INSTRUCTIONS 1. ORIOINATIKG ACTIVITY: Entt of th« contractor, ■ubcontractor, granto». Dapartnant of Do» faaaa activity or othar organlsatloa (eoipetmlt mtlhot) laaulag tha rapoit. 2a. REPORT SECUBTTY CLASSIFICATION: Batar tba ovar- all aacurlty claaalflcatlon of tha raport. Indicata «hathor "Raatrletod Data" la IncludaA Uaiklac la to ba In accord ano« with appraprlata aacurlty ragulatloaa. 26. GROUP: Automatic dowapatflnc la apaclflad la OoD U- ractlvo 5200.10 and Armad Porcaa Induatrlal ManuaL Bntar tha group number. Alto, whan appllcabla. ahow that optional markingt hava boon uaad for Group 3 and Group 4 aa author- Uad.

3. REPORT TITLE: Entar tha conplata rapoit tltla la all capital lattara. Tltlea la all eaaaa ahould ba naclaaalflad. If a meaningful tltla cannot ba aelactad without daaalflca- tlon, ahow tltla claaalflcatlon la all capltala la parantbaala Immediately following tha tltla. 4. DESCRIPTIVE NOTES: If approprtat«, enter the typ« of report, e.g., Interim, progreea, aummary, annual, or flnaU Give the inclusive dates whan a apaclflc reporting period lo covered« 5. AUTHOR(S): Enter the aama(a) of autboKa) aa ahown on or In the report. Enter laat name, flrat name, atlddle Initial. If military, ahow rank and branch of aarvlc*. Tha name of the principal author ia an abaeluta mlnlaum requirement 6. REPORT DATE: Enter th» data of tha report aa day, month, year, or month, yean If more than one data appeara on the report, uae date of publication. 7a. TOTAL NUMBER OF PAGES: Tha total page count ahould follow normal pagination procaduraa. La., enter tha number of pagea containing Information. 7b. NUMBER OF REFERENCES: reference* cited in the report. 8a. CONTRACT OR GRANT NUMBER: If appropriate, entar tha applicable number of the contract or graat under which tha report waa written. Sft, 8c, * Id. PROJECT NUMBER: Entar the appraprlata military department Identification, ouch aa project number, aubproject number, system aumbara, taak auiribar, at» 9a. ORIGINATOR'S REPORT NUMBBR(S)! Eater the offi- cial report number by which the doeumant will ba Identified end controlled by the originating activity. Thla number amat ba unique to thla report. 9b. OTHER REPORT NUMBER(S)t If tha report haa been aaalgnad any other report numbers feither ty th» originator or by (he aponaorj, alao enter thla nwnbaKa). 10. AVAILABILITY/LIMITATION NOTICES: Eater any tte> Itatlona on further dissemination of tha report, other than thcae

Inpoaed by aacurlty claaalflcatlon, ualng atandard atatemeats auchaai

(1) *,Quallflad raqaaatara may obtala coplaa of thla rapott from DOC"

Entar the total number of

(2) "Foreign announcaatent and dlaaemlnatlon of thla rapott by DDC lo not authorised,"

(3) "U 8. Government aganclaa may obtain coplea of thla report directly from DDC. Other qualified DDC uoara ahall requoat thraugh

(4) "U. t. military agenclea may obtain coplea of «Ale rapott directly from DDC Other qualified uaert ahall raqueat through

(S) "All dletrlbutloa of this report la ooatrollad Qual- ified DDC uaare shall request through

If tha rapoit haa been furalahad to tha Office of Technical Servlcaa, Department of Commerce, for aale to tha public, Indi- cate thla fact and enter the price. If knowib IL SUPPLEMENTARY NOTES: lary nataot IX SPONSORING MILITARY ACTIVITY: Enter the name of the dapartmantal project office or laboratory aponaoriog (pay int lot) tha raaeerch and development Include addreaa. 13. ABSTRACT: Eater aa abatract giving a brief and tactual auauaaiy of the document Indicative of the report, even though It may alao appaar eleewhere la the body of the technical ra- pott. If additional apace ia required, a continuation aheet ahall be attached.

It la highly dealrable that the abatract of claaaifled raporta be unclaaalnad. Each paragraph of the abatract ahall end with an indication of tha military aacurlty claaalflcatlon of tha In- formation In the paragraph, rapraaanted aa (TS), (B). (C), or (V).

How-

1 1 1

1 i

Una for additional esplan»

Thara la no limitation on the length of tha abatract. aver, the auggeated length la from ISO to 22S worda.

14. KEY WORDS: Key worda are technically meanlngfal terma or abort pbraaea that characterise a report and may be uaad aa Indes entriaa for cataloging the report. Key worda must ba selected ao that ao aacurlty claaalflcatlon la required. Identl- flera, auch aa equipment model dealpatlon, trade aame, mllitaiy project coda name, geographic location, may be uaad aa bay worda hut will ba followed by an Indication of technical con- test. Tha aaalgament of llnka, ralea, aad welghta la optional.

DD /.^ 1473 (BACK) Unclassified

I

I

Security Claasificatioa

i

I I

J

.1

J