use a edge to distance map instead of the other way around.  this gets the correct answer on the homework