THE SHORTEST PATH PROBLEM - University of Nigeria, …€¦ · ii title page the shortest path...

41
i OMEJE, ANENE VITUS PG/MSC/14/68256 THE SHORTEST PATH PROBLEM DEPARTMENT OF MATHEMATICS FACULTY OF PHYSICAL SCIENCES Godwin Valentine Digitally Signed by: Content manager’s Name DN : CN = Webmaster’s name O= University of Nigeria, Nsukka OU = Innovation Centre

Transcript of THE SHORTEST PATH PROBLEM - University of Nigeria, …€¦ · ii title page the shortest path...

i

OMEJE, ANENE VITUS

PG/MSC/14/68256

THE SHORTEST PATH PROBLEM

DEPARTMENT OF MATHEMATICS

FACULTY OF PHYSICAL SCIENCES

Godwin Valentine

Digitally Signed by: Content manager’s Name

DN : CN = Webmaster’s name

O= University of Nigeria, Nsukka

OU = Innovation Centre

ii

TITLE PAGE

THE SHORTEST PATH PROBLEM

BY

OMEJE, ANENE VITUS

PG/MSC/14/68256

A THESIS SUBMITTED IN PARTIAL FULFILLMENT OF THE

REQUIREMENTS FOR THE AWARD OF MASTER OF SCIENCE (M.Sc)

DEGREE IN APPLIED MATHEMATICS FROM THE DEPARTMENT OF

MATHEMATICS, FACULTY OF PHYSICAL SCIENCES,

UNIVERSITY OF NIGERIA, NSUKKA.

SUPERVISOR: PROF. G.C.E. MBAH

DECEMBER, 2015

iii

CERTIFICATION

This project work was supervised and approved as having met the requirements of

the Department of Mathematics, University of Nigeria, Nsukka for the award of

Master of Science (M.Sc.) degree in Applied Mathematics.

CERTIFIED BY

____________________________________ ______________________ OMEJE, ANENE V. (PG/M.SC./14/68256) Date

(Student)

___________________________________ ______________________

PROF. G.C.E. MBAH Date

(Supervisor)

__________________________________ ______________________

PROF. M.O. OYESANYA Date

(Head of Department)

_________________________________ ______________________

EXTERNAL SUPERVISOR Date

iv

DEDICATION

I dedicate this work to Almighty God from whom all inspiration and knowledge

comes from.

v

ACKNOWLEDGEMENT

First and foremost I offer my sincerest gratitude to my supervisor Prof.

G.C.E. Mbah for his continuous support during this research. His guidance,

motivation, enthusiasm and immense knowledge helped me in all the time of this

research.

Besides my supervisor, I would like to thank the head of Department of

Mathematics Prof. M.O. Oyesanya and other lecturers Prof. J.C. Amazigo, Prof.

F.I. Ocho, Dr. Collins Obiora, Dr. S.I. Yekini, Dr. S.E. Aniaku and other lecturers

from Mathematics Department for their assistance.

I thank my fellow Mathematics postgraduate students: Chima, Chinedu,

Chukwuemeka, Onyekachi and Kenneth, for the stimulating discussions, for the

sleepless nights we worked together before deadlines, and for all the fun we had

during the programme.

My sincere thanks also go to Mr. Onah James Ikechukwu for his

encouragements and mentorship.

My special thanks to my beloved sister Mrs. Nnadi Nneka and her husband

Mr. Nnadi Sunday for their financial and moral supports. May the God almighty to

whom I dedicate this research work reward you abundantly. Amen.

vi

ABSTRACT

The Shortest Path Problem (SPP) requires the determination of the minimum route

or path between a source node and a destination node in a network. In this work,

we determined the shortest path between two locations in a road network using the

Dijkstra’s Algorithm. The real life navigation problem is represented in a directed

graph and the Dijkstra’s Algorithm was used to determine the shortest distance

between a single source node and the destination node.

vii

TABLE OF CONTENT

Title page i

Certification ii

Dedication iii

Acknowledgement iv

Abstract v

Table of Content vi

Chapter One: Introduction to the Shortest Path Problem 1

1.1 Preamble 1

1.2 Aims and Objectives of Study 1

1.3 Scope of Study 2

1.4 Limitations of Study 2

1.5 Motivation of Study 2

1.6 Assumption 2

1.7 Applications of the Shortest Path Problem 2

Chapter Two: Literature Review 4

Chapter Three: Mathematical Background 11

3.1 Introduction 11

3.2 The Label Algorithm – Brief description 13

3.3 Mono–Objective Case 13

viii

3.4 Data Structure for Set X 14

3.5 Multi-Objective Case 16

3.6 Theory of the Dijkstra’s Algorithm 18

Chapter Four: Real Life Problem 21

4.1 Sketch of the Road Network under Study 21

4.2 Representation of the Problem in a Directed and Weighted Graph 22

4.3 Dijktra’s Algorithm Solution Method 23

4.4 Analysis of the Solution 24

Chapter Five: Summary, Conclusion and Recommendations 31

5.1 Summary 31

5.2 Conclusion 31

5.3 Recommendation 31

References 32

1

CHAPTER ONE

INTRODUCTION TO SHORTEST PATH PROBLEM

1.1 Preamble

The shortest path problem is the problem of finding the shortest path or route from

a starting point to a final destination. Generally, in order to represent the shortest

path problem we use graphs. A graph is a mathematical abstract object, which

contains sets of vertices and edges. Edges connect pairs of vertices. Along the

edges of a graph it is possible to walk by moving from one vertex to other vertices.

Depending on whether or not one can walk along edges by both sides or by only

one side determines if the graph is a directed graph or an undirected graph. In

addition, lengths of edges are often called weights, and the weights are normally

used for calculating the shortest path from one point to another point. In the real

world it is possible to apply the graph theory to different types of scenarios. For

example, in order to represent a map we can use a graph, where vertices represent

cities and edges represent routes that connect the cities. If routes are one-way then

the graph will be directed; otherwise, it will be undirected. There exist different

types of algorithms that solve the shortest path problem. Dijkstra’s Algorithm was

used in this work while others were discussed in the literature review.

1.2 Aims and Objectives of the Study

1. To study, determine and identify the shortest path in a network.

2. To explain the general concept of the Dijkstra’s algorithm.

3. To use Dijkstra’s algorithm method to evaluate the shortest path between a

source node and a destination node in a road network

2

1.3 Scope of the Study

In this work, we studied the general concept of the Shortest Path Optimization with

concentration on the Shortest Path from a single source node to a destination node

in a road network.

1.4 Limitations of Study

The solution method we applied in this work is limited to directed graph. This

graph is an abstract representation of the real life problem. The method also does

not apply to graph network with non positive weights.

1.5 Motivation of Study

This work was motivated by the need to determine the closest route to navigate in a

network in order to get to the desired destination faster. Navigating through the

shortest path implies reducing cost and minimization of time.

1.6 Assumption

We assumed there is a free movement in the road network. This means that there is

no traffic jam or obstruction of any kind in the road network.

1.7 Application of Shortest Path Method

Shortest path algorithms are apSplied to automatically find the shortest route

between physical locations, such as driving directions on web mapping websites

like Google maps. It can be used to find an optimal sequence of choices to reach a

certain goal state, or to establish lower bounds on the time needed to reach a given

state. For example, if vertices represent the states of a puzzle like a Rubik’s cube

and each directed edge corresponds to a single move or turn, shortest path

algorithms can be used to find a solution that uses the minimum possible number

of moves.

3

In networking or telecommunication, shortest path method is called the min-

delay path problem and usually tied with a widest path problem. Other shortest

path applications often studied in operations research include transportation,

travelling salesman problem, plant and facility layout, robotics and VLSI design.

4

CHAPTER TWO

LITERATURE REVIEW

It is difficult to trace the history of the shortest path problem. One can

imagine that even in very primitive societies, finding short paths (for instance to

food or water) is essential. Compared with other combinatorial optimization

problem, like shortest spanning tree, assignment and transportation; the

mathematical research in the shortest path problem started relatively late. This

might be due to the fact that the problem was seen to be elementary which is also

illustrated by the fact that at the moment that the problem came into the focus of

interest, several researchers independently developed similar methods.

Yet, the problem has offered some substantial difficulties. For some

considerable period heuristical, non-optimal approaches have been investigated

(for instance Rosenfled [1956], who gave a heuristic approach for determining an

optimal trucking route through a given traffic congestion pattern).

Path finding, in particular searching in a maze, belongs to the classical graph

problems, and the classical references are Wiener [1873], Biggs, Lloyd, and

Wilson [1976]. They form the basis for depth-first search techniques. Path

problems were also studied at the beginning of the 1950s in the context of alternate

routing, that is, finding a second shortest route if the shortest route is blocked. This

applies to freeway usage (Trueblood [1952]), but also to telephone call routing. At

that time making long-distance calls in the U.S.A was automated and alternate

routes for telephone calls over the U.S. telephone network nation-wide were found

automatically.

When a telephone customer makes a long-distance call, the major problem

facing the operator is how to get the call to its destination. In some cases, each toll

operator has two main routes by which the call can be started towards its

5

destination. The first-choice route, of course, is the most direct route. If this is

busy, the second choice is made, followed by other available choices at the

operator’s discretion. When telephone operators are concerned with such a call,

they can exercise choice between alternate routes. But when operator or customer

toll dialing is considered, the choice of routes has to be left to a machine. Since the

intelligence” of a machine is limited to previously “Programmed” operations, the

choice of routes has to be decided upon, and incorporated in an automatic alternate

routing arrangement.

Matrix methods were developed to study relations in networks, like finding

the transitive closure of a relation; that is, identifying in a directed graph the pairs

of points s,t such that t is reachable from s. Such methods were studied because of

their application to communication nets (including neural nets) and to animal

sociology (e.g peck rights).

The matrix methods consist of representing the directed graph by a matrix,

and then taking iterative matrix products to calculate the transitive closure. This

was studied by Landahl and Runge [1946], Landahl [1947], Luke and Perry

[1949], Luke [1950], Lunts [1950, 1952], and by A. Shrimbel.

Shimbel’s interest in matrix methods was motivated by their applications to

neural networks. He analyzed with matrices which sites in a network can

communicate to each other, and how much time it takes.

Orden [1955] observed that the shortest path problem is a special case of a

transshipment problem (uncapacited minimum-cost flow problem), and hence can

be solved by linear programming. Dantzig [1957] described the following

graphical procedure for the simplex method applied to this problem.

Let � be a rooted spanning tree on (1, … , �), with root 1. For each =

1, … , � , let �� be equal to the length of the path from 1 to in �. Now if � ≤ �� +

6

��, for all , �, for each , then 1 − path in � is a shortest path. If �� > �� + ��, ,

replace the arc of � entering � by the arc (, �), and iterate with the new tree.

Trivially, this process terminates as ∑=

n

i

ju1

decreases at each iteration, and there are

only finitely many rooted trees. In a reaction to the paper of Dantzig [1657], Minty

[1957] proposed an analog computer for the shortest path problem.

In a Rand report dated 14 August 1656, Ford [1956] described a method to

find a shortest path from �� to ��, in a network nodes (vertices) ��, … . , �� , where

��, denotes the length of an arc from to �

Assign initially �� = 0 and �� = ∞ ��� ��� ≠ 0, scan the network for a pair

�� and � with the property that �� − � > ��, . For this pair replace �� − � .

Continue this process. Eventually no such pairs can be found, and �� is now

minimal distance from �� � ��. So this is the general scheme described above. No

selection rule for the arc (�, !) is prescribed by Ford. Ford showed that the method

terminates. It was shown however by Johnson [1973a, 1973b, 1977] that Ford’s

method also follows from a result given in the book studies in the Economics of

Transportation by Beckmann, McGurie and Winsten [1956]: given a length matrix

(��, ) the distance matrix is the unique matrix (��, ) satisfying

��, = 0 ��� ���

��," = min

(��, + � ,") ��� ��� , & ' ℎ ≠ &.

It was noticed by Robucker [1956] that shortest paths allow a theorem dual

to Menger’s theorem: the minimum length of �� − �) path in a graph * is equal to

the maximum number of pair wise disjoint �� − �) cuts. In Robacker’s words:

7

“The maximum number of mutually disjoint cuts of * is

equal to the length of the shortest chain of * from �� −

�)”

A related ‘good characterization’ was found by Gallai [1958]. A length function

�: , → ℤ on the arcs of a directed graph (/, ,) does not give negative length

directed circuits, if and only if there is a function (‘potential’) 0: , → ℤ such that

�(�, !) ≥ �(!) − �(�) for each arc (�, !).

The shortest path problem was also investigated by a group of researchers at

the case Institute of Technology in Cleveland, Ohio, in the project investigation of

Mode Techniques, performed for the combat Development Department of the

Army Electronic Proving Ground in their First Annual Report, Leyzorek, Gray,

Johnson, Ladew, Meaker, Petry, and Seitz [1957] presented their results.

First, they noted that Shimbel’s method can be speeded up by calculating S

by iteratively raising the current matrix to the square (in the min-sum matrix

algebra). This solves the all-pairs shortest path problem in time 2(�3 log �). Next,

they gave rudimentary description of a method equivalent to Dijkstra’s method.

We quote.

i. All the links joined to the origin, � may be given an outward orientation.

ii. Pick out the links radiating from �, �78, with the smallest delay. Then it is

possible to pass from the origin to any other node in the network by any

“shorter” path than �78

iii. All of the other links joining � may now be directed outward. Since �78 must

necessarily be the minimal path to �, there is no advantage to be gained by

directing any other links toward �.

iv. Once � has been evaluated, it is possible to evaluate immediately all other

nodes in the network whose minimal values do not exceed the value of the

8

second-smallest link radiating from the origin. Only the smallest link, �78, can

form a part of the minimal path to these nodes. Once a minimal value has been

assigned to these nodes, it is possible to orient all other links except the

incoming link in an outward direction.

v. Suppose that all those nodes whose minimal values do not exceed the value of

the second-smallest link radiating from the origin have been evaluated. Now it

is possible to evaluate the node on which the second smallest link terminates.

At this point, it can be observed that if conflicting directions are assigned to a

link, in accordance with the rules which have been given for direction

assignment, that kind may be ignored. It will not be a path of the minimal path

to either of the two nodes it joins.

After having published several papers on dynamic programming which is, in

some sense, a generalization on the shortest path problem by itself, in a paper in

the Quarterly of Applied Mathematics; Bellman described the following functional

equation approach for the shortest path problem.

There are * cities, numbered 1, … . . *, every two of which are linked by a

direct road. A matrix � = 9 �, : is given, where �, is time required to travel from

to � (not necessarily symmetric). Find a path between and * which consumes

minimum time. Bellman remarked.

Since there are only a finite number of paths available, the problem reduces

to choosing the smallest from a finite set of numbers. This direct or enumerative

approach is possible to execute, however, for values of * of the order of magnitude

of 20.

He gave a functional equation approach the basic method is that of

successive approximations. We choose an initial sequence )( )0(if , and then proceed

iteratively, setting.

9

0

1.....,2,1),()(

(

)()(

=

−==+=

+

=

+

ik

N

k

iijij

ik

i

f

NiftMinf

��� & = 0,1,2 …

As initial function 0if Bellman proposed to take 0

,i i Nf t= for all . Bellman noticed

that, for each fixed , starting with this choice of )0(if gives that )(k

if is

monotonically non-increasing in &.

Dijkstra [1959] gave a concise and clean description of ‘Dijkstra’s method’,

yielding an timenO −)( 2 implementation. Dijkstra stated:

The solution given above is to be preferred to the solution by L.R. Ford; irrespective of

the number of branches, we need not store the data for all branches simultaneously but only

those for the branches in sets I and II, and this number is always less than n. furthermore the

amount of work to be done seems to be considerably less.

Dijkstra’s method is easier to implement as an ( )( 2nO algorithm) than

Dantzig’s method since we do not need to store the information in lists: in order to

find a next vertex ! minimizing �(!), we can just scan all vertices. Later, using the

more efficient data structures of heaps and Fibonacci heaps, one realized that

Dijkstra’s method has implementations with running times 2(< log �) and 2(< +

� log �) respectively, where < is the number of arcs.

Dijkstra’s algorithm makes nodes permanent in increasing order of distance

from the origin node. Dijkstra’s algorithm is efficient in its current form; the

running time grows as �=, where � is the number of nodes. In practice, it runs in

time linear in the number of arcs.

It finds the shortest path from an initial node say node 1 to all other nodes in

an increasing order of distance from the source node. The bottleneck operation is

10

identifying the minimum distance label. One can speed this up, and get an

incredibly efficient algorithm.

Dijkstra’s algorithm is used in this project because of its efficiency and less

delay time compare to other methods such as Bellman Ford algorithm and Floyd-

Warshall algorithm.

11

CHAPTER THREE

MATHEMATICAL BACKGROUND

3.1 Introduction

In this section, some definitions are given and only the strict necessary

results are presented.

A network is denoted by ( )cANG ,,= , where ),...,1( nN = is the set of nodes (or

vertices) and A NxN= is the set of oriented arcs. Let k be the number of

criteria, then the vectorial function c attributes k dimensional vector cost to

each arc:

:c1

, , ,( , ) ( , ) ( , . . . , ) .

K

k

i j i j i j

A IR

i j c i j c c c

→ = =

A path ,p from the vertex i to j , is an alternating sequence of nodes and arcs of

the form ⟩⟨= rro uuup ,,...,, 11, αα where:

• , (0,..., );.v N rε ε∀l

l

• 0v i= and ;rv j=

• ( 1, ) , {1,..., ).v v A rα ε ε= − ∀l l l

l

By convention 0v⟨ ⟩ is considered as a null path )( or = . The set of all paths from

i to j is denoted by jip , and gP represents the set of all paths in the network,

that is Njig UP ε,= jiP , . A cycle is a path with non repeated vertices except the

initial and terminal ones which are coincident; that is, o rv v= .

With no loss of generality, we consider that N has an initial node s and a

terminal node t such that φ≠tsP , , φ≠tsP , and φ≠tiP , , for any i ε { , }N s t− . In

12

order to simplify the notation, p can be denoted only by the sequence of its

nodes, 1, ,...,o rv v v⟨ ⟩ . The objective function f is defined by

1

:

( ) ( ),..., ( )),

k

g

k

f p IR

p f p f p f p

=a

Where ∑ ∀= ).,...,1(,)( 8

,),( kcpf jiojie εε l

The concatenation operator, ◊, joins two paths ⟩⟨= rpuvp ...,0 and ⟩⟨− rqo uuq ,...,

such that orp uu = . Then, p◊q 0 0,..., , ...,rp rpv v v v⟨ = ⟩ . In shortest path problem, one

looks for the set of non-dominated (ND) paths from s to t , mathematically

described as follows:

Definition 3.1 let a and b be two elements of kIR . Then,

, (1,..., ).kRa b a b kε≤ ⇔ ≤ ∀l l l

Definition 3.2 let p and q be two paths of jip , . We say p dominates q or q is

dominated by q )( qp D< if and only if

).()()()( qfpandfqfpf kR≤≠

Definition 3.3 let p be a path in , , , .i jp i j Nε if there is no path jiq ,ερ such that q<D

p, then p is called non-dominant, efficient or pareto optimal path. the set of ND

paths from i to j is denoted by jiD ,

and

D will be used for .,tsD−

The classical shortest path problem can easily be solved when the

optimality principle is held. This property asserts that every shortest path is

formed by shortest sub-paths. The following theorem gives us a necessary and

sufficient condition in which the shortest path problem verifies the optimality

principle.

13

Theorem 3.1: The shortest path problem verifies the optimality principle if and

only if there are no cycles with negative cost.

The generalization of this property for the multi-objective case involves the

notion of ND paths. Thus, in this case, one says that every ND paths is formed by

ND sub-paths. The generalization of the previous theorem is not as strong as in the

mono-criteria case.

Theorem 3.2: if there is no cycle with negative cost at any criteria, then the multi-

objective shortest path problem verifies the optimality principle.

3.2 The label algorithm – brief description

3.3 Mono-objective case

The label algorithm in the mono-objective shortest path problem has been matter

of many papers in the literature. In fact, Deo and Pang, [8], collected hundred of

references about shortest path algorithms until 18980. It is a consequence of the

large number of applications in real-life situations and also the simplicity and high

performance of this method.

In sum, the initialization consists of marking as “scanned” all nodes except

the initial node s . Node s is labeled with ,0 the cost of the best path from s to s , and

the remainder nodes are labeled with a very large value (example: ∞). In the

general step of the algorithm, an “unscanned” label is chosen and the

corresponding node, let us say i , is identified. Therefore, one tries to improve labels

from which this task is from i , that is, nodes j from which ),( ji ε A . The nodes from

which this task is successfully achieved are remarked as “scanned”. The algorithm

stops when there are no more “unscanned” nodes. In our implementation, the

“unscanned” nodes are stored in a set X

14

The difference between label correcting and label setting techniques rests in

the selection of the next node to be chosen. In label correcting algorithm on

conditions are established but in the label setting, the node of X with the minimum

label is demanded. The optimality principle and Theorem 3.6 are the basis of the

correctness of label setting algorithm.

Theorem 3.3: Assume that ,0, ≥jic for all (i,j) ɛ,, and let � ɛ? be a node verifying

@A = min {@C: D ɛ?}

Note proof of the previous theorem lays on the monotony of the objective

function, that is, f (◊ ),(), pfji ≥⟩⟨ where p Є ),(,, jiisP Є A

Note that, Theorem 3.3 tells us that one can stop the label setting algorithm

when node t is chosen in X. So, label setting algorithm can solve the shortest path

problem between s and t without computing the shortest tree rooted at s (a tree

composed by shortest paths from s to i, i Є N). The label correcting algorithm does

not have this property; the shortest path from s to t is assured only after the shortest

tree is obtained.

3.4 Data Structures for set X

As in label correcting algorithm, no conditions are required to select the next

label to be scanned, we use the FIFO rule (first in, first out) to this purpose. Thus,

X is represented by a queue where new nodes are put in one end (the tail) and the

selected label is removed from the other (the head). Pape, [1975], proposed a

modification of this structure using double end queue (DEQUE) to represent X.

Here, the way a node is joined to X depends on the value of its label: if it is greater

than the label of the current node in the head of X, the node is inserted on the tail;

otherwise it is placed on the head.

15

In what concerns to label setting algorithm, one is looking for the minimum

label in X. This task is easier done when X is sorted by non-decreasing order of its

labels. In this work, we have considered the following data structures for X (where

X: = [S]

� List: Each element points to the next one in a sequence ordered by no

decreasing value of its labels. Then, the minimum label appears in the

beginning (direct access). However, the insertion of a new element obliges

searching the correct position in X. In the worst case, the full list needs to be

searched. A similar situation occurs to remove an element in X, because

finding this node is required before taking it away. Note that the removal of an

element can be simplified if an auxiliary list is considered (double list

structure). Here, the element of X should be linked in reverse order, allowing a

direct removal of element.

� Address Calculation: The nodes in X are grouped by the value of its labels.

Each group is represented by a single or a double list. An auxiliary vector v

is used to index the group, that is )(lv points to the list of elements which

labels are equal to ℓ. Defining M = 1 + max { jic , : ),( ji Є A }, then, at most M

components of v are not null at each iteration. So v is defined as an M

component vector where )(lv is concerned to the elements which labels mod

M are equal to ℓ. An auxiliary variable “first” is also needed to indicate the

index of the list with the minimum labels in X.

� HEAP: Each element (the father) of X points to two others elements (its

sons) of X in such a way that the labels of the sons are greater or equal the

label of its father.

16

X Find minimum

Remove minimum

Insert new element

Remove element

Memory space

not O(#X) O(1) O(1) O(#X) #X

List (simple) List (double)

O(1) O(1)

O(1) O(1)

O(#X) O(#X)

O(#X) O(1)

#X 2(#X)

Heap (simple) O(1) O(1)

O( 2log (0(#X))

O( 2log (0(#X))

O(#X)

O( 2log (0(#X)) O(#X)

O( 2log (0(#X)) #X 2(#X)

Address (simple) O(1) O(1)

O )( hM

O )( hM

O(1) O(1)

O )/(# hMX

O(1)

hMX +#

)(#2 hMX +

Table 1: Worst case complexity order for basic iset operation.

Thus, the set X is partially ordered and the minimum label appears in the root of

the heap. The insertion of new elements is accomplished in O( 2log (0(#X))

operations, but the removal needs O(#X) because one has to find first the element

and X is not totally ordered. The removal task can be simplified if an auxiliary

n-dimensional vector v is used, where )(iv points to the position of node i in the

heap.

Figure 1 shows an example of each one of the described data structures used for X.

Table 1 indicates the worst case complexity order for basic operation over X.

3.5 Multi-Objective Case

The generalization of the label algorithm to the multi-objective version has

to be done carefully. In fact, the concept of “the best path from s to t” is not

appropriated in the multi-objective shortest path problem because several “best”

paths may exist. So, in the multi-criteria case, iΠ will keep the paths from s to i that

are not dominated by any s-i path already computed. They will be called as

temporary ND paths. Note that these paths will be ND ones if all s-i paths were

analyzed. If an s-i path has not been considered yet, it may dominate some

temporary ND paths in a future iteration. As a consequence, iΠ have to be updated

each time a new s-i path is joined to iΠ instead of its label as in the mono-

objective case.

17

X not ordered 1p 2p 3p 4p 5p

1f 6 2 1 5 5

2f 2 7 8 3 6

3f 4 1 2 7 1

sumh 12 10 11 15 12

List address calculation

Simple double simple list double list

4

5

1

3

2

p

p

p

p

p

4

5

1

3

2

p

p

p

p

p

↓↑

↓↑

↓↑

↓↑

Figure 1: X representation for each of the data structures using sumh auxiliary

function

A second item in the generalization of the label algorithm needs special

attention. In the mono-criteria version, only a single label is associated to each

node. Therefore, there is a match between labels and nodes (both concepts are

interchangeable). However, in the multi-objective shortest path problem, several

Index=10 2p

11

12

13

14

15

3p

15 pp →

4p

... ...

Index=10 2p

11

12

13

14

15

3p

15 pp →

4p

... ...

18

labels may be related to the same node. As a consequence, two ways for selecting

elements in X have been developed.

� Node Selection: A node is chosen and all unscanned labels associated to this

node are considered simultaneously to produce new temporary ND paths;

� Label Selection: It is a straightforward generalization of the label algorithm

for the classical shortest path problem. Here, a single unscanned label is

chosen from set X.

The node selection policy requires a greater implementation effort and, in general,

is less efficient than label selection policy. For this reason, this work is devoted to

the study of the label algorithm with a label selection policy.

We would like to note that, as the number of ND paths from s to i is unknown in

advanced, the stop condition for the label algorithm is when X becomes an empty

set (either for label correcting/setting and label/node policy selection). Therefore,

the resolution of the shortest s-t path problem passes through the resolution of the

short tree.

3.6 Theory of the Dijkstra’s Algorithm

For each vertex with a graph we assign a label that determines the minimal

length from the starting point to other vertices v of the graph. In a computer we can

do it declaring an array �( ). The algorithm works sequentially, and in each step it

tries to decrease the value of the label of the vertices. The algorithm stops when all

the vertices have been visited. The label at the starting s is equal to zero (dFGH=0);

however labels in other vertices v are equal to infirmity (dF!H= ∞). This means that

the length from the starting point s to other vertices is unknown.

In a computer we can just use a very big number in order to represent

infinity.

19

However for each vertex v we have to identify whether it has been visited or

not. In order to do that, we declare an array of Boolean type called (�F!H) =

���GI). The Dijkstra’s algorithm consists of iterations. If all vertices have been

visited, then the algorithm finishes; otherwise from the list of unvisited vertices we

choose the vertex which has the minimum (smallest) value at its label.

At the beginning, we choose a starting point. After that, we consider

all neighbours of this vertex. Neighbours of a vertex are those vertices that have

common edges with the initial vertex. For each unvisited neighbour we consider a

new length, which is equal to the sum of the label’s value at the initial vertex

! (dF!H) and l that connects them if the resulting value is less than the value at the

label, then we have to change the value in that label with the obtained shorter

value.

�F�IJℎK���GH = <� (�F�IJℎK���GH), (�F!H) + �)

After considering all of the neighbours, we will assign the initial vertex as

visited (�F!H) = ��I). After repeating this step � times, all vertices of the graph

will be visited and the algorithm finishes or terminates.

Key observations

• Suppose that �() is the length of some path from node , to node �

• Suppose that there is an arc (, �) of length (L�, ).

• Then there is a path from node i to node j of length at most �() +

L�, .

20

In this case, there is a path from 1 to � through of length 72. Then we can reduce

�(�) to 72.

At each iteration �(�) is the length of some path from node 1 to node � (if no path

is known, then �(�) = Ø)

Produce updates ()

For each (, �) Є ,() do

If �(� ) > �(�) + L�, then �( ) : = �() + L�, and ��I� (� ) : =

0�I�(�)<I��G ��I�ILIGG�� �� ���I� ���I � ���I �

Up to this point, the best path from 1 to � had length 78; but �(, �) is a path from 1

to � of shorter length 72.

�(�) = 78

�O

PI�J ℎ (�O) = 78

1

� i

PI�J ℎ (�) = 62

10 �

� 62

1 10

21

CHAPTER FOUR

REAL LIFE PROBLEM

The problem is to find the shortest path between Barracks Junction (node 1) and

Ugwuoye primary school Junction (node 8). In the graph, edge of weight 1

represents 100 metres.

4.1 Sketch of the Road Network

Ugwuoye

Primary sch

Junction

Old park

Enugu Rd

Odenigbo

Junction

Ofulonu

Junction Barracks

Junctions

Source node

Achala Junction

New Anglican Rd

3

3

1

4

2

1

5

2 Aku Rd

5

2

Destination node

Ikenga hotel

Junction

22

4.2 Representation of the problem in a weighted and directed graph.

Barracks Junction - node 1, which is the source node

Ofulonu unction - node 2

Ikenga Junction - node3

Odenigbo Junction - node4

Aku Rd Junction - node 5

Achara Junction - node 6

8

7

4

2

3

6

3

5

1

2

1

4

7

4

2

6

3

5

5

5

5

5

6

2

2

3

1

3

6

8

7

4

2

5

2

23

Enu Rd Junction - node7

Ugwuoye Junction - node 8, the destination node

4.3 Dijkstra’s Algorithm Solution Method

Dijikstra’s Algorithm

Begin

�(G): = 0 and 0�I� (G) ∶ = 0:

�(�) : = Ø ��� I�Lℎ � − {G}:

PG : = {G}: ,

While list do Ø

Begin

Let �(): = <� {�(�): � PST�}

Remove node from LIST;

Update ()

If �() decrease from ∞,

Place � in LIST

END

Initialize distances

LIST = set of Temporary nodes

24

4.4 Analysis of the Solution

Initializing the starting point. Now it is assumed that the distance from other

nodes to the source node is very large say infinity(∞) and the distance from the

source node to itself is zero(d(1)=0, node 1 is the source node). It is also means

that at this initial state that the predecessor or parent node through the optimal path

to each of the node is not known, hence pred(i) = U.

LIST = {1,

d( ) = {0,

Now node 1 is removed from the list of the ’unscanned’ nodes and its distance d(1)

= 0 with pred(1) = U stored. The next is the selection of node(s) nearest to source

node for scanning.

Select the node I

on LIST with

minimum

distance label,

And then update

(i)

6

3

2

4

7

8

3

5

1

2

1

4

�(7) = ∞

��I�(7) = Ø

�(8) = ∞

��I�(8) = Ø

�(6) = ∞

��I�(6) = Ø

�(3) = ∞

��I�(3) = Ø �(1) = 0

��I�(1) = Ø

�(2) = ∞

��I�(2) = Ø

�(5) = ∞

��I�(5) = Ø

�(4) = ∞

��I�(4) = Ø

2

2

5

1

5

3

2

3

6

8

7

4

25

Scanning of load (2), and (3)

Node 2 is scanned. The distance from node 2 to source node is 2; the predecessor

to node 2 is node 1. Therefore the d(2) =2; pred(2) =1. Node 3 is scanned in the

same way. Distance from node 3 to the source node is 1 and the parent node to

node 3 is 1, then d(3) =1 , pred(3) =1. The distance from nodes 2 and 3 to the

source and predecessor of nodes 2 and 3 change in the next graph. Other

unscanned nodes remain the same.

Update(1)

LIST = {2,3

d( ) = {2,1

�(4) = ∞

��I�(4) = Ø 4

2

1

3

6

5

2

5

�(7) = ∞

��I�(7) = Ø= Ø [[U

�(2) = 2

��I�(2) = 1

�(1) = 0

��I�(1) = Ø

�(3) = 1

��I�(3) = 1

�(5) = ∞

��I�(5) = Ø

2

3

2

5

1

3

8

7

4

�(8) = ∞

��I�(8) = Ø

�(6) = ∞

��I�(6) = Ø 6

1

26

Scanning of node 6

The next to be scanned is either node 6 whose root is the scanned node 3 or

nodes 4 and 5 that are linked from the scanned node 2. Let us scan node 6 first.

The distance from node 6 to node 3 is 5 and d(3) =1. Therefore distance from node

6 to source node is d(6) = 6. The parent node of node 6 is pred(6) = 3. The next

graph shows the update.

Update 2

LIST = {6,

d( ) ={6

4

2

1

3

6

5

2

5

�(7) = ∞

��I�(7) = Ø= Ø [[U

�(2) = 2

��I�(2) = 1

�(1) = 0

��I�(1) = Ø

�(3) = 1

��I�(3) = 1

�(5) = ∞

��I�(5) = Ø

2

3

2

5

1

3

8

7

4

�(4) = ∞

��I�(4) = Ø

�(8) = ∞

��I�(8) = Ø

�(6) = 6

��I�(6 = 3 6

1

27

Scanning of node 4 and 5

The distance from node 2 to node 4 is 1. Then the distance from node 4 to

the source node is d(4) = 3, pred(4) = 2. The distance from node 2 to 5 is 5 and the

distance from node 6 to 5 is 2. Then the shortest distance from node 5 to the source

node is d(5) = min{d(2) +5, d(6) +2} = min{2+5 , 6+2}= 7. Therefore d(5) = 7 and

pred(5) =2. The next graph takes care of the update.

Update 3

4

2

1

3

6

5

2

5

�(7) = ∞

��I�(7) = Ø= Ø [[U

�(2) = 2

��I�(2) = 1

�(1) = 0

��I�(1) = Ø

�(3) = 1

��I�(3) = 1

�(5) = 7

��I�(5) = 2

2

3

2

5

1

3

8

7

4

�(4) = 3

��I�(4) = 2

�(8) = ∞

��I�(8) = Ø

�(6) = 6

��I�(6 = 3 6

1

4

2

1

3

6

5

2

5

�(7) = ∞

��I�(7) = Ø= Ø [[U

�(2) = 2

��I�(2) = 1

�(1) = 0

��I�(1) = Ø

�(3) = 1

��I�(3) = 1

�(5) = 7

��I�(5) = 2

2

3

2

5

1

3

8

7

4

�(4) = 3

��I�(4) = 2

�(8) = ∞

��I�(8) = Ø

�(6) = 6

��I�(6 = 3 6

1

28

Scanning of node 7

There is a link from node 7 to node 8, this means that node 7 should be scanned

before node 8. Node 7 like the previous node 5 has two parent nodes and therefore

minimum weighted path should be determined. Distance from node 4 to node 7 is 4

while the distance from node 5 to 7 is 2. The shortest distance from node 7 to the

source is d(7) = min{d(4) + 4, d(5) +2}= min{3+4, 7+2}=7. d(7) = 7, pred(7) = 4.

Update 4

4

2

1

3

6

5

2

5

�(7) = 7

��I�(7) = 4

�(2) = 2

��I�(2) = 1

�(1) = 0

��I�(1) = Ø

�(3) = 1

��I�(3) = 1

�(5) = 7

��I�(5) = 2

2

3

2

5

1

3

8

7

4

�(4) = 3

��I�(4) = 2

�(8) = ∞

��I�(8) = Ø

�(6) = 6

��I�(6 = 3 6

1

29

Scanning of node 8.

The remaining node unscanned is the node 8 which has two parent nodes.

The distance from nodes 7 to 8 is 3; distance from nodes 6 to 8 is 3.

The shortest distance from nodes 8 to the source node is

d(8) = min{d(7) +3 , d(6) + 3}= 9.

Update 5

Node 8 has no outgoing arcs, therefore the iteration terminates and program ends.

�(4) = 3

��I�(4) = 2 �(6) = 6

��I�(6) = 3

�(8) = 9

��I�(8) = 6

�(1) = 0

��I�(1) = Ø

5

5

�(7) = 7

��I�(7) = 4

�(2) = 2

��I�(2) = 1 �(3) = 1

��I�(3) = 1

�(5) = 7

��I�(5)= 2

2

3

2

5

1

3

8

7

3

6 4

2

1

3

1

30

It can be seen from the last graph that the shortest path from the source node to the

destination node is traceable from the destination node by following the

predecessor or parent nodes from node 8. The predecessor of node 8 is node 6;

predecessor of node 6 is node 3 and finally the predecessor of node 3 is the source

node 1.

The shortest path from the source node 1 to the destination node 8 is the path from

source node 1 through nodes 3 and 6 to the destination node as shown above.

The shortest distance is 9 representing 900metres. The shortest distance from

Barracks Junction to Ugwuoye Primary School Junction is the path through Ikenga

Hotel Junction , Achalla Junction and then to the destination. And it is about

900metres.

Barracks junction.

6

Ikenga junction

8

Destination Source

1 5 3 1 3

Achalla Junction Ugwuoye junction

31

CHAPTER FIVE

SUMMARY, CONCLUSION AND RECOMMENDATIONS

5.1 Summary

Finding the shortest path between nodes in a network is essential as it helps to

reduce cost and time of navigation. In the road network studied, the Dijkstra’s

algorithm found the shortest path between Barracks Junction (source node) and

Ugwuoye Primary school junction (destination node). The shortest route is through

Ikenga Hotel Junction , Achalla Junction and to the destination node. In the process

of finding this distance between a source node and the destination node, the

algorithm also determines the shortest path from the source to all other nodes in the

graph that represents the road network.

5.2 Conclusion

In this work, Dijktra’s algorithm was presented and tested for solving the shortest-

path problem in a road network. The algorithm produced a good result in terms of

higher success rates for getting the optimal path than the Bellman-Ford algorithm

reported in the literature review.

5.3 Recommendations

In hybrid techniques, one technique can be used to overcome the disadvantage of

the other. We believe that there is still a room for improving the performance of

the algorithm by adding more techniques so that it could be able to handle directed

graphs with negative weights. It could also be improved to handle other variants of

the shortest path problem like the constrained shortest path, multi-objective

shortest path which are known to be NP-hard and no polynomial time solution is

known for them.

32

REFERENCES

1. Beckmann M., McGuire C.B., and Winsten C.B. (1956); Studies on the

Economics of Transportation, Cowles Commission for Research in Economics,

Yale University Press, New Haven, Connecticut

2. Bellman R.(1958); On a Routing Problem: Quarterly of Applied Mathematics

16, pp 87-90

3. Dantzig G.B.(1958); On the Shortest Route through a Network, The RAND

Corporation, Santa Monica, California.

4. Johnson D.B.(1977), Efficient Algorithm for Shortest Paths in Sparse

Networks; Journal of the Association for Computing Machinery 24, pp 1–13.

5. Johnson D.B.(1973a); A note on Dijkstra’s Shortest Path Algorithm, Journal of

the Association for Computing Machinery 20, pp 385 – 388.

6. Johnson D.B.(1973b); Algorithms for Shortest Paths, Ph.D Thesis, Department

of Computer Science, Cornell University, Ithaca, New York.

7. Dijkstra .E(1959); A Note on Two Problems in Connection with Graphs.

Numer. Math. 1: pp 269 – 271.

8. Ford Jr.and Lester R. (1956). Network Flow Theory. Paper P-923. Santa

Monica, California: RAND Corporation.

9. Landahl H.D and Runge R. (1946); Outline of a matrix algebra for neural nets:

Bulletin of Mathematical Biophysics 8, pp 75-81.

10. Landahl H.D (1947); A matrix calculus for neural nets, Bulletin of

Mathematical Biophysics 9, pp 99 – 108.

11. Leyzorek M., Gray R.S., Johnson A.A., Ladew W.C., Meaker S.R., Petry R.M.,

and Seitz R.N. (1957); Investigation Model Techniques for Communication

Systems, Case Institute of Technology, Cleveland, Ohio,

12. Luce R.D. (1950); Connectivity and Generalized Cliques in Sociometric Group

Structures, Psychometrika 15, pp 169 – 190.

33

13. Luce R.D. and Perry A.D. (1949); A method of matrix analysis of group

structure, Psychometrika 14, pp 95 – 190.

14. Lunts A.G. (1950); Application of Matrix Boolean Algebra to Analysis and

Synthesis of Relay – Contact Schemes; Doklady Akademic Naut SSSR (N.S)

70, pp 421 – 432.

15. Minty G.J. (1958); A variant on the shortest – route problem: Operations

Research 6, pp 882 – 883.

16. Orden A. (1955); The transshipment problem, Management Science 2, pp 276

– 285.

17. Rosenfeld L. (1956); Unusual problems and their solutions by digital computer

techniques: Proceedings of the Western joint computer conference (San

Francisco, California); The American Institute of Electrical Engineers, New

York, pp 79 – 82.

18. Robacker J.T (1956); Min-Max Theorem on Shortest Chains and Disjoint Cuts

of a Network: Research Memorandum RM-1660, The RAND Corporation,

Santa Monica, California.

19. Shimbel A. (1951); Applications of Matrix Algebra to Communication nets:

Bulletin of Mathematical Biophysics 15, pp 501 – 507.

20. Trueblood D.L.(1952), The Effect of Travel Time and Distance on Freeway

Usage of Public Roads.

21. Alexander Schrijver (2012); History of the Shortest Path Problem: Documenta

Mathematica. Extra Vol ISMP pp. 155-167.