openplans/OpenTripPlanner — pull request #1064 by flamholz (2013-04-30 20:19:05+00:00)
Title: Fix short trips on the same edge

Andrew, David --

There was a bug in the routing code where trips with an origin and destination on the same edge would get too-long routes. For example, the walking route would tell you to go to the corner and then turn around and go back. This was due to the way that temporary edges were set up - that the origin and destination may lie on the same underlying edges but since they are connected to the graph via temporary edges they were actually disconnected from each other.

I have updated the code as follows:
1) I added an explicit class PartialPlainStreetEdge for representing partial edges. These edges track their "parent" edge so that you can tell that two temporary edges lie on the same parent edge.
2) I updated RoutingContext to detect when the to/from vertices share any edges and to connect them along those edges.
3) I added a unit test in TestHalfEdges to verify that we get single-edge routes when the origin and destination lie on the same edge.

Please take a look,
Avi