Open
Graph Drawing
Framework

 v. 2023.09 (Elderberry)
 

Loading...
Searching...
No Matches
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
40namespace ogdf {
41class GraphAttributes;
42class GraphCopy;
43template<class E>
44class List;
45
47
53public:
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
142private:
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
174
176
177protected:
179
181
183
188 virtual void doCall() = 0;
189
191};
192
193}
Includes declaration of graph class.
Basic declarations, included by all source files.
virtual void doCall()=0
Find cliques in m_pCopy.
static void cliqueListToNumber(const Graph &G, const List< List< node > * > &cliqueLists, NodeArray< int > &cliqueNumber)
Uses a list of cliques to get the clique number of each node.
void endCall()
Frees memory after doCall().
CliqueFinderModule()
Creates a CliqueFinderModule.
static void cliqueNumberToList(const Graph &G, const NodeArray< int > &cliqueNumber, List< List< node > * > &cliqueLists)
Uses the clique number for each node to create a list of cliques.
void beginCall(const Graph &G)
Initializes member variables and calls doCall().
void setResults(List< List< node > * > &cliqueLists)
Sets the results of doCall() using m_copyCliqueNumber.
bool handleTrivialCases()
Checks whether finding cliques in m_pCopy is trivial, i.e.
void setResults(NodeArray< int > &cliqueNumber)
Sets the results of doCall() using m_copyCliqueNumber.
NodeArray< int > m_copyCliqueNumber
The clique number for each node in m_pCopy.
GraphCopy * m_pCopy
Copy of m_pGraph without self-loops and multi-edges.
void call(const Graph &G, List< List< node > * > &cliqueLists)
Searches for cliques and returns the list of cliques.
void call(const Graph &G, NodeArray< int > &cliqueNumber)
Searches for cliques and sets the clique index number for each node.
static bool cliqueOK(const Graph &G, List< node > *clique, double density=1.0)
Checks whether density times the number of possible edges exist between clique members.
const Graph * m_pGraph
The original Graph in which cliques are searched.
static void cliqueGraphAttributes(const Graph &G, const NodeArray< int > &cliqueNumber, GraphAttributes &GA)
Labels and colors nodes in the given GraphAttributes according to their clique number.
void setMinSize(int i)
Sets the minimum size of a clique.
int m_minDegree
Minimum degree of the nodes in a found clique.
Stores additional attributes of a graph (like layout information).
Copies of graphs supporting edge splitting.
Definition GraphCopy.h:390
Data type for general directed graphs (adjacency list representation).
Definition Graph_d.h:866
Doubly linked lists (maintaining the length of the list).
Definition List.h:1451
RegisteredArray for nodes, edges and adjEntries of a graph.
Definition Graph_d.h:659
#define OGDF_EXPORT
Specifies that a function or class is exported by the OGDF dynamic library (shared object / DLL),...
Definition config.h:117
#define OGDF_MALLOC_NEW_DELETE
Makes the class use malloc for memory allocation.
Definition memory.h:92
Declaration of memory manager for allocating small pieces of memory.
The namespace for all OGDF objects.