23.6 Case Study: Graph Representation (cont.)
- Represent graph using type of map
- City name is the key, a DistanceToCity is the element
- cities is a multimap; more than one edge may leave a city
multimap<string, DistanceToCity> CityMap;
(Adjacency list)
- DistanceFinder wraps the multimap, provides 2 member functions:
- set_distance adds an edge to the graph
- find_distance fills in a map of destinations and their
costs, given a source node
prev
|top
|next