diff --git a/province.cc b/province.cc index 90f106d..d0f3f5f 100644 --- a/province.cc +++ b/province.cc @@ -12,18 +12,6 @@ using namespace std; -/* -* Constructor -* @param source File containing province: -* 1. One line: number of towns (n), number of roads (p) -* as integers -* 2. n lines: names of towns, all uppercase -* 3. p lines: roads, defined as names of towns they -* connect, bridge/not bridge, and length in miles -* ex: BEVERLY DANVERS N 2.9 (connects Beverly and -* Danvers, not a bridge, 2.9 miles long) -*/ - Province::Province(std::istream & source) { // Read first line of input source >> _numberOfTowns >> _numberOfRoads; @@ -110,10 +98,6 @@ int Province::smallest(double dist[], std::list toVisit, return smallest; } -/** -* Print the shortest route from the capital of the -* province to each of the other towns -*/ void Province::printShortestPath(std::ostream & output) const { // if there is only one town only one town diff --git a/province.h b/province.h index 5e04368..9724b94 100644 --- a/province.h +++ b/province.h @@ -9,15 +9,15 @@ #include #include -/** -* towns connected by roads -*/ class Province { public: /** * Constructor * @param source Input data for province + * + * The constructor handles input data and creates a new province graph + * with town and road data */ Province(std::istream & source); @@ -26,6 +26,13 @@ class Province { * @param output Stream to print data to */ void printAll(int start, std::ostream & output); + + /** + * Print the shortest path conections from the capital of a province + * to all other towns + * + * @param output Stream to print data to + */ void printShortestPath(std::ostream & output) const; /** @@ -33,15 +40,29 @@ class Province { */ void findShortestPath(); + /** + * Create a minimum cost spanning tree of a province + * to calculate ideal + * + * @param output Stream to print data to + */ void minSpan(std::ostream & output) const; + /** + * Remove bridges from the graph to evaluate + * which towns would become isolated by a storm + * + * @param output Stream to print data to + */ void removeBridges(std::ostream & output) const; + /** + * Find the articulation points of a graph + * + * @param output Stream to print data to + */ void articulationPoints(std::ostream & output) const; - /** - * Destructor - */ ~Province() {} private: @@ -55,6 +76,17 @@ class Province { */ std::vector bfs(int start) const; + /** + * Recursive helper for articulationPoints() + * + * @param u + * @param visited + * @param disc + * @param low + * @param time + * @param parent + * @param isAP + */ void APUtil(int u, bool visited[], int disc[], int low[], int& time, int parent, bool isAP[]) const;