Intermediate Processors
This section describes the intermediate processors that are available. For a description of what intermediate processors actually are, see KLay Layered.
Each intermediate processor is described by its required preconditions, its postconditions, the slot where it should be placed in and dependencies to intermediate processors in the same slot. The descriptions are kept very brief, since layout processors are usually well documented. Programmers using layout processors need not worry about dependencies. However, when adding a new processor, dependencies matter. For more information, see the documentation of IntermediateLayoutProcessor.
The following table provides an overview of all available layout processors and the slots they can be placed in. Note that a processor may appear in more than one slot. Within each slot, processors are ordered by theirs dependencies on each other.
Slot | Processor | Tested |
---|---|---|
Before phase 1 | Graph Transformer | |
Before phase 2 | Big Nodes Processor | |
Before phase 3 | Layer Constraint Processor | |
Before phase 4 | In Layer Constraint Processor | |
Before phase 5 | Layer Size and Graph Height Calculator | |
After phase 5 | Comment Postprocessor |
Contents
- Big Nodes Processor
- Comment Postprocessor
- Comment Preprocessor
- Edge And Layer Constraint Edge Reverser
- End Label Processor
- Graph Transformer
- Hierarchical Port Constraint Processor
- Hierarchical Port Dummy Size Processor
- Hierarchical Port Orthogonal Edge Router
- Hierarchical Port Position Processor
- Hyperedge Dummy Merger
- Hypernode Processor
- In-Layer Constraint Processor
- Inverted Port Processor
- Label And Node Size Processor
- Label Dummy Inserter
- Label Dummy Remover
- Label Dummy Switcher
- Label Side Selector
- Layer Constraint Processor
- Layer Size and Graph Height Calculator
- Long Edge Joiner
- Long Edge Splitter
- Node Margin Calculator
- North South Port Postprocessor
- North South Port Preprocessor
- Port List Sorter
- Port Side Processor
- Reversed Edge Restorer
- Self Loop Processor
Big Nodes Processor
TODO: Document.
Preconditions |
|
---|---|
Postconditions |
|
Slot | Before phase 2. |
Dependencies |
|
Remarks |
|
Comment Postprocessor
If any comments are found that were removed by the Comment Preprocessor, they are reinserted and placed above or below their corresponding connected node. This requires the margin around the node to be large enough to hold all comments, which is ensured by the Node Margin Calculator.
Preconditions |
|
---|---|
Postconditions |
|
Slot | After phase 5. |
Dependencies |
|
Remarks |
|
Comment Preprocessor
Looks for comments that have exactly one connection to a normal node and removes them from the graph. Such comments are put either into the Properties.TOP_COMMENTS or the Properties.BOTTOM_COMMENTS list of the connected node and processed later by the Comment Postprocessor. Other comments are processed normally, i.e. they are treated as regular nodes, but their incident edges may be reversed.
Preconditions |
|
---|---|
Postconditions |
|
Slot | Before phase 1. |
Dependencies |
|
Remarks |
|
Edge And Layer Constraint Edge Reverser
Edge constraints affect if a node may have only incoming or only outgoing edges. This processor reverses edges if necessary to respect the edge constraints.
Layer constraints can be seen as implicit edge constraints. If a node should be placed in the first layer, it may have only outgoing edges. Similar for the last layer.
Preconditions |
|
---|---|
Postconditions |
|
Slot | Before phase 1. |
Dependencies | None. |
Remarks |
|
Tests |
|
End Label Processor
TODO: Document.
Preconditions |
|
---|---|
Postconditions |
|
Slot | After phase 5. |
Dependencies |
|
Remarks |
|
Graph Transformer
A layout processor that is able to perform transformations on the coordinates of a graph. The supported operations are mirror (invert the x coordinates), transpose (swap the x and y coordinates), or both. This is used to support all four layout directions, since the basic algorithm only performs left-to-right layout.
Preconditions |
|
---|---|
Postconditions |
|
Slots |
|
Dependencies |
|
Remarks |
|
Hierarchical Port Constraint Processor
This processor is concerned with hierarchical ports.
For eastern and western ports, the order of the nodes is fixed if the port constraints are at least at FIXED_ORDER. This processor inserts the necessary in-layer successor constraints to ensure that this order is respected during crossing reduction.
For northern and southern hierarchical ports, we just need one hierarchical port dummy per hierarchical port in the simple cases. With port constraints at least at FIXED_ORDER, however, we need to modify that approach a little. For each node connected to a hierarchical port on the northern or southern side, we insert a hierarchical port dummy in the following layer. We then remove the original hierarchical port dummy representing the port, setting the new dummy's ORIGIN property to that original dummy node. The old dummy nodes are inserted again by the HierarchicalPortOrthogonalEdgeRouter. For all other port constraints, the original port dummy nodes are replaced by a single new dummy node, in a similar way as described above. This greatly simplifies hierarchical port dummy handling later on during edge routing.
Preconditions |
|
---|---|
Postconditions |
|
Slot | Before phase 3. |
Dependencies |
|
Remarks |
|
Hierarchical Port Dummy Size Processor
Sets the width of hierarchical port dummy nodes.
To see why this is necessary, let's step back for a minute and imagine three hierarchical northern port dummy nodes in the same layer. With the default hierarchical port edge router, what will happen is the following. Each each going into one of the nodes is routed upwards, the bend point being placed at the dummy node's input port. If all dummy nodes have the same width, these ports will have the same x coordinate – the edges incident to all three nodes will be routed on top of each other. To make the task of avoiding this easier, this processor sets the width in a way ensuring that the x coordinates of the three ports are as far apart as the edge spacing dictates.
Preconditions |
|
---|---|
Postconditions |
|
Slot | Before phase 5. |
Dependencies | None. |
Remarks |
|
Hierarchical Port Orthogonal Edge Router
After edge routing, edges have only been routed inside the graph. What remains to be done is to route the edges to the hierarchical ports. This processor does just that, using an orthogonal edge routing approach. During that process, hierarchical port dummy nodes that map onto hierarchical port are assigned the coordinates of the hierarchical port, relative to the graph's content area and already corrected for the offset. The necessary bend points are added to the edges connected to hierarchical ports. Hierarchical port dummy nodes that don't map onto a hierarchical port are removed, their incident edges connected to the appropriate hierarchical port dummy node representing a hierarchical port.
This is the default edge router for edges incident to hierarchical ports. Other edge routers are free to come with an own implementation for routing hierarchical edges.
Preconditions |
|
---|---|
Postconditions |
|
Slot | After phase 5. |
Dependencies | None. |
Remarks |
|
Hierarchical Port Position Processor
If port constraints are set to at least FIXED_RATIO, the node placement phase is not free to position external port dummies at will. If the node placement algorithm doesn't support fixed positions, including a dependency on this processor fixes the y positions of external port dummies representing western or eastern ports.
Preconditions |
|
---|---|
Postconditions |
|
Slot | Before phase 5. |
Dependencies | None. |
Remarks |
|
Hyperedge Dummy Merger
Merges long edge dummy nodes with edges originally coming from the same port or going into the same port. The idea is to reduce the amount of edges in the diagram as much as possible.
Preconditions |
|
---|---|
Postconditions |
|
Slot | Before phase 4. |
Dependencies |
|
Remarks |
|
Hypernode Processor
Improves the placement of hypernodes by moving them such that they replace the join points of connected edges. This is done as a post-processing, since hypernodes are treated as regular nodes for the rest of the algorithm.
Preconditions |
|
---|---|
Postconditions |
|
Slot | After phase 5. |
Dependencies |
|
Remarks |
|
In-Layer Constraint Processor
Makes sure that in-layer constraints are respected. This processor is only necessary for crossing minimizers that don't respect in-layer constraints.
Preconditions |
|
---|---|
Postconditions |
|
Slot | Before phase 4. |
Dependencies | None. |
Remarks |
|
Tests |
|
Inverted Port Processor
Inserts odd port side dummy nodes to cope with odd port sides. Odd port sides are the eastern side for input ports and the western side for output ports. In both cases, the incoming or outgoing edges have to be routed around the node.
Preconditions |
|
---|---|
Postconditions |
|
Slot | Before phase 3. |
Dependencies |
|
Remarks |
|
Tests |
|
Label And Node Size Processor
Calculates node sizes, places ports, and places node and port labels.
Preconditions |
|
---|---|
Postconditions |
|
Slot | Before phase 4. |
Dependencies |
|
Remarks | Replaces the old PortPositionProcessor . |
Label Dummy Inserter
TODO: Document.
Preconditions |
|
---|---|
Postconditions |
|
Slot | Before phase 2. |
Dependencies |
|
Remarks |
|
Label Dummy Remover
TODO: Document.
Preconditions |
|
---|---|
Postconditions |
|
Slot | After phase 5. |
Dependencies |
|
Remarks |
|
Tests |
|
Label Dummy Switcher
TODO: Document.
Preconditions |
|
---|---|
Postconditions |
|
Slot | Before phase 3. |
Dependencies |
|
Remarks |
|
Label Side Selector
TODO: Document.
Preconditions |
|
---|---|
Postconditions |
|
Slot | Before phase 4. |
Dependencies |
|
Remarks |
|
Tests |
|
Layer Constraint Processor
Nodes can have a property associated with them that restricts the layers they can be placed in. They can be forced in the first or the last existing layer. They can also be forced into a newly created first or last layer, along with all other nodes with the appropriate property set. While they may not be treated differently by the layerer, this processor moves them into the layer they should be placed in. A node placed in the first layer must have only outgoing edges; similarly, nodes placed in the last layer must have only incoming edges. This processor assumes that as a precondition.
Preconditions |
|
---|---|
Postconditions |
|
Slot | Before phase 3. |
Dependencies |
|
Remarks |
|
Tests |
|
Layer Size and Graph Height Calculator
This processor, which is always part of the processing pipeline, calculates the height and width of each layer, sets the graph's height accordingly, and calculates the graph's vertical offset based on vertical node positions. The offset is calculated such that the topmost node will have a y coordinate equal to 0. The graph's width cannot be set in this processor since that is only determined during edge routing.
The reason for this processor's existence is to factor this code out of the node placement implementations.
Preconditions |
|
---|---|
Postconditions |
|
Slot | Before phase 5. |
Dependencies |
|
Remarks |
|
Tests |
|
Long Edge Joiner
Removes all long edge dummy nodes, joining their edges together.
Preconditions |
|
---|---|
Postconditions |
|
Slot | After phase 5. |
Dependencies |
|
Remarks |
|
Tests |
|
Long Edge Splitter
Turns a layered graph into a properly layered graph by inserting long edge dummies where appropriate..
Preconditions |
|
---|---|
Postconditions |
|
Slot | Before phase 3. |
Dependencies |
|
Remarks | None. |
Tests |
|
Node Margin Calculator
Calculates node margins based on port positions and sizes and label positions and sizes.
Preconditions |
|
---|---|
Postconditions |
|
Slot | Before phase 4. |
Dependencies |
|
Remarks | None. |
Tests |
|
North South Port Postprocessor
Removes north / south port dummy nodes and routes the edges properly.
Preconditions |
|
---|---|
Postconditions |
|
Slot | After phase 5. |
Dependencies | None. |
Remarks |
|
Tests |
|
North South Port Preprocessor
Inserts dummy nodes to cope with northern and southern ports. Dummy nodes are assigned to layout groups identified by the node whose ports they were created from. Also, node successor constraints are set to keep north / south port dummy nodes in a certain order. This processor is capable of processing self-loops connecting two northern or two southern ports. For other kinds of self-loops, the SelfLoopProcessor may be required.
Preconditions |
|
---|---|
Postconditions |
|
Slot | Before phase 3. |
Dependencies |
|
Remarks |
|
Port List Sorter
If a node already has a fixed port order, its port lists are sorted accordingly.
Preconditions |
|
---|---|
Postconditions |
|
Slot | Before phase 3, before phase 4. |
Dependencies | None. |
Remarks |
|
Tests |
|
Port Side Processor
Ensures that nodes have at least fixed port sides.
Preconditions |
|
---|---|
Postconditions |
|
Slot | Before phase 3. |
Dependencies | None. |
Remarks | None. |
Tests |
|
Reversed Edge Restorer
Restores the direction of reversed edges.
Preconditions |
|
---|---|
Postconditions |
|
Slot | After phase 5. |
Dependencies | None. |
Remarks |
|
Tests |
|
Self Loop Processor
Does some work that enables the other processors and phases to handle self-loops. To handle them well, the NorthSouthPortPreprocessor may be required.
Preconditions |
|
---|---|
Postconditions |
|
Slot | After phase 3. |
Dependencies |
|
Remarks | None. |