Open
Graph Drawing
Framework

 v. 2023.09 (Elderberry)
 

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 
38 namespace ogdf {
39 template<class E>
40 class List;
41 
48 public:
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 
67 private:
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 
115  const Graph& m_graph;
117  double m_alpha;
118  };
119 };
120 }
ogdf
The namespace for all OGDF objects.
Definition: multilevelmixer.cpp:39
ogdf::NodeColoringHalldorsson::setSearchProcedure
void setSearchProcedure(SearchProcedure searchProcedure)
Sets the search procedure to find the smallest possible parameter k such as the graph is k-colorable.
Definition: NodeColoringHalldorsson.h:60
ogdf::NodeColoringHalldorsson::m_searchProcedure
SearchProcedure m_searchProcedure
Definition: NodeColoringHalldorsson.h:68
Graph.h
Includes declaration of graph class.
ogdf::NodeColoringHalldorsson::SearchWrapperHalldorsson::step
bool step(int k) override
Performs a step in the search procedure.
Definition: NodeColoringHalldorsson.h:110
ogdf::NodeColoringHalldorsson::SearchWrapperHalldorsson::m_independentSet
List< node > & m_independentSet
Definition: NodeColoringHalldorsson.h:116
ogdf::NodeColoringHalldorsson::SearchWrapperHalldorsson::m_alpha
double m_alpha
Definition: NodeColoringHalldorsson.h:117
ogdf::NodeColoringHalldorsson::SearchWrapperHalldorsson::m_coloring
NodeColoringHalldorsson & m_coloring
Definition: NodeColoringHalldorsson.h:114
ogdf::NodeColoringHalldorsson::SearchWrapperHalldorsson::m_graph
const Graph & m_graph
Definition: NodeColoringHalldorsson.h:115
ogdf::NodeColoringHalldorsson::NodeColoringHalldorsson
NodeColoringHalldorsson()
The constructor.
Definition: NodeColoringHalldorsson.h:53
ogdf::NodeColoringHalldorsson
Approximation algorithms for the node coloring problem in graphs.
Definition: NodeColoringHalldorsson.h:47
ogdf::colors
const std::array< Color, 63 > colors
An array of 63 different colors to cycle through.
ogdf::NodeColoringModule
Approximation algorithms for the node coloring problem in graphs.
Definition: NodeColoringModule.h:48
ogdf::List
Doubly linked lists (maintaining the length of the list).
Definition: DfsMakeBiconnected.h:40
ogdf::internal::GraphRegisteredArray
RegisteredArray for nodes, edges and adjEntries of a graph.
Definition: Graph_d.h:658
ogdf::NodeColoringHalldorsson::SearchWrapperHalldorsson
Wraps the recursive Halldórsson algorithm.
Definition: NodeColoringHalldorsson.h:95
ogdf::Graph
Data type for general directed graphs (adjacency list representation).
Definition: Graph_d.h:869
NodeColoringModule.h
Template of base class of node coloring algorithms.
ogdf::NodeColoringHalldorsson::SearchWrapperHalldorsson::SearchWrapperHalldorsson
SearchWrapperHalldorsson(NodeColoringHalldorsson &coloringHalldorsson, const Graph &graph, List< node > &independentSet, double alpha)
Creates the wrapper.
Definition: NodeColoringHalldorsson.h:103
basic.h
Basic declarations, included by all source files.
OGDF_EXPORT
#define OGDF_EXPORT
Specifies that a function or class is exported by the OGDF DLL.
Definition: config.h:101
ogdf::NodeColoringModule::SearchProcedure
SearchProcedure
Declares the search procedures.
Definition: NodeColoringModule.h:58
ogdf::NodeColoringModule::SearchWrapper
Wraps the search for the minimum parameter k so that the same code can be reused for all algorithms.
Definition: NodeColoringModule.h:196