6 * $Date: 2012-07-12 23:31:45 +0200 (Do, 12. Jul 2012) $
7 ***************************************************************/
10 * \brief Computes an embedding of a graph with maximum external face.
12 * \author Thorsten Kerkhof
15 * This file is part of the Open Graph Drawing Framework (OGDF).
19 * See README.txt in the root directory of the OGDF installation for details.
22 * This program is free software; you can redistribute it and/or
23 * modify it under the terms of the GNU General Public License
24 * Version 2 or 3 as published by the Free Software Foundation;
25 * see the file LICENSE.txt included in the packaging of this file
29 * This program is distributed in the hope that it will be useful,
30 * but WITHOUT ANY WARRANTY; without even the implied warranty of
31 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
32 * GNU General Public License for more details.
35 * You should have received a copy of the GNU General Public
36 * License along with this program; if not, write to the Free
37 * Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
38 * Boston, MA 02110-1301, USA.
40 * \see http://www.gnu.org/copyleft/gpl.html
41 ***************************************************************/
47 #ifndef OGDF_EMBEDDER_MAX_FACE_H
48 #define OGDF_EMBEDDER_MAX_FACE_H
50 #include <ogdf/module/EmbedderModule.h>
51 #include <ogdf/decomposition/BCTree.h>
52 #include <ogdf/decomposition/StaticSPQRTree.h>
56 //! Planar graph embedding with maximum external face.
58 * See the paper "Graph Embedding with Minimum Depth and Maximum External
59 * Face" by C. Gutwenger and P. Mutzel (2004) for details.
61 class OGDF_EXPORT EmbedderMaxFace
: public EmbedderModule
64 //constructor and destructor
66 ~EmbedderMaxFace() { }
69 * \brief Computes an embedding of \a G with maximum external face.
70 * \param G is the original graph. Its adjacency list has to be changed by the embedder.
71 * \param adjExternal is assigned an adjacency entry on the external face and has to be set by the embedder.
73 void call(Graph
& G
, adjEntry
& adjExternal
);
77 * \brief Computes recursively the block graph for every block.
79 * \param bT is a block node in the BC-tree.
80 * \param cH is a node of bT in the block graph.
82 void computeBlockGraphs(const node
& bT
, const node
& cH
);
85 * \brief Bottom up traversal of BC-tree.
87 * \param bT is the BC-tree node treated in this function call.
88 * \param cH is the block node which is related to the cut vertex which is
89 * parent of bT in BC-tree.
91 int constraintMaxFace(const node
& bT
, const node
& cH
);
94 * \brief Top down traversal of BC-tree.
96 * \param bT is the tree node treated in this function call.
97 * \param bT_opt is assigned a block node in BC-tree which contains a face which
98 * cann be expanded to a maximum face.
99 * \param ell_opt is the size of a maximum face.
101 void maximumFaceRec(const node
& bT
, node
& bT_opt
, int& ell_opt
);
104 * \brief Computes the adjacency list for all nodes in a block and calls
105 * recursively the function for all blocks incident to nodes in bT.
107 * \param bT is the tree node treated in this function call.
109 void embedBlock(const node
& bT
);
112 * \brief Computes the adjacency list for all nodes in a block and calls
113 * recursively the function for all blocks incident to nodes in bT.
115 * \param bT is the tree node treated in this function call.
116 * \param cT is the parent cut vertex node of bT in the BC-tree. cT is 0 if bT
118 * \param after is the adjacency entry of the cut vertex, after which bT has to
121 void embedBlock(const node
& bT
, const node
& cT
, ListIterator
<adjEntry
>& after
);
124 /** BC-tree of the original graph */
127 /** an adjacency entry on the external face */
128 adjEntry
* pAdjExternal
;
131 NodeArray
<Graph
> blockG
;
133 /** a mapping of nodes in the auxiliaryGraph of the BC-tree to blockG */
134 NodeArray
< NodeArray
<node
> > nH_to_nBlockEmbedding
;
136 /** a mapping of edges in the auxiliaryGraph of the BC-tree to blockG */
137 NodeArray
< EdgeArray
<edge
> > eH_to_eBlockEmbedding
;
139 /** a mapping of nodes in blockG to the auxiliaryGraph of the BC-tree */
140 NodeArray
< NodeArray
<node
> > nBlockEmbedding_to_nH
;
142 /** a mapping of edges in blockG to the auxiliaryGraph of the BC-tree */
143 NodeArray
< EdgeArray
<edge
> > eBlockEmbedding_to_eH
;
145 /** saving for each node in the block graphs its length */
146 NodeArray
< NodeArray
<int> > nodeLength
;
148 /** is saving for each node in the block graphs its cstrLength */
149 NodeArray
< NodeArray
<int> > cstrLength
;
151 /** saves for every node of PG the new adjacency list */
152 NodeArray
< List
<adjEntry
> > newOrder
;
154 /** treeNodeTreated saves for all block nodes in the
155 * BC-tree if it has already been treated or not. */
156 NodeArray
<bool> treeNodeTreated
;
158 /** The SPQR-trees of the blocks */
159 NodeArray
<StaticSPQRTree
*> spqrTrees
;
162 } // end namespace ogdf