ColPack
|
00001 /************************************************************************************ 00002 Copyright (C) 2005-2008 Assefaw H. Gebremedhin, Arijit Tarafdar, Duc Nguyen, 00003 Alex Pothen 00004 00005 This file is part of ColPack. 00006 00007 ColPack is free software: you can redistribute it and/or modify 00008 it under the terms of the GNU Lesser General Public License as published 00009 by the Free Software Foundation, either version 3 of the License, or 00010 (at your option) any later version. 00011 00012 ColPack is distributed in the hope that it will be useful, 00013 but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00015 GNU Lesser General Public License for more details. 00016 00017 You should have received a copy of the GNU Lesser General Public License 00018 along with ColPack. If not, see <http://www.gnu.org/licenses/>. 00019 ************************************************************************************/ 00020 00021 #ifndef DISJOINTSETS_H 00022 #define DISJOINTSETS_H 00023 00024 using namespace std; 00025 00026 namespace ColPack 00027 { 00037 class DisjointSets 00038 { 00039 private: 00040 00041 vector<int> p_vi_Nodes; 00042 00043 public: 00044 00045 //Public Constructor 4251 00046 DisjointSets(); 00047 00048 //Public Constructor 4252 00049 DisjointSets(int); 00050 00051 //Public Destructor 4253 00052 ~DisjointSets(); 00053 00054 //Public Function 4254 00056 int SetSize(int); 00057 00058 //Public Function 4255 00060 int Count(); 00061 00062 //Public Function 4256 00064 int Print(); 00065 00066 //Public Function 4257 00068 int Find(int); 00069 00070 //Public Function 4258 00072 int FindAndCompress(int); 00073 00074 //Public Function 4259 00076 00079 int Union(int li_SetOne, int li_SetTwo); 00080 00081 //Public Function 4260 00083 00091 int UnionByRank(int li_SetOne, int li_SetTwo); 00092 00093 //Public Function 4261 00095 00102 int UnionBySize(int li_SetOne, int li_SetTwo); 00103 00104 }; 00105 } 00106 #endif