Don't import ogdf namespace
[TortoiseGit.git] / ext / OGDF / ogdf / internal / cluster / ClusterPQContainer.h
blob40403458e8a27633610bf39790b529ec53ca4f3c
1 /*
2 * $Revision: 2523 $
4 * last checkin:
5 * $Author: gutwenger $
6 * $Date: 2012-07-02 20:59:27 +0200 (Mon, 02 Jul 2012) $
7 ***************************************************************/
9 /** \file
10 * \brief Declaration of ClusterPQContainer.
12 * Stores information for a biconnected component
13 * of a cluster for embedding the cluster in the
14 * top down traversal
16 * \author Sebastian Leipert
18 * \par License:
19 * This file is part of the Open Graph Drawing Framework (OGDF).
21 * \par
22 * Copyright (C)<br>
23 * See README.txt in the root directory of the OGDF installation for details.
25 * \par
26 * This program is free software; you can redistribute it and/or
27 * modify it under the terms of the GNU General Public License
28 * Version 2 or 3 as published by the Free Software Foundation;
29 * see the file LICENSE.txt included in the packaging of this file
30 * for details.
32 * \par
33 * This program is distributed in the hope that it will be useful,
34 * but WITHOUT ANY WARRANTY; without even the implied warranty of
35 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
36 * GNU General Public License for more details.
38 * \par
39 * You should have received a copy of the GNU General Public
40 * License along with this program; if not, write to the Free
41 * Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
42 * Boston, MA 02110-1301, USA.
44 * \see http://www.gnu.org/copyleft/gpl.html
45 ***************************************************************/
48 #ifdef _MSC_VER
49 #pragma once
50 #endif
53 #ifndef OGDF_CLUSTER_PQ_CONTAINER_H
54 #define OGDF_CLUSTER_PQ_CONTAINER_H
56 #include <ogdf/cluster/CconnectClusterPlanarEmbed.h>
57 #include <ogdf/internal/planarity/EmbedPQTree.h>
58 #include <ogdf/basic/NodeArray.h>
59 #include <ogdf/basic/EdgeArray.h>
62 namespace ogdf {
64 class ClusterPQContainer {
66 friend class CconnectClusterPlanarEmbed;
69 // Definition
70 // incoming edge of v: an edge e = (v,w) with number(v) < number(w)
73 // Stores for every node v the keys corresponding to the incoming edges of v
74 NodeArray<SListPure<PlanarLeafKey<IndInfo*>* > >* m_inLeaves;
76 // Stores for every node v the keys corresponding to the outgoing edges of v
77 NodeArray<SListPure<PlanarLeafKey<IndInfo*>* > >* m_outLeaves;
79 // Stores for every node v the sequence of incoming edges of v according
80 // to the embedding
81 NodeArray<SListPure<edge> >* m_frontier;
83 // Stores for every node v the nodes corresponding to the
84 // opposed sink indicators found in the frontier of v.
85 NodeArray<SListPure<node> >* m_opposed;
87 // Stores for every node v the nodes corresponding to the
88 // non opposed sink indicators found in the frontier of v.
89 NodeArray<SListPure<node> >* m_nonOpposed;
91 // Table to acces for every edge its corresponding key in the PQTree
92 EdgeArray<PlanarLeafKey<IndInfo*>*>* m_edge2Key;
94 // Stores for every node its st-number
95 NodeArray<int> *m_numbering;
97 // Stores for every st-number the node
98 Array<node> *m_tableNumber2Node;
100 node m_superSink;
102 // the subgraph that contains the biconnected component
103 // NOT THE COPY OF THE BICONNECTED COMPONENT THAT WAS CONSTRUCTED
104 // DURING PLANARITY TESTING. THIS HAS BEEN DELETED.
105 Graph *m_subGraph;
106 // corresponding PQTree
107 EmbedPQTree *m_T;
108 // The leaf correpsonding to the edge (s,t).
109 PlanarLeafKey<IndInfo*> *m_stEdgeLeaf;
111 public:
113 ClusterPQContainer():
114 m_inLeaves(0),m_outLeaves(0),m_frontier(0),
115 m_opposed(0),m_nonOpposed(0),m_edge2Key(0),
116 m_numbering(0),m_tableNumber2Node(0),
117 m_superSink(0),m_subGraph(0),m_T(0), m_stEdgeLeaf(0) { }
119 ~ClusterPQContainer() { }
121 void init(Graph *subGraph){
122 m_subGraph = subGraph;
123 m_inLeaves
124 = OGDF_NEW NodeArray<SListPure<PlanarLeafKey<IndInfo*>* > >(*subGraph);
126 m_outLeaves
127 = OGDF_NEW NodeArray<SListPure<PlanarLeafKey<IndInfo*>* > >(*subGraph);
129 m_frontier
130 = OGDF_NEW NodeArray<SListPure<edge> >(*subGraph);
132 m_opposed
133 = OGDF_NEW NodeArray<SListPure<node> >(*subGraph);
135 m_nonOpposed
136 = OGDF_NEW NodeArray<SListPure<node> >(*subGraph);
138 m_edge2Key
139 = OGDF_NEW EdgeArray<PlanarLeafKey<IndInfo*>*>(*subGraph);
141 m_numbering
142 = OGDF_NEW NodeArray<int >(*subGraph);
144 m_tableNumber2Node
145 = OGDF_NEW Array<node>(subGraph->numberOfNodes()+1);
149 void Cleanup() {
150 if (m_inLeaves)
151 delete m_inLeaves;
152 if (m_outLeaves)
154 node v;
155 forall_nodes(v,*m_subGraph)
157 while (!(*m_outLeaves)[v].empty())
159 PlanarLeafKey<IndInfo*>* L = (*m_outLeaves)[v].popFrontRet();
160 delete L;
163 delete m_outLeaves;
165 if (m_frontier)
166 delete m_frontier;
167 if (m_opposed)
168 delete m_opposed;
169 if (m_nonOpposed)
170 delete m_nonOpposed;
171 if (m_edge2Key)
172 delete m_edge2Key;
173 if (m_T)
175 m_T->emptyAllPertinentNodes();
176 delete m_T;
178 if (m_numbering)
179 delete m_numbering;
180 if (m_tableNumber2Node)
181 delete m_tableNumber2Node;
188 #endif