Finds cliques. More...
#include <ogdf/clique/CliqueFinderModule.h>
Public Member Functions | |
CliqueFinderModule () | |
Creates a CliqueFinderModule. | |
virtual | ~CliqueFinderModule () |
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. | |
Parameter Setters | |
void | setMinSize (int i) |
Sets the minimum size of a clique. | |
Static Public Member Functions | |
Helper Functions | |
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. | |
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. | |
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. | |
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. | |
Protected Member Functions | |
virtual void | doCall ()=0 |
Find cliques in m_pCopy. | |
Protected Attributes | |
NodeArray< int > | m_copyCliqueNumber |
The clique number for each node in m_pCopy. | |
int | m_minDegree |
Minimum degree of the nodes in a found clique. | |
GraphCopy * | m_pCopy |
Copy of m_pGraph without self-loops and multi-edges. | |
Private Member Functions | |
void | beginCall (const Graph &G) |
Initializes member variables and calls doCall(). | |
void | endCall () |
Frees memory after doCall(). | |
bool | handleTrivialCases () |
Checks whether finding cliques in m_pCopy is trivial, i.e. | |
void | setResults (List< List< node > * > &cliqueLists) |
Sets the results of doCall() using m_copyCliqueNumber. | |
void | setResults (NodeArray< int > &cliqueNumber) |
Sets the results of doCall() using m_copyCliqueNumber. | |
Private Attributes | |
const Graph * | m_pGraph |
The original Graph in which cliques are searched. | |
Finds cliques.
A CliqueFinderModule can be called on a graph to retrieve (disjoint) cliques.
Definition at line 46 of file CliqueFinderModule.h.
|
inlineexplicit |
Creates a CliqueFinderModule.
By default, it searches for cliques containing at least three nodes. This setting can be changed with setMinSize().
Definition at line 54 of file CliqueFinderModule.h.
|
inlinevirtual |
Definition at line 56 of file CliqueFinderModule.h.
Initializes member variables and calls doCall().
G | The graph in which to search for cliques. |
Searches for cliques and returns the list of cliques.
Each clique is represented by a list of member nodes in the list of cliques cliqueLists
.
G | The graph on which the clique finding algorithm is called. |
cliqueLists | The list of cliques. |
Searches for cliques and sets the clique index number for each node.
Each clique will be assigned a different number. Each node gets the number of the clique it is contained in or -1 if the node is not a clique member.
G | The graph on which the clique finding algorithm is called. |
cliqueNumber | The clique number for each node. |
|
static |
Labels and colors nodes in the given GraphAttributes according to their clique number.
Note that the coordinates of the nodes are not changed: A separate layout algorithm has to be used to this end.
G | Graph the cliques belong to. |
cliqueNumber | The clique number for each node. |
GA | Is assigned the node colors and labels. |
|
static |
Uses the clique number for each node to create a list of cliques.
G | Graph the cliques belong to. |
cliqueNumber | The clique number for each node. |
cliqueLists | Is assigned a list of lists, each one representing a clique. |
|
static |
Checks whether density times the number of possible edges exist between clique members.
G | Graph the cliques belong to. |
clique | The clique to check. |
density | The fraction in [0,1] of possible edges between clique members that have to exist in order for the check to succeed. |
Find cliques in m_pCopy.
The found cliques are noted in m_copyCliqueNumber. Clique nodes get a number >= 0, all other nodes -1.
Implemented in ogdf::CliqueFinderHeuristic, and ogdf::CliqueFinderSPQR.
|
private |
Checks whether finding cliques in m_pCopy is trivial, i.e.
n < 3 or n < m_minDegree, and sets m_copyCliqueNumber if that is the case.
Sets the minimum size of a clique.
Definition at line 81 of file CliqueFinderModule.h.
Sets the results of doCall() using m_copyCliqueNumber.
cliqueLists | Is assigned a list of pointers, each one pointing to a list of nodes representing a clique. |
Sets the results of doCall() using m_copyCliqueNumber.
cliqueNumber | Is assigned the clique number for each node. |
The clique number for each node in m_pCopy.
Definition at line 174 of file CliqueFinderModule.h.
|
protected |
Minimum degree of the nodes in a found clique.
Definition at line 176 of file CliqueFinderModule.h.
|
protected |
Copy of m_pGraph without self-loops and multi-edges.
Definition at line 172 of file CliqueFinderModule.h.
The original Graph in which cliques are searched.
Definition at line 169 of file CliqueFinderModule.h.