Open
Graph Drawing
Framework

 v. snapshot-2017-02-16
 

CliqueFinder.h
Go to the documentation of this file.
1 
33 #pragma once
34 
35 #include <ogdf/basic/NodeArray.h>
36 #include <ogdf/basic/EdgeArray.h>
37 #include <ogdf/basic/List.h>
38 #include <ogdf/basic/GraphCopy.h>
39 
40 namespace ogdf{
41 
42 
44 
61 
62 public:
63  //constructor
64  explicit CliqueFinder(const Graph &G);
65  ~CliqueFinder();
66 
67  //Calls
68  //We first make G biconnected, this keeps the triconnected
69  //components. then the triconnected components are computed
70  //within these components, we search for cliques
71 
73 
77  void call(NodeArray<int> &cliqueNumber);
79 
83  void call(List< List<node> > &cliqueLists);
84 
86  void setMinSize(int i) { m_minDegree = max(2, i-1);}
87  enum class postProcess {None, Simple};
88 
90 
93  void setDensity(int density)
94  {
95  if (density < 0) m_density = 0;
96  else if (density > 100) m_density = 100;
97  else m_density = density;
98  }
99 
100 protected:
106  void doCall(int minDegree = 2);
107 
108  //sets the results of doCall depending on call signature
109 
110  //clique nodes get numbers from >=0, all other nodes -1
111  void setResults(NodeArray<int> &cliqueNumber);
112  void setResults(List< List<node> > &cliqueLists);
113  void setResults(List< List<node>* > &cliqueLists);
114 
115  //work on the result of the first phase (heuristic), e.g.
116  //by dropping, splitting or joining some of the found subgraphs
117  void postProcessCliques(List< List<node>* > &cliqueList,
118  EdgeArray<bool> &usableEdge);
119 
120  //check if node v is adjacent to all nodes in node list
121  bool allAdjacent(node v, List<node>* vList);
122  void writeGraph(Graph &G, NodeArray<int> &cliqueNumber,
123  const char *fileName);
124 
125  //does a heuristic evaluation of node v (in m_pCopy)
126  //concerning its qualification as a cluster start node
127  //the higher the return value, the better the node
128  //uses only edges with usableEdge == true
129  int evaluate(node v, EdgeArray<bool> &usableEdge);
130 #ifdef OGDF_DEBUG
131  void checkCliques(List< List<node>* > &cliqueList, bool sizeCheck = true);
132 #endif
133  bool cliqueOK(List<node> *clique);
134  void findClique(node v, List<node> &neighbours,
135  int numRandom = 0);
136 
137 private:
138  const Graph* m_pGraph;
141  NodeArray<bool> m_usedNode; //node is assigned to clique
142 #if 0
143  List< List<node>* > m_cliqueList;
144 #endif
146  int m_numberOfCliques; //stores the number of found cliques
148  bool m_callByList; //stores information on type of call for result setting
149  List< List<node> > *m_pList; //stores pointer on list given as call parameter
150 
151  int m_density; //an abstract value from 0..100 definin how dense the
152  //subgraphs need to be, is not directly related to any
153  //measure (degree, ...) but translated into a constraint
154  //based on the heuristical search of the subgraphs
155 };//CliqueFinder
156 
157 }//end namespace ogdf
NodeArray< int > m_copyCliqueNumber
Definition: CliqueFinder.h:140
postProcess m_postProcess
Definition: CliqueFinder.h:147
Data type for general directed graphs (adjacency list representation).
Definition: Graph_d.h:472
#define OGDF_EXPORT
Specifies that a function or class is exported by the OGDF DLL.
Definition: config.h:99
const Graph * m_pGraph
Definition: CliqueFinder.h:138
void setMinSize(int i)
the minimum degree of the nodes within the clique/subgraph
Definition: CliqueFinder.h:86
NodeArray< bool > m_usedNode
Definition: CliqueFinder.h:141
Declaration and implementation of EdgeArray class.
void setDensity(int density)
Sets the abstract measure of density needed for subgraphs to be detected.
Definition: CliqueFinder.h:93
Doubly linked lists (maintaining the length of the list).
Definition: List.h:39
Declaration of graph copy classes.
no new dummy nodes are introduced, for every hyperedge e = (v_1, ..., v_l), we add a cliqie K_l conne...
Copies of graphs supporting edge splitting.
Definition: GraphCopy.h:250
Finds cliques and dense subgraphs.
Definition: CliqueFinder.h:60
Class for the representation of nodes.
Definition: Graph_d.h:167
Declaration and implementation of NodeArray class.
List< List< node > > * m_pList
Definition: CliqueFinder.h:149
The namespace for all OGDF objects.
GraphCopy * m_pCopy
Definition: CliqueFinder.h:139
Declaration of doubly linked lists and iterators.