C++ graph / map data structure
I am having a little trouble understanding the graph data structure. If you guys know any links that provide sample code that I can look at and learn please help!
Just need some help getting the ball rolling on an assignment that requires me to find the most efficient route from a city to another city. I've thought about the algorithm (using a stack & recursion) but I need help to as how I store the cities.
For basics, I made an array that holds each city (no duplitcates). So, cities[] has from 0 to 4: A B C D E. How to I approach creating the links, such as A as links to B & E, C has a link to B. I did some reading and ran into creating an adjacentMatrix ( ? ) or vector (?) ?
This is where I am stuck!
|