Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00043 #ifdef _MSC_VER
00044 #pragma once
00045 #endif
00046
00047 #ifndef OGDF_CLIQUEFINDER_H
00048 #define OGDF_CLIQUEFINDER_H
00049
00050
00051 #include <ogdf/basic/NodeArray.h>
00052 #include <ogdf/basic/EdgeArray.h>
00053 #include <ogdf/basic/List.h>
00054 #include <ogdf/basic/GraphCopy.h>
00055
00056 namespace ogdf{
00057
00058
00060
00074 class OGDF_EXPORT CliqueFinder {
00075
00076 public:
00077
00078 CliqueFinder(const Graph &G);
00079 ~CliqueFinder();
00080
00081
00082
00083
00084
00085
00087
00091 void call(NodeArray<int> &cliqueNumber);
00093
00097 void call(List< List<node> > &cliqueLists);
00098
00100 void setMinSize(int i) { m_minDegree = max(2, i-1);}
00101 enum postProcess {ppNone, ppSimple};
00102
00104
00107 void setDensity(int density)
00108 {
00109 if (density < 0) m_density = 0;
00110 else if (density > 100) m_density = 100;
00111 else m_density = density;
00112 }
00113
00114 protected:
00120 void doCall(int minDegree = 2);
00121
00122
00123
00124
00125
00126 void setResults(NodeArray<int> &cliqueNumber);
00127 void setResults(List< List<node> > &cliqueLists);
00128 void setResults(List< List<node>* > &cliqueLists);
00129
00130
00131
00132 void postProcessCliques(List< List<node>* > &cliqueList,
00133 EdgeArray<bool> &usableEdge);
00134
00135
00136 bool allAdjacent(node v, List<node>* vList);
00137 void writeGraph(Graph &G, NodeArray<int> &cliqueNumber,
00138 const String &fileName);
00139
00140
00141
00142
00143
00144 int evaluate(node v, EdgeArray<bool> &usableEdge);
00145 void checkCliques(List< List<node>* > &cliqueList, bool sizeCheck = true);
00146 bool cliqueOK(List<node> *clique);
00147 void findClique(node v, List<node> &neighbours,
00148 int numRandom = 0);
00149
00150 private:
00151 const Graph* m_pGraph;
00152 GraphCopy* m_pCopy;
00153 NodeArray<int> m_copyCliqueNumber;
00154 NodeArray<bool> m_usedNode;
00155
00156 int m_minDegree;
00157 int m_numberOfCliques;
00158 postProcess m_postProcess;
00159 bool m_callByList;
00160 List< List<node> > *m_pList;
00161
00162 int m_density;
00163
00164
00165
00166 };
00167
00168 }
00169
00170 #endif