6 * $Date: 2012-07-07 00:03:48 +0200 (Sa, 07. Jul 2012) $
7 ***************************************************************/
10 * \brief constructive compaction applying computation of min-cost
11 * flow in the dual of the constraint graphs
13 * \author Carsten Gutwenger
16 * This file is part of the Open Graph Drawing Framework (OGDF).
20 * See README.txt in the root directory of the OGDF installation for details.
23 * This program is free software; you can redistribute it and/or
24 * modify it under the terms of the GNU General Public License
25 * Version 2 or 3 as published by the Free Software Foundation;
26 * see the file LICENSE.txt included in the packaging of this file
30 * This program is distributed in the hope that it will be useful,
31 * but WITHOUT ANY WARRANTY; without even the implied warranty of
32 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
33 * GNU General Public License for more details.
36 * You should have received a copy of the GNU General Public
37 * License along with this program; if not, write to the Free
38 * Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
39 * Boston, MA 02110-1301, USA.
41 * \see http://www.gnu.org/copyleft/gpl.html
42 ***************************************************************/
49 #ifndef OGDF_FLOW_COMPACTION_H
50 #define OGDF_FLOW_COMPACTION_H
53 #include <ogdf/orthogonal/OrthoRep.h>
54 #include <ogdf/planarity/PlanRep.h>
55 #include <ogdf/internal/orthogonal/RoutingChannel.h>
56 #include <ogdf/orthogonal/MinimumEdgeDistances.h>
57 #include <ogdf/basic/GridLayoutMapped.h>
62 template<class ATYPE
> class CompactionConstraintGraph
;
66 //! represents compaction algorithm using min-cost flow in the dual of the constraint graph
67 class OGDF_EXPORT FlowCompaction
71 FlowCompaction(int maxImprovementSteps
= 0,
75 //! call of constructive heuristics for orthogonal representation
76 void constructiveHeuristics(
79 const RoutingChannel
<int> &rc
,
80 GridLayoutMapped
&drawing
);
83 //! call of improvement heuristics for orthogonal drawing (variable cages)
84 void improvementHeuristics(
87 const RoutingChannel
<int> &rc
,
88 GridLayoutMapped
&drawing
);
90 //! call of improvement heuristics for orthogonal drawing (tight cages)
91 void improvementHeuristics(
95 MinimumEdgeDistances
<int> &minDist
,
96 GridLayoutMapped
&drawing
,
97 int originalSeparation
//the input value before multiplication test for compaction improvement
103 //! sets option maxImprovementSteps, which is the maximal number of steps performed by improvementHeuristics().
104 void maxImprovementSteps(int maxSteps
) {
105 m_maxImprovementSteps
= maxSteps
;
108 //! returns option maxImprovementSteps
109 int maxImprovementSteps() const {
110 return m_maxImprovementSteps
;
113 //! sets cost of arcs in constraint graph corresponding to generalizations
114 void costGen(int c
) {
118 //! returns option costGen
119 int costGen() const {
123 //! sets cost of arcs in constraint graph corresponding to associations
124 void costAssoc(int c
) {
128 //! returns option costGen
129 int costAssoc() const {
133 //! sets number of separation scaling improvement steps
134 void scalingSteps(int sc
) {m_scalingSteps
= sc
;}
136 //! set alignment option
137 void align(bool b
) {m_align
= b
;}
142 CompactionConstraintGraph
<int> &D
,
144 bool fixZeroLength
= false,
145 bool fixVertexSize
= false,
146 bool improvementHeuristics
= false,
147 bool onlyGen
= false);
149 NodeArray
<bool> &visited
,
155 int m_maxImprovementSteps
; //!< maximal number of improvement steps
156 int m_costGen
; //!< cost of arcs in constraint graph corresponding to generalization
157 int m_costAssoc
; //!< cost of arcs in constraint graph corresponding to associations
158 bool m_cageExpense
; //!< should cageedges be more expensive than others? will be propagated to compactionConstraintGraph
159 //int m_costCage; //!< preliminary: Carsten uses 10
160 int m_numGenSteps
; //!< number of steps reserved for generalization compaction
161 int m_scalingSteps
; //!< number of improvement steps with decreasing separation
162 bool m_align
; //!< toggle if brother nodes in hierarchies should be aligned
165 EdgeArray
<edge
> m_dualEdge
;
166 EdgeArray
<int> m_flow
;
170 } // end namespace ogdf