Home | AJAX Demos | Java Demos | Products

GLG Graph Layout Demo

An interactive graph layout demo using spring-based layout algorithm.
Drag the graph nodes with the mouse to help or distract the layout process.

  • Overview
  • User Interface

  • Applet Source Code


    This demo demonstrates the use of 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 may be used to show the layout progress either in slow motion, or to show just the final result of the layout.

    The demo also allows the user to interact 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 as well as changing the number of nodes in the graph.


    The layout process is interactive and allows the movement of nodes with the mouse 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. The mouse may also be used to disturb the algorithm to see how it reacts.

    To move the node with the mouse, 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.