You need more than just distances between points on the road for example.
Think of a road like you would think of a 3d model instead. The Road since it's not moving has a fixed BONE structure for that model. The bones you can use for point distance calculations.
Remember it's a simulation which means you need to account for a physical model, hence think 3d instead of a series of data structures. (the later comes from the physical information).
I suggest looking for online maps or creating a simple test course for your map.
3d models have a number of possible layers in them.
You have the physical description which is surfaces and textures adhered to those surfaces
Bone structure, if you push this here whole sets of points deform and stretch.
In your case you need a 3d planar surface called a walk map. This walk map in your case is your road (in other words the car can only walk on that area.
Of course if the teacher wants something that's unrealistically simple heh.. a series of connecting points on a planar surface works just fine, use a cubic spline to determine when and where to turn (can't use beizer curves as they don't actually go through the point in this case you have to remain on the road
).
At this point you can create your data structure. I suggest a maze solving alogrythm. This is the same thing that is used by circuit board routers. You being by finding the nearest node and going to it, you keep going until you either can't go anymore or hit your goal. At this point you return the list of locations and construct your travel plan from that. The road is your 'safe' path for travel is all.
If you find two paths the shortest path should be choosen, safest path is another thing all together LOL.
Structure...
Lets assume your road way is a 2d planar surface (IE it's flatland).
You only need X and Y points of your road surface. I'm not sure what you wish to do for how detailed it is but lets be simplistic. You have a road surface and points in the center of it.
Points are connected (they are essentially a polyline).
class intersection
{
road_location *Connection;
interesection *Next;
};
class road_location
{
double Lattitude, Longitude; // or Y and X :)
intersection *Branch;
};
you might want a few operators.. such as the difference returning a double ( IE A - B = the distance between the two points).
Also notice Branchs, they refer to other locations that this connects too. If you wish to simplify this just use a fixed array instead of a list of intersections that this location connects too.
So your graph is basically a series of lists of interesections and the road locations they go to.
Your starting point and end points are road locations.
You traverse the graph between those locations to find if you can get there and the shortest path
How you traverse that path, well you have your books and you can have fun figuring out how to I guess
Cyb