Open
Graph Drawing
Framework

 v. 2023.09 (Elderberry)
 

Loading...
Searching...
No Matches
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
39namespace ogdf {
40template<class E>
41class List;
42
49public:
50 virtual NodeColor call(const Graph& graph, NodeArray<NodeColor>& colors,
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
97private:
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}
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.
unsigned int NodeColor
Data type of the node colors.
Class for comparing two nodes by the node degree.
static int compare(const node &v1, const node &v2)
Compares two nodes by using the node degree.
Approximation algorithms for the node coloring problem in graphs.
virtual NodeColor colorByDegree(const Graph &graph, NodeArray< NodeColor > &colors, NodeColor start=0)
Performs the sequential nodes coloring.
virtual NodeColor fromPermutation(const Graph &graph, NodeArray< NodeColor > &colors, List< node > &nodePermutation, NodeColor start=0, bool lookForNeighbors=false)
Colors a graph with the sequential coloring algorithm from a given node permutation.
virtual void sortByDegree(List< node > &nodes)
Sorts a list of nodes decreasingly by the degree.
virtual NodeColor colorByIndex(const Graph &graph, NodeArray< NodeColor > &colors, NodeColor start=0)
Performs the sequential nodes coloring.
virtual NodeColor call(const Graph &graph, NodeArray< NodeColor > &colors, NodeColor start=0) override
The actual algorithm call.
Class for the representation of nodes.
Definition Graph_d.h:241
int degree() const
Returns the degree of the node (indegree + outdegree).
Definition Graph_d.h:284
const Graph * graphOf() const
Returns the graph containing this node (debug only).
Definition Graph_d.h:345
RegisteredArray for nodes, edges and adjEntries of a graph.
Definition Graph_d.h:659
Declarations for Comparer objects.
#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.