# Intuitively we just need to atten the k copies of g

This preview shows page 1. Sign up to view the full content.

This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: target vertex t in Gk .) Once we have a shortest path in G , we can convert it into the corresponding path in G by simply replacing every vertex ui ∈ V with u ∈ V , and then removing any loop edges (vi , vi ) from the path ii (resulting from the zero-weight edge (vi , vi +1 )). Intuitively, we just need to ﬂatten the k copies of G down to the single copy. Another solution to this problem, found by many students, is to replace the endpoints of the edges instead of using zero-weight edges. For example, after making k copies of the graph G, we can i i replace each edge (ui , vi ) with (ui , vi +1 ). This has the same effect as the zero-weight edges, and removes the need to remove loops at the end. 6.006 Quiz 2 Solutions Name 12 Problem 6. Fill ’Er Up! [25 points] You are traveling by car from one city to another city. Unfortunately, you have a hole in your gas tank, and you have to reﬁll your gas tank to travel across more than two roads. In addition, there is a toll booth on every road that charges you for...
View Full Document

## This document was uploaded on 03/17/2014 for the course ELECTRICAL 6.006 at MIT.

Ask a homework question - tutors are online