You are on page 1of 2

32-33 3.

5 WEIGHTED GRAPHS

NAME:
You had several errands one day: go to the market, submit an assignment in school,
visit a sick friend, buy medicine from the pharmacy, and have a haircut. You want to do
all these things while minimizing the total distance traveled.

The distance (in meters) between each of the locations of your errands are shown below.

Distance Market School Friend Pharmacy Hair Cut


(km)
Market - 1200 900 700 300
School 1200 - 250 800 650
Friend 900 250 - 1300 1100
Pharmacy 300 800 1300 - 150
Hair Cut 700 650 1100 150 -

Draw the edges and weights that connect two errands below

1300
______________

1. Use the Greedy Algorithm to determine a time-saving route that starts and ends
at the market.
Market → Pharmacy → Hair Cut → School → Friend → Market
32-33 3.5 WEIGHTED GRAPHS

300 + 150 + 650 + 250 + 500 = 2250


Total Distance: 2250

2. Use the Edge-Picking Algorithm to determine a time-saving route that starts and
ends at the market. In the diagram below, draw the edges that you “picked”, and
label them 1, 2, 3, 4, 5, on the order with which you drew them.

__________________________

3
5
1
4
2

300 + 150 + 650 + 250 + 500 = 2250

Total Distance: 2250

You might also like