Open
Graph Drawing
Framework

 v. snapshot-2017-02-16
 

Multilevel.h
Go to the documentation of this file.
1 
32 #pragma once
33 
34 #include <ogdf/basic/Graph.h>
35 #include <ogdf/basic/NodeArray.h>
36 #include <ogdf/basic/EdgeArray.h>
37 #include <ogdf/basic/List.h>
42 
43 namespace ogdf {
44 namespace energybased {
45 namespace fmmm {
46 
48 {
49 public:
50 
51  Multilevel() { }
52  ~Multilevel() { }
53 
58  int rand_seed,
59  FMMMOptions::GalaxyChoice galaxy_choice,
60  int min_Graph_size,
61  int rand_tries,
62  Array<Graph*> &G_mult_ptr,
63  Array<NodeArray<NodeAttributes>*> &A_mult_ptr,
64  Array<EdgeArray<EdgeAttributes>*> &E_mult_ptr,
65  int & max_level);
66 
72  int level,
73  FMMMOptions::InitialPlacementMult init_placement_way,
74  Array<Graph*> &G_mult_ptr,
75  Array<NodeArray <NodeAttributes>*> &A_mult_ptr,
76  Array<EdgeArray<EdgeAttributes>*> &E_mult_ptr);
77 
80  Array<Graph*> &G_mult_ptr,
81  Array<NodeArray<NodeAttributes>*> &A_mult_ptr,
82  Array<EdgeArray<EdgeAttributes>*> &E_mult_ptr,
83  int max_level);
84 
85 private:
86 
93  Array<Graph*> &G_mult_ptr,
94  int act_level,
95  int&bad_edgenr_counter);
96 
98  void init_multilevel_values(const Graph &G_mult,
100  EdgeArray<EdgeAttributes> &E_mult);
101 
110  Array<Graph*> &G_mult_ptr,
111  Array<NodeArray<NodeAttributes>*> &A_mult_ptr,
112  Array<EdgeArray<EdgeAttributes>*> &E_mult_ptr,
113  int rand_seed,
114  FMMMOptions::GalaxyChoice galaxy_choice,
115  int random_tries,
116  int act_level);
117 
121  Array<Graph*> &G_mult_ptr,
122  Array<NodeArray<NodeAttributes>*> &A_mult_ptr,
123  Array<EdgeArray<EdgeAttributes>*> &E_mult_ptr,
124  int rand_seed,
125  FMMMOptions::GalaxyChoice galaxy_choice,
126  int random_tries,
127  int act_level);
128 
132  void create_moon_nodes_and_pm_nodes(const Graph &G_mult,
134  EdgeArray<EdgeAttributes> &E_mult);
135 
141  Array<Graph*> &G_mult_ptr,
142  Array<NodeArray<NodeAttributes>*> &A_mult_ptr,
143  Array<EdgeArray<EdgeAttributes>*> &E_mult_ptr,
144  int act_level);
145 
149  Array<Graph*> &G_mult_ptr,
150  Array<NodeArray<NodeAttributes>*> &A_mult_ptr,
151  int act_level);
152 
156  Array<Graph*> &G_mult_ptr,
157  Array<NodeArray<NodeAttributes>*> &A_mult_ptr,
158  Array<EdgeArray<EdgeAttributes>*> &E_mult_ptr,
159  EdgeArray<double>& new_edgelength,
160  int act_level);
161 
165  Array<Graph*> &G_mult_ptr,
166  Array<EdgeArray<EdgeAttributes>*> &E_mult_ptr,
167  EdgeArray<double>& new_edgelength,
168  int act_level);
169 
172  int level,
173  Array<Graph*> &G_mult_ptr,
174  Array<NodeArray<NodeAttributes>*> &A_mult_ptr);
175 
179  int level,
180  FMMMOptions::InitialPlacementMult init_placement_way,
181  Array<Graph*> &G_mult_ptr,
182  Array<NodeArray<NodeAttributes>*> &A_mult_ptr,
183  Array<EdgeArray<EdgeAttributes>*> &E_mult_ptr,
184  List<node> &pm_nodes);
185 
190  Array<Graph*> &G_mult_ptr,
191  Array<NodeArray<NodeAttributes>*> &A_mult_ptr,
192  Array<EdgeArray<EdgeAttributes>*> &E_mult_ptr,
193  int level);
194 
198  int level,
199  FMMMOptions::InitialPlacementMult init_placement_way,
200  Array<NodeArray<NodeAttributes>*> &A_mult_ptr,
201  Array<EdgeArray<EdgeAttributes>*> &E_mult_ptr,
202  List<node>& pm_nodes);
203 
205  DPoint create_random_pos(DPoint center, double radius, double angle_1, double angle_2);
206 
208  DPoint get_waggled_inbetween_position(DPoint s, DPoint t, double lambda);
209 
213 
216  DPoint calculate_position(DPoint P,DPoint Q, double dist_P, double dist_Q);
217 };
218 
219 }
220 }
221 }
void delete_multilevel_representations(Array< Graph *> &G_mult_ptr, Array< NodeArray< NodeAttributes > *> &A_mult_ptr, Array< EdgeArray< EdgeAttributes > *> &E_mult_ptr, int max_level)
Free dynamically allocated memory.
DPoint calculate_position(DPoint P, DPoint Q, double dist_P, double dist_Q)
Creates a waggled position on the line PQ, depending on dist_P and dist_Q needed in case init_placeme...
The parameterized class Array implements dynamic arrays of type E.
Definition: Array.h:56
void collaps_solar_systems(Array< Graph *> &G_mult_ptr, Array< NodeArray< NodeAttributes > *> &A_mult_ptr, Array< EdgeArray< EdgeAttributes > *> &E_mult_ptr, int act_level)
Using information generated in partition_galaxy_into_solar_systems we create the edge set of *G_mult_...
Data type for general directed graphs (adjacency list representation).
Definition: Graph_d.h:472
bool edgenumbersum_of_all_levels_is_linear(Array< Graph *> &G_mult_ptr, int act_level, int &bad_edgenr_counter)
This function returns true if act_level = 0 or if act_level >0 and the number of edges at the actual ...
DPoint get_barycenter_position(List< DPoint > &L)
Returns the barycenter position of all points in L (the mass of all point is regarded as equal)...
void calculate_mass_of_collapsed_nodes(Array< Graph *> &G_mult_ptr, Array< NodeArray< NodeAttributes > *> &A_mult_ptr, int act_level)
The mass of all nodes at level act_level+1 is set to the mass of its dedicated solar_system at level ...
DPoint create_random_pos(DPoint center, double radius, double angle_1, double angle_2)
Returns a random point with radius radius between angle_1 and angle_2.
void create_edges_edgedistances_and_lambda_Lists(Array< Graph *> &G_mult_ptr, Array< NodeArray< NodeAttributes > *> &A_mult_ptr, Array< EdgeArray< EdgeAttributes > *> &E_mult_ptr, EdgeArray< double > &new_edgelength, int act_level)
The edges , new_edgelength and the lambda lists at level act_level+1 are created (the graph may conta...
void delete_parallel_edges_and_update_edgelength(Array< Graph *> &G_mult_ptr, Array< EdgeArray< EdgeAttributes > *> &E_mult_ptr, EdgeArray< double > &new_edgelength, int act_level)
Parallel edges at level act_level+1 are deleted and the edgelength of the remaining edge is set to th...
void create_all_placement_sectors(Array< Graph *> &G_mult_ptr, Array< NodeArray< NodeAttributes > *> &A_mult_ptr, Array< EdgeArray< EdgeAttributes > *> &E_mult_ptr, int level)
The values of angle_1 and angle_2 that restrict the area of the placement for all nodes that are not ...
Dynamic arrays indexed with edges.
Definition: EdgeArray.h:112
Real points.
Definition: geometry.h:219
GalaxyChoice
Specifies how sun nodes of galaxies are selected.
Definition: FMMMOptions.h:87
void set_initial_positions_of_pm_nodes(int level, FMMMOptions::InitialPlacementMult init_placement_way, Array< NodeArray< NodeAttributes > *> &A_mult_ptr, Array< EdgeArray< EdgeAttributes > *> &E_mult_ptr, List< node > &pm_nodes)
The initial positions of the pm nodes are calculated by the position of the dedicated sun and moon_no...
void create_moon_nodes_and_pm_nodes(const Graph &G_mult, NodeArray< NodeAttributes > &A_mult, EdgeArray< EdgeAttributes > &E_mult)
Partitions the nodes of G_mult that have not been assigned yet, to moon nodes of a nearest planet or ...
Dynamic arrays indexed with nodes.
Definition: Graph_d.h:423
void find_initial_placement_for_level(int level, FMMMOptions::InitialPlacementMult init_placement_way, Array< Graph *> &G_mult_ptr, Array< NodeArray< NodeAttributes > *> &A_mult_ptr, Array< EdgeArray< EdgeAttributes > *> &E_mult_ptr)
The initial placement of the nodes at multilevel level are created by the placements of the nodes of ...
Declaration of Fast Multipole Multilevel Method (FM^3) options.
Declaration and implementation of EdgeArray class.
Doubly linked lists (maintaining the length of the list).
Definition: List.h:39
Declaration of class EdgeAttributes.
Declaration and implementation of NodeArray class.
void set_initial_positions_of_sun_nodes(int level, Array< Graph *> &G_mult_ptr, Array< NodeArray< NodeAttributes > *> &A_mult_ptr)
The initial positions of all sun_nodes at level level are set.
Declaration of class Edge.
Declaration of class NodeAttributes.
void init_multilevel_values(const Graph &G_mult, NodeArray< NodeAttributes > &A_mult, EdgeArray< EdgeAttributes > &E_mult)
Sets the default multilevel values for all nodes and edges in G_mult.
Includes declaration of graph class.
DPoint get_waggled_inbetween_position(DPoint s, DPoint t, double lambda)
Returns roughtly the position s +lambda*(t-s) + some random waggling.
void set_initial_positions_of_planet_and_moon_nodes(int level, FMMMOptions::InitialPlacementMult init_placement_way, Array< Graph *> &G_mult_ptr, Array< NodeArray< NodeAttributes > *> &A_mult_ptr, Array< EdgeArray< EdgeAttributes > *> &E_mult_ptr, List< node > &pm_nodes)
The initial positions of the planet/moon_nodes at level level are calculated here and a list of all p...
void create_suns_and_planets(Array< Graph *> &G_mult_ptr, Array< NodeArray< NodeAttributes > *> &A_mult_ptr, Array< EdgeArray< EdgeAttributes > *> &E_mult_ptr, int rand_seed, FMMMOptions::GalaxyChoice galaxy_choice, int random_tries, int act_level)
The sun and planet nodes are created by choosing the sun nodes randomly with uniform or weighted prob...
The namespace for all OGDF objects.
InitialPlacementMult
Specifies how the initial placement is generated.
Definition: FMMMOptions.h:101
void partition_galaxy_into_solar_systems(Array< Graph *> &G_mult_ptr, Array< NodeArray< NodeAttributes > *> &A_mult_ptr, Array< EdgeArray< EdgeAttributes > *> &E_mult_ptr, int rand_seed, FMMMOptions::GalaxyChoice galaxy_choice, int random_tries, int act_level)
The nodeset(galaxy) of *G_mult_ptr[act_level] is partitioned in s,p,pm,m nodes. The dedicated s...
void create_multilevel_representations(Graph &G, NodeArray< NodeAttributes > &A, EdgeArray< EdgeAttributes > &E, int rand_seed, FMMMOptions::GalaxyChoice galaxy_choice, int min_Graph_size, int rand_tries, Array< Graph *> &G_mult_ptr, Array< NodeArray< NodeAttributes > *> &A_mult_ptr, Array< EdgeArray< EdgeAttributes > *> &E_mult_ptr, int &max_level)
The multilevel representations *G_mult_ptr/*A_mult_ptr/*E_mult_ptr for G/A/E are created. The maximum multilevel is calculated, too.
Declaration of doubly linked lists and iterators.