// Algorithms to design electrical grids #include #include #include #include "Graph.h" #include "place.h" #include "Pq.h" //////////////////////////////////////////////////////////////////////// // Your task /** * Designs a minimal cost electrical grid that will deliver electricity * from a power plant to all the given cities. Power lines must be built * between cities or between a city and a power plant. Cost is directly * proportional to the total length of power lines used. * Assumes that numCities is at least 1 (numCities is the size of the * cities array). * Stores the power lines that need to be built in the given powerLines * array, and returns the number of power lines stored. Assumes that the * powerLines array is large enough to store all required power lines. */ int planGrid1(struct place cities[], int numCities, struct place powerPlant, struct powerLine powerLines[]) { // TODO: Complete this function return 0; } //////////////////////////////////////////////////////////////////////// // Optional task /** * Designs a minimal cost electrical grid that will deliver electricity * to all the given cities. Power lines must be built between cities or * between a city and a power plant. Cost is directly proportional to * the total length of power lines used. Assume that each power plant * generates enough electricity to supply all cities, so not all power * plants need to be used. * Assumes that numCities and numPowerPlants are at least 1 (numCities * and numPowerPlants are the sizes of the cities and powerPlants arrays * respectively). * Stores the power lines that need to be built in the given powerLines * array, and returns the number of power lines stored. Assumes that the * powerLines array is large enough to store all required power lines. */ int planGrid2(struct place cities[], int numCities, struct place powerPlants[], int numPowerPlants, struct powerLine powerLines[]) { // TODO: Complete this function return 0; }