File: PlanarAugmentationFix.h

package info (click to toggle)
tulip 4.8.0dfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 179,264 kB
  • ctags: 64,517
  • sloc: cpp: 600,444; ansic: 36,311; makefile: 22,136; python: 1,304; sh: 946; yacc: 522; xml: 337; pascal: 157; php: 66; lex: 55
file content (225 lines) | stat: -rw-r--r-- 5,159 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
/*
 * $Revision: 2523 $
 *
 * last checkin:
 *   $Author: gutwenger $
 *   $Date: 2012-07-02 20:59:27 +0200 (Mon, 02 Jul 2012) $
 ***************************************************************/

/** \file
 * \brief planar biconnected augmentation algorithm with fixed
 * 		  combinatorial embedding.
 *
 * \author Bernd Zey
 *
 * \par License:
 * This file is part of the Open Graph Drawing Framework (OGDF).
 *
 * \par
 * Copyright (C)<br>
 * See README.txt in the root directory of the OGDF installation for details.
 *
 * \par
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * Version 2 or 3 as published by the Free Software Foundation;
 * see the file LICENSE.txt included in the packaging of this file
 * for details.
 *
 * \par
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * \par
 * You should have received a copy of the GNU General Public
 * License along with this program; if not, write to the Free
 * Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 * Boston, MA 02110-1301, USA.
 *
 * \see  http://www.gnu.org/copyleft/gpl.html
 ***************************************************************/

#ifdef _MSC_VER
#pragma once
#endif

#ifndef OGDF_PLANAR_AUGMENTATION_FIX_H
#define OGDF_PLANAR_AUGMENTATION_FIX_H

#include <ogdf/module/AugmentationModule.h>
#include <ogdf/basic/GraphCopy.h>
#include <ogdf/internal/augmentation/PALabel.h>


namespace ogdf {

	class DynamicBCTree;


/**
 * \brief The algorithm for biconnectivity augmentation with fixed combinatorial embedding.
 *
 */
class OGDF_EXPORT PlanarAugmentationFix : public AugmentationModule {

public:
	//! Creates an instance of planar augmentation with fixed embedding.
	PlanarAugmentationFix() { }

	~PlanarAugmentationFix() { }


protected:
	/**
	 * \brief The implementation of the algorithm call.
	 *
	 * \param g is the working graph.
	 * \param L is the list of all new edges.
	 */
	void doCall(Graph& g, List<edge>& L);

private:
	/**
	 * \brief The embedding of g.
	 */
	CombinatorialEmbedding* m_pEmbedding;

	/**
	 * \brief The embedding of the actual partial graph.
	 */
	CombinatorialEmbedding* m_pActEmbedding;

	/**
	 * \brief The working graph.
	 */
	Graph* m_pGraph;

	/**
	 * \brief The inserted edges by the algorithm.
	 */
	List<edge>* m_pResult;

	/**
	 * \brief The actual dynamic bc-tree.
	 */
	DynamicBCTree* m_pBCTree;

	/**
	 * \brief The actual partial graph.
	 */
	GraphCopy m_graphCopy;

	/**
	 * \brief Edge-array required for construction of the graph copy.
	 */
	EdgeArray<edge> m_eCopy;

	/**
	 * \brief The list of all labels.
	 */
	List<pa_label> m_labels;

	/**
	 * \brief Array that contains iterators to the list of labels
	 * 		 if a node is a parent of a label.
	 */
	NodeArray< ListIterator<pa_label> > m_isLabel;

	/**
	 * \brief Array that contains the label a node belongs to.
	 */
	NodeArray<pa_label> m_belongsTo;

	/**
	 * \brief Array that contains the iterator of the label a node belongs to.
	 */
	NodeArray< ListIterator<node> > m_belongsToIt;

	/**
	 * \brief The actual root of the bc-tree.
	 */
	node m_actBCRoot;

	/**
	 * \brief The main function for planar augmentation.
	 */
	void augment(adjEntry adjOuterFace);

	/**
	 * \brief Modifies the root of the bc-tree.
	 */
	void modifyBCRoot(node oldRoot, node newRoot);

	/**
	 * \brief Exchanges oldRoot by newRoot and updates data structurs in the bc-tree.
	 */
	void changeBCRoot(node oldRoot, node newRoot);

	/**
	 * \brief Adds the pendant to a label or creates one (uses followPath()).
	 */
	void reduceChain(node pendant);

	/**
	 * \brief Traverses upwards in the bc-tree, starting at the pendant node.
	 */
	paStopCause followPath(node v, node& last);

	/**
	 * \brief Finds the next matching pendants.
	 */
	bool findMatching(node& pendant1, node& pendant2, adjEntry& v1, adjEntry& v2);

	/**
	 * \brief Called by findMatching, if a dominating tree was detected.
	 */
	void findMatchingRev(node& pendant1, node& pendant2, adjEntry& v1, adjEntry& v2);

	/**
	 * \brief Creates a new label.
	 */
	pa_label newLabel(node cutvertex, node parent, node pendant, paStopCause whyStop);

	/**
	 * \brief Adds pendant \a p to label \a l.
	 */
	void addPendant(node p, pa_label& l);

	/**
	 * \brief Inserts the label into the list of labels maintaining decreasing order.
	 */
	ListIterator<pa_label> insertLabel(pa_label l);

	/**
	 * \brief Connect the two pendants.
	 */
	void connectPendants(node pendant1, node pendant2, adjEntry adjV1, adjEntry adjV2);

	/**
	 * \brief Connects the remaining label.
	 */
	void connectSingleLabel();

	/**
	 * \brief Deletes the pendant.
	 */
	void deletePendant(node pendant);

	/**
	 * \brief Deletes the label.
	 */
	void deleteLabel(pa_label& l, bool removePendants = true);

	/**
	 * \brief Removes the label from the list of labels.
	 */
	void removeLabel(pa_label& l);

};	// class PlanarAugmentationFix


} // namespace ogdf

#endif