Loading [MathJax]/extensions/tex2jax.js

Open
Graph Drawing
Framework

 v. 2023.09 (Elderberry)
 

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Loading...
Searching...
No Matches
CoffmanGrahamRanking.h
Go to the documentation of this file.
1
33#pragma once
34
36#include <ogdf/basic/tuples.h>
39
40#include <memory>
41
42namespace ogdf {
43
45
54public:
57
58
65 virtual void call(const Graph& G, NodeArray<int>& rank) override;
66
74
76
78 int width() const { return m_w; }
79
81 void width(int w) { m_w = w; }
82
83
84private:
85 // CoffmanGraham data structures
86 class _int_set {
87 int* m_array;
90
91 public:
92 _int_set() : m_array(nullptr), m_length(0), m_index(0) { }
93
94 explicit _int_set(int len) : m_array(nullptr), m_length(len), m_index(len) {
95 if (len > 0) {
96 m_array = new int[m_length];
97 }
98 }
99
100 ~_int_set() { delete[] m_array; }
101
102 void init(int len) {
103 delete m_array;
104 if ((m_length = len) == 0) {
105 m_array = nullptr;
106 } else {
107 m_array = new int[m_length];
108 }
109 m_index = len;
110 }
111
112 int length() const { return m_length; }
113
114 int operator[](int i) const { return m_array[i]; }
115
116 void insert(int x) { m_array[--m_index] = x; }
117
118 bool ready() const { return m_index == 0; }
119 };
120
121 // CoffmanGraham members
122 std::unique_ptr<AcyclicSubgraphModule> m_subgraph;
123 int m_w;
125
126 // dfs members
128
129 // CoffmanGraham funktions
131 void insert(node u, List<node>& ready, const NodeArray<int>& pi);
132
133 // dfs funktions
135 void dfs(node v);
136};
137
138}
Declaration of interface for acyclic subgraph algorithms.
Declaration and implementation of NodeArray class.
Declaration of interface for ranking algorithms.
Base class of algorithms for computing a maximal acyclic subgraph.
The coffman graham ranking algorithm.
CoffmanGrahamRanking()
Creates an instance of coffman graham ranking.
void setSubgraph(AcyclicSubgraphModule *pSubgraph)
Sets the module for the computation of the acyclic subgraph.
void width(int w)
Set for the with.
int width() const
Get for the with.
std::unique_ptr< AcyclicSubgraphModule > m_subgraph
void insert(node u, List< Tuple2< node, int > > &ready_nodes)
void insert(node u, List< node > &ready, const NodeArray< int > &pi)
void removeTransitiveEdges(Graph &G)
virtual void call(const Graph &G, NodeArray< int > &rank) override
Computes a node ranking of G in rank.
Data type for general directed graphs (adjacency list representation).
Definition Graph_d.h:521
Doubly linked lists (maintaining the length of the list).
Definition List.h:1435
Dynamic arrays indexed with nodes.
Definition NodeArray.h:125
Class for the representation of nodes.
Definition Graph_d.h:177
Interface of algorithms for computing a node ranking.
Tuples of two elements (2-tuples).
Definition tuples.h:46
#define OGDF_EXPORT
Specifies that a function or class is exported by the OGDF DLL.
Definition config.h:101
static MultilevelBuilder * getDoubleFactoredZeroAdjustedMerger()
The namespace for all OGDF objects.
Declaration and implementation of class Tuple2, Tuple3 and Tuple4.