I would start here, if you haven't found it already:
http://vis.stanford.edu/protovis/jsdoc/symbols/pv.Layout.Force.html
If you want the simulation to converge more quickly, that generally
means that you want to bump up the forces. So you could try decreasing
the charge constant from the default -40 to -80, and increasing the
spring constant from .1 to .5.
The real problem with increasing these values is that numerical
instability becomes more likely. You see this when the graph starts
oscillating back and forth, with forces getting stronger and stronger
until everything devolves to NaN. There's a little more information
about that here:
http://en.wikipedia.org/wiki/Numerical_ordinary_differential_equations
Protovis uses position Verlet integration:
http://en.wikipedia.org/wiki/Verlet_integration
You could also try implementing some sliders with jQuery (see the
examples directory in the git repo), and tweak the constants
interactively to see what works best. The best constants are usually
dependent on the size and connectivity of the graph.
There are likely some things we could do to improve the stability of
the simulation, as well as the quality of the graph layout. For
example, we currently normalize spring forces based on the sqrt of the
link degree, so that springs connected to nodes with lots of edges are
weaker. This way, the total force on heavily-connected nodes doesn't
balloon out of control and introduce instability.
One of the tricks I was playing with recently was to scale the spring
force proportional to the link value; this way, the link value can
affect the layout and not just the visual appearance.
> Also, I am wondering, is there a callback that can be setup for a
> graph that triggers a "render complete" signal?
There's no callback at the moment. You can tell the layout to run a
fixed number of iterations if you just want it to be static. However,
for interactive layouts, the simulation restarts when you drag a node
(or add new nodes to the layout). So it's never really "complete".
Mike
I've revisited my edge weights and found that they were the primary reason for my sparse graphs going atomic. With edge weights on the order of hundres rather than tens or ones seeme to keep everything together, with all the default spring and charge parameters.
--
You received this message because you are subscribed to the Google Groups "protovis" group.
To post to this group, send email to prot...@googlegroups.com.
To unsubscribe from this group, send email to protovis+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/protovis?hl=en.
Unfortunately, that won't work. You can specify the springConstant as
a function, but that's only useful if you have multiple force-directed
layouts (in conjunction with panel replication), and you want to use
different spring constants for different graphs.
Spring forces are normalized by the maximum of the connected node's
link degree; see SpringForce.js for details. If you want to change
this behavior, you could either hack SpringForce.js and rebuild
protovis.js, or use pv.Simulation directly with your own pv.Force
implementation.
I wish it were easier to customize the internals of pv.Layout.Force,
but it's difficult to plug that into the standard mark property
evaluation mechanism.
Mike