Open
Graph Drawing
Framework

 v.2010.10
 

FruchtermanReingold.h

Go to the documentation of this file.
00001 /*
00002  * $Revision: 2027 $
00003  * 
00004  * last checkin:
00005  *   $Author: gutwenger $ 
00006  *   $Date: 2010-09-01 11:55:17 +0200 (Wed, 01 Sep 2010) $ 
00007  ***************************************************************/
00008  
00053 #ifdef _MSC_VER
00054 #pragma once
00055 #endif
00056 
00057 #ifndef OGDF_FRUCHTERMAN_REINGOLD_H
00058 #define OGDF_FRUCHTERMAN_REINGOLD_H
00059 
00060 #include <ogdf/basic/Graph.h>
00061 #include <ogdf/basic/geometry.h>
00062 #include <ogdf/basic/NodeArray.h>
00063 #include <ogdf/internal/energybased/NodeAttributes.h>
00064 #include <ogdf/internal/energybased/EdgeAttributes.h>
00065 
00066 namespace ogdf {
00067 
00068 class OGDF_EXPORT FruchtermanReingold 
00069 {
00070    
00071    
00072    public:
00073       FruchtermanReingold();          //constructor
00074       ~FruchtermanReingold();         //destructor
00075 
00076       //Calculate exact rep. forces for each node. 
00077       void calculate_exact_repulsive_forces(const Graph &G,NodeArray<NodeAttributes>& A,
00078                                       NodeArray<DPoint>& F_rep);
00079 
00080       //Grid approximation of rep.forces for each node. 
00081       void calculate_approx_repulsive_forces(const Graph &G,NodeArray<NodeAttributes>&
00082                          A, NodeArray<DPoint>& F_rep);
00083 
00084       //Make all initialisations that are needed for FruchtermanReingold.
00085       void make_initialisations (double boxlength,DPoint down_left_corner,int grid_quotient);
00086 
00087       //Import updated information of the drawing area.
00088       void update_boxlength_and_cornercoordinate(double b_l,DPoint d_l_c)
00089            { boxlength = b_l; down_left_corner = d_l_c;}
00090 
00091    private:
00092       int _grid_quotient;//for coarsening the FrRe-grid
00093       int max_gridindex; //maximum index of a grid row/column
00094       double boxlength;  //length of drawing box
00095       DPoint down_left_corner;//down left corner of drawing box
00096 
00097       //Returns the repulsing force_function_value of scalar d.
00098       double f_rep_scalar (double d);
00099       
00100       //The number k of rows and colums of the grid is sqrt(|V|) / frGridQuotient()  
00101       //(Note that in [FrRe] frGridQuotient() is 2.) 
00102       void grid_quotient(int p) { _grid_quotient = ((0<=p) ? p : 2);}
00103       int grid_quotient() const {return _grid_quotient;}
00104 
00105 };
00106 }//namespace ogdf
00107 #endif
00108 
00109