Open
Graph Drawing
Framework

 v. 2023.09 (Elderberry)
 

NodeColoringSequential.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>
36 #include <ogdf/basic/comparer.h>
38 
39 namespace ogdf {
40 template<class E>
41 class List;
42 
49 public:
51  NodeColor start = 0) override {
52  return colorByDegree(graph, colors, start);
53  }
54 
59  virtual void sortByDegree(List<node>& nodes);
60 
70  virtual NodeColor colorByIndex(const Graph& graph, NodeArray<NodeColor>& colors,
71  NodeColor start = 0);
72 
82  virtual NodeColor colorByDegree(const Graph& graph, NodeArray<NodeColor>& colors,
83  NodeColor start = 0);
84 
94  virtual NodeColor fromPermutation(const Graph& graph, NodeArray<NodeColor>& colors,
95  List<node>& nodePermutation, NodeColor start = 0, bool lookForNeighbors = false);
96 
97 private:
102  public:
111  static int compare(const node& v1, const node& v2) {
112  OGDF_ASSERT(v1->graphOf() == v2->graphOf());
113  return v1->degree() - v2->degree();
114  }
115 
117  };
118 };
119 }
ogdf
The namespace for all OGDF objects.
Definition: multilevelmixer.cpp:39
ogdf::NodeColoringSequential::NodeDegreeComparer
Class for comparing two nodes by the node degree.
Definition: NodeColoringSequential.h:101
Graph.h
Includes declaration of graph class.
ogdf::NodeColoringSequential::call
virtual NodeColor call(const Graph &graph, NodeArray< NodeColor > &colors, NodeColor start=0) override
The actual algorithm call.
Definition: NodeColoringSequential.h:50
OGDF_ASSERT
#define OGDF_ASSERT(expr)
Assert condition expr. See doc/build.md for more information.
Definition: basic.h:66
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:229
ogdf::NodeColoringSequential::NodeDegreeComparer::compare
static int compare(const node &v1, const node &v2)
Compares two nodes by using the node degree.
Definition: NodeColoringSequential.h:111
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:283
ogdf::NodeColoringModule
Approximation algorithms for the node coloring problem in graphs.
Definition: NodeColoringModule.h:48
ogdf::NodeColoringSequential
Approximation algorithms for the node coloring problem in graphs.
Definition: NodeColoringSequential.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::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.
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::NodeColor
unsigned int NodeColor
Data type of the node colors.
Definition: NodeColoringModule.h:53
ogdf::NodeElement::graphOf
const Graph * graphOf() const
Returns the graph containing this node (debug only).
Definition: Graph_d.h:344
comparer.h
Declarations for Comparer objects.
ogdf::NodeElement
Class for the representation of nodes.
Definition: Graph_d.h:240