Professional Documents
Culture Documents
Routing: We First Need To Know What Is A Route
Routing: We First Need To Know What Is A Route
Routing: We First Need To Know What Is A Route
Lets say he has police men to ask at some crossings who know about
some of the places near them and other policemen standing at other
crossings. The next slide displays such a situation. The arrows indicate
the places and policemen, a policeman knows. Lets see how Mac finds
out the route to his school!!!
There I want to
you are go to
This
R2 school
block R4 Go this
way
Where
I don’t know
is my any one
school other than
Geeeeee… R4 I will
send him via
!!!! R4
I am here!!!
R6
R2 = 2 stops
R3 = 3 stops
so I will This I want to
send him via way go to
R2
R3 school
R5
R1
So, we can see that Mac has ultimately
found out the route!!!
We can also see that a path has been
established from Mac’s starting place to his
school.
Now let us figure out the various
components involved in this model.
Mac – Analogous to Data Packet
Blocks – Analogous to Distinct Networks
Police Men – Analogous to routers.
Now we can explain
Router – Router is a device that connects
different networks and also finds the
minimum cost path between them.
The fact is that a router never finds out the
full path. Doing this is practically not
possible.
It just redirects the data packet to the next
router (also referred to as ‘next hop’) on the
shortest path. We will now try to learn how.
What is meant by “shortest path” ?
Well, the path from one point to another is logically
weighted according to the distance. The weight is called
“metric”.
Metric is calculated on the basis of a number of factors. For
instance –
E3 V4 E5
Tree – This is a graph or sub-graph where there exists maximum one path
between two nodes. This simply means that there is no loop in the graph.
E2, 5
V1 V3
E3, 1 E5, 2
V4
Spanning Tree – A tree that covers all the vertices of the graph or network is
called a spanning tree.
E3 V4 E5
Algorithms to find the shortest path
between two nodes.
Dijkstra’s Algorithm
The algorithm works as follows:
1. Label the start vertex's final value as 0 (as it is the origin), and label it
1.
2. Update the working values (if they have no working value yet, or if
the new working value is lower) of all the vertices that can be reached
directly from the last vertex labelled.
3. Choose the unlabelled vertex with the smallest working value, and
record its working value as its final value and record its order of
labellling.
4. Repeat steps 2 and 3 until the destination vertex is labelled.
The working value for the destination vertex is its best working value.
The shortest route can now be found by tracking back:
If vertex a lies on the route, then vertex b is the previous vertex if the
label at a - label at b =weight of edge ab
Example of using Dijkstra's algorithm
to get from A to C:
Step 1 – Label the start vertex's final value as 0 (as it is the origin), and label it 1.
Step 2 – Update the working values of B,E and D.
Step 3 – Choose the vertex with the lowest working value (B), and record its
working value as its final value and the order in which it was labelled
Step 4 Update all working values
5 Label the smallest working value vertex with no label (E),final value=working value.
Step 6 – Update working values (no change)
Step 7 – Choose smallest working value (D), label.
A question may be asked over here that “how was this routing table
generated?”.
The routers have communicated the costs of connecting to their
neighbours to all the other routers. Then the routers have used some or
other “shortest path algorithms” to determine the routing table for itself.
This communication may be done only once (The first time they are
connected – Static Routing), Periodically (At fixed time intervals -
Dynamic) or in Triggered manner (Whenever there is some change in
the network – new router is added or an existing one is removed etc. -
Triggered).