0% found this document useful (0 votes)
9 views14 pages

9a. Network Model Shortest Route

Uploaded by

20228379
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views14 pages

9a. Network Model Shortest Route

Uploaded by

20228379
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 14

15/11/2023

Network Models
Shortest Route

Network Models

Prepared by:
Demy F. Gabriel DEngg

Network Models Network Models


Overview Overview
Here are some simple examples of networks:
Network models are an extremely important category of mathematical program
nodes arcs flow
that have numerous practical applications. Part of their appeal is the direct and
cities highways vehicles
intuitive mapping between the real world, the network diagram, and the
call switching centers telephone lines telephone calls
underlying solution algorithms. Many network problems can be solved via linear
pipe junctions pipes water
programming, and in fact, special extremely fast variants of linear programming
There are some further definitions associated with graphs and networks:
can be applied.
chain: a sequence of arcs connecting two nodes i and j. For example, in Figure
1(a), we might connect nodes A and E via the chains ABCE or ADCE.
The largest mathematical programs that are regularly solved in practice, e.g.
path: a sequence of directed arcs connecting two nodes. In this case, you must
airline crew scheduling problems, are usually network problems.
respect the arc directions. For example, in Figure 1(b), a path from A to E might
be ABDE, but the chain ABCE is not a path because it traverses arc BC in the
Network models are created from two major building blocks:
wrong direction.
1. Arcs (sometimes called edges), which are connecting lines, and
cycle: a chain that connects a node to itself without any retracing. For example,
2. Nodes, which are the connecting points for the arcs.
in Figure 1(a), ABCEDA is a cycle, but ABCDECBA is not a cycle because of
the double traversal of arcs AB and BC.
A graph is a structure that is built by interconnecting nodes and arcs.
connected graph (or connected network): has just one part. In other words you
A directed graph (often called a digraph) is a graph in which the arcs have
can reach any node in the graph or network via a chain from any other node. It
specified directions, as shown by arrowheads. Finally, a network is a graph (or
is sometimes important to know whether a graph is connected and there are
more commonly a digraph) in which the arcs have an associated flow.
efficient computer algorithms for checking this.
15/11/2023

Network Models Network Models


Overview Overview

flow capacity: an upper (and sometimes lower) limit on the amount of flow in an
arc in a network. For example, the maximum flow rate of water in a pipe, or the
maximum simultaneous number of calls on a telephone connection.
spanning tree: normally a tree selected from among the arcs in a graph or
source (or source node): a node which introduces flow into a network. This network so that all of the nodes in the tree are connected. See Figure 2(b).
happens at the boundary between the network under study and the external Spanning trees have interesting applications in services layout, for example,
world. finding a way to lay out the computer cable connecting all of the buildings on a
campus (nodes) by selecting from among the possible inter-building
sink (or sink node): a node which removes flow from a network. This happens connections (arcs).
at the boundary between the network under study and the external world.

Network Models Network Models


The Shortest Route Problem The Shortest Route Problem
Here is a technical statement of the shortest route problem: given a graph in Note that “shortest route problem” is also the name applied when the arc labels
which each arc is labelled with the distance between the two nodes that it are not distances, but perhaps travel time (quickest route problem) or travel
connects, what is the shortest route between some node i and some other node cost (cheapest route problem). The solution methods are identical in all cases.
j in the graph?
We will look first at one of the most popular methods for finding the shortest
For example, consider the graph in Figure 3: what is the shortest route between route in a graph or network: Dijkstra’s algorithm. It is an iterative method. At the
node A and node H? What is the length of the shortest route? nth iteration you will find the nth closest node to the start node (the origin), and
the shortest route to that node. You stop iterating when the destination node is
reached, even if you have not visited all of the nodes in the network.

All of the nodes in the network are initially “unsolved”. A node is “solved” at
each iteration when the shortest distance and route to that node is found. The
length of the shortest path from the origin to a node is the “distance”: a node is
solved when the distance is determined. By definition (and common sense), the
distance from the origin node to the origin node is zero. Arcs which may form
part of the shortest route are gradually added to the “arc set” as the method
proceeds; the arc set is initially empty. Note that the method ventures up some
blind alleys as it proceeds: not all of the arcs that are added to the arc set will
feature in the final shortest route!
15/11/2023

Network Models Network Models


The Shortest Route Problem The Shortest Route Problem
Here is a statement of Dijkstra’s algorithm: 3. If the newly solved node is not the destination node, then go to step 1. Else,
stop and recover the solution:
0. To initialize: a. length of shortest route from origin to destination is the distance to the
a. the origin is the only solved node. destination node.
b. the distance to the origin is 0. b. shortest route is found by tracing backwards from the destination node to
c. the arc set is empty. the origin (or the reverse) using the arcs in the arc set. It is usually
easiest to trace backwards because each node is reached from exactly
1. Find all the unsolved nodes that are directly connected by a single arc to any one other node, but may have outward arcs to several other nodes.
solved node. For each unsolved node, calculate all of the “candidate distances”
(there may be several of these for one unsolved node because it may directly
connect to more than one solved node):
a. choose an arc connecting the unsolved node directly to a solved node.
b. the “candidate distance” is (distance to solved node) + (length of arc
directly connecting the solved and the unsolved node)

2. Choose the smallest candidate distance:


a. add the corresponding unsolved node to the solved set.
b. distance to the newly solved node is the candidate distance.
c. add the corresponding arc to the arc set.

Example Example
Cable Layout Network (km) Cable Layout Network (km)
C 15 C 15
2 J 2 J
A 8 A 8
3 F 5 4 3 F 5 4
3 1 3 1
6 2 0 6 2
S D 1 I 8 S D 1 I 8
7 2 T 7 2 T
2 6 2 6
B 6 G 2 B 6 G 2
3 5 5 3 5 5
3 3
K K
E 3 E 3
13 13
H Unsolved node H Unsolved node

Solved node Solved node


The arc values are the distance in kilometers
between the two nodes
Initiate by displaying the origin as solved. We will label it with 0, since it is 0 units from
Find the shortest route from S to T the origin
15/11/2023

Example Example
Cable Layout Network (km) Cable Layout Network (km)
C 15 C 15
3 2 J 2 J
A 8 A 8
3 F 5 4 3 F 5 4
3 1 3 1
0 6 2 0 6 2
S D 1 I 8 S D 1 I 8
7 2 T 7 2 T
2 6 2 6
B 6 G 2 B 6 G 2
3 5 5 3 5 5
2 3 2 3
K K
E 3 E 3
13 13
H Unsolved node H Unsolved node

Solved node Solved node

For each arc connecting a solved and unsolved node, calculate the candidate distance:
Candidate distance = distance to the solved node + length of arc Select the node with the lowest value. This time it is node B.
Change node B to solved node and label it with the candidate distance

Example Example
Cable Layout Network (km) Cable Layout Network (km)
C 15 C 15
3 2 J 3 2 J
A 8 A 8
3 F 5 4 3 F 5 4
3 1 3 1
0 6 2 0 6 2
9
S D 1 I 8 S D 1 I 8
7 2 T 7 2 T
2 6 2 6
B 6 G 2 B 6 G 2
3 5 5 3 5 5
2 5 3 2 3
K K
E 3 E 3
13 13
H Unsolved node H Unsolved node

Solved node Solved node

Again, calculate the candidate distance for each arc connecting a solved and
Select the node with the lowest value. This time it is node A.
unsolved node:
Change node A to solved node and label it with the candidate distance
Candidate distance = distance to the solved node + length of arc
15/11/2023

Example Example
Cable Layout Network (km) Cable Layout Network (km)
5 5
C 15 C 15
3 2 J 3 2 J
A 8 A 8
3 F 5 4 3 F 5 4
3 1 3 1
0 6 2 0 6 2
9
S D 1 I 8 S D 1 I 8
7 2 T 7 2 T
9
2 6 2 6
B 6 G 2 B 6 G 2
3 5 5 3 5 5
2 5 3 2 3
K K
E 3 E 3
13 13
H Unsolved node H Unsolved node

Choose arbitrary between node C and E Solved node Solved node

Again, calculate the candidate distance for each arc connecting a solved and
Select the node with the lowest value. This time, C is selected over E.
unsolved node:
Change node E to solved node and label it with the candidate distance
Candidate distance = distance to the solved node + length of arc

Example Example
Cable Layout Network (km) Cable Layout Network (km)
5 5
15 20 15
C C
3 2 J 3 2 J
8 13 8
A 3 F 4 A 3 F 4
5 1 5 1
0 3 0 3
6 9 8 2 6 2
S D 1 I 8 S D 1 I 8
7 2 T 7 2 T
9
2 6 2 6
B 6 G 2 B 6 G 2
3 5 5 3 5 5
2 5 3 2 5 3
K K
E 3 E 3
13 13
H Unsolved node H Unsolved node

Solved node Solved node

Again, calculate the candidate distance for each arc connecting a solved and
Select the node with the lowest value. This time E is selected.
unsolved node:
Change node E to solved node and label it with the candidate distance
Candidate distance = distance to the solved node + length of arc
15/11/2023

Example Example
Cable Layout Network (km) Cable Layout Network (km)
5 5
15 20 15
C C
3 2 J 3 2 J
8 13 8
A 3 F 4 A 3 F 4
5 1 5 1
0 3 0 3
6 9 8 2 6 8 2
S D 1 I 8 S D 1 I 8
7 2 T 7 2 T
9 11
2 10 G 6 2 6
B 6 2 B 6 G 2
3 5 5 3 5 5
2 5 3 2 5 3
K K
E 3 E 3
13 13
H Unsolved node H Unsolved node
18 Solved node Solved node

Again, calculate the candidate distance for each arc connecting a solved and
Select the node with the lowest value. This time D is selected.
unsolved node:
Change node D to solved node and label it with the candidate distance
Candidate distance = distance to the solved node + length of arc

Example Example
Cable Layout Network (km) Cable Layout Network (km)
5 5
15 20 15
C C
3 2 J 3 2 J
8 13 8
A 3 F 4 A 3 F 4
5 1 5 1
0 3 0 3
6 8 2 10 6 8 2 10
S D 1 I 8 S D 1 I 8
7 2 T 7 2 T
2 10 G 6 2 6
B 6 2 B 6 G 2
3 5 5 3 5 5
2 5 3 2 5 3
K K
E 3 E 3
13 13
H Unsolved node H Unsolved node

Choose arbitrary between node F and G 18 Solved node Solved node

Again, calculate the candidate distance for each arc connecting a solved and
Select the node with the lowest value. This time, F is selected over G.
unsolved node:
Change node F to solved node and label it with the candidate distance
Candidate distance = distance to the solved node + length of arc
15/11/2023

Example Example
Cable Layout Network (km) Cable Layout Network (km)
5 5
15 20 15
C C
3 2 J 3 2 J
A 8 A 8
3 F 5 4 3 F 5 4
3 1 3 1
0 6 2 15 0 6 2
8 10 8 10
S D 1 I 8 S D 1 I 8
7 11 2 T 7 2 T
2 10 G 6 2 10 G 6
B 6 2 B 6 2
3 5 5 3 5 5
2 5 3 2 5 3
K K
E 3 E 3
13 13
H Unsolved node H Unsolved node
18 Solved node Solved node

Again, calculate the candidate distance for each arc connecting a solved and
Select the node with the lowest value. This time G is selected.
unsolved node:
Change node G to solved node and label it with the candidate distance
Candidate distance = distance to the solved node + length of arc

Example Example
Cable Layout Network (km) Cable Layout Network (km)
5 5
15 20 15
C C
3 2 J 3 2 J
A 8 A 8
3 F 5 4 3 F 5 4
3 1 3 1
0 6 2 15 0 6 2
8 10 8 10
S D 1 I 8 S D 1 I 8
7 2 T 7 2 T
12 12
2 10 G 6 2 10 G 6
B 6 2 B 6 2
3 5 5 3 5 5
2 5 3 2 5 3
13 K K
E 3 E 3
13 13
H Unsolved node H Unsolved node
18 Solved node Solved node

Again, calculate the candidate distance for each arc connecting a solved and
Select the node with the lowest value. This time I is selected.
unsolved node:
Change node I to solved node and label it with the candidate distance
Candidate distance = distance to the solved node + length of arc
15/11/2023

Example Example
Cable Layout Network (km) Cable Layout Network (km)
5 5
15 20 15
C C
3 2 J 3 2 J
A 8 A 8
3 F 5 4 16 3 F 5 4
3 1 3 1
0 6 2 0 6 2
8 10 20 8 10
S D 1 I 8 S D 1 I 8
7 2 T 7 2 T
12 12
2 10 G 6 2 10 G 6
B 6 2 B 6 2
5 5 18 5 5
3 3
2 5 3 2 5 3
13 17 K 13 K
E 3 E 3
13 13
H Unsolved node H Unsolved node
18 Solved node Solved node

Again, calculate the candidate distance for each arc connecting a solved and
Select the node with the lowest value. This time H is selected.
unsolved node:
Change node H to solved node and label it with the candidate distance
Candidate distance = distance to the solved node + length of arc

Example Example
Cable Layout Network (km) Cable Layout Network (km)
5 5
15 20 15
C C
3 2 J 3 2 J
A 8 A 8
3 F 5 4 16 3 F 5 4
3 1 3 1
0 6 2 0 6 2
8 10 20 8 10
S D 1 I 8 S D 1 I 8
7 2 T 7 2 T
12 12
2 10 G 6 2 10 G 6
B 6 2 B 6 2
5 5 18 5 5
3 3
2 5 3 2 5 3
13 K 13 K
E 3 E 3
13 16 13 16
H Unsolved node H Unsolved node

Choose arbitrary between node J and K Solved node Solved node

Again, calculate the candidate distance for each arc connecting a solved and
Select the node with the lowest value. This time, K is selected over J.
unsolved node:
Change node k to solved node and label it with the candidate distance
Candidate distance = distance to the solved node + length of arc
15/11/2023

Example Example
Cable Layout Network (km) Cable Layout Network (km)
5 5
15 20 15
C C
3 2 J 3 2 J
A 8 A 8
3 F 5 4 16 3 F 5 4 16
3 1 3 1
0 6 2 0 6 2
8 10 20 8 10
S D 1 I 8 S D 1 I 8
7 2 T 7 2 T
12 12
2 10 G 6 2 10 G 6
B 6 2 18 B 6 2
3 5 5 3 5 5
2 5 3 2 5 3
13 K 13 K
E 3 E 3
13 16 13 16
H Unsolved node H Unsolved node

Solved node Solved node

Again, calculate the candidate distance for each arc connecting a solved and
Select the node with the lowest value. This time J is selected.
unsolved node:
Change node J to solved node and label it with the candidate distance
Candidate distance = distance to the solved node + length of arc

Example Example
Cable Layout Network (km) Cable Layout Network (km)
5 5
C 15 C 15
3 2 J 3 2 J
A 8 A 8
3 F 5 4 16 3 F 5 4 16
3 1 3 1
0 6 2 0 6 2
8 10 17 8 10 17
S D 1 I 8 S D 1 I 8
7 2 20 T 7 2 T
12 12
2 10 G 6 2 10 G 6
B 6 2 18 B 6 2
3 5 5 3 5 5
2 5 3 2 5 3
13 K 13 K
E 3 E 3
13 16 13 16
H Unsolved node H Unsolved node

Solved node Solved node

Again, calculate the candidate distance for each arc connecting a solved and
Select the node with the lowest value. This time T is selected.
unsolved node:
Change node T to solved node and label it with the candidate distance
Candidate distance = distance to the solved node + length of arc
15/11/2023

Example Example
Cable Layout Network (km) Road Network in kilometers
C 15
2 J
A 8
3 F 5 4
3 1
6 2
S D 1 I 8
7 2 T
2 6
B 6 G 2
3 5 5
3
K
E 3
13
H Unsolved node

Solved node
Find the shortest route from O to T
The shortest route is S-B-E-G-I-J-T with a distance of 17 kilometers.
15/11/2023
15/11/2023
15/11/2023
15/11/2023

Problem

You might also like