Open
Graph Drawing
Framework

 v. 2023.09 (Elderberry)
 

NodeColoringSequential.h
Go to the documentation of this file.
1 
32 #pragma once
33 
35 
36 namespace ogdf {
37 
44 public:
46  NodeColor start = 0) override {
47  return colorByDegree(graph, colors, start);
48  }
49 
54  virtual void sortByDegree(List<node>& nodes);
55 
65  virtual NodeColor colorByIndex(const Graph& graph, NodeArray<NodeColor>& colors,
66  NodeColor start = 0);
67 
77  virtual NodeColor colorByDegree(const Graph& graph, NodeArray<NodeColor>& colors,
78  NodeColor start = 0);
79 
89  virtual NodeColor fromPermutation(const Graph& graph, NodeArray<NodeColor>& colors,
90  List<node>& nodePermutation, NodeColor start = 0, bool lookForNeighbors = false);
91 
92 private:
97  public:
106  static int compare(const node& v1, const node& v2) {
107  OGDF_ASSERT(v1->graphOf() == v2->graphOf());
108  return v1->degree() - v2->degree();
109  }
110 
112  };
113 };
114 }
ogdf
The namespace for all OGDF objects.
Definition: AugmentationModule.h:36
ogdf::NodeColoringSequential::NodeDegreeComparer
Class for comparing two nodes by the node degree.
Definition: NodeColoringSequential.h:96
ogdf::NodeColoringSequential::call
virtual NodeColor call(const Graph &graph, NodeArray< NodeColor > &colors, NodeColor start=0) override
The actual algorithm call.
Definition: NodeColoringSequential.h:45
OGDF_ASSERT
#define OGDF_ASSERT(expr)
Assert condition expr. See doc/build.md for more information.
Definition: basic.h:54
OGDF_AUGMENT_STATICCOMPARER
#define OGDF_AUGMENT_STATICCOMPARER(type)
Add this macro to your class to turn it into a full static comparer.
Definition: comparer.h:225
ogdf::NodeColoringSequential::NodeDegreeComparer::compare
static int compare(const node &v1, const node &v2)
Compares two nodes by using the node degree.
Definition: NodeColoringSequential.h:106
ogdf::colors
const std::array< Color, 63 > colors
An array of 63 different colors to cycle through.
ogdf::NodeElement::degree
int degree() const
Returns the degree of the node (indegree + outdegree).
Definition: Graph_d.h:276
ogdf::NodeColoringModule
Approximation algorithms for the node coloring problem in graphs.
Definition: NodeColoringModule.h:44
ogdf::NodeColoringSequential
Approximation algorithms for the node coloring problem in graphs.
Definition: NodeColoringSequential.h:43
ogdf::List
Doubly linked lists (maintaining the length of the list).
Definition: List.h:42
ogdf::internal::GraphRegisteredArray
RegisteredArray for nodes, edges and adjEntries of a graph.
Definition: Graph_d.h:651
ogdf::Graph
Data type for general directed graphs (adjacency list representation).
Definition: Graph_d.h:862
NodeColoringModule.h
Template of base class of node coloring algorithms.
OGDF_EXPORT
#define OGDF_EXPORT
Specifies that a function or class is exported by the OGDF DLL.
Definition: config.h:101
ogdf::NodeColoringModule::NodeColor
unsigned int NodeColor
Data type of the node colors.
Definition: NodeColoringModule.h:49
ogdf::NodeElement::graphOf
const Graph * graphOf() const
Returns the graph containing this node (debug only).
Definition: Graph_d.h:337
ogdf::NodeElement
Class for the representation of nodes.
Definition: Graph_d.h:233