Open
Graph Drawing
Framework

 v. snapshot-2017-02-16
 

BalloonLayout.h
Go to the documentation of this file.
1 
37 /*
38  * The layout is computed by first computing a spanning tree
39  * of the graph that is then used to derive the vertices' coordinates.
40  * First, the radii at each vertex are computed.
41  * Then, depending on the embedding option, the order of the
42  * edges around each vertex is optimized to maximize angular
43  * resolution and to minimize the aspect ratio.
44  *
45  * Finally, the layout is shifted into the positive quadrant
46  * of the cartesian plane
47  * */
48 
49 #pragma once
50 
52 #include <ogdf/basic/List.h>
53 
54 
55 namespace ogdf {
56 
58 {
59 public:
60  //Root may be defined by center of the graph
61  //Directed cases: source/sink
62  enum class RootSelection {Center, HighestDegree};
63  //either keep the given embedding or optimize
64  //the order wrto angular resolution and minimum aspect ratio
65  enum class ChildOrder {Fixed, Optimized};
66  //compute tree by different methods
67  enum class TreeComputation {Bfs, Dfs, BfsRandom};
69  BalloonLayout();
70  virtual ~BalloonLayout();
72  BalloonLayout &operator=(const BalloonLayout &bl);
73 
75  virtual void call(GraphAttributes & AG) override;
76 
80  virtual void callFractal(GraphAttributes & AG, double ratio = 0.3)
81  {
82  bool even = getEvenAngles();
83  setEvenAngles(true);
84  call(AG);
85  setEvenAngles(even);
86  }
87 
89  void setEvenAngles(bool b) {m_evenAngles = b;}
91  bool getEvenAngles() {return m_evenAngles;}
92 
93 protected:
97  void computeTree(const Graph &G);
98 
100  void computeBFSTree(const Graph &G, node v);
101 
104  void selectRoot(const Graph &G);
105 
111  #ifdef OGDF_DEBUG
112  void computeRadii(GraphAttributes &AG);
113  #else
114  void computeRadii(const GraphAttributes &AG);
115  #endif
116 
118  void computeAngles(const Graph &G);
119 
121  void computeCoordinates(GraphAttributes &AG);
122 
123 private:
132 
134 #ifdef OGDF_DEBUG
135  void checkTree(const Graph &G, bool treeRoot = true);
137  EdgeArray<bool> *m_treeEdge;
138 #endif
139 
143 
145  // estimate to compute radius.
146 
150 
151  void check(Graph &G);
152 
154 }; //class BalloonLayout
155 
156 OGDF_EXPORT ostream &operator<<(ostream &os, const BalloonLayout::RootSelection &rs);
157 
158 }//end namespace ogdf
RootSelection m_rootSelection
Defines how the tree root is selected.
NodeArray< List< node > > m_childList
Data type for general directed graphs (adjacency list representation).
Definition: Graph_d.h:472
#define OGDF_EXPORT
Specifies that a function or class is exported by the OGDF DLL.
Definition: config.h:99
NodeArray< int > m_childCount
Number of children in spanning tree.
ChildOrder m_childOrder
How to arrange the children.
NodeArray< double > m_radius
NodeArray< double > m_oRadius
Radius at node center.
ostream & operator<<(ostream &os, const ogdf::Array< E, INDEX > &a)
Prints array a to output stream os.
Definition: Array.h:764
NodeArray< double > m_maxChildRadius
Outer radius of largest child.
Stores additional attributes of a graph (like layout information).
NodeArray< node > m_parent
Parent in spanning tree.
TreeComputation m_treeComputation
How to derive the spanning tree.
Declaration of interface for layout algorithms (class LayoutModule)
node m_treeRoot
Root of tree after computation.
Class for the representation of nodes.
Definition: Graph_d.h:167
void setEvenAngles(bool b)
Subtrees may be assigned even angles or angles depending on their size.
Definition: BalloonLayout.h:89
#define OGDF_NEW_DELETE
Makes the class use OGDF&#39;s memory allocator.
Definition: memory.h:84
Interface of general layout algorithms.
Definition: LayoutModule.h:44
NodeArray< double > m_angle
Angle assigned to nodes.
node m_root
Root of tree by selection method.
virtual void callFractal(GraphAttributes &AG, double ratio=0.3)
Call using special parameter settings for fractal model takes radius ratio < 0.5 as parameter...
Definition: BalloonLayout.h:80
double m_estimateFactor
Weight of value (largestchild / number of children) added to.
NodeArray< double > m_estimate
Rough estimate of circumference of subtrees.
bool getEvenAngles()
returns how the angles are assigned to subtrees.
Definition: BalloonLayout.h:91
The namespace for all OGDF objects.
NodeArray< double > m_size
Radius of circle around node box.
Declaration of doubly linked lists and iterators.