Note
Graph layout features are only available if
you have purchased a full JViews Diagrammer license.
In some situations, diagrams can be drawn
manually and still kept clear to read. The user typically places
the nodes and links and repositions the nodes manually if the
diagram becomes cluttered.
In many cases, the diagram is too complex to be handled manually,
or there is no human being involved: the diagram is built
dynamically with application data that does not contain any
geometric information. In such cases, automatic
layout algorithms are required to position the nodes and to route
the links.
The Graph Layout package is a set of layout
algorithms provided with JViews Diagrammer to position nodes and
labels, and to route links, automatically. The goal of a layout
algorithm is to propose solutions in which nodes do not overlap,
links do not cross nodes or links, and labels do not overlap other
objects. Ideal solutions do not always exist, but an algorithm will
tend to an optimal one, see the following figure.
![diaint_route6.gif](../../JViews_Diagrammer/usrintdiag/_media/diaint_route6_default.gif)
Applying a graph layout: before and
after
The most effective way of displaying a graph
depends on its type and sometimes on industry standards.
JViews Diagrammer offers various algorithms with many parameters to
adapt to the many situations. For example, the hierarchical layout
is mainly used for displaying flows and processes; circular and bus
layouts for LAN networks; radial tree layout for semantic networks
and website maps; and tree layout for organization charts, decision
trees, and directories.
In JViews Diagrammer, several graph layouts can be applied to a
single diagram: a subgraph may require a different layout to its
parent; or one layout can be applied to only a subset of the nodes.
Constraints can also be set, for example, to make nodes with a
certain property stay above the others.
When it comes to routing links,
JViews Diagrammer offers strategies to limit the length of links,
algorithms to bundle links or connect nicely to nodes—especially
when several links arrive at a single node.
The label layout (labeling) algorithm makes
sure that labels do not overlap—which would make them hard to
read—by shifting them slightly away from their base position and by
rotating them if necessary. This algorithm is used for labels on
nodes and links, and for labels in Rogue Wave® JViews Maps.