Specific parameters of the TML

The following parameters are specific to the IlvTopologicalMeshLayout class.

Link style (TML)

When the layout algorithm moves the nodes, straight-line links (such as instances of IlvLinkImage) will automatically “follow” the new positions of their end nodes. If the grapher contains other types of links (for example, IlvPolylineLinkImage or IlvSplineLinkImage), the shape of the link may not be appropriate because the intermediate points of the link will not be moved. In this case, you can ask the layout algorithm to automatically remove all the intermediate points of the links (if any).
To specify that the layout algorithm automatically remove all the intermediate points of the links (if any):
In CSS
Add to the GraphLayout section:
linkStyle: "STRAIGHT_LINE_STYLE";
In Java™
Use the method:
void setLinkStyle(int style)  
The valid values for style are:
  • IlvTopologicalMeshLayout.NO_RESHAPE_STYLE
    None of the links is reshaped in any manner.
  • IlvTopologicalMeshLayout.STRAIGHT_LINE_STYLE
    All the intermediate points of the links (except for links specified as fixed) are removed. This is the default value.
Note
The layout algorithm may raise an IlvInappropriateLinkException if layout is performed on an IlvGrapher, but inappropriate link classes or link connector classes are used. See Layout exceptions for details and solutions to this problem.

Connect links to node center (TML)

This feature is shared by all subclasses of the Basic Link Style Layout. See Connect links to node center for details.

Multilink and self-link features (TML)

This feature is shared by all subclasses of the Basic Link Style Layout. See Multilink and self-link features for details.

Optimization iterations and allowed time (TML)

The iterative computation performed in the Topological Optimization step is stopped if the number of iterations exceeds the allowed number of iterations for optimization or the time exceeds the allowed time for optimization (or, of course, if the general layout time has elapsed; see Allowed time (TML)).
To specify the parameters:
In CSS
Add to the GraphLayout section:
allowedOptimizationTime: "30000";
allowedNumberOfOptimizationIterations: "5";
In Java
Use the methods:
void setAllowedOptimizationTime(long time)   
void setAllowedNumberOfOptimizationIterations(int iter)     
The time is in milliseconds. The default value is 28000 (28 seconds).

Node placement iterations and allowed time (TML)

The iterative computation performed in the Nodes Placement step is stopped if the number of iterations exceeds the allowed number of iterations or the time exceeds the allowed time for node placement (or, of course, if the general layout time has elapsed; see Allowed time (TML)).
To specify these parameters:
In CSS
Add to the GraphLayout section:
allowedNodesPlacementTime: "30000";
allowedNumberOfNodesPlacementIterations: "5";
In Java
Use the methods:
void setAllowedNodesPlacementTime(long time)     
void setAllowedNumberOfNodesPlacementIterations(int iter)     
The time is in milliseconds. The default value is 28000 (28 seconds).

Node placement algorithm (TML)

Two barycentric algorithms are implemented for the Nodes Placement step of TML.
To specify the algorithm:
In CSS
Add to the GraphLayout section:
nodesPlacementAlgorithm: "QUICK_BAD";
In Java
Use the method:
void setNodesPlacementAlgorithm(int option)     
The valid values for option are:
  • IlvTopologicalMeshLayout.SLOW_GOOD
    This option provides more uniformity of the nodes distribution inside the outer cycle, but is slightly slower.
  • IlvTopologicalMeshLayout.QUICK_BAD
    This option provides less uniformity of the nodes distribution, but is slightly quicker.
In most cases, both algorithms are fairly quick. We recommend that you use the SLOW_GOOD version, which is the default value. Compare the layouts of the same graph in Node placement algorithm: SLOW_GOOD and Node placement algorithm: QUICK_BAD to get an idea of the difference between these algorithms.
In CSS, you omit the prefix IlvTopologicalMeshLayout when specifying the value of the nodes placement.
Example
of Topological Mesh Layout with the node placement algorithm SLOW_GOOD
Node placement algorithm: SLOW_GOOD
Example
of Topological Mesh Layout with the node placement algorithm QUICK_BAD
Node placement algorithm: QUICK_BAD

Outer cycle (TML)

The Topological Optimization step of TML computes a set of cycles that can be used as the outer cycle in the Nodes Placement step . By default, the longest cycle is actually used (that is, the cycle containing the largest number of nodes). However, you may find it useful to try a different outer cycle. To do so in Java, use the method:
void setExteriorCycleId(int cycleId)  
The valid values for cycleId range from zero to the number of cycles computed by the Topological Optimization step minus one. This number is returned by the method:
int getNumberOfPossibleExteriorCycles()  
If the number is not in this range, the value zero is used.
You can use these methods only after having performed the layout successfully. Otherwise, no outer cycle is defined.
When the layout is performed again with a new outer cycle, only the Nodes Placement step of TML is performed, and not the time-consuming the Topological Optimization step. This is true if the topology of the graph has not been changed (that is, no nodes or links were added or removed), and no parameters that affect the Topological Optimization step have been changed.
Layout using 1st outer cycle, Layout using 2nd outer cycle, Layout using 3rd outer cycle, and Layout using 4th outer cycle show various layouts produced for the same graph when the cycleId parameter is changed:
Example
of Topological Mesh Layout using the first outer cycle
Layout using 1st outer cycle
Example
of Topological Mesh Layout using the second outer cycle
Layout using 2nd outer cycle
Example
of Topological Mesh Layout using the third outer cycle
Layout using 3rd outer cycle
Example
of Topological Mesh Layout using the fourth outer cycle
Layout using 4th outer cycle