GLG Graph Layout Demo
Overview
User
Interface
OVERVIEW
This demo demonstrates a
spring-based
graph layout algorithm to position nodes of a given arbitrary graph.
The
demo is an example of how dynamic GLG objects may be used to visualize
nodes of a graph, display additional node-related information and a
node's
dynamic properties. The Graph Layout component is a part of the GLG
Extended API.
Changing the UpdateRate
option
shows either layout progress in slow motion, or just the final result
of
the layout.
The demo also allows
user
iteraction with the layout algorithm: you can move graph nodes with the
mouse to help find the best layout, or just disturb the layout and see
how it responds.
The demo provides
options
for creating graphs of two different types and changing the number of
nodes
in the graph.
Source
Code
USER
INTERFACE
BUTTONS
-
New
Creates a new graph with
the number of nodes defined by the NumNodes slider and of the type
defined
by the Star toggle (Star or Circular).
- Scramble
Randomly scrambles the
graph's
nodes.
- Untangle
Enables using additional
graph untangling methods.
- Star
Controls the type of
graph
(Star or Circular) to be created with the New button.
- Quit
In the stand-alone
version,
exits the demo.
SLIDERS
-
UpdateRate
Controls the update
frequency.
In the Min position, the demo shows
just the resulting layout. In the Max position, each iteration
of the layout is shown (slowing down layout progress).
- NumNodes
Controls the number of
nodes
in the graph created with the New
button.
- IconSize
Controls the size of a
node
MOUSE
The demo is interactive
and
allows the movement of nodes with the mouse
to disturb the algorithm, or to help it find a better layout
when the algorithm gets
stuck in a local extrema, resulting in a semi-optimal
layout for some graph chains.
To move the node, click
on
it with the left mouse button and drag. The
selected node will be highlighted using the dynamic properties of
the node, and the layout
algorithm will adjust the graph to accomodate the
new node position.