Академический Документы
Профессиональный Документы
Культура Документы
Barangays
2
5 4 4
10 5 7
1 3 5
1 3 9
2 9
7 8 8
4 6
3
Simple Method: Connect adjacent nodes with the least distance, no cycle
allowed
1
11/4/2013
5 4 4
10 5 7
1 3 5
1 3 9
2 9
7 8 8
4 6
3
5 4 4
10 5 7
1 3 5
1 3 9
2 9
7 8 8
4 6
3
2
11/4/2013
5 4 4
10 5 7
1 3 5
1 3 9
2 9
7 8 8
4 6
3
5 4 4
10 5 7
1 3 5
1 3 9
2 9
7 8 8
4 6
3
3
11/4/2013
5 4 4
10 5 7
1 3 5
1 3 9
2 9
7 8 8
4 6
3
5 4 4
10 5 7
1 3 5
1 3 9
2 9
7 8 8
4 6
3
4
11/4/2013
5 4 4
10 5 7
1 3 5
1 3 9
2 9
7 8 8
4 6
3
5 4 4
10 5 7
1 3 5
1 3 9
2 9
7 8 8
4 6
3
5
11/4/2013
ASSIGNMENT
5.9 13
2.1
12 4.9
11 2.7 10
3.7 3.3 14
9 1.6
4.4 8 6.2
3.1 6.0
6 1.2
7 15
2.5 6.0 16
5 4.6 3.8
2.8 3.3
1 Jordan 1 Jordan
2.0 3.4 12.4
3 2 17
5.1 10.2
4 8.9 10.0
3.1
31 32 18 4.0
3.0
3.8 19
2.5 30
28 8.3
29 3.4 4.4
8.2
27 2.4 3.3
4.9 5.0
24
Note: Values are in km
6
11/4/2013
7
11/4/2013
Barangays
2
5 4 4
10 5 7
Municipal
Center 1 3 5
1 3 9
2 9
7 8 8
4 6
3
Solution:
This is a shortest-route problem which can be solved using the Dijkstra’s Algorithm.
1st Iteration:
Nodes 1 2 3 4 5 6 7 8
L(1) 0 5 1 7 ∞ ∞ ∞ ∞
(km)
*
2
5 4 4
10 5 7
1 3 5
1 3 9
2 9
7 8 8
4 6
3
8
11/4/2013
2nd Iteration:
Nodes 1 2 3 4 5 6 7 8
L(2) 0 5 1 7 ∞ ∞ ∞ ∞
(km)
* *
2
5 4 4
10 5 7
1 3 5
1 3 9
2 9
7 8 8
4 6
3
3rd Iteration:
Nodes 1 2 3 4 5 6 7 8
L(3) 0 5 1 3 11 10 ∞ ∞
(km)
* * *
2
5 4 4
10 5 7
1 3 5
1 3 9
2 9
7 8 8
4 6
3
9
11/4/2013
4th Iteration:
Nodes 1 2 3 4 5 6 7 8
L(2) 0 5 1 3 11 6 ∞ ∞
(km)
* * * *
2
5 4 4
10 5 7
1 3 5
1 3 9
2 9
7 8 8
4 6
3
5th Iteration:
Nodes 1 2 3 4 5 6 7 8
L(2) 0 5 1 3 11 6 ∞ ∞
(km)
* * * * *
2
5 4 4
10 5 7
1 3 5
1 3 9
2 9
7 8 8
4 6
3
10
11/4/2013
6th Iteration:
Nodes 1 2 3 4 5 6 7 8
L(6) 0 5 1 3 9 6 15 14
(km)
* * * * * *
2
5 4 4
10 5 7
1 3 5
1 3 9
2 9
7 8 8
4 6
3
7th Iteration:
Nodes 1 2 3 4 5 6 7 8
L(6) 0 5 1 3 9 6 13 14
(km)
* * * * * * *
2
5 4 4
10 5 7
1 3 5
1 3 9
2 9
7 8 8
4 6
3
11
11/4/2013
8th Iteration:
Nodes 1 2 3 4 5 6 7 8
L(6) 0 5 1 3 9 6 13 14
(km)
* * * * * * * *
5 4 4
10 5 7
1 3 5
1 3 9
2 9
7 8 8
4 6
3
5 4 4
10 5 7
1 3 5
1 3 9
2 9
7 8 8
4 6
3
12
11/4/2013
ASSIGNMENT
5.9 13
2.1
12 4.9
11 2.7 10
3.7 3.3 14
9 1.6
4.4 8 6.2
3.1 6.0
6 1.2
7 15
2.5 6.0 16
5 4.6 3.8
2.8 3.3
1 Jordan 1 Jordan
2.0 3.4 12.4
3 2 17
5.1 10.2
4 8.9 10.0
3.1
31 32 18 4.0
3.0
3.8 19
2.5 30
28 8.3
29 3.4 4.4
8.2
27 2.4 3.3
4.9 5.0
24
Note: Values are in km
13
11/4/2013
14
11/4/2013
Lazi Community
Hospital
Missing
road link
2 Missing
road links
15
11/4/2013
Example: Find the following: (a) the minimal spanning tree and (b) the
shortest path from Zone A to Zone D and also from Zone B to Zone C.
16
11/4/2013
1 2 5 6 5
8
1
3 6
1 2 7
2 5 4 7
8
END
17