Open
Graph Drawing
Framework

 v. 2023.09 (Elderberry)
 

Loading...
Searching...
No Matches
NodeColoringBergerRompel.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>
41
42namespace ogdf {
43
50public:
55 trivialColoring,
56 sequentialColoringSimple,
57 sequentialColoringDegree,
58 johnsonColoring,
59 wigdersonColoring,
60 pooled,
61 };
62
69 : m_simpleColoring()
70 , m_sequentialColoring()
71 , m_johnsonColoring()
72 , m_wigdersonColoring()
73 , m_searchProcedure(SearchProcedure::wigdersonSearch)
74 , m_bruteForceProcedure(BruteForceProcedure::pooled)
75 , m_alpha(0.4) { }
76
82 inline void setSearchProcedure(SearchProcedure searchProcedure) {
83 m_searchProcedure = searchProcedure;
84 }
85
90 inline void setBruteForceProcedure(BruteForceProcedure bruteForceProcedure) {
91 m_bruteForceProcedure = bruteForceProcedure;
92 }
93
100 inline void setAlpha(double alpha) {
101 OGDF_ASSERT(alpha > 0.1);
102 m_alpha = alpha;
103 }
104
105 virtual NodeColor call(const Graph& graph, NodeArray<NodeColor>& colors,
106 NodeColor start = 0) override;
107
108private:
115 double m_alpha;
116
118 NodeColor& color, int k, double alpha);
119
132 const Graph& graph, NodeArray<NodeColor>& colors, double alpha)
133 : m_coloring(coloringBergerRompel), m_graph(graph), m_colors(colors), m_alpha(alpha) { }
134
135 bool step(int k) override {
136 NodeColor start = NodeColor(1);
137 return m_coloring.bergerRompelParameterized(m_graph, m_colors, start, k, m_alpha);
138 }
139
143 double m_alpha;
144 };
145};
146}
Includes declaration of graph class.
Applies the node coloring approximation specified by Johnson.
Template of base class of node coloring algorithms.
Applies the sequential coloring algorithm to a given graph.
Trivial node coloring which assigns every node a different color.
Applies the node coloring approximation specified by Wigderson.
Basic declarations, included by all source files.
Data type for general directed graphs (adjacency list representation).
Definition Graph_d.h:866
Approximation algorithms for the node coloring problem in graphs.
bool bergerRompelParameterized(const Graph &graph, NodeArray< NodeColor > &colors, NodeColor &color, int k, double alpha)
void setAlpha(double alpha)
Sets the parameter alpha which controls the accuracy of the algorithm.
virtual NodeColor call(const Graph &graph, NodeArray< NodeColor > &colors, NodeColor start=0) override
The actual algorithm call.
BruteForceProcedure
Declares the procedure dealing with the brute force coloring.
void setSearchProcedure(SearchProcedure searchProcedure)
Sets the search procedure to find the smallest possible parameter k such as the graph is k-colorable.
void setBruteForceProcedure(BruteForceProcedure bruteForceProcedure)
Sets the brute force procedure.
Approximation algorithms for the node coloring problem in graphs.
Approximation algorithms for the node coloring problem in graphs.
unsigned int NodeColor
Data type of the node colors.
SearchProcedure
Declares the search procedures.
Approximation algorithms for the node coloring problem in graphs.
Approximation algorithms for the node coloring problem in graphs.
Approximation algorithms for the node coloring problem in graphs.
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_ASSERT(expr)
Assert condition expr. See doc/build.md for more information.
Definition basic.h:52
The namespace for all OGDF objects.
const std::array< Color, 63 > colors
An array of 63 different colors to cycle through.
Wraps the parameterized Berger&Rompel algorithm.
bool step(int k) override
Performs a step in the search procedure.
SearchWrapperBergerRompel(NodeColoringBergerRompel &coloringBergerRompel, const Graph &graph, NodeArray< NodeColor > &colors, double alpha)
Creates the wrapper.
Wraps the search for the minimum parameter k so that the same code can be reused for all algorithms.