Choosing a layout algorithm

The choice of the appropriate algorithm for a graph can be done either by the user at run time or by the programmer when developing the application. This process can be semiautomatic, when the user is involved, or automatic, when the application does everything with no user intervention.
As a programmer of applications, you can choose Semiautomatic layout to involve the user in the choice of the layout, or Automatic layout, in which case the application does everything with no user action.

Semiautomatic layout

For applications using a semiautomatic layout, the choice of the layout algorithm is done by the user. The application can provide a menu or some other way to select the layout algorithm.
In some cases, it can be an iterative process. The user may try different layout algorithms with different values for the parameters or may apply manual refinements to find the best layout, or both. The application can provide some help by using textual explanations or by automatically checking the graph to find out to which class it belongs.
For example, to detect whether the graph that has been attached to a layout instance is a tree, the IlvGraphLayoutUtil class provides the method:
static boolean IsTree(IlvGraphLayout layout, Object startNode) 
For details on this method, see IsTree. See also Attaching or detaching a grapher.

Automatic layout

If an automatic layout is needed, the choice of the layout algorithm can be:
  • Chosen dynamically at run time with heuristics or rules to determine the appropriate layout algorithm depending on the structure or size of the graph, or both
  • Hard-coded if the developer knows what types of graphs are used and can determine the appropriate layout algorithm.