Open
Graph Drawing
Framework

 v. 2023.09 (Elderberry)
 

ogdf::NodeColoringBergerRompel Class Reference

Approximation algorithms for the node coloring problem in graphs. More...

#include <ogdf/graphalg/NodeColoringBergerRompel.h>

+ Inheritance diagram for ogdf::NodeColoringBergerRompel:

Classes

struct  SearchWrapperBergerRompel
 Wraps the parameterized Berger&Rompel algorithm. More...
 

Public Types

enum  BruteForceProcedure { BruteForceProcedure::trivialColoring, BruteForceProcedure::sequentialColoringSimple, BruteForceProcedure::sequentialColoringDegree, BruteForceProcedure::johnsonColoring, BruteForceProcedure::wigdersonColoring, BruteForceProcedure::pooled }
 Declares the procedure dealing with the brute force coloring. More...
 
- Public Types inherited from ogdf::NodeColoringModule
using NodeColor = unsigned int
 Data type of the node colors. More...
 
enum  RamseyProcedure { RamseyProcedure::smallestIndex, RamseyProcedure::smallestDegree, RamseyProcedure::largestDegree, RamseyProcedure::extremalDegree }
 Declares the procedure of finding nodes in Ramsey's algorithm. More...
 
enum  SearchProcedure { SearchProcedure::linearSearch, SearchProcedure::binarySearch, SearchProcedure::wigdersonSearch }
 Declares the search procedures. More...
 

Public Member Functions

 NodeColoringBergerRompel ()
 The constructor. More...
 
virtual NodeColor call (const Graph &graph, NodeArray< NodeColor > &colors, NodeColor start=0) override
 The actual algorithm call. More...
 
void setAlpha (double alpha)
 Sets the parameter alpha which controls the accuracy of the algorithm. More...
 
void setBruteForceProcedure (BruteForceProcedure bruteForceProcedure)
 Sets the brute force procedure. More...
 
void setSearchProcedure (SearchProcedure searchProcedure)
 Sets the search procedure to find the smallest possible parameter k such as the graph is k-colorable. More...
 
- Public Member Functions inherited from ogdf::NodeColoringModule
 NodeColoringModule ()
 Default constructor. More...
 
virtual ~NodeColoringModule ()
 Destructor. More...
 
virtual bool checkColoring (const Graph &graph, const NodeArray< NodeColor > &colors) const
 Checks if the given node coloring is valid. More...
 
virtual void preprocessGraph (Graph &graph) const
 Preprocesses a graph so that a coloring algorithm can be applied. More...
 

Private Member Functions

bool bergerRompelParameterized (const Graph &graph, NodeArray< NodeColor > &colors, NodeColor &color, int k, double alpha)
 

Private Attributes

double m_alpha
 
BruteForceProcedure m_bruteForceProcedure
 
NodeColoringJohnson m_johnsonColoring
 
SearchProcedure m_searchProcedure
 
NodeColoringSequential m_sequentialColoring
 
NodeColoringSimple m_simpleColoring
 
NodeColoringWigderson m_wigdersonColoring
 

Additional Inherited Members

- Protected Member Functions inherited from ogdf::NodeColoringModule
template<class CONTAINER >
bool checkIndependentSet (const Graph &graph, const CONTAINER &nodes) const
 Checks if subgraph induced by the given nodes forms an independent set. More...
 
virtual void cliqueRemoval (const Graph &graph, List< node > &independentSet) const
 Applies the clique removal algorithm for finding a large independent set in a given graph. More...
 
virtual void createBuckets (const Graph &graph, int size, Array< Array< node >> &buckets) const
 Creates a partitioning of the node set into buckets of a given size. More...
 
virtual int getMaximumDegreeNode (const Graph &graph, node &maxDegreeNode) const
 Searches for a maximum degree node in the graph. More...
 
virtual int getMaximumDegreeNodes (const Graph &graph, List< node > &maxDegreeNodes) const
 Searches for all nodes with maximum degree in the graph. More...
 
virtual NodeColor getMaximumNodeColor (NodeArray< NodeColor > &colors)
 Calculates the maximum node color index used in a certain node coloring. More...
 
virtual int getMinimumDegreeNode (const Graph &graph, node &minDegreeNode) const
 Searches for a minimum degree node in the graph. More...
 
virtual int getMinimumDegreeNodes (const Graph &graph, List< node > &minDegreeNodes) const
 Searches for all nodes with minimum degree in the graph. More...
 
int getNeighborDegrees (const node &v) const
 Calculates the sum of neighbor nodes degrees for a given node v. More...
 
template<class LISTITERATOR >
void getNeighbors (const Graph &graph, LISTITERATOR nodes, List< node > &neighbors) const
 Calculates the set of neighbors Y for a given set of nodes X. More...
 
template<class LISTITERATOR >
void getNeighborsComplement (const Graph &graph, LISTITERATOR nodes, List< node > &complementNeighbors) const
 Calculates the set of complement neighbors Y for a given set of nodes X. More...
 
template<class LISTITERATOR >
void mergeNodeLists (const Graph &graph, LISTITERATOR firstList, LISTITERATOR secondList, List< node > &mergedList) const
 Merges two lists of nodes and deletes the duplicates. More...
 
virtual void ramseyAlgorithm (const Graph &graph, List< node > &clique, List< node > &independentSet) const
 Performs the Ramsey algorithm for finding heuristically large cliques and independents sets in a graph. More...
 
virtual void reverseNodeTable (const Graph &graphOrig, const Graph &graphNew, const NodeArray< node > &orig2New, NodeArray< node > &new2Orig) const
 Reverses the mapping between the nodes sets of a graph and a subgraph. More...
 
int searchBinary (SearchWrapper *searchWrapper, int start, int end) const
 Performs a binary search in a specified range with a given oracle. More...
 
int searchLinear (SearchWrapper *searchWrapper, int start, int end) const
 Performs a linear search in a specified range with a given oracle. More...
 
int searchWigderson (SearchWrapper *searchWrapper) const
 Performs a the search procedure specified by Wigderson. More...
 
- Protected Attributes inherited from ogdf::NodeColoringModule
RamseyProcedure m_ramseyProcedure
 The RamseyProcedure to be used to select nodes. More...
 

Detailed Description

Approximation algorithms for the node coloring problem in graphs.

This class implements the approximation given by Berger&Rompel which colors the graph by finding independent sets.

Definition at line 47 of file NodeColoringBergerRompel.h.

Member Enumeration Documentation

◆ BruteForceProcedure

Declares the procedure dealing with the brute force coloring.

Enumerator
trivialColoring 

Uses trivial coloring, i.e. colors each node with a different color.

sequentialColoringSimple 

Uses sequential coloring with the trivial node permutation.

sequentialColoringDegree 

Uses sequential coloring with the nodes sorted decreasing by their degree.

johnsonColoring 

Uses Johnson's coloring algorithm.

wigdersonColoring 

Uses Wigderson's coloring algorithm.

pooled 

Pools all nodes from the recursion anchor and then applies sequential coloring.

Definition at line 52 of file NodeColoringBergerRompel.h.

Constructor & Destructor Documentation

◆ NodeColoringBergerRompel()

ogdf::NodeColoringBergerRompel::NodeColoringBergerRompel ( )
inline

The constructor.

Initializes the search procedure with the binary-search by default. The parameter alpha is initialized with 1.0 by default.

Definition at line 66 of file NodeColoringBergerRompel.h.

Member Function Documentation

◆ bergerRompelParameterized()

bool ogdf::NodeColoringBergerRompel::bergerRompelParameterized ( const Graph graph,
NodeArray< NodeColor > &  colors,
NodeColor color,
int  k,
double  alpha 
)
private

◆ call()

virtual NodeColor ogdf::NodeColoringBergerRompel::call ( const Graph graph,
NodeArray< NodeColor > &  colors,
NodeColor  start = 0 
)
overridevirtual

The actual algorithm call.

Parameters
graphThe graph for which the node coloring will be calculated.
colorsThe resulting node coloring.
startThe first color index which will be used.
Returns
The number of colors used by the node coloring.

Implements ogdf::NodeColoringModule.

◆ setAlpha()

void ogdf::NodeColoringBergerRompel::setAlpha ( double  alpha)
inline

Sets the parameter alpha which controls the accuracy of the algorithm.

A higher value of alpha results in a better approximation ratio. Also, the running time increases with alpha.

Parameters
alphaThe control parameter alpha

Definition at line 98 of file NodeColoringBergerRompel.h.

◆ setBruteForceProcedure()

void ogdf::NodeColoringBergerRompel::setBruteForceProcedure ( BruteForceProcedure  bruteForceProcedure)
inline

Sets the brute force procedure.

Parameters
bruteForceProcedureThe desired brute force coloring procedure

Definition at line 88 of file NodeColoringBergerRompel.h.

◆ setSearchProcedure()

void ogdf::NodeColoringBergerRompel::setSearchProcedure ( SearchProcedure  searchProcedure)
inline

Sets the search procedure to find the smallest possible parameter k such as the graph is k-colorable.

Parameters
searchProcedureThe desired search procedure

Definition at line 80 of file NodeColoringBergerRompel.h.

Member Data Documentation

◆ m_alpha

double ogdf::NodeColoringBergerRompel::m_alpha
private

Definition at line 113 of file NodeColoringBergerRompel.h.

◆ m_bruteForceProcedure

BruteForceProcedure ogdf::NodeColoringBergerRompel::m_bruteForceProcedure
private

Definition at line 112 of file NodeColoringBergerRompel.h.

◆ m_johnsonColoring

NodeColoringJohnson ogdf::NodeColoringBergerRompel::m_johnsonColoring
private

Definition at line 109 of file NodeColoringBergerRompel.h.

◆ m_searchProcedure

SearchProcedure ogdf::NodeColoringBergerRompel::m_searchProcedure
private

Definition at line 111 of file NodeColoringBergerRompel.h.

◆ m_sequentialColoring

NodeColoringSequential ogdf::NodeColoringBergerRompel::m_sequentialColoring
private

Definition at line 108 of file NodeColoringBergerRompel.h.

◆ m_simpleColoring

NodeColoringSimple ogdf::NodeColoringBergerRompel::m_simpleColoring
private

Definition at line 107 of file NodeColoringBergerRompel.h.

◆ m_wigdersonColoring

NodeColoringWigderson ogdf::NodeColoringBergerRompel::m_wigdersonColoring
private

Definition at line 110 of file NodeColoringBergerRompel.h.


The documentation for this class was generated from the following file: