dyng
DynamicGraphLayout
Public Member Functions | List of all members
dyng::fruchterman_reingold< InitialLayout > Class Template Reference

#include <fruchterman_reingold.h>

Public Member Functions

template<typename Graph >
void operator() (Graph &graph, float canvas_width, float canvas_height)
 
const InitialLayout & initial_layout () const
 Returns the object that crates initial placement.
 
InitialLayout & initial_layout ()
 Returns the object that crates initial placement.
 
float relative_unit (float width, float height) const
 Returns the relative unit that is used with temperature calculations.
 
void set_first_cooling (cooling c)
 Sets the cooling strategy for the first algorithm pass.
 
void set_second_cooling (cooling c)
 Sets the cooling strategy for the second algorithm pass.
 
void set_k_coeff (float coeff)
 Sets the coefficient for the parameter k representing average edge length. More...
 
void set_border_force_coeff (float coeff)
 Sets the coefficient for border force calculations. More...
 
void use_global_repulsion (bool value)
 Switches whether or not repulsive force should be calculated between all nodes. More...
 
template<typename Graph >
void iteration (Graph &graph, float width, float height, float temperature)
 

Detailed Description

template<typename InitialLayout>
class dyng::fruchterman_reingold< InitialLayout >

An implementation of the Fruchterman and Reingold algorithm. It's used as a function object. Before it performs the algorithm, it first creates an initial placement using parameter InitialLayout.

(Referenced in section 6.1.2)

Template Parameters
InitialLayoutFunction object that crates initial placement.
See also
cooling

Member Function Documentation

◆ iteration()

template<typename InitialLayout >
template<typename Graph >
void dyng::fruchterman_reingold< InitialLayout >::iteration ( Graph &  graph,
float  width,
float  height,
float  temperature 
)
inline

Does a single iteration of the algorithm with a given temperature within specified bounds ([-width/2, width/2] and [-height/2, height/2]). All nodes are placed within those bounds.

Parameters
widthThe canvas width.
heightThe canvas height.
graphStatic graph to perform the iteration on.
temperatureThe maximum distance a node can travel. In a unit relative to canvas diagonal.

◆ operator()()

template<typename InitialLayout >
template<typename Graph >
void dyng::fruchterman_reingold< InitialLayout >::operator() ( Graph &  graph,
float  canvas_width,
float  canvas_height 
)
inline

Creates a layout from initial placement of nodes on a static graph using the algorithm. ([-width/2, width/2] and [-height/2, height/2]) All nodes are placed within those bounds.

Parameters
canvas_widthThe width of the canvas.
canvas_heightThe height of the canvas.
graphStatic graph to perform the algorithm on.

◆ set_border_force_coeff()

template<typename InitialLayout >
void dyng::fruchterman_reingold< InitialLayout >::set_border_force_coeff ( float  coeff)
inline

Sets the coefficient for border force calculations.

Relative to normal force calculations. Default value is 0.6 meaning that border is only 0.6 times as strong as repulsive forces between nodes.

◆ set_k_coeff()

template<typename InitialLayout >
void dyng::fruchterman_reingold< InitialLayout >::set_k_coeff ( float  coeff)
inline

Sets the coefficient for the parameter k representing average edge length.

Default value is 0.6.

◆ use_global_repulsion()

template<typename InitialLayout >
void dyng::fruchterman_reingold< InitialLayout >::use_global_repulsion ( bool  value)
inline

Switches whether or not repulsive force should be calculated between all nodes.

As opposed to within a radius of 2k. Switched off by default which enables a significant optimization and also the resulting layouts are more pleasing. Turning this on requires other changes, namely increasing set_border_force_coeff has positive effect.

See also
set_border_force_coeff

The documentation for this class was generated from the following file: