[BGL] Fruchterman-Reingold: clipping strategy

This code:
// Update positions for (tie(v, v_end) = vertices(g); v != v_end; ++v) { BOOST_USING_STD_MIN(); BOOST_USING_STD_MAX(); Dim disp_size = sqrt(displacement[*v].x * displacement[*v].x + displacement[*v].y * displacement[*v].y); position[*v].x += displacement[*v].x / disp_size * min BOOST_PREVENT_MACRO_SUBSTITUTION (disp_size, temp); position[*v].y += displacement[*v].y / disp_size * min BOOST_PREVENT_MACRO_SUBSTITUTION (disp_size, temp); position[*v].x = min BOOST_PREVENT_MACRO_SUBSTITUTION (width / 2, max BOOST_PREVENT_MACRO_SUBSTITUTION(-width / 2, position[*v].x)); position[*v].y = min BOOST_PREVENT_MACRO_SUBSTITUTION (height / 2, max BOOST_PREVENT_MACRO_SUBSTITUTION(-height / 2, position[*v].y)); }
determines the both how objects with strong forces in one direction are "slowed down" and how clipping is done when nodes are about to leave the drawing area. IMO, this should be a bit more generic. E.g., another clipping strategy would be to let nodes "bounce" from the walls. The way the temperature is taken into account could also be different (I presume you have taken it from literature? All these values etc. seem to be largely based on experiments ...). Btw, does anyone have a better test program (e.g., reading and writing Graphviz, together with a sufficiently large example graph)?
participants (1)
-
Jens Müller