Open
Graph Drawing
Framework

 v. 2023.09 (Elderberry)
 

CliqueFinderModule.h
Go to the documentation of this file.
1 
32 #pragma once
33 
34 #include <ogdf/basic/Graph.h>
35 #include <ogdf/basic/basic.h>
36 #include <ogdf/basic/memory.h>
37 
38 #include <algorithm>
39 
40 namespace ogdf {
41 class GraphAttributes;
42 class GraphCopy;
43 template<class E>
44 class List;
45 
47 
53 public:
60  explicit CliqueFinderModule() : m_pGraph(nullptr), m_pCopy(nullptr), m_minDegree(2) { }
61 
62  virtual ~CliqueFinderModule() { }
63 
65 
72  void call(const Graph& G, NodeArray<int>& cliqueNumber);
73 
75 
81  void call(const Graph& G, List<List<node>*>& cliqueLists);
82 
85 
87  void setMinSize(int i) { m_minDegree = max(0, i - 1); }
88 
92 
100  static void cliqueListToNumber(const Graph& G, const List<List<node>*>& cliqueLists,
101  NodeArray<int>& cliqueNumber);
102 
111  static void cliqueNumberToList(const Graph& G, const NodeArray<int>& cliqueNumber,
112  List<List<node>*>& cliqueLists);
113 
125  static void cliqueGraphAttributes(const Graph& G, const NodeArray<int>& cliqueNumber,
126  GraphAttributes& GA);
127 
138  static bool cliqueOK(const Graph& G, List<node>* clique, double density = 1.0);
139 
141 
142 private:
144 
147  void beginCall(const Graph& G);
148 
154  void setResults(NodeArray<int>& cliqueNumber);
155 
163  void setResults(List<List<node>*>& cliqueLists);
164 
166  void endCall();
167 
173  bool handleTrivialCases();
174 
175  const Graph* m_pGraph;
176 
177 protected:
179 
181 
183 
188  virtual void doCall() = 0;
189 
191 };
192 
193 }
ogdf
The namespace for all OGDF objects.
Definition: multilevelmixer.cpp:39
ogdf::GraphAttributes
Stores additional attributes of a graph (like layout information).
Definition: GraphAttributes.h:72
Graph.h
Includes declaration of graph class.
ogdf::CliqueFinderModule::m_pGraph
const Graph * m_pGraph
The original Graph in which cliques are searched.
Definition: CliqueFinderModule.h:175
ogdf::GraphCopy
Copies of graphs supporting edge splitting.
Definition: GraphCopy.h:391
ogdf::CliqueFinderModule::m_pCopy
GraphCopy * m_pCopy
Copy of m_pGraph without self-loops and multi-edges.
Definition: CliqueFinderModule.h:178
OGDF_MALLOC_NEW_DELETE
#define OGDF_MALLOC_NEW_DELETE
Makes the class use malloc for memory allocation.
Definition: memory.h:92
ogdf::CliqueFinderModule::CliqueFinderModule
CliqueFinderModule()
Creates a CliqueFinderModule.
Definition: CliqueFinderModule.h:60
ogdf::CliqueFinderModule::m_copyCliqueNumber
NodeArray< int > m_copyCliqueNumber
The clique number for each node in m_pCopy.
Definition: CliqueFinderModule.h:180
ogdf::List
Doubly linked lists (maintaining the length of the list).
Definition: DfsMakeBiconnected.h:40
ogdf::internal::GraphRegisteredArray
RegisteredArray for nodes, edges and adjEntries of a graph.
Definition: Graph_d.h:658
ogdf::Graph
Data type for general directed graphs (adjacency list representation).
Definition: Graph_d.h:869
ogdf::CliqueFinderModule
Finds cliques.
Definition: CliqueFinderModule.h:52
ogdf::CliqueFinderModule::m_minDegree
int m_minDegree
Minimum degree of the nodes in a found clique.
Definition: CliqueFinderModule.h:182
ogdf::CliqueFinderModule::setMinSize
void setMinSize(int i)
Sets the minimum size of a clique.
Definition: CliqueFinderModule.h:87
basic.h
Basic declarations, included by all source files.
OGDF_EXPORT
#define OGDF_EXPORT
Specifies that a function or class is exported by the OGDF DLL.
Definition: config.h:101
ogdf::CliqueFinderModule::~CliqueFinderModule
virtual ~CliqueFinderModule()
Definition: CliqueFinderModule.h:62
memory.h
Declaration of memory manager for allocating small pieces of memory.