Sei sulla pagina 1di 18

1.

Shortest-path model:

In transport organizations, one the objective is to find the shortest path to a particular
node from any of the other nodes in a road network for shipping cargo. Determination of
the shortest path using specialized procedures is known as shortest-path model.
The following methods are popularly used to find the shortest-path in a distance network:
A. Systematic method
B. Dijkstra’s algorithm
C. Floyd’s algorithm
Algorithm for Systematic method
A. Systematic Method

Example: 1
Consider the road network as shown in Figure below, where distance between different

pairs of adjacent cities are summarized in Table 1. Find the shortest path from City 1 to
City 10.

Distance Network
Table 2 Details of selection of Node in each iterations

Iterations List A Nearest nodes Distance calculation


(nodes included)
1 - 1 0
2 1 2 0 + 6 = 6*

3 1,2 3 ,5 0 + 7 = 7*
6 + 8 = 14
4 1,2,3 4,5, 7 0 + 10 = 10*
6 + 8 = 14
7 + 3 = 10*
5 1,2,3,7 4 ,5,4,6 0 + 10 = 10*
6 + 8 = 14
7 + 4 =11
10 + 5 = 15
6 X X 5, 5 ,6 6 + 8 = 14
1, 2,3,7, 4 7 + 6 = 13*
10 + 5 = 15
7 X 6, 6 ,8 7 + 11 = 18
2, 3,7,5 10 + 5 = 15*
13 + 9 =22
8 X 9,8, 10 10 + 10 =20
3 ,7,5,6 13 + 9 =22
15 + 3 = 18*
Shortest path indicated using Red line
B. Dijkstra’s Algorithm
Replacing cell

Lowest dist.
Lowest dist.

Out going cell

Lowest dist.
Lowest dist.

Lowest dist.

Lowest dist.

Lowest dist.
Final solution

Shortest path is 1-2-4-6-9 measuring 44 units


Minimum spanning tree problem

The objective of the minimum spanning tree problem is to connect the nodes of the
network by a set of arcs such that the total length of all the arcs are minimized.
Laying telephone cable, television cable, etc., are the examples of minimum
spanning tree problem.
There are two algorithms for the minimum spanning tree problem is presented:
a). PRIM algorithm
b). Kruskal’s algorithm
1.Consider the details of a distance network as shown below:

Arc Distance Arc Distance


1-2 4 4-7 10
1-4 2 5-7 5
1-5 3 5-8 7
2-4 6 6-7 3
2-3 6 6-10 6
3-4 5 7-8 1
3-6 9 7-9 3
4-5 4 8-9 2
4-6 8 9-10 5

a). Construct the distance network.


b). Find the minimum spanning tree using PRIM algorithm.
Solution:
a). Construction of distance network as shown below
b). minimum spanning tree using PRIM algorithm

1 2 3 4 5 6 7 8 9 10
1 - 4 ∞ 2 3 ∞ ∞ ∞ ∞ ∞
2 4 - 6 6 ∞ ∞ ∞ ∞ ∞ ∞
3 ∞ 6 - 5 ∞ 9 ∞ ∞ ∞ ∞
4 2 6 5 - 4 8 10 ∞ ∞ ∞
5 3 ∞ ∞ 4 - ∞ 5 7 ∞ ∞
6 ∞ ∞ 9 8 ∞ - 3 ∞ ∞ 6
7 ∞ ∞ ∞ 10 5 3 - 1 3 ∞
8 ∞ ∞ ∞ ∞ 7 ∞ 1 - 2 ∞
9 ∞ ∞ ∞ ∞ ∞ ∞ 3 2 - 5
10 ∞ ∞ ∞ ∞ ∞ 6 ∞ ∞ 5 -
1 2 3 4 5 6 7 8 9 10
1 - 4 ∞ 2 3 ∞ ∞ ∞ ∞ ∞
2 4 - 6 6 ∞ ∞ ∞ ∞ ∞ ∞
3 ∞ 6 - 5 ∞ 9 ∞ ∞ ∞ ∞
4 2 6 5 - 4 8 10 ∞ ∞ ∞
5 3 ∞ ∞ 4 - ∞ 5 7 ∞ ∞
6 ∞ ∞ 9 8 ∞ - 3 ∞ ∞ 6
7 ∞ ∞ ∞ 10 5 3 - 1 3 ∞
8 ∞ ∞ ∞ ∞ 7 ∞ 1 - 2 ∞
9 ∞ ∞ ∞ ∞ ∞ ∞ 3 2 - 5
10 ∞ ∞ ∞ ∞ ∞ 6 ∞ ∞ 5 -
1 2 3 4 5 6 7 8 9 10
1 - 4 ∞ 2 3 ∞ ∞ ∞ ∞ ∞
2 4 - 6 6 ∞ ∞ ∞ ∞ ∞ ∞
3 ∞ 6 - 5 ∞ 9 ∞ ∞ ∞ ∞
4 2 6 5 - 4 8 10 ∞ ∞ ∞
5 3 ∞ ∞ 4 - ∞ 5 7 ∞ ∞
6 ∞ ∞ 9 8 ∞ - 3 ∞ ∞ 6
7 ∞ ∞ ∞ 10 5 3 - 1 3 ∞
8 ∞ ∞ ∞ ∞ 7 ∞ 1 - 2 ∞
9 ∞ ∞ ∞ ∞ ∞ ∞ 3 2 - 5
10 ∞ ∞ ∞ ∞ ∞ 6 ∞ ∞ 5 -

Possible path are: 1-2,1-4,1-5,4-3,5-7,7-6,7-8, 8-9 and 9-10


Solution: Minimum spanning tree using PRIM algorithm

Potrebbero piacerti anche