Tutorial_5

# Tutorial_5 - IELM202 Tutorial 5 1 You need to take a trip...

This preview shows pages 1–3. Sign up to view the full content.

IELM202 Tutorial 5 1/6/11 1. You need to take a trip by car to another town that you have never visited before. Therefore, you are studying a map to determine the shortest route to your destination. Depending on which route you choose, there are five other towns (call them A, B, C, D, E) that you might pass through on the way. The map shows the mileage along each road that directly connects two towns without any intervening towns. These numbers are summarized in the following table, where a dash indicates that there is no road directly connecting these two towns without going through any other towns. Town Miles between Adjacent Towns A B C D E Destination Origin 40 60 50 --- --- --- A 10 --- 70 --- --- B 20 55 40 --- C --- 50 --- D 10 60 E 80 (a) Formulate this problem as a shortest-path problem by drawing a network where nodes represent towns, links represent roads, and number indicate the length of each link in miles. (b) Use Dijkstra algorithm to solve this shortest-path problem. Ans: Remove the direction -> (a) A B D T O C E 70 10 40 50 50 80 60 55 60 20 40 10

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
IELM202 Tutorial 5 1/6/11 (b) n Solved nodes connected to unsolved nodes Closest connected unsolved odes Total distance involved Nth Nearest node Minimum distance Last connection 1 O A 40 A 40 OA 2,3 O A C B 50 40+10=50 C B 50 50 OC AB 4 A B C D E E 40+70=110 50+40=90 50+50=100 E 90 BE 5 A B E D D D 40+70=110 50+55=105 90+10=100 D 100 ED 6 D E T T 100+60=160 90+80=170 T 160
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### Page1 / 4

Tutorial_5 - IELM202 Tutorial 5 1 You need to take a trip...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online