0% found this document useful (0 votes)
154 views2 pages

Assignment 3.4 (Page 31-32)

The document describes a scenario where a student has several errands to complete in one day and wants to minimize the total distance traveled between each location. It provides a distance matrix between 5 locations: the market, school, a friend's house, the pharmacy, and a hair salon. Using two graph algorithms - the greedy algorithm and edge-picking algorithm - it finds the shortest route that starts and ends at the market is Market → Pharmacy → Haircut → School → Friend → Market, with a total distance of 2,250 meters.
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)
154 views2 pages

Assignment 3.4 (Page 31-32)

The document describes a scenario where a student has several errands to complete in one day and wants to minimize the total distance traveled between each location. It provides a distance matrix between 5 locations: the market, school, a friend's house, the pharmacy, and a hair salon. Using two graph algorithms - the greedy algorithm and edge-picking algorithm - it finds the shortest route that starts and ends at the market is Market → Pharmacy → Haircut → School → Friend → Market, with a total distance of 2,250 meters.
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/ 2

3.5.

WEIGHTED GRAPHS 3​1

NAME:​ KATE IANNEL C. VICENTE

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 hair cut. You want to do all these things while minimizing
the total distance traveled.
The distances (in meters) between each of the locations of your errands are shown below.

Distance (km) Market School Friend Pharmacy Hair Cut

Market − 1200 900 300 700

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.

1. Use the Greedy Algorithm to determine a time-saving route that starts and ends at the market.

Market → Pharmacy→ Haircut → School→ Friend → Market

Total Distance: 2 250 meters


3.5. WEIGHTED GRAPHS 3​2

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.

Total Distance: 2 250 meters

You might also like