Create a graph structure with cities as Vertices and roads as Edges. We are creating a connected graph of cities so that every city is reachable. We are not following an existing road network, we are magically flying between cities. Make it so that every city will have a degree of D (in/out degree), where each edge connects one of D closest cities to that vertex.
You should make sure that you can adjust the degree using a command line parameter and not hard coding it.
Included in the folder is a [login to view URL] file with 1000 cities along with some data about each city. Your Vertex data type should hold all the information below.
Also included are the [login to view URL] and [login to view URL] files. Using the json helper, you can read in the [login to view URL] file just like our last project.
Starting with the first city in the file C0, find the D closest cities to C0 and create undirected edges between them: C0 => Ci and Ci => C0. Your edge type should store the distance (as well as other pertinent information). Continue processing the rest of the cities C1 , C2, ... ,Cn adding edges until each city as D edges.
Look out for pitfalls, like just because a city is close to another, you may not be able to connect them if it already has D edges.
You must use a Heap to find the closest cities. I've included a heap implementation thats templated and only requires you to push on a struct* that includes a Priority data member. You can calculate the distance using the Haversine formula in Geo.hpp.