Open
Graph Drawing
Framework

 v. 2020.02 (Catalpa)
 

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 namespace ogdf {
55 
57 {
58 public:
59  //Root may be defined by center of the graph
60  //Directed cases: source/sink
61  enum class RootSelection {Center, HighestDegree};
62  //either keep the given embedding or optimize
63  //the order wrto angular resolution and minimum aspect ratio
64  enum class ChildOrder {Fixed, Optimized};
65  //compute tree by different methods
66  enum class TreeComputation {Bfs, Dfs, BfsRandom};
68  BalloonLayout();
70  BalloonLayout &operator=(const BalloonLayout &bl);
71 
73  virtual void call(GraphAttributes & AG) override;
74 
78  virtual void callFractal(GraphAttributes & AG, double ratio = 0.3)
79  {
80  bool even = getEvenAngles();
81  setEvenAngles(true);
82  call(AG);
83  setEvenAngles(even);
84  }
85 
87  void setEvenAngles(bool b) {m_evenAngles = b;}
89  bool getEvenAngles() {return m_evenAngles;}
90 
91 protected:
95  void computeTree(const Graph &G);
96 
98  void computeBFSTree(const Graph &G, node v);
99 
102  void selectRoot(const Graph &G);
103 
109  #ifdef OGDF_DEBUG
110  void computeRadii(GraphAttributes &AG);
111  #else
112  void computeRadii(const GraphAttributes &AG);
113  #endif
114 
116  void computeAngles(const Graph &G);
117 
119  void computeCoordinates(GraphAttributes &AG);
120 
121 private:
130 
132 #ifdef OGDF_DEBUG
133  void checkTree(const Graph &G, bool treeRoot = true);
135  EdgeArray<bool> m_treeEdge;
136 #endif
137 
141 
143 
147 
148  void check(Graph &G);
149 
151 };
152 
153 OGDF_EXPORT std::ostream &operator<<(std::ostream &os, const BalloonLayout::RootSelection &rs);
154 
155 }
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:492
#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.
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:169
void setEvenAngles(bool b)
Subtrees may be assigned even angles or angles depending on their size.
Definition: BalloonLayout.h:87
#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:78
double m_estimateFactor
Weight of value (largestchild / number of children) added to estimate to compute radius.
NodeArray< double > m_estimate
Rough estimate of circumference of subtrees.
bool getEvenAngles()
returns how the angles are assigned to subtrees.
Definition: BalloonLayout.h:89
The namespace for all OGDF objects.
NodeArray< double > m_size
Radius of circle around node box.
std::ostream & operator<<(std::ostream &os, const ogdf::Array< E, INDEX > &a)
Prints array a to output stream os.
Definition: Array.h:942
Declaration of doubly linked lists and iterators.