Você está na página 1de 37

A

PROJECT REPORT

ON

“ROUTING ALGORITHM”
SUBMITTED TO

CHHATTISGARH SWAMI VIVEKANAND TECHNICAL UNIVERSITY

BHILAI (INDIA)

FOR THE FULFILLEMENT OF AWARD OF DEGREE

BACHELOR OF ENGINEERING

IN

INFORMATION TECHNOLOGY

BY

AKSHAY AGRAWAL

DEPARTMENT OF INFORMATION TECHNOLOGY

SHRI SHANKARACHARYA GROUP OF INSTITUTIONS

P.O JUNWANI, NEHRU NAGAR, BHILAI-490020

SESSION – 2014-15

Page | 1
A

PROJECT REPORT

ON

“ROUTING ALGORITHM”
SUBMITTED TO

CHHATTISGARH SWAMI VIVEKANAND TECHNICAL UNIVERSITY

BHILAI (INDIA)

FOR THE FULFILLEMENT OF AWARD OF DEGREE

BACHELOR OF ENGINEERING

IN

INFORMATION TECHNOLOGY

BY

AKSHAY AGRAWAL

DEPARTMENT OF INFORMATION TECHNOLOGY

SHRI SHANKARACHARYA GROUP OF INSTITUTIONS

P.O JUNWANI, NEHRU NAGAR, BHILAI-490020

SESSION – 2014-15

Page | 2
DECLARATION

We the undersigned solemnly declare that the report of the project work entitled
“ROUTING ALGORITHM”, is based on our own work carried out during the course
of study under the supervision of Mr. Ashutosh Bhensle .

We assert that the statements made and conclusions drawn are an


outcome of the project work. We further declare that to the best of our knowledge
and belief that the report does not contain any part of any work which has been
submitted for the award of any other degree/diploma/certificate in this University of
any other University.

(Signature of the Candidate)

Akshay Agrawal

Roll No. : 3143311006

Enrollment No. : AK1960

Page | 3
CERTIFICATE

This is to certify that the report of the project submitted is an outcome of the project
work entitled “ROUTING ALGORITHM” carried out by

Akshay Agrawal Roll No. : 3143311006 Enrollment No. : AK1960

Under my guidance and supervision for the award of Degree in Bachelor of


Engineering in INFORMATION TECHNOLOGY ENGINEERING of Chhattisgarh
Swami Vivekananda Technical University, Bhilai (C.G.), and India.

To the best Knowledge the report

i) Embodies the work of the candidate him/herself,


ii) Has duly been completed,
iii) Fulfills the requirements of the Ordinance relating to the BE degree of the
University.
iv) Is up to the desired standard for the purpose of which is submitted.

The project work as mentioned above is hereby being recommended and forwarded
for examination and evaluation.

(Signature of H.O.D) (Signature of Incharge) (Signature of the Guide)


Prof. Jaspal Bagga Mr Bhagwati C. Patel Mr. Ashutosh Bhensle

Head of Deptt. Assistant Lecturer Assistant Lecturer


I.T. I.T. I.T.
S.S.G.I, Bhilai S.S.G.I. Bhilai S.S.G.I, Bhilai

Page | 4
CERTIFICATE BY THE EXAMINERS

This is to certify that the projec11t work entitled “ROUTING ALGORITHM”

Submitted by

Akshay Agrawal Roll No. : 3143311006

Has been examined by the undersigned as a part of the examination for the award of
Bachelor of Engineering degree in Information Technology Engineering of
Chhattisgarh Swami Vivekananda Technical University, Bhilai

Internal Examiner External Examiner

Date: Date:

Page | 5
ACKNOWLEDGEMENT

Working on this project has been a great learning experience for us.
There were moments of anxiety, which we could not solve a problem for several
days & there were moments when we could solve a problem after struggling for
several days. But we have enjoyed every bit of the process and we are thankful to all
people associated with us during this period.

We convey our sincere thanks to our project guide Mr. Ashutosh


Bhensle sir, for providing us all sorts of facilities. Their support & guidance helped
us to carry out the project. We owe a great debt of her gratitude for his constant
advice, support, cooperation & encouragement throughout the project.

We would also like to express our deep gratitude to Mrs. Jaspal Bagga
Mam for her ever helping and support. We also pay special for her helpful solutions
& comments enriched by her experience, which improved our ideas for the
betterment of project.

It will be our pleasure to acknowledge, utmost co-operation & valuable


suggestion from time to time given by other staff members of Department, to whom
we owe our entire computer knowledge and also we would like to thank all those
persons who have directly or indirectly helped us by providing books & computer
peripherals and other necessary amenities which helped us in the development of
this project which would otherwise have not been possible.

(Signature of Candidate)

Akshay Agrawal

Page | 6
ABSTRACT

The report is concerned with the shortest path problem, its theoretical approach,
Implementation and application. First a historical background of SP algorithms
is given and basic concepts of network analysis in connection with traffic issues
are explored for the later use. The report concentrates on two SP algorithms.
The first algorithm finds one shortest path in a network with time dependent
costs of links in O(n + m) time, where n is the number of nodes, m is the
number of links in the network. The second algorithm designed for the purpose
of the group project is a combination of the first algorithm and the Dijkstra
algorithm, it also runs in O(n + m) time. Both algorithms are presented in the
context of public transport networks and implemented in Java. At the end of the
report the author’s results are discussed and ideas for the further work are given.

Page | 7
TABLE OF CONTENTS

PARTICULARS: PAGE NO. :


1. Introduction
1.1 Project Description……………………………………....... 10
1.1.1 Routing Approach
1.2 Purpose of Project…………………………………………. 11

1.3 Scope of Development Project………………………….. 13

1.4 Document Overview………………………………………. 13

2. Literature Summary

2.1 Overview of Data warehouse Routing technology. 15

3. Problem Identification………………………………. 18

4. Project Analysis
4.1 Hardware Requirement………………………………….. 20

4.2 Software Requirement…………………………………… 20

5. Methodology
5.1 Theoritical Background………………………………….. 22

5.2 Dijkstra Algorithm……………………. 23

6. Result and Discussion


6.1 Screenshots………………………………………………. 29

7. Conclusion……………………………………………… 34
8. Bibliography……………………………………………. 37

Page | 8
CHAPTER- 1
INTRODUCTION

Page | 9
1.1 Project Description

This project deals with algorithms that find the fastest route from your position
to chosen destination. These algorithms are based on the Graph theory. Traffic
network is transformed into graph and some graph algorithm for finding the
fastest/shortest route is applied. Resulting route is relayed to the driver. It may seem
simple at the first glance but several issues arise. First of them is that graph generated
from traffic network would be too large. Generally navigations are small and not
tooled for computational power.It is necessary to separate such a big graph to smaller
ones. This is done by partitioning (see e.g. [1]). Graph representing traffic network is
divided into several smaller subgraphs which contain roads of the same level (for
example motorways, 1st class roads, 2nd class roads etc.) Connected by some
boundary graph. This allows searching on relatively smaller sub graphs. Search is first
done on higher level roads which are faster and then moves to lower levels as faster
roads usually do not lead to hotels, places of business etc. Also some heuristics can be
added to solve this problem. Second issue, which is main motivation for this thesis, is
what graph algorithm for finding fastest/shortest route to use.

1.1.1 ROUTING Approach

Large-scale, wide area data networks are a part of today’s global


communication infrastructure. Networks such as the Internet have become an integral
medium of information transfer, ranging from personal communication to electronic
commerce and entertainment. The importance of such networks will only increase as
the electronic world becomes more prevalent.

The basic function of a data network is very simple: delivering data from one
network node to another. Achieving this goal requires many network components,
including physical computers and links, signalling protocols between computers, and
data packaging protocols. This project addresses one such component, routing, and
the process that logically connects network nodes by calculating paths between nodes
so that data sent by one node traverses the calculated path to its destination.

Although many algorithms in graph and operational research literature


calculate paths between nodes, the challenge in developing network routing
algorithms is in dealing with the scale and distribution of the physical network.
Because typical wide area networks have nodes on the order of tens of thousands,
routing algorithms must be scalable. In addition, routing algorithms must be able to
calculate paths in a distributed manner due to the global and distributive nature of
physical networks. Moreover, because of the actual physical network, routing
algorithms need to cope with events such as physical component failures and
recalculate paths whenever such events occur. Finally, routing algorithms need
to calculate paths to allow nodes to achieve high network performance.

In general, routing algorithms view a network as a weighted graph, where


network links are represented as graph edges and network routers as graph vertices.
Network routers are network nodes that execute routing algorithms and ensure that
data travel the calculated paths. In the weighted graph, the assignment of edge
Page | 10
weights depends on the specific routing algorithm; typically, the assignment reflects
the latency and bandwidth of the link. After a routing algorithm makes these link cost
assignments, it then computes paths between nodes. Thus, the specific routing
algorithm that routers execute determines the paths that data will travel in the
network.

1.1 Purpose

Routing is the process of selecting best paths in a network. In the past, the
term routing was also used to mean forwarding network traffic among networks.
However this latter function is much better described as simply forwarding. Routing
is performed for many kinds of networks, including the telephone network (circuit
switching), electronic data networks (such as the Internet), and transportation
networks. This article is concerned primarily with routing in electronic data networks
using packet switching technology.
In packet switching networks, routing directs packet forwarding (the transit of
logically addressed network packets from their source toward their ultimate
destination) through intermediate nodes. Intermediate nodes are typically network
hardware devices such as routers, bridges, gateways, firewalls, or switches. General-
purpose computers can also forward packets and perform routing, though they are not
specialized hardware and may suffer from limited performance. The routing process
usually directs forwarding on the basis of routing tables which maintain a record of
the routes to various network destinations. Thus, constructing routing tables, which
are held in the router's memory, is very important for efficient routing. Most routing
algorithms use only one network path at a time. Multipath routing techniques enable
the use of multiple alternative paths.
In case of overlapping/equal routes, the following elements are considered in
order to decide which routes get installed into the routing table (sorted by priority):

1. Prefix-Length: where longer subnet masks are preferred (independent of whether it is


within a routing protocol or over different routing protocol)
2. Metric: where a lower metric/cost is preferred (only valid within one and the same
routing protocol)

3. Administrative distance: where a lower distance is preferred (only valid between


different routing protocols)

Routing, in a more narrow sense of the term, is often contrasted


with bridging in its assumption that network addresses are structured and that similar
addresses imply proximity within the network. Structured addresses allow a single
routing table entry to represent the route to a group of devices. In large networks,
Page | 11
structured addressing (routing, in the narrow sense) outperforms unstructured
addressing (bridging). Routing has become the dominant form of addressing on the
Internet. Bridging is still widely used within localized environments.

1.2 Scope of the Development Project

The single pair shortest path problem in real-world road networks, also known
as route planning, has many important everyday applications. There are two most
significant variants of the problem – static and dynamic route planning. In the static
variant, a road network is fixed during the computation of optimal routes (query).
Static route planning received a lot of attention during the last decades. On the other
hand, in the dynamic variant a road network is subject to change in time – some new
roads are built, some other are closed, traffic jams or car accidents happen, some
routes must be avoided due to turn angle limits, and so on. Clearly, the latter is a more
realistic scenario. Actually, even time-dependent cost functions can be modeled in
dynamic route planning to some extent.

Classical algorithms such as Dijkstra’s or A* and their dynamic adaptions are not well
suitable neither for static nor for dynamic variants becauseof huge road networks size.
Thus, a feasible solution lies in computing suitable auxiliary data of the road network
(pre-processing) in order to improve both time and space complexity of subsequent
queries. This technique led to several very interesting static approaches in the last
decade, see extensive surveys, for instance, in. Some of these algorithms such as
highway-hierarchies, ALT or, for example, geometric containers were proved to work
fine also

1.3 Document Overview

In the next part of this thesis we define all theoretical terms that we use in this
thesis. These include definitions from the Graph theory, mathematical analysis, and
descriptions of some basic graph algorithms like graph searches and basic Dijkstra
algorithm. We will also describe here Ant colony algorithms which we will use later.
After theoretical terms follows part that is about making static graphs dynamic. We
will show some representations of time in dynamic graph and discuss their
advantages. Then we will decide which one we will use for our algorithms.After that
we will describe proposed algorithms. We will present their features and talk about
their implementation. They will be demonstrated on some simple examples solved by
our implemented algorithms and then manually for comparison of results. Next part
comprises of analyze and comparison of proposed algorithms. We will test all
presented algorithms on real data obtained from local traffic network and do thorough
analysis. Results of this analysis will be discussed and cons and pros of each
algorithm presented. In the final part we will summarize our results and achievements.
This part will be followed by appendix containing proposed algorithms implemented
in Mat lab programming language.

Page | 12
CHAPTER - 2
LITERATURE SUMMARY

Shortest/fastest path problem is studied since 1950s. One of the first and one
of the most well-known was developed by Dijkstra and so is called Dijkstra’s
Page | 13
algorithm. On this algorithm is based another widely used algorithm that is called A*.
It adds heuristic function which estimates cost of the route from current node to the
destination. If the estimation satisfies some conditions it can be used to effectively
find shortest route.

Many other algorithms were proposed like Bellman-Ford algorithm which


allows search for shortest path even in case that this graph contains negative edge
weights and Floyd algorithm which also accepts negative edge weights but can only
solve all-pairs shortest paths and provides only distance and not the path. Important
part of traffic navigation is also speeding up the search process because Dijkstra
algorithm works slowly on large graphs. Jung and Pramanik describe method for
graph partitioning. They divide large graph into sub graphs which are connected by
boundary graph. Another method is using planar separators invented by Lipton and
Tarjan.

This was practiced for example by Chen and Xu. There were a lot of research
activity on behalf of the dynamic graphs and routing on them. Harary and Gupta layed
down some basics of dynamic graphs and outlined some applications for them. They
also study them as extension of static graphs. Kali nowski and Wenk present model
where navigation receives periodic updates and computes only shortest path to the
next update. It works on base of A* algorithm. This algorithm tries to be at high
degree node when update comes so it has a lot of possibilities to react on the change
in graph. They also show that these computations can be done locally on navigation or
on some central computer connected to navigation. Demetrescu, Finocchi and Italiano
have come up with similar approach. Dynamism is also represented by some periodic
updates to the edges. Their all pairs shortest path recomputes only shortest path which
were invalidated by update. After the update they are recomputed by Dijkstra
algorithm and by observation that shortest route is composed of other shortest routes.
These approaches are unsuitable for our problem because they are not good at
modeling periodical processes.

Useful insights are also provided by Tong andWong. They point to the
problem that updates of edge value must be done even when a car is already travelling
on the updated edge and the algorithm must consider this change. Not considering it
can provide results that are very different from the reality on long roads. This is
because traffic is changing continuously even when you are driving on a road without
exits or ramps. Flinsberg [2004] in her dissertation used modified A* algorithm in
conjunction with daily traffic speed profiles representing time dependence of the
graph. However she computed speed on an edge as constant. Ant’s colony
optimization (ACO) and its application on problem of finding the shortest route was
also discussed in some papers like Angus and Hendtlass. They show that ACO can
compete with deterministic algorithms but has several weaknesses of stochastic
algorithms as well. Most important one is that they are not even guarateed to produce
some solution.

As mentioned earlier, a graph can be used to represent a map where the cities
are represented by vertices and the routes or roads are represented by edges within the
graph. In this section, a graph representation of a map is explained further, and brief
descriptions and implementations of the four shortest path algorithms being studied
are presented.
Page | 14
2.1 An Overview of ROUTING ALGORTHM

Personally, what I find interesting is how those algorithms evolved through time.
Sorry for punctual technical details.

1956 – 1958: Ford, Moore and Bellman


The first suggested algorithm was published independently by those authors.
It is nowadays usually called the Bellman-Ford algorithm.

1959: Dijkstra
Edgard Dijkstra is Dutch.
He is one of the big names in computer science. He is know for his handwriting and
quotes such as:
 Simplicity is prerequisite for reliability
 The question of whether Machines Can Think... is about as relevant as the question of
whether Submarines Can Swim

 Object-oriented programming is an exceptionally bad idea which could only have


originated in California

He is the author of — brace yourself — Dijkstra’s algorithm published in 1959. It has


been described in a two pages only article but the name stuck as the fundamental brick of
route computations.

1987: Tarjan
The weakness of Dijkstra’s algorithm is its priority queue that returns what node to
visit next. An article from 1987 by Tarjan (an other reference in the world of graphs) brings
us to the “modern” Dijkstra’s algorithm.

2005: Dimacs challenge and rise of the KIT


The 9th Dimac Challenge was about routes computation. For this event the road
network of the United States was published.
A large number of publications pulverised all the records. The algorithms are now fast
enough to compute a route between two points on earth in less than a millisecond (more than
a thousands times faster than the Dijkstra’s algorithm).

Page | 15
2008: consolidation with the Contraction Hierarchies
After this phase of exuberant creativity, we could extract the core substance to make
the algorithm that will probably become the new reference: the contraction hierarchies.

2009: public transit are still forgotten


At last we know to efficiently compute a route on a street network. What about public
transit? Not so bright here.
The question was already studied in 1991 in the great PhD thesis of Eduard Tulp. But
little happened since.
Performances are deceiving and trying to use the successes in street network failed.

2010: transfer patterns, performance, at last!


It was summer, I had just sent my thesis manuscript to the examiners. Because of
over-zealousness I read the latest article from H. Bast.
For the first time it was possible to compute routes using public transit within a few
milliseconds in a large city as New-York.

2012: Delling’s Raptor


Daniel Delling likes cool names (a previous algorithm was called Sharc). He
chose Raptor for his new algorithm.
The proposed approach has no need for pre-processing and has better performances
than the transfer patterns.

2013: Connection Scan Algorithm


A last one! In an article very modestly called Intriguingly Simple and Fast Transit
Routing the authors present the connection scan algorithm. It is slightly more efficient than
Raptor but is considerably more simple.
When reading the article, and once again when implementing it, I was struck how
braindead simple it is, but it works.

Page | 16
CHAPTER - 3
PROBLEM IDENTIFICATION

Problem Identification

Among several variants of the SP algorithms there is a group of algorithms


which could be applied to solve the present issue, but the solution would not be
Page | 17
efficient. An obvious group of algorithms is the one that gives a more general solution
than needed and their solution would be redundant. A good example of a group giving
a redundant solution is the ‘all pairs’ group of the SP algorithms: only one pair of
nodes would be used from the set of all pairs. Matrix algorithms are not of a good use
for sparse networks. Matrix algorithms are memory consuming and for sparse
networks time consuming. The implementation of the Dijkstra algorithm based on a
matrix is inefficient for road networks. Therefore the matrix algorithms are abandoned
from this point for the rest of the report. Bellman (1958) designed an algorithm for
networks with also negative link lengths. The concern about negative link length
made the Bellman algorithm more general than Dijkstra algorithm, but it also made it
less efficient for the networks without negative links. Since the report deals with road
networks (of which the inherent feature is the nonnegative link lengths) only, the
study of the Bellman algorithm will not be of much interest for the report.

Another example of an algorithm providing a solution more general than


needed is the algorithm devised by Caiet al (1997). This algorithm is an enhanced
Dijkstra algorithm. The algorithm processes a network to whose links two attributes
are ascribed: cost of traversing and time of traversing. The algorithm searches for the
cheapest path (the shortest path in terms of the cost) which satisfies an extra
condition: the overall time of such a path (the time required to traverse the links of the
path) does not exceed a given T. The algorithm can be used to solve the project’s
problem by setting every link’s time to 0 and setting T = 0. Such a solution is not
efficient thought.

An algorithm by Cooke and Halsey (1966) finds the shortest path from one
source to one destination in a network with time dependent link costs. The algorithm
is based on the Bellman approach (the paper was also submitted by Bellman). The
algorithm works out but unfortunately is inefficient. The description of the algorithm
is complicated and not clear. The algorithm was revised by Dreyfus (1969) who
pointed out the inefficiency of the algorithm and proposed his solution to the problem.
F. le Clercq published his paper in 1972 in which he proposed an algorithm for public
transport. The algorithm does not use timetables which is the main requirement for the
group project, the algorithm proposed by F. le Clercq uses frequencies of bus lines
instead. The algorithm is vaguely described without emphasis of main ideas and firm
specification of the algorithm. The paper does not report the time complexity and
memory requirements.

Page | 18
CHAPTER - 4
PROJECT ANALYSIS

4.1 HARDWARE REQUIREMENTS

Processor: - Pentium III & Above

Hard Disk : - 40 GB

Page | 19
RAM : - 512 MB

4.2 SOFTWARE REQUIREMENTS

Operating System: - Windows- XP, Linux

Browser Specification: - IE- +5.0 and above, Opera, Chrome


Technology: Java 5.0 and above

Page | 20
CHAPTER - 5
METHODOLOGY

5 Theoretical background

5.1 Graph theory definitons


In this part we present graph theory definitons needed for defining algorithms,
that we use in this thesis.

Page | 21
5.1.1 Undirected Graph
Definition 5.1 Undirected graph is an ordered pair G = (V,E) comprising a
set V of vertices or nodes together with a set E of edges or lines, which are 2-
element subsets of V .

5.1.2 Weighted Graph


Definition 5.2 Weighted grapg is graph that has numeric weight w (e)
associated with each edge e in E. Edge weights can be integers, rational
numbers or real numbers. This number represents some property like length or
cost.

5.1.3 Walk
Definition 5.3 A walk in a graph G is such sequence of edges a vertices
(v0, e1, v1, e2, v2, ..., en, vn) , that ei has adjacent vertices vi−1 and vi for
each i = 1, 2, 3, ..., n. Such walk is called a (v0, vn) walk.

5.1.4 Trail
Definition 5.4 Draw is special kind of walk, in which no edge is repeated. We
call it a (v0, vn) trail.

5.1.5 Path
Definition 5.5 Path is a trail, in which no vertex is repeated. We call it a (v0,
vn)-path.

5.1.6 Length of a path


Definition 5.6 Length of a path is determined by the by number of edges that
are traversed on a path. In weighted graph is this number is denoted as sum of
weights of edges
l (u, v) = Xn
i=1
w (ei) ,
where w (ei) is weight of an edge ei, that belongs to a path.

5.1.7 Distance in graph


Definition 5.7 Distance from vertex v0 to vertex vn in graph G is a length of
the shortest (v0, vn)-path.We denote it as dist (v0, vn). If there is no (v0, vn)-
path then we set dist (v0, vn) = ∞.
5.1.8 Adjacency matrix
Definition 5.8 Adjacency matrix A(G) is representation of a graph G. It is
symmetric matrix n × n where n is number of vertices in graph G.

` 2.1.9 Adjacency list


Definition 2.9 Adjacency list a[] is representation of a graph G. Every
element of list ai[] stores vertices that are adjacent to vi, for example
a1[] = [v2, v3, v4]. In case of a weighted graph we add a second row to the
matrix with adjacent vertices containing weights of corresponding edges

5.2 Dijkstra algorithm

Page | 22
Dijkstra's algorithm, conceived by computer scientist Edsger Dijkstra in
1956 and published in 1959,[1][2] is a graph search algorithm that solves the single-
source shortest path problem for a graph with non-negative edge path costs, producing
ashortest path tree. This algorithm is often used in routing and as a subroutine in other
graph algorithms.
For a given source vertex (node) in the graph, the algorithm finds the path
with lowest cost (i.e. the shortest path) between that vertex and every other
vertex[3]:196–206 (although Dijkstra originally only considered the shortest path between
a given pair of nodes[4]). It can also be used for finding costs of shortest paths from a
single vertex to a single destination vertex by stopping the algorithm once the shortest
path to the destination vertex has been determined. For example, if the vertices of the
graph represent cities and edge path costs represent driving distances between pairs of
cities connected by a direct road, Dijkstra's algorithm can be used to find the shortest
route between one city and all other cities. As a result, the shortest path algorithm is
widely used in network routing protocols, most notably IS-IS and OSPF (Open
Shortest Path First).

Dijkstra's original algorithm does not use a min-priority queue and runs
in time (where is the number of vertices). The idea of this algorithm is
also given in (Leyzorek et al. 1957). The implementation based on a min-priority
queue implemented by a Fibonacci heap and running in
(where is the number of edges) is due to (Fredman & Tarjan 1984). This
is asymptotically the fastest known single-source shortest-path algorithm for
arbitrary directed graphs with unbounded non-negative weights.
Note that graphs under special cases such as integer and/or bounded weights,
can be improved further in complexity. See the following section on running time.

ALGORITHM

Page | 23
Let the node at which we are starting be called the initial node. Let the distance
of node Y be the distance from the initial node to Y. Dijkstra's algorithm will assign
some initial distance values and will try to improve them step by step.

1. Assign to every node a tentative distance value: set it to zero for our initial node and
to infinity for all other nodes.
2. Set the initial node as current. Mark all other nodes unvisited. Create a set of all the
unvisited nodes called the unvisited set.

3. For the current node, consider all of its unvisited neighbors and calculate
their tentative distances. Compare the newly calculatedtentative distance to the
current assigned value and assign the smaller one. For example, if the current
node A is marked with a distance of 6, and the edge connecting it with a
neighbor B has length 2, then the distance to B (through A) will be 6 + 2 = 8. If B was
previously marked with a distance greater than 8 then change it to 8. Otherwise, keep
the current value.

4. When we are done considering all of the neighbors of the current node, mark the
current node as visited and remove it from theunvisited set. A visited node will never
be checked again.

5. If the destination node has been marked visited (when planning a route between two
specific nodes) or if the smallest tentative distance among the nodes in the unvisited
set is infinity (when planning a complete traversal; occurs when there is no
connection between the initial node and remaining unvisited nodes), then stop. The
algorithm has finished.

6. Select the unvisited node that is marked with the smallest tentative distance, and set it
as the new "current node" then go back to step 3.

DESCRIPTION
between two intersections on a city map, a starting point and a destination.
The order is conceptually simple: to start, mark the distance to every intersection on
the map with infinity. This is done not to imply there is an infinite distance, but to
note that intersection has not yet been visited; some variants of this method simply
leave the intersection unlabeled. Now, at each iteration, select a currentintersection.
For the first iteration, the current intersection will be the starting point and the
distance to it (the intersection's label) will be zero. For subsequent iterations (after the
first), the current intersection will be the closest unvisited intersection to the starting
point—this will be easy to find.
From the current intersection, update the distance to every unvisited
intersection that is directly connected to it. This is done by determining the sum of the
Page | 24
distance between an unvisited intersection and the value of the current intersection,
and relabeling the unvisited intersection with this value if it is less than its current
value. In effect, the intersection is relabeled if the path to it through the current
intersection is shorter than the previously known paths. To facilitate shortest path
identification, in pencil, mark the road with an arrow pointing to the relabeled
intersection if you label/relabel it, and erase all others pointing to it. After you have
updated the distances to each neighboring intersection, mark the current intersection
as visited and select the unvisited intersection with lowest distance (from the starting
point) – or the lowest label—as the current intersection. Nodes marked as visited are
labeled with the shortest path from the starting point to it and will not be revisited or
returned to.
Continue this process of updating the neighboring intersections with the
shortest distances, then marking the current intersection as visited and moving onto
the closest unvisited intersection until you have marked the destination as visited.
Once you have marked the destination as visited (as is the case with any visited
intersection) you have determined the shortest path to it, from the starting point, and
can trace your way back, following the arrows in reverse.
Of note is the fact that this algorithm makes no attempt to direct "exploration"
towards the destination as one might expect. Rather, the sole consideration in
determining the next "current" intersection is its distance from the starting point. This
algorithm, therefore "expands outward" from the starting point, interactively
considering every node that is closer in terms of shortest path distance until it reaches
the destination. When understood in this way, it is clear how the algorithm necessarily
finds the shortest path, however, it may also reveal one of the algorithm's weaknesses:
its relative slowness in some topologies.

Path selection
Path selection involves applying a routing metric to multiple routes, in order to
select (or predict) the best route. In computer networking, the metric is computed by a
routing algorithm, and can cover information such as bandwidth, network delay, hop
count, path cost, load, MTU, reliability, and communication cost (see e.g. this
survey for a list of proposed routing metrics). The routing table stores only the best
possible routes, while link-state or topological databases may store all other
information as well.
Because a routing metric is specific to a given routing protocol, multi-protocol
routers must use some external heuristic in order to select between routes learned
from different routing protocols. Cisco routers, for example, attribute a value known
as the administrative distance to each route, where smaller administrative distances
indicate routes learned from a supposedly more reliable protocol.

Page | 25
A local network administrator, in special cases, can set up host-specific routes
to a particular device which provides more control over network usage, permits
testing and better overall security. This can come in handy when debugging network
connections or routing tables.

Multiple agents
In some networks, routing is complicated by the fact that no single entity is
responsible for selecting paths; instead, multiple entities are involved in selecting
paths or even parts of a single path. Complications or inefficiency can result if these
entities choose paths to optimize their own objectives, which may conflict with the
objectives of other participants.
A classic example involves traffic in a road system, in which each driver picks
a path which minimizes their own travel time. With such routing,
the equilibrium routes can be longer than optimal for all drivers. In particular, Braess
paradox shows that adding a new road can lengthen travel times for all drivers.
In another model, for example, used for routing automated guided
vehicles (AGVs) on a terminal, reservations are made for each vehicle to prevent
simultaneous use of the same part of an infrastructure. This approach is also referred
to as context-aware routing.[2]
The Internet is partitioned into autonomous systems (ASs) such as internet
service providers (ISPs), each of which has control over routes involving its network,
at multiple levels. First, AS-level paths are selected via the BGP protocol, which
produces a sequence of ASs through which packets will flow. Each AS may have
multiple paths, offered by neighboring ASs, from which to choose. Its decision often
involves business relationships with these neighboring ASs,[3] which may be unrelated
to path quality or latency. Second, once an AS-level path has been selected, there are
often multiple corresponding router-level paths, in part because two ISPs may be
connected in multiple locations. In choosing the single router-level path, it is common
practice for each ISP to employ hot-potato routing: sending traffic along the path that
minimizes the distance through the ISP's own network—even if that path lengthens
the total distance to the destination.
Consider two ISPs, A and B, which each have a presence in New York,
connected by a fast link with latency 5 ms; and which each have a presence
in London connected by a 5 ms link. Suppose both ISPs have trans-Atlantic links
connecting their two networks, but A's link has latency 100 ms and B's has latency
120 ms. When routing a message from a source in A's London network to a
destination in B's New York network, A may choose to immediately send the message
to B in London. This saves A the work of sending it along an expensive trans-Atlantic

Page | 26
link, but causes the message to experience latency 125 ms when the other route would
have been 20 ms faster.
A 2003 measurement study of Internet routes found that, between pairs of
neighboring ISPs, more than 30% of paths have inflated latency due to hot-potato
routing, with 5% of paths being delayed by at least 12 ms. Inflation due to AS-level
path selection, while substantial, was attributed primarily to BGP's lack of a
mechanism to directly optimize for latency, rather than to selfish routing policies. It
was also suggested that, were an appropriate mechanism in place, ISPs would be
willing to cooperate to reduce latency rather than use hot-potato routing.
Such a mechanism was later published by the same authors, first for the case
of two ISPs and then for the global case.
Route analytics
As the Internet and IP networks become mission critical business tools, there
has been increased interest in techniques and methods to monitor the routing posture
of networks. Incorrect routing or routing issues cause undesirable performance
degradation, flapping and/or downtime. Monitoring routing in a network is achieved
using route analytics tools and techniques.

Page | 27
CHAPTER - 6
RESULT AND DISCUSSION

6.1 Screenshots

Fig.: Window showing to select directed or undirected graph


Page | 28
Fig.: Window showing to draw graph

Fig.: Window showing nodes

Page | 29
Page | 30
Fig.: Window showing graph

Fig.: Window showing the shortest path in green between node n1 to n5

Page | 31
Page | 32
CHAPTER - 7
CONCLUSION

Page | 33
CONCLUSION

The considered algorithms are efficient for the project application. In the
project application context only one best route is required and the algorithm provides
the solution in a very efficient time and with small memory requirements.

The route is combined of roads to traverse with a car and a bus (a timetable
mean in general). The form of the shortest path is strictly limited; only four kinds of a
shortest path can be found. Results of this kind are satisfying in most cases. However,
it may be necessary to get solutions of a different type. There are many other kinds of
output the program can provide which may be more useful for the user. The author
aimed at algorithms which are basic for the issue of the ‘home to work’ route finding
and which are a good starting point for the further research.

During the work on the two algorithms many ideas of the project and the
designed algorithms have occurred to be the best possible (as the time complexity
O(n + m)) or to be superior to the research done before. Of course in no way the work
presented here is completely finished or absolutely satisfying. This report presents
only a piece of work that with more available time could be extended to a better work
with solutions more realistic. However, this would be above the scope of a Final Year
Project and would require more time.

Future work

Sometimes the given algorithms may produce output that is of no use even
though it has been correctly generated. For example, there can be a path that will
require a car and one bus only to reach the destination after 30 minutes. However, the
algorithm may advise you to take a car and three times to take a bus which will take
25 minutes, 5 minutes less than the previous path. From the point of view of the
defined conditions the second path is better, but a more reasonable path is the first
one, though 5 minutes shorter. The first path is actually better because it is less
troublesome (it is easier to take one bus instead of three), more reliable (three buses
cause more risk than only one since each bus can break down, changing buses is risky
as opposed to sitting in the bus) and is cheaper. This example proves the need to
introduce different conditions for the shortest route.

The future research can go into two directions. First, well known algorithms
can be adapted into the public transport needs. For example, the algorithm for finding
second shortest path, third etc, paths for buses can be developed. More can be
proposed: finding the shortest path going through specific nodes, through specific
number of nodes or by the most reliable path.

The other direction is more interesting: development of new algorithms for


traffic issues and not just adaptation of existing algorithms. So far there has not been
devised (as far as the author of this report know) an algorithm for many public
transport means: a train, an underground, buses and a car. There would not be
Page | 34
anything interesting in this if not that the buses and metro would be considered in
parallel. A user could point out that the path should be build up in accordance with the
following criteria:

 the mean of transport to start with,


 the mean of transport to stop with,
 the number of changes to a specific mean of transport,
 the allowed types of changes (for example to change a bus to a train may be
 disallowed).

More than that, user can specify exactly how many changes he wants between
different means. For example the user can say that only one change between car and
bus is allowed but that changing between buses and an underground can be done as
many times as necessary. Also, the number of changes can be named as at most or
exactly. Therefore saying at most 3 changes of means can ban choosing the best route
with only one change. But still, this is should also be possible to find the path with
exact number of
changes. The flexibility of conditions seems to be very big.

Page | 35
CHAPTER – 8
BIBLIOGRAPHY

Page | 36
BIBLIOGRAPHY

Website Reference:

 http://www.myprojects.com/sms.php
 http://www.w3schools.com
 http://www.wikipedia.org

Page | 37

Você também pode gostar