The Random Layout (RL) algorithm is not
really a layout algorithm. It simply places the nodes at randomly
computed positions inside a user-defined region. Nevertheless, the
Random Layout algorithm can be useful when a random, initial
placement is needed by another layout algorithm or in cases where
an aesthetic, readable drawing is not important.
Example of RL
In CSS
The following sample CSS specification uses the Random Layout
algorithm. The CSS specification can be loaded as style file
into an application that uses the IlvDiagrammer class (see Graph layout in Rogue Wave JViews Diagrammer).
SDM { GraphLayout : "true"; LinkLayout : "false"; } GraphLayout { linkStyle : "STRAIGHT_LINE_STYLE"; }
In Java™
The following code sample uses the IlvRandomLayout class. This code sample
shows how to perform a Random Layout on a grapher directly
without using a diagram component or any style sheet:
... import ilog.views.*; import ilog.views.graphlayout.*; import ilog.views.graphlayout.random.*; ... IlvGrapher grapher = new IlvGrapher(); IlvManagerView view = new IlvManagerView(grapher); ... /* Fill in here the grapher with nodes and links in */ IlvRandomLayout layout = new IlvRandomLayout(); layout.attach(grapher); try { IlvGraphLayoutReport layoutReport = layout.performLayout(); int code = layoutReport.getCode(); System.out.println("Layout completed (" + layoutReport.codeToString(code) + ")"); } catch (IlvGraphLayoutException e) { System.err.println(e.getMessage()); }