# The weight we of an edge e represents the toll amount

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: using that road. Your goal is to ﬁnd the least-expensive path from your start to your destination. You represent the city network using a directed graph G = (V, E, w) with weights w deﬁned on both edges and vertices. The vertices V represent the cities and the edges E represent the roads. The weight w(e) of an edge e represents the toll amount on that road. The weight w(v ) of a vertex v is the price of ﬁlling your gas tank in that city (which is a ﬁxed price independent of how much gas you have left, or ∞ if there is no gas available to purchase). You are allowed (but not obligated) to end your journey with an empty tank, and you may assume that you always start your journey with a full tank. Below is an example graph that we will use to answer part (a). One seemingly cheap path from s to t is (s, u1 , u2 , t) at a cost of \$8. Unfortunately, this path is not valid, because our leaky gas tank won’t permit moving across three edges without reﬁlling our gas tank. One valid path is (s, u3 , u2 , t) at a cost of \$22. (This is a valid path: we begin with a full tank, trav...
View Full Document

Ask a homework question - tutors are online