#pragma once #include #include #include #include #include #include #include "DisjSets.h" using namespace stdext; using namespace std; class CityConnector { public: // this function should allow the user to load an input text file CityConnector(string InputFileName); CityConnector(void); void LoadFile(const char * filename); // this function should compute the eq. classes and output void ReportConnectedCities(); // this function checks whether two cities are connected bool CheckConnection(string city_1, string city_2); // other member functions and private data stores private: DisjSets djs; void LoadPairs(const char *filename); void UnionConnections(void); void Print(void); int cityID; //Direct connections by flight vector< pair > connections; //cityID of City to int map city2int; //cityID of int to City map int2city; //can't think of a good way to print out directly from union find structure //so I'll use a hash on the finds of each node... hash_multimap node2root; //this allows for you to declare a CityConnector to have //CityConnector(void) and be able to Load the file from a method. //--for expandability and reuseability. bool initialized; };