Laying out Graphs
One of the most critical aspects of visualizing graphs is to get nice looking layouts. The figures above represent a sampling of the layouts provided by GUESS which you can apply to your graphs. A number of the guess layouts are iterative. That is they are always trying to “improve” and thus may never converge. For these layouts you may predefine how many loops they should run for. If you choose not to define a limit the layout algorithms will run until convergence or will show a dialog every 30 seconds asking if you would like to continue.
Currently GUESS provides the following layouts
-
Random
-
Commands: randomLayout() or randomLayout(width,height)
-
Randomly lays out nodes in a 1000 x 1000 pixel space or width x height if specified
-
Circlular
-
Commands: circleLayout()
-
Lay all nodes in a circle
-
Kamada-Kawai
-
There are currently 3 Kamada-Kawai implementations in GUESS: kkLayout(), jkkLayout1(), and jkkLayout2()
-
The first was transferred from Zoomgraph and the second two are the KKLayout and KKLayoutInt from the JUNG toolkit
-
Note: the kkLayout command will fail on graphs that have multiple components
-
Spring Layouts
-
There are currently 2 Spring layout implementations in GUESS: springLayout(…) and jSpringLayout(…)
-
The first was transferred from Zoomgraph. The second is the JUNG implementation.
-
Both will accept a “max” parameter to indicate how many loops should be run
-
Fruchterman-Rheingold
-
There are currently 2 Fructerman-Rheingold implementations in GUESS: frLayout() and jfrLayout()
-
The first was transferred from Zoomgraph and contains a slight modification to ensure nodes do not overlap. The second is the JUNG implementation
-
GEM Layout
-
Commands: gemLayout()
-
Lay all nodes in using the GEM algorithm
-
Physics Layout
-
Commands: physicsLayout(…)
-
Lay all nodes in using a “physics” (spring-type) layout algorithm. You may use a “max” parameter to indicate when this should stop.
-
Note: this is a port of
http://www.schmuhl.org/graphopt/
-
Multi-Dimensional Scaling Layout
-
Commands: mdsLayout()
-
Does a mutli-dimensional scaling on the graph where node-node distances are defined by the connecting edge weight
-
Note: currently uses the “weight” attribute on edges to determine similarity/dissimilarity. This will be generalized to any property in the future.
-
Radial Layout
-
Commands: radialLayout(center)
-
Places the center node in the center and places nodes connected to it at increasing radii based on shortest path.
-
Circular-Constrained Layout
-
Commands: g.circleLayout(field,center)
-
Places the center node in the center and each of its neighbors around it with the radius based on value of field (works for both edge and node fields).
-
Rescaling layouts
-
Commands: rescaleLayout(height,width) or rescaleLayout(percent)
-
Rescale all the nodes to fit in an array of height x width or reduce/increase the dimensions by %percent.
-
Edge Shifting
-
Command: readjustEdges()
-
As of version 1.0.3 we also have the commands expandOverlapping() which is the same as readjustEdges() and compressOverlapping() which does the opposite.
-
Shift overlapping edges a little bit along a curve so that you can see that there are multiple edges between nodes. See Figure below for an example.
-
Bin Pack
-
Command: binPackLayout()
-
This will pull together disconnected graph components into a nicer view.
-
Isom Layout
-
Command: isomLayout()
By and large layouts are executed in their own loops so that they do not take over the UI rendering pipeline. Layouts will also center the display to fit all the nodes. This is also an asynchronous process. At times you may want to add layout operations into your scripts. You may wish to make use of the commands:
-
setSynchronous(state) where state is a Boolean (true/false) which will tell the layout algorithms whether to run in their own thread (default false, the system is asynchronous)
-
centerAfterLayout(state) where state is a Boolean (true/false) which will allow/prevent GUESS from centering after a layout (default true).
[programmatic control of layouts]












