So as you're following your route, your program is checking off each node
as it is passed at every intersection where a turn is required.
Ignore points in a polyline that only represent bends in the road and not intersections.
At least for Garmin maps (and I suspect every other data map), roads that
intersect or join always have exactly the same coordinates where they meet,
so your node list can be a structure containing the coordinate pairs for intersections of the route.
http://computer.howstuffworks.com/routing-algorithm3.htm
In the above example, the preferred route is A,B,D,E.
If you took the wrong turn at node D, and headed back toward node C,
it is easy to determine you are on a line (road) that does not connect node E.
Your GPS doesn't check that you took a left turn at node D,
it checks that you are still connected to the path that ends in the next node.
I think a commercial GPS gives a little bit of time to reroute to allow for GPS
error which is ok because you weren't going to do a 180 on the road and head
back in most cases. you need to reroute from node C.