The GL algorithm

The Grid Layout (GL) has two main modes: grid and row/column.
  • In grid mode, the layout arranges the nodes of a graph in the cells of a grid (matrix). If a node is too large to fit in one grid cell (with margins), it occupies multiple cells. The size of the grid cells and the margins are parameters of the algorithm.
  • In row/column mode, the layout arranges the nodes of a graph either by rows or by columns (according to the specified option). The width of the rows is controlled by the width of the layout region parameter. The height of the columns is controlled by the height of the layout region parameter. The horizontal and vertical margins between the nodes are parameters of the algorithm.
GL Example
In Java
Below is a code sample using the IlvGridLayout class. This code sample shows how to perform a Grid Layout:
 ...
import ilog.views.*;
import ilog.views.eclipse.graphlayout.runtime.*;
import ilog.views.eclipse.graphlayout.GraphModel;
import ilog.views.eclipse.graphlayout.runtime.grid.*;
 ...
 
IlvGridLayout layout = new IlvGridLayout();
GraphModel graphModel = new GraphModel(myGrapherEditPart);
layout.attach(graphModel);
 
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());
}
layout.detach();
graphModel.dispose();