Open
Graph Drawing
Framework

 v. 2023.09 (Elderberry)
 

Loading...
Searching...
No Matches
NodeColoringHalldorsson.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>
37
38namespace ogdf {
39template<class E>
40class List;
41
48public:
53 NodeColoringHalldorsson() { m_searchProcedure = SearchProcedure::wigdersonSearch; }
54
60 inline void setSearchProcedure(SearchProcedure searchProcedure) {
61 m_searchProcedure = searchProcedure;
62 }
63
64 virtual NodeColor call(const Graph& graph, NodeArray<NodeColor>& colors,
65 NodeColor start = 0) override;
66
67private:
69
78 void performHalldorsson(const Graph& graph, List<node>& independentSet);
79
90 bool halldorssonRecursive(const Graph& graph, List<node>& independentSet, int k, double alpha);
91
103 SearchWrapperHalldorsson(NodeColoringHalldorsson& coloringHalldorsson, const Graph& graph,
104 List<node>& independentSet, double alpha)
105 : m_coloring(coloringHalldorsson)
106 , m_graph(graph)
107 , m_independentSet(independentSet)
108 , m_alpha(alpha) { }
109
110 bool step(int k) override {
111 return m_coloring.halldorssonRecursive(m_graph, m_independentSet, k, m_alpha);
112 }
113
117 double m_alpha;
118 };
119};
120}
Includes declaration of graph class.
Template of base class of node coloring algorithms.
Basic declarations, included by all source files.
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
Approximation algorithms for the node coloring problem in graphs.
void setSearchProcedure(SearchProcedure searchProcedure)
Sets the search procedure to find the smallest possible parameter k such as the graph is k-colorable.
bool halldorssonRecursive(const Graph &graph, List< node > &independentSet, int k, double alpha)
Performs the recursive Halldorsson algorithm to find large independent sets.
void performHalldorsson(const Graph &graph, List< node > &independentSet)
Performs the Halldorsson algorithm for finding an independent set.
virtual NodeColor call(const Graph &graph, NodeArray< NodeColor > &colors, NodeColor start=0) override
The actual algorithm call.
Approximation algorithms for the node coloring problem in graphs.
unsigned int NodeColor
Data type of the node colors.
SearchProcedure
Declares the search procedures.
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
The namespace for all OGDF objects.
Wraps the recursive Halldórsson algorithm.
SearchWrapperHalldorsson(NodeColoringHalldorsson &coloringHalldorsson, const Graph &graph, List< node > &independentSet, double alpha)
Creates the wrapper.
bool step(int k) override
Performs a step in the search procedure.
Wraps the search for the minimum parameter k so that the same code can be reused for all algorithms.