Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.nwoods.jgo.layout
Class JGoLayeredDigraphAutoLayout

    java.lang.Object
      com.nwoods.jgo.layout.JGoAutoLayout
          com.nwoods.jgo.layout.JGoLayeredDigraphAutoLayout

public class JGoLayeredDigraphAutoLayout
extends JGoAutoLayout

JGoLayeredDigraphAutoLayout provides an auto-layout for layered drawings of directed graphs. JGoLayeredDigraphAutoLayout provides an auto-layout algorithm for directed graphs. The method uses a hierarchical approach for creating drawings of digraphs with nodes arranged in layers. The layout algorithm consists of four-major steps: Cycle Removal, Layer Assignment, Crossing Reduction, and Straightening and Packing.

Field Summary
`static int` | `LD_AGGRESSIVE_FALSE` The default crossing reduction option, create a JGoLayeredDigraphAutoLayout with LD_AGGRESSIVE_FALSE to use the faster, less agressive crossing reduction algorithm.
`static int` | `LD_AGGRESSIVE_TRUE` Create a JGoLayeredDigraphAutoLayout with LD_AGGRESSIVE_TRUE to use the slower, more agressive crossing reduction algorithm.
`static int` | `LD_CYCLEREMOVE_DFS` The default cycle removal option, create a JGoLayeredDigraphAutoLayout with LD_CYCLEREMOVE_DFS to remove cycles using depthFirstSearchCycleRemoval()
`static int` | `LD_CYCLEREMOVE_GREEDY` Create a JGoLayeredDigraphAutoLayout with LD_CYCLEREMOVE_GREEDY to remove cycles using greedyCycleRemoval()
`static int` | `LD_DIRECTION_DOWN` Create a JGoLayeredDigraphAutoLayout with LD_DIRECTION_DOWN if the digraph point in the down direction.
`static int` | `LD_DIRECTION_LEFT` Create a JGoLayeredDigraphAutoLayout with LD_DIRECTION_LEFT if the digraph point in the left direction.
`static int` | `LD_DIRECTION_RIGHT` Create a JGoLayeredDigraphAutoLayout with LD_DIRECTION_RIGHT if the digraph point in the right direction.
`static int` | `LD_DIRECTION_UP` The default direction option, create a JGoLayeredDigraphAutoLayout with LD_DIRECTION_UP if the digraph point in the up direction.
`static int` | `LD_INITIALIZE_DFSIN` Create a JGoLayeredDigraphAutoLayout with LD_INITIALIZE_DFSIN to initialize using depthFirstInInitializeIndices()
`static int` | `LD_INITIALIZE_DFSOUT` The default initialization option, create a JGoLayeredDigraphAutoLayout with LD_INITIALIZE_DFSOUT to initialize using depthFirstOutInitializeIndices()
`static int` | `LD_INITIALIZE_NAIVE` Create a JGoLayeredDigraphAutoLayout with LD_INITIALIZE_NAIVE to initialize using naiveInitializeIndices()
`static int` | `LD_LAYERING_LONGESTPATHSINK` Create a JGoLayeredDigraphAutoLayout with LD_LAYERING_LONGESTPATHSINK to layer using longestPathSinkLayering()
`static int` | `LD_LAYERING_LONGESTPATHSOURCE` Create a JGoLayeredDigraphAutoLayout with LD_LAYERING_LONGESTPATHSOURCE to layer using longestPathSourceLayering()
`static int` | `LD_LAYERING_OPTIMALLINKLENGTH` The default layering option, create a JGoLayeredDigraphAutoLayout with LD_LAYERING_OPTIMALLINKLENGTH to layer using optimalLinkLengthLayering()
`static int` | `LD_PACK_ALL` An option passed to setPackOption that has all options selected.
`static int` | `LD_PACK_EXPAND` An option passed to setPackOption that may be bit-wise combined with other pack options.
`static int` | `LD_PACK_MEDIAN` An option passed to setPackOption that may be bit-wise combined with other pack options.
`static int` | `LD_PACK_STRAIGHTEN` An option passed to setPackOption that may be bit-wise combined with other pack options.

Constructor Summary
`JGoLayeredDigraphAutoLayout()` Constructs a LayeredDigraphAutoLayout with null network and document.
`JGoLayeredDigraphAutoLayout(JGoDocument doc)` Constructs a LayeredDigraphAutoLayout for the passed in document with default spacing and options.
`JGoLayeredDigraphAutoLayout(JGoDocument doc, int NlayerSpacing, int NcolumnSpacing, int NdirectionOption, int NcycleremoveOption, int NlayeringOption, int NinitializeOption, int Niterations, int NaggressiveOption)` Constructs a LayeredDigraphAutoLayout for the passed in document with the spacing and options passed into the constructor.
`JGoLayeredDigraphAutoLayout(JGoDocument doc, JGoNetwork network)` Constructs a LayeredDigraphAutoLayout for the passed in document, and network, with default spacing and options.
`JGoLayeredDigraphAutoLayout(JGoDocument doc, JGoNetwork network, int NlayerSpacing, int NcolumnSpacing, int NdirectionOption, int NcycleremoveOption, int NlayeringOption, int NinitializeOption, int Niterations, int NaggressiveOption)` Constructs a LayeredDigraphAutoLayout for the passed in document, and network, with the spacing and options passed into the constructor.
`JGoLayeredDigraphAutoLayout(JGoLayeredDigraphAutoLayout layout)` Make a copy of a JGoLayeredDigraphAutoLayout, copying most of the important properties except for the JGoNetwork.

Method Summary
`protected boolean` | `adjacentExchangeCrossingReductionBendStraighten(int unfixedLayer, int directionCR, boolean straighten, int directionBS)` Adjusts the columns of nodes within the unfixedLayer to simultaneously reduce the number of link crossings and the number of "bends" between the unfixedLayer and its adjacent layers between the unfixedLayer and its adjacent layers.
`protected void` | `assignLayers()` Assigns every node in the input network to a layer.
`protected double[]` | `barycenters(int unfixedLayer, int direction)` Computes the array of barycenters (average) columns for the nodes in the unfixedLayer based on the columns of predecessors (direction < 0), successors (direction > 0), or both predecessors and successors (direction == 0).
`protected double` | `bends(int unfixedLayer, int direction, boolean weighted)` Computes the bends between the unfixedLayer and its adjacent layers.
`protected boolean` | `bendStraighten(int unfixedLayer, int direction)` Adjusts the columns of nodes within the unfixedLayer to reduce the number of "bends" between the unfixedLayer and its adjacent layers.
`protected void` | `component(JGoNetworkNode pNode, int component, boolean forw, boolean back)` Uses a depth first search algorithm to set the component of all nodes in a component.
`protected void` | `componentPack(int direction)` Adjusts the columns of nodes in the network to produce a layout which is tightly packed.
`protected boolean` | `componentPackAux(int column, int direction)` Attempts to augment the argument column by merging components into from the argument direction.
`protected void` | `componentUnset(JGoNetworkNode pNode, int component, int unset, boolean forw, boolean back)` Uses a depth first search algorithm to set the component of all nodes in a component.
`protected double` | `countBends(boolean weighted)` Returns the total number of bends in the network.
`protected int` | `countCrossings()` Returns the total number of crossings in the network.
`protected int[]` | `crossingMatrix(int unfixedLayer, int direction)` Computes the crossing matrix between the unfixedLayer and its adjacent layers.
`protected void` | `depthFirstInInitializeIndices()` Assigns every node in the input network an index number, such that nodes in the same layer will be labeled with consecutive indices in left to right order.
`protected void` | `depthFirstInInitializeIndicesVisit(JGoNetworkNode pNode)` Assigns pNode the appropriate index and updates the indices array.
`protected void` | `depthFirstOutInitializeIndices()` Assigns every node in the input network an index number, such that nodes in the same layer will be labeled with consecutive indices in left to right order.
`protected void` | `depthFirstOutInitializeIndicesVisit(JGoNetworkNode pNode)` Assigns pNode the appropriate index and updates the indices array.
`protected void` | `depthFirstSearchCycleRemoval()` Removes cycles from the input network using a depth first search.
`protected void` | `depthFirstSearchCycleRemovalVisit(JGoNetworkNode pNode)` Peforms the recursive step of the depth first search on pNode.
`protected boolean` | `equalLayout(int[] layoutA, int[] layoutB)` The function equalLayout compares two layouts and determines if they are equal.
`int` | `getAggressiveOption()` Accessor to private variable aggressiveOption.
`int` | `getColumnSpacing()` Accessor to private variable columnSpacing.
`int` | `getCycleRemoveOption()` Accessor to private variable cycleremoveOption.
`int` | `getDirectionOption()` Accessor to private variable directionOption.
`int[]` | `getIndices()` Accessor to private variable indices.
`int` | `getInitializeOption()` Accessor to private variable initializeOption.
`int` | `getIterations()` Accessor to private variable iterations.
`int` | `getLayeringOption()` Accessor to private variable layeringOption.
`int` | `getLayerSpacing()` Accessor to private variable layerSpacing.
`protected double` | `getLinkLengthWeight(JGoNetworkLink pLink)` The function getLinkLengthWeight returns the weight of the link represented by the JGoNetworkLink pLink.
`protected int` | `getLinkMinLength(JGoNetworkLink pLink)` The function getLinkMinLength returns the minimum length of the link represented by the JGoNetworkLink pLink.
`protected double` | `getLinkStraightenWeight(JGoNetworkLink pLink)` The function getLinkStraightenWeight returns the weight of the link represented by the JGoNetworkLink pLink.
`int` | `getMaxColumn()` Accessor to private variable maxColumn.
`int` | `getMaxIndex()` Accessor to private variable maxIndex.
`int` | `getMaxIndexLayer()` Accessor to private variable maxIndexLayer.
`int` | `getMaxLayer()` Accessor to private variable maxLayer.
`int` | `getMinIndexLayer()` Accessor to private variable minIndexLayer.
`protected int` | `getNodeMinColumnSpace(JGoNetworkNode pNode)` The function getNodeMinColumnSpace returns the minimum space reserved to either side of this node.
`protected int` | `getNodeMinLayerSpace(JGoNetworkNode pNode)` The function getNodeMinLayerSpace returns the minimum space reserved above and below this node.
`int` | `getPackOption()` The options used by the standard implementation of the straightenAndPack method.
`protected void` | `greedyCycleRemoval()` Removes cycles from the input network using a Greedy-Cycle-Removal algorithm.
`protected JGoNetworkNode` | `greedyCycleRemovalFindNode(JGoNetwork pGoNetwork)` Finds a valid node in the network.
`protected JGoNetworkNode` | `greedyCycleRemovalFindNodeMaxDegDiff(JGoNetwork pGoNetwork)` Finds a valid node in the network that maximizes outdeg - indeg.
`protected JGoNetworkNode` | `greedyCycleRemovalFindSink(JGoNetwork pGoNetwork)` Finds a sink node in the network.
`protected JGoNetworkNode` | `greedyCycleRemovalFindSource(JGoNetwork pGoNetwork)` Finds a source node in the network.
`protected void` | `initializeColumns()` Assigns every node in the input network a column number, such that nodes in the same layer will be labeled with increasing indices in left to right order.
`protected void` | `initializeIndices()` Assigns every node in the input network an index number, such that nodes in the same layer will be labeled with consecutive indices in left to right order.
`protected void` | `layoutLinks()` Lays out the links.
`protected void` | `layoutNodes()` Lays out the nodes.
`protected void` | `layoutNodesAndLinks()` Updates the physical location of "real" nodes and links to reflect the layout.
`protected JGoLayeredDigraphAutoLayoutLinkData` | `linkData(JGoNetworkLink pLink)` Takes in a JGoNetworkLink and returns the link's JGoLayeredDigraphAutoLayoutLinkData.
`protected void` | `longestPathSinkLayering()` Assigns every node in the input network to a layer.
`protected int` | `longestPathSinkLayeringLength(JGoNetworkNode pNode)` Computes the length of the longest path from pNode to a sink node and sets the layer of pNode to that length.
`protected void` | `longestPathSourceLayering()` Assigns every node in the input network to a layer.
`protected int` | `longestPathSourceLayeringLength(JGoNetworkNode pNode)` Computes the length of the longest path from pNode to a source node and sets the layer of pNode to that length.
`protected void` | `makeProper()` Converts the input network into a proper digraph; i.e., artificial nodes and links are introduced into the network such that ever link is between nodes in adjacent layers.
`protected boolean` | `medianBarycenterCrossingReduction(int unfixedLayer, int direction)` Reorders nodes within the unfixedLayer to reduce the number of link crossings between the unfixedLayer and its adjacent layers.
`protected double[]` | `medians(int unfixedLayer, int direction)` Computes the array of median columns for the nodes in the unfixedLayer based on the columns of predecessors (direction < 0), successors (direction > 0), or both predecessors and successors (direction == 0).
`protected boolean` | `medianStraighten(int unfixedLayer, int direction)` Adjusts the columns of nodes within the unfixedLayer in order to move nodes towards their median columns.
`protected void` | `naiveInitializeIndices()` Assigns every node in the input network an index number, such that nodes in the same layer will be labeled with consecutive indices in left to right order.
`protected JGoLayeredDigraphAutoLayoutNodeData` | `nodeData(JGoNetworkNode pNode)` Takes in a JGoNetworkNode and returns the node's JGoLayeredDigraphAutoLayoutNodeData.
`protected void` | `normalize()` Adjusts the columns of all nodes such that the leftmost column will be column 0 and maxColumn is updated appropriately.
`protected void` | `optimalLinkLengthLayering()` Assigns every node in the input network to a layer.
`protected void` | `optimalLinkLengthLayeringDepthFirstSearch(JGoNetworkNode pNode)` Peforms the depth first search of the network.
`protected void` | `optimalLinkLengthLayeringPull(JGoNetworkNode pNode)` Attempts to move pNode and it's tight component to a higher layer.
`protected void` | `optimalLinkLengthLayeringPush(JGoNetworkNode pNode)` Attempts to move pNode and it's tight component to a lower layer.
`protected void` | `pack()` Adjusts the columns of nodes in the network to produce a layout which is tightly packed.
`protected boolean` | `packAux(int column, int direction)` Attempts to remove the argument column by shifting columns into from the argument direction.
`void` | `performLayout()` Performs a layered-digraph auto-layout.
`protected void` | `printNetworkData()` Prints out the contents linkData and nodeData for all nodes and links in the network.
`protected void` | `reduceCrossings()` Reorders nodes within layers to reduce the total number of link crossings in the network.
`protected void` | `removeCycles()` Removes cycles from the input network by reversing some number of links.
`protected void` | `restoreLayout(int[] layout)` The function restoreLayout restores the layer, column, and index of all nodes from an array of integers.
`protected int[]` | `saveLayout()` The function saveLayout stores the layer, column, and index of all nodes in an array of integers.
`void` | `setAggressiveOption(int a)` Specify a new way to consider reducing crossings.
`void` | `setColumnSpacing(int s)` Specify a new value for the distance between columns.
`void` | `setCycleRemoveOption(int c)` Specify a new way of removing cycles from the original network.
`void` | `setDirectionOption(int d)` Specify a new direction for the layout orientation.
`void` | `setInitializeOption(int i)` Specify a new way of assigning indices and columns.
`void` | `setIterations(int i)` Specify the number of iterations to be used during cycle removal.
`void` | `setLayeringOption(int l)` Specify a new way of assigning layers to nodes.
`void` | `setLayerSpacing(int s)` Specify a new value for the distance between layers.
`void` | `setPackOption(int p)` Specify possible behaviors (and performance) of the straightenAndPack method.
`protected boolean` | `shiftBendStraighten(int unfixedLayer, int direction)` Adjusts the columns of nodes within the unfixedLayer to reduce the number of "bends" between the unfixedLayer and its adjacent layers.
`protected void` | `straightenAndPack()` Adjusts the columns of nodes in the network to produce a layout which reduces the number of bends and is tightly packed.
`protected void` | `tightComponent(JGoNetworkNode pNode, int component, boolean forw, boolean back)` Uses a depth first search algorithm to set the component of all nodes in a component.
`protected void` | `tightComponentUnset(JGoNetworkNode pNode, int component, int unset, boolean forw, boolean back)` Uses a depth first search algorithm to set the component of all nodes in a component.
`protected void` | `tightPack()` Adjusts the columns of nodes in the network to produce a layout which is tightly packed.
`protected boolean` | `tightPackAux(int column, int direction)` Attempts to augment the argument column by merging columns into from the argument direction.

Methods inherited from class com.nwoods.jgo.layout.JGoAutoLayout
`getDocument, getNetwork, progressUpdate, setDocument, setNetwork`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### LD_DIRECTION_UP

    public static final int LD_DIRECTION_UP

  The default direction option, create a JGoLayeredDigraphAutoLayout with LD_DIRECTION_UP if the digraph point in the up direction.

  See Also:
    Constant Field Values

### LD_DIRECTION_DOWN

    public static final int LD_DIRECTION_DOWN

  Create a JGoLayeredDigraphAutoLayout with LD_DIRECTION_DOWN if the digraph point in the down direction.

  See Also:
    Constant Field Values

### LD_DIRECTION_LEFT

    public static final int LD_DIRECTION_LEFT

  Create a JGoLayeredDigraphAutoLayout with LD_DIRECTION_LEFT if the digraph point in the left direction.

  See Also:
    Constant Field Values

### LD_DIRECTION_RIGHT

    public static final int LD_DIRECTION_RIGHT

  Create a JGoLayeredDigraphAutoLayout with LD_DIRECTION_RIGHT if the digraph point in the right direction.

  See Also:
    Constant Field Values

### LD_CYCLEREMOVE_GREEDY

    public static final int LD_CYCLEREMOVE_GREEDY

  Create a JGoLayeredDigraphAutoLayout with LD_CYCLEREMOVE_GREEDY to remove cycles using greedyCycleRemoval()

  See Also:
    `greedyCycleRemoval()`, Constant Field Values

### LD_CYCLEREMOVE_DFS

    public static final int LD_CYCLEREMOVE_DFS

  The default cycle removal option, create a JGoLayeredDigraphAutoLayout with LD_CYCLEREMOVE_DFS to remove cycles using depthFirstSearchCycleRemoval()

  See Also:
    `depthFirstSearchCycleRemoval()`, Constant Field Values

### LD_LAYERING_LONGESTPATHSINK

    public static final int LD_LAYERING_LONGESTPATHSINK

  Create a JGoLayeredDigraphAutoLayout with LD_LAYERING_LONGESTPATHSINK to layer using longestPathSinkLayering()

  See Also:
    `longestPathSinkLayering()`, Constant Field Values

### LD_LAYERING_LONGESTPATHSOURCE

    public static final int LD_LAYERING_LONGESTPATHSOURCE

  Create a JGoLayeredDigraphAutoLayout with LD_LAYERING_LONGESTPATHSOURCE to layer using longestPathSourceLayering()

  See Also:
    `longestPathSourceLayering()`, Constant Field Values

### LD_LAYERING_OPTIMALLINKLENGTH

    public static final int LD_LAYERING_OPTIMALLINKLENGTH

  The default layering option, create a JGoLayeredDigraphAutoLayout with LD_LAYERING_OPTIMALLINKLENGTH to layer using optimalLinkLengthLayering()

  See Also:
    `optimalLinkLengthLayering()`, Constant Field Values

### LD_INITIALIZE_NAIVE

    public static final int LD_INITIALIZE_NAIVE

  Create a JGoLayeredDigraphAutoLayout with LD_INITIALIZE_NAIVE to initialize using naiveInitializeIndices()

  See Also:
    `naiveInitializeIndices()`, Constant Field Values

### LD_INITIALIZE_DFSOUT

    public static final int LD_INITIALIZE_DFSOUT

  The default initialization option, create a JGoLayeredDigraphAutoLayout with LD_INITIALIZE_DFSOUT to initialize using depthFirstOutInitializeIndices()

  See Also:
    `depthFirstOutInitializeIndices()`, Constant Field Values

### LD_INITIALIZE_DFSIN

    public static final int LD_INITIALIZE_DFSIN

  Create a JGoLayeredDigraphAutoLayout with LD_INITIALIZE_DFSIN to initialize using depthFirstInInitializeIndices()

  See Also:
    `depthFirstInInitializeIndices()`, Constant Field Values

### LD_AGGRESSIVE_TRUE

    public static final int LD_AGGRESSIVE_TRUE

  Create a JGoLayeredDigraphAutoLayout with LD_AGGRESSIVE_TRUE to use the slower, more agressive crossing reduction algorithm.

  See Also:
    Constant Field Values

### LD_AGGRESSIVE_FALSE

    public static final int LD_AGGRESSIVE_FALSE

  The default crossing reduction option, create a JGoLayeredDigraphAutoLayout with LD_AGGRESSIVE_FALSE to use the faster, less agressive crossing reduction algorithm.

  See Also:
    Constant Field Values

### LD_PACK_EXPAND

    public static final int LD_PACK_EXPAND

  An option passed to setPackOption that may be bit-wise combined with other pack options.

  See Also:
    Constant Field Values

### LD_PACK_STRAIGHTEN

    public static final int LD_PACK_STRAIGHTEN

  An option passed to setPackOption that may be bit-wise combined with other pack options.

  See Also:
    Constant Field Values

### LD_PACK_MEDIAN

    public static final int LD_PACK_MEDIAN

  An option passed to setPackOption that may be bit-wise combined with other pack options.

  See Also:
    Constant Field Values

### LD_PACK_ALL

    public static final int LD_PACK_ALL

  An option passed to setPackOption that has all options selected.

  See Also:
    Constant Field Values

Constructor Detail

### JGoLayeredDigraphAutoLayout

    public JGoLayeredDigraphAutoLayout()

  Constructs a LayeredDigraphAutoLayout with null network and document. performLayout() will be a no-op until the network has been set.

  By default,

  - layerSpacing = 50
  - columnSpacing = 50
  - directionOption = LD_DIRECTION_UP
  - cycleremoveOption = LD_CYCLEREMOVE_DFS
  - layeringOption = LD_LAYERING_OPTIMALLINKLENGTH
  - initializeOption = LD_INITIALIZE_DFSOUT
  - iterations = 4
  - aggressiveOption = LD_AGGRESSIVE_FALSE
  - packOption = LD_PACK_EXPAND | LD_PACK_STRAIGHTEN | LD_PACK_MEDIAN;

### JGoLayeredDigraphAutoLayout

    public JGoLayeredDigraphAutoLayout(JGoDocument doc)

  Constructs a LayeredDigraphAutoLayout for the passed in document with default spacing and options.

Parameters:
  `doc` - the JGoDocument containing the JGoObjects to layout

### JGoLayeredDigraphAutoLayout

    public JGoLayeredDigraphAutoLayout(JGoDocument doc,
                                       JGoNetwork network)

  Constructs a LayeredDigraphAutoLayout for the passed in document, and network, with default spacing and options.

Parameters:
  `doc` - the JGoDocument containing the JGoObjects to layout
  `network` - the JGoNetwork representation of the JGoObjects to layout

### JGoLayeredDigraphAutoLayout

    public JGoLayeredDigraphAutoLayout(JGoDocument doc,
                                       int NlayerSpacing,
                                       int NcolumnSpacing,
                                       int NdirectionOption,
                                       int NcycleremoveOption,
                                       int NlayeringOption,
                                       int NinitializeOption,
                                       int Niterations,
                                       int NaggressiveOption)

  Constructs a LayeredDigraphAutoLayout for the passed in document with the spacing and options passed into the constructor.

  Use the zero, one or two argument constructor instead--it's easier to call.

Parameters:
  `doc` - the JGoDocument containing the JGoObjects to layout
  `NlayerSpacing` - the default number of logical units between layers; use getNodeMinLayerSpace to ensure extra space around large nodes
  `NcolumnSpacing` - the default number of logical units between columns; use getNodeMinColumnSpace to ensure extra space around large nodes
  `NdirectionOption` - the direction that directed links should point: LD_DIRECTION_UP, LD_DIRECTION_DOWN, LD_DIRECTION_LEFT, LD_DIRECTION_RIGHT
  `NcycleremoveOption` - the type of cycle removal to be used during layout: LD_CYCLEREMOVE_GREEDY, uses the GreedyCycleRemoval algorithm; LD_CYCLEREMOVE_DFS, uses the DepthFirstSearchCycleRemoval algorithm
  `NlayeringOption` - the type of layering to be used during layout: LD_LAYERING_LONGESTPATHSINK, uses the LongestPathSinkLayeringAlgorithm; LD_LAYERING_LONGESTPATHSOURCE, uses the LongestPathSourceLayering algorithm, LD_LAYERING_OPTIMALLINKLENGTH, uses the OptimalLinkLengthLayering algorithm
  `NinitializeOption` - the type of initialization of indices and columns to be used during layout: LD_INITIALIZE_NAIVE, uses the NaiveInitializeIndices algorithm; LD_INITIALIZE_DFSOUT, uses the DepthFirstOutInitializeIndices algorithm; LD_INITIALIZE_DFSIN, uses the DepthFirstInInitializeIndices algorithm
  `Niterations` - the number of iterations to be used during cycle removal
  `NaggressiveOption` - whether or not to use an aggressive (read time-consuming) crossing reduction step: LD_AGGRESSIVE_TRUE, uses the aggressive crossing reduction, LD_AGGRESSIVE_FALSE, does not use the aggressive crossing reduction

### JGoLayeredDigraphAutoLayout

    public JGoLayeredDigraphAutoLayout(JGoDocument doc,
                                       JGoNetwork network,
                                       int NlayerSpacing,
                                       int NcolumnSpacing,
                                       int NdirectionOption,
                                       int NcycleremoveOption,
                                       int NlayeringOption,
                                       int NinitializeOption,
                                       int Niterations,
                                       int NaggressiveOption)

  Constructs a LayeredDigraphAutoLayout for the passed in document, and network, with the spacing and options passed into the constructor.

  Use the zero, one or two argument constructor instead--it's easier to call.

Parameters:
  `doc` - the JGoDocument containing the JGoObjects to layout
  `network` - the JGoNetwork representation of the JGoObjects to layout
  `NlayerSpacing` - the default number of logical units between layers; use getNodeMinLayerSpace to ensure extra space around large nodes
  `NcolumnSpacing` - the default number of logical units between columns; use getNodeMinColumnSpace to ensure extra space around large nodes
  `NdirectionOption` - the direction that directed links should point: LD_DIRECTION_UP, LD_DIRECTION_DOWN, LD_DIRECTION_LEFT, LD_DIRECTION_RIGHT
  `NcycleremoveOption` - the type of cycle removal to be used during layout: LD_CYCLEREMOVE_GREEDY, uses the GreedyCycleRemoval algorithm; LD_CYCLEREMOVE_DFS, uses the DepthFirstSearchCycleRemoval algorithm
  `NlayeringOption` - the type of layering to be used during layout: LD_LAYERING_LONGESTPATHSINK, uses the LongestPathSinkLayeringAlgorithm; LD_LAYERING_LONGESTPATHSOURCE, uses the LongestPathSourceLayering algorithm, LD_LAYERING_OPTIMALLINKLENGTH, uses the OptimalLinkLengthLayering algorithm
  `NinitializeOption` - the type of initialization of indices and columns to be used during layout: LD_INITIALIZE_NAIVE, uses the NaiveInitializeIndices algorithm; LD_INITIALIZE_DFSOUT, uses the DepthFirstOutInitializeIndices algorithm; LD_INITIALIZE_DFSIN, uses the DepthFirstInInitializeIndices algorithm
  `Niterations` - the number of iterations to be used during cycle removal
  `NaggressiveOption` - whether or not to use an aggressive (read time-consuming) crossing reduction step: LD_AGGRESSIVE_TRUE, uses the aggressive crossing reduction, LD_AGGRESSIVE_FALSE, does not use the aggressive crossing reduction

### JGoLayeredDigraphAutoLayout

    public JGoLayeredDigraphAutoLayout(JGoLayeredDigraphAutoLayout layout)

  Make a copy of a JGoLayeredDigraphAutoLayout, copying most of the important properties except for the JGoNetwork.

Method Detail

### performLayout

    public void performLayout()

  Performs a layered-digraph auto-layout. This method can be overridden to customize the layout algorithm, but care should be taken to ensure that each node and link in the input network are properly initialized and terminated.

  Specified by:
    `performLayout` in class `JGoAutoLayout`

### getLinkMinLength

    protected int getLinkMinLength(JGoNetworkLink pLink)

  The function getLinkMinLength returns the minimum length of the link represented by the JGoNetworkLink pLink. The default implementation gives multi-links a minimum length of 2, and all other links a minimum length of 1. This function can be overridden to provide "fine-tuning" of the layout.

### getLinkLengthWeight

    protected double getLinkLengthWeight(JGoNetworkLink pLink)

  The function getLinkLengthWeight returns the weight of the link represented by the JGoNetworkLink pLink. This weight is used by optimalLinkLengthLayering to minimize weighted link lengths. The default implementation gives all links a length weight of 1.0. This function can be overridden to provide "fine-tuning" of the layout.

### getLinkStraightenWeight

    protected double getLinkStraightenWeight(JGoNetworkLink pLink)

  The function getLinkStraightenWeight returns the weight of the link represented by the JGoNetworkLink pLink. This weight is used by the straightening methods to give priority straightening to those links with higher weights. The default implementation gives links between two "real" nodes a weight of 1.0, links between a "real" node and an "artifical" node a weight of 4.0, and links between two "artificial" nodes a weight of 8.0. This function can be overridden to provide "fine-tuning" of the layout.

### getNodeMinLayerSpace

    protected int getNodeMinLayerSpace(JGoNetworkNode pNode)

  The function getNodeMinLayerSpace returns the minimum space reserved above and below this node. The default implementation returns 0 for nodes that do not correspond to top-level JGo objects. For nodes that do correspond to top-level JGo objects, the layer space is determined by the width and height of the object. Note: all sub-classes that override this method should ensure that nodes that do not correspond to top-level JGo objects have a minimum layer space of 0.

### getNodeMinColumnSpace

    protected int getNodeMinColumnSpace(JGoNetworkNode pNode)

  The function getNodeMinColumnSpace returns the minimum space reserved to either side of this node. The default implementation returns 0 for nodes that do not correspond to top-level JGo objects. For nodes that do correspond to top-level JGo objects, the column space is determined by the width and height of the object. Note: all sub-classes that override this method should ensure that nodes that do not correspond to top-level JGo objects have a minimum column space of 0. This function can be overridden to provide "fine-tuning" of the layout.

### saveLayout

    protected int[] saveLayout()

  The function saveLayout stores the layer, column, and index of all nodes in an array of integers.

  See Also:
    `restoreLayout(int[])`, `equalLayout(int[], int[])`

### restoreLayout

    protected void restoreLayout(int[] layout)

  The function restoreLayout restores the layer, column, and index of all nodes from an array of integers.

  See Also:
    `saveLayout()`, `equalLayout(int[], int[])`

### equalLayout

    protected boolean equalLayout(int[] layoutA,
                                  int[] layoutB)

  The function equalLayout compares two layouts and determines if they are equal.

  See Also:
    `saveLayout()`, `restoreLayout(int[])`

### crossingMatrix

    protected int[] crossingMatrix(int unfixedLayer,
                                   int direction)

  Computes the crossing matrix between the unfixedLayer and its adjacent layers. The direction argument indicates which adjacent layers should be taken into consideration when computing the crossing matrix:

  direction == 0 -- use unfixedLayer - 1 and unfixedLayer + 1
  direction > 0 -- use unfixedLayer - 1 (sweeping away from layer 0)
  direction < 0 -- use unfixedLayer + 1 (sweeping towards layer 0)

  The resulting integer array can be used as follows: if index1 and index2 are the indices corresponding to two nodes on the unfixedLayer and crossmat is the crossing matrix, then crossmat[index1 * indices[unfixedLayer] + index2] is the number of crossing that occur if the node corresponding to index1 is placed to the left of the node corresponding to index2. If index1 == index2, then crossmat[index1 * indices[unfixedLayer] + index2] is the number of crossings between links to and from the node corresponding to index1.

### countCrossings

    protected int countCrossings()

  Returns the total number of crossings in the network. Internal method used by reduceCrossings().

  See Also:
    `reduceCrossings()`

### bends

    protected double bends(int unfixedLayer,
                           int direction,
                           boolean weighted)

  Computes the bends between the unfixedLayer and its adjacent layers. The "bend" between a node U and a node V connected by a link L is calcluated by
  abs((U.column + L.portFromColOffset) - (V.column + L.portToColOffset)).
  The "weighted bend" between a node U and a node V connected by link L is calculated by
  abs((U.column + L.portFromColOffset) - (V.column + L.portToColOffset)) * getLinkStraightenWeight(L).
  The getLinkStraightenWeight attempts to give higher priority to links between "artificial" nodes; i.e., long links in the final layout will be straighter. The direction argument indicates which adjacent layers should be taken into consideration when computing the crossing matrix:

  direction == 0 -- use unfixedLayer - 1 and unfixedLayer + 1
  direction > 0 -- use unfixedLayer - 1 (sweeping away from layer 0)
  direction < 0 -- use unfixedLayer + 1 (sweepeing towards layer 0)

### countBends

    protected double countBends(boolean weighted)

  Returns the total number of bends in the network. The "bend" between a node U and a node V connected by a link L is calcluated by
  abs((U.column + L.portFromColOffset) - (V.column + L.portToColOffset)).
  The "weighted bend" between a node U and a node V connected by link L is calculated by
  abs((U.column + L.portFromColOffset) - (V.column + L.portToColOffset)) * getLinkStraightenWeight(L).
  The getLinkStraightenWeight attempts to give higher priority to links between "artificial" nodes; i.e., long links in the final layout will be straighter.

### normalize

    protected void normalize()

  Adjusts the columns of all nodes such that the leftmost column will be column 0 and maxColumn is updated appropriately.

### barycenters

    protected double[] barycenters(int unfixedLayer,
                                   int direction)

  Computes the array of barycenters (average) columns for the nodes in the unfixedLayer based on the columns of predecessors (direction < 0), successors (direction > 0), or both predecessors and successors (direction == 0). Elements without a defined barycenter will have an entry of -1.0.

### medians

    protected double[] medians(int unfixedLayer,
                               int direction)

  Computes the array of median columns for the nodes in the unfixedLayer based on the columns of predecessors (direction < 0), successors (direction > 0), or both predecessors and successors (direction == 0). Elements without a defined median will have an entry of -1.0.

### tightComponent

    protected void tightComponent(JGoNetworkNode pNode,
                                  int component,
                                  boolean forw,
                                  boolean back)

  Uses a depth first search algorithm to set the component of all nodes in a component. The forw and back booleans indicate the direction to use for a directed depth first search from pNode.
  **Unset** functions only set the component and recurse on nodes whose component is currently set to the unset value.
  Tight** functions only set the component and recurse on nodes which are "tight", in the sense that the nodes are separated by a link which corresponds to the minumum link length of the link between the two nodes.

### tightComponentUnset

    protected void tightComponentUnset(JGoNetworkNode pNode,
                                       int component,
                                       int unset,
                                       boolean forw,
                                       boolean back)

  Uses a depth first search algorithm to set the component of all nodes in a component.

  Tight** functions only set the component and recurse on nodes which are "tight", in the sense that the nodes are separated by a link which corresponds to the minumum link length of the link between the two nodes.
  **Unset functions only set the component and recurse on nodes whose component is currently set to the unset value. The forw and back booleans indicate the direction to use for a directed depth first search from pNode.

### component

    protected void component(JGoNetworkNode pNode,
                             int component,
                             boolean forw,
                             boolean back)

  Uses a depth first search algorithm to set the component of all nodes in a component. The forw and back booleans indicate the direction to use for a directed depth first search from pNode.

### componentUnset

    protected void componentUnset(JGoNetworkNode pNode,
                                  int component,
                                  int unset,
                                  boolean forw,
                                  boolean back)

  Uses a depth first search algorithm to set the component of all nodes in a component.
  **Unset functions only set the component and recurse on nodes whose component is currently set to the unset value. The forw and back booleans indicate the direction to use for a directed depth first search from pNode.

### removeCycles

    protected void removeCycles()

  Removes cycles from the input network by reversing some number of links. This method can be overridden to customize the layout algorithm, but care should be taken to ensure proper initialization and termination.

### greedyCycleRemoval

    protected void greedyCycleRemoval()

  Removes cycles from the input network using a Greedy-Cycle-Removal algorithm. The idea is to induce an order on all nodes in the network (U1, U2, U3, ..., Uk) such that for the majority of links L = (Ui, Uj) it is true that i < j. All links L = (Ui, Uj) such that i > j are reversed.

### greedyCycleRemovalFindNode

    protected JGoNetworkNode greedyCycleRemovalFindNode(JGoNetwork pGoNetwork)

  Finds a valid node in the network. Returns null if no valid node exists. Used by greedyCycleRemoval.

### greedyCycleRemovalFindSink

    protected JGoNetworkNode greedyCycleRemovalFindSink(JGoNetwork pGoNetwork)

  Finds a sink node in the network. A node is considered a sink node if it is valid and all of its predecessors are invalid. A valid node with no predecessors is vacously a sink. Returns null if no valid sink node exists. Used by greedyCycleRemoval.

### greedyCycleRemovalFindSource

    protected JGoNetworkNode greedyCycleRemovalFindSource(JGoNetwork pGoNetwork)

  Finds a source node in the network. A node is considered a sink node if it is valid and all of its successors are invalid. A valid node with no successors is vacously a source. Returns null if no valid source node exists. Used by greedyCycleRemoval.

### greedyCycleRemovalFindNodeMaxDegDiff

    protected JGoNetworkNode greedyCycleRemovalFindNodeMaxDegDiff(JGoNetwork pGoNetwork)

  Finds a valid node in the network that maximizes outdeg - indeg. The degree difference is computed using valid successors and predecessors. Returns null if no valid node exists. Used by greedyCycleRemoval.

### depthFirstSearchCycleRemoval

    protected void depthFirstSearchCycleRemoval()

  Removes cycles from the input network using a depth first search. A link not in the depth first forest is reversed if the from-node was discovered and finished by the depth first search after the to-node was discovered but before the to-node was finished.

### depthFirstSearchCycleRemovalVisit

    protected void depthFirstSearchCycleRemovalVisit(JGoNetworkNode pNode)

  Peforms the recursive step of the depth first search on pNode. Updates the discover and finish time of pNode. Updates the forest flag of followed links.

### assignLayers

    protected void assignLayers()

  Assigns every node in the input network to a layer. The layering satisfies the following: if L is a link from node U to node V, then U.layer > V.layer; further, U.layer - V.layer >= getLinkMinLength(L). This method can be overridden to customize the layout algorithm, but care should be taken to ensure proper initialization and termination.

### longestPathSinkLayering

    protected void longestPathSinkLayering()

  Assigns every node in the input network to a layer. In addition to the requirements described in assignLayers(), longestPathSinkLayering ensures that every sink appears in layer 0 and every node is as close to a sink as possible.

### longestPathSinkLayeringLength

    protected int longestPathSinkLayeringLength(JGoNetworkNode pNode)

  Computes the length of the longest path from pNode to a sink node and sets the layer of pNode to that length. Returns the length of the longest path from pNode to a sink node.

### longestPathSourceLayering

    protected void longestPathSourceLayering()

  Assigns every node in the input network to a layer. In addition to the requirements described in assignLayers(), longestPathSourceLayering ensures that every source appears in layer maxLayer and every node is as close to a source as possible.

### longestPathSourceLayeringLength

    protected int longestPathSourceLayeringLength(JGoNetworkNode pNode)

  Computes the length of the longest path from pNode to a source node and sets the layer of pNode to that length. Returns the length of the longest path from pNode to a source node.

### optimalLinkLengthLayering

    protected void optimalLinkLengthLayering()

  Assigns every node in the input network to a layer. In addition to the requirements described in assignLayers(), optimalLinkLengthLayering ensures that nodes are set in layers to minimize the total weighted link length. Hence, optimalLinkLengthLayering minimizes the sum (U.layer - V.layer) * getLinkLengthWeight(L) over all links L = (U,V).

  See Also:
    `getLinkMinLength(com.nwoods.jgo.layout.JGoNetworkLink)`, `getLinkLengthWeight(com.nwoods.jgo.layout.JGoNetworkLink)`

### optimalLinkLengthLayeringDepthFirstSearch

    protected void optimalLinkLengthLayeringDepthFirstSearch(JGoNetworkNode pNode)

  Peforms the depth first search of the network. After traversing all decendents, the pNode is "pull"-ed into the appropriate layer.

  See Also:
    `optimalLinkLengthLayeringPull(com.nwoods.jgo.layout.JGoNetworkNode)`

### optimalLinkLengthLayeringPull

    protected void optimalLinkLengthLayeringPull(JGoNetworkNode pNode)

  Attempts to move pNode and it's tight component to a higher layer.

### optimalLinkLengthLayeringPush

    protected void optimalLinkLengthLayeringPush(JGoNetworkNode pNode)

  Attempts to move pNode and it's tight component to a lower layer.

### makeProper

    protected void makeProper()

  Converts the input network into a proper digraph; i.e., artificial nodes and links are introduced into the network such that ever link is between nodes in adjacent layers. This has the effect of breaking up long links into a sequence of artificial nodes. This method can be overridden to customize the layout algorithm, but care should be taken to ensure proper initialization and termination.

### initializeIndices

    protected void initializeIndices()

  Assigns every node in the input network an index number, such that nodes in the same layer will be labeled with consecutive indices in left to right order. All consecutive layout operations will preserve or update the indices. In addition, the indices array is initialized such that indices[layer] indicates the number of nodes in the layer. Finally, the variables minIndexLayer and maxIndexLayer record the layers that correspond to the minimum and maximum nodes in a layer.

### naiveInitializeIndices

    protected void naiveInitializeIndices()

  Assigns every node in the input network an index number, such that nodes in the same layer will be labeled with consecutive indices in left to right order. Uses a naive implementation that assigns indices to nodes as they are encountered in a sweep of the network. Because of the way networks are stored, this has the effect of initialy placing all "artificial" nodes to the right of all "real" nodes.

### depthFirstOutInitializeIndices

    protected void depthFirstOutInitializeIndices()

  Assigns every node in the input network an index number, such that nodes in the same layer will be labeled with consecutive indices in left to right order. Uses a depth first "outward" (i.e., following links from "from-node" to "to-node") traversal of the network, assigning indices to nodes as they are discovered.

### depthFirstOutInitializeIndicesVisit

    protected void depthFirstOutInitializeIndicesVisit(JGoNetworkNode pNode)

  Assigns pNode the appropriate index and updates the indices array. Implements the recursive portion of a depth first search.

### depthFirstInInitializeIndices

    protected void depthFirstInInitializeIndices()

  Assigns every node in the input network an index number, such that nodes in the same layer will be labeled with consecutive indices in left to right order. Uses a depth first "inward" (i.e., following links from "to-node" to "from-node") traversal of the network, assigning indices to nodes as they are discovered.

### depthFirstInInitializeIndicesVisit

    protected void depthFirstInInitializeIndicesVisit(JGoNetworkNode pNode)

  Assigns pNode the appropriate index and updates the indices array. Implements the recursive portion of a depth first search.

### initializeColumns

    protected void initializeColumns()

  Assigns every node in the input network a column number, such that nodes in the same layer will be labeled with increasing indices in left to right order. In addition, a node U is assigned to a column such that 2 * minColumnSpace(U) + 1 columns are "allocated" to node U, and no two nodes have overlapping "allocations" of columns. All consecutive layout operations will preserve or update the columns. This method can be overridden to customize the layout algorithm, but care should be taken to ensure proper initialization and termination.

### reduceCrossings

    protected void reduceCrossings()

  Reorders nodes within layers to reduce the total number of link crossings in the network. There are many, many possible implementations of this function. Basically, some iteration of medianBarycenterCrossingReduction and adjacentExchangeCrossingReductionBendStraighten sweeping back and forth over the layers is needed. The default implementation has performed favorably on a large number of networks, but other options are available. This method can be overridden to customize the layout algorithm, but care should be taken to ensure proper initialization and termination.

### medianBarycenterCrossingReduction

    protected boolean medianBarycenterCrossingReduction(int unfixedLayer,
                                                        int direction)

  Reorders nodes within the unfixedLayer to reduce the number of link crossings between the unfixedLayer and its adjacent layers. The direction argument indicates which of the adjacent layers should be taken into consideration when reducing the number of crossings.

  direction == 0 -- use unfixedLayer - 1 and unfixedLayer + 1
  direction > 0 -- use unfixedLayer - 1 (sweeping away from layer 0)
  direction < 0 -- use unfixedLayer + 1 (sweepeing towards layer 0)

  The idea is to calculate the median and barycenter for each node in the unfixedLayer, and to sort the nodes in the unfixedLayer by their median and barycenter values. Returns true if some change was made to the layer.

### adjacentExchangeCrossingReductionBendStraighten

    protected boolean adjacentExchangeCrossingReductionBendStraighten(int unfixedLayer,
                                                                      int directionCR,
                                                                      boolean straighten,
                                                                      int directionBS)

  Adjusts the columns of nodes within the unfixedLayer to simultaneously reduce the number of link crossings and the number of "bends" between the unfixedLayer and its adjacent layers between the unfixedLayer and its adjacent layers. The directionCR argument indicates which of the adjacent layers should be taken into consideration when reducing the number of link crossings.

  direction == 0 -- use unfixedLayer - 1 and unfixedLayer + 1
  direction > 0 -- use unfixedLayer - 1 (sweeping away from layer 0)
  direction < 0 -- use unfixedLayer + 1 (sweepeing towards layer 0)

  The directionBS argument indicates which of the adjacent layers should be taken into consideration when reducing the number of bends.

  direction == 0 -- use unfixedLayer - 1 and unfixedLayer + 1
  direction > 0 -- use unfixedLayer - 1 (sweeping away from layer 0)
  direction < 0 -- use unfixedLayer + 1 (sweepeing towards layer 0)

  The "weighted bend" between a node U and a node V connected by link L is calculated by
  abs((U.column + L.portFromColOffset) - (V.column + L.portToColOffset)) * getLinkStraightenWeight(L).
  The getLinkStraightenWeight attempts to give higher priority to links between "artificial" nodes; i.e., long links in the final layout will be straighter. The idea is to use a bubble-sort technique to exchange adjacent nodes whenever doing so reduces the number of link crossings or the number of bends. This function is used in both crossing reduction and bend straightening. Returns true if some change was made to the layer.

  Parameters:
    `unfixedLayer` - the layer to be reordered
    `directionCR` - indicates which adjacent layers should be taken into consideration when calculating the crossing matrix
    `straighten` - indicates whether or not to reorder to nodes to straighten links
    `directionBS` - indicates which adjacent layers should be taken into consideration when calculating the bends of a link

### straightenAndPack

    protected void straightenAndPack()

  Adjusts the columns of nodes in the network to produce a layout which reduces the number of bends and is tightly packed. This method can be overridden to customize the layout algorithm. The behavior and performance of this routine can be controlled by calling setPackOption().

### bendStraighten

    protected boolean bendStraighten(int unfixedLayer,
                                     int direction)

  Adjusts the columns of nodes within the unfixedLayer to reduce the number of "bends" between the unfixedLayer and its adjacent layers. The direction argument indicates which of the adjacent layers should be taken into consideration when reducing the number of bends. The "weighted bend" between a node U and a node V connected by link L is calculated by
  abs((U.column + L.portFromColOffset) - (V.column + L.portToColOffset)) * getLinkStraightenWeight(L).
  The getLinkStraightenWeight attempts to give higher priority to links between "artificial" nodes; i.e., long links in the final layout will be straighter. The idea is to iterate the shiftBendStraighten and adjacentExchangeBendStraighten methods until no improvements are made.

### shiftBendStraighten

    protected boolean shiftBendStraighten(int unfixedLayer,
                                          int direction)

  Adjusts the columns of nodes within the unfixedLayer to reduce the number of "bends" between the unfixedLayer and its adjacent layers. The direction argument indicates which of the adjacent layers should be taken into consideration when reducing the number of bends. The "weighted bend" between a node U and a node V connected by link L is calculated by
  abs((U.column + L.portFromColOffset) - (V.column + L.portToColOffset)) * getLinkStraightenWeight(L).
  The getLinkStraightenWeight attempts to give higher priority to links between "artificial" nodes; i.e., long links in the final layout will be straighter. The idea is shift nodes to the left and to the right to reduce the bends ensuring that no two nodes have overlapping "allocations" of columns. Return true if some change was made to the layer.

### medianStraighten

    protected boolean medianStraighten(int unfixedLayer,
                                       int direction)

  Adjusts the columns of nodes within the unfixedLayer in order to move nodes towards their median columns. The direction argument indicates which of the adjacent layers should be taken into consideration when computing the median column. The idea is shift nodes to the left and to the right to move nodes towards their median columns, ensuring that no two nodes have overlapping "allocations" of columns. Returns true if some change was made to the layer.

### pack

    protected void pack()

  Adjusts the columns of nodes in the network to produce a layout which is tightly packed. The idea is that columns which are "un-allocated" through all layers can be eliminated and the nodes can be shifted into that space.

### packAux

    protected boolean packAux(int column,
                              int direction)

  Attempts to remove the argument column by shifting columns into from the argument direction. direction > 0 -- columns > argument column are shifted direction < 0 -- columns < argument column are shifted Returns true if the argument column was removed.

### tightPack

    protected void tightPack()

  Adjusts the columns of nodes in the network to produce a layout which is tightly packed. The idea is that two adjacent columns can be "merged" if each layer has at most one of the two columns "allocated" to a node.

### tightPackAux

    protected boolean tightPackAux(int column,
                                   int direction)

  Attempts to augment the argument column by merging columns into from the argument direction.

  direction > 0 -- columns > the argument column are shifted
  direction < 0 -- columns < the argument column are shifted

  Returns true if the argument column was changed.

### componentPack

    protected void componentPack(int direction)

  Adjusts the columns of nodes in the network to produce a layout which is tightly packed. The idea is that the network can be fragmented from a given column in the following way: all nodes "behind" the column are placed into a single component, and the remainder of the network is divided into connected components. Each of these new components can be examined, and those that can be merged with the given column do so.

### componentPackAux

    protected boolean componentPackAux(int column,
                                       int direction)

  Attempts to augment the argument column by merging components into from the argument direction.

  direction > 0 -- columns > the argument column are shifted
  direction < 0 -- columns < the argument column are shifted

  Returns true if the argument column was changed.

### layoutNodesAndLinks

    protected void layoutNodesAndLinks()

  Updates the physical location of "real" nodes and links to reflect the layout. This method can be overridden to customize the layout algorithm, but care should be taken to ensure proper initialization and termination. One reason to override this method would be to take advantage of added functionality of sub-classes of JGoLink, for example, a sub-class that tracked bend points and allowed them to be repositioned by the application.

  See Also:
    `layoutNodes()`, `layoutLinks()`

### layoutNodes

    protected void layoutNodes()

  Lays out the nodes. Called by layoutNodesAndLinks(). Made into a seperate function so that it can be overridden.

  See Also:
    `layoutNodesAndLinks()`, `layoutLinks()`

### layoutLinks

    protected void layoutLinks()

  Lays out the links. Called by layoutNodesAndLinks(). Made into a seperate function so that it can be overridden.

  See Also:
    `layoutNodesAndLinks()`, `layoutNodes()`

### nodeData

    protected JGoLayeredDigraphAutoLayoutNodeData nodeData(JGoNetworkNode pNode)

  Takes in a JGoNetworkNode and returns the node's JGoLayeredDigraphAutoLayoutNodeData.

### linkData

    protected JGoLayeredDigraphAutoLayoutLinkData linkData(JGoNetworkLink pLink)

  Takes in a JGoNetworkLink and returns the link's JGoLayeredDigraphAutoLayoutLinkData.

### printNetworkData

    protected void printNetworkData()

  Prints out the contents linkData and nodeData for all nodes and links in the network. Used as a debuging tool. Appends the results to javaout.txt. To ensure that the data in javaout.txt is only from the most recent execution of the layout algorithm, uncomment the code which sets javaout.txt's size to zero. This code can be found in performLayout().

### getLayerSpacing

    public int getLayerSpacing()

  Accessor to private variable layerSpacing. layerSpacing is the default number of logical units between layers. Use getNodeMinLayerSpace to ensure extra space around large nodes.

### setLayerSpacing

    public void setLayerSpacing(int s)

  Specify a new value for the distance between layers.

  Parameters:
    `s` - the new distance, must be positive.

### getColumnSpacing

    public int getColumnSpacing()

  Accessor to private variable columnSpacing. columnSpacing is the default number of logical units between columns. use getNodeMinColumnSpace to ensure extra space around large nodes.

### setColumnSpacing

    public void setColumnSpacing(int s)

  Specify a new value for the distance between columns.

  Parameters:
    `s` - the new distance, must be positive.

### getDirectionOption

    public int getDirectionOption()

  Accessor to private variable directionOption. directionOption represents the direction that directed links should point. It should be set to one of the following values: LD_DIRECTION_UP, LD_DIRECTION_DOWN, LD_DIRECTION_LEFT, LD_DIRECTION_RIGHT.

### setDirectionOption

    public void setDirectionOption(int d)

  Specify a new direction for the layout orientation.

  Parameters:
    `d` - one of LD_DIRECTION_UP, LD_DIRECTION_DOWN, LD_DIRECTION_LEFT, LD_DIRECTION_RIGHT

### getCycleRemoveOption

    public int getCycleRemoveOption()

  Accessor to private variable cycleremoveOption. cycleremoveOptions represents the type of cycle removal to be used during layout. It should be set to one of the following values: LD_CYCLEREMOVE_GREEDY, which uses the greedyCycleRemoval algorithm, or LD_CYCLEREMOVE_DFS, shich uses the depthFirstSearchCycleRemoval algorithm.

### setCycleRemoveOption

    public void setCycleRemoveOption(int c)

  Specify a new way of removing cycles from the original network.

  Parameters:
    `c` - one of LD_CYCLEREMOVE_GREEDY or LD_CYCLEREMOVE_DFS

### getLayeringOption

    public int getLayeringOption()

  Accessor to private variable layeringOption. layeringOption represents the type of layering to be used during layout. It should be set to one of the following values: LD_LAYERING_LONGESTPATHSINK, which uses the longestPathSinkLayeringAlgorithm, LD_LAYERING_LONGESTPATHSOURCE, which uses the longestPathSourceLayering algorithm, or LD_LAYERING_OPTIMALLINKLENGTH, which uses the optimalLinkLengthLayering algorithm.

### setLayeringOption

    public void setLayeringOption(int l)

  Specify a new way of assigning layers to nodes.

  Parameters:
    `l` - one of LD_LAYERING_LONGESTPATHSINK, LD_LAYERING_LONGESTPATHSOURCE, LD_LAYERING_OPTIMALLINKLENGTH

### getInitializeOption

    public int getInitializeOption()

  Accessor to private variable initializeOption. initializeOption represents the type of initialization of indices and columns to be used during layout. It should be set to one of the following values: LD_INITIALIZE_NAIVE, which uses the naiveInitializeIndices algorithm, LD_INITIALIZE_DFSOUT, which uses the depthFirstOutInitializeIndices algorithm, or LD_INITIALIZE_DFSIN, which uses the depthFirstInInitializeIndices algorithm.

### setInitializeOption

    public void setInitializeOption(int i)

  Specify a new way of assigning indices and columns.

  Parameters:
    `i` - one of LD_INITIALIZE_NAIVE, LD_INITIALIZE_DFSOUT, LD_INITIALIZE_DFSIN

### getIterations

    public int getIterations()

  Accessor to private variable iterations. iterations represents the number of iterations to be used during cycle removal.

### setIterations

    public void setIterations(int i)

  Specify the number of iterations to be used during cycle removal.

### getAggressiveOption

    public int getAggressiveOption()

  Accessor to private variable aggressiveOption. aggressiveOption represents whether or not to use an aggressive (read time-consuming) crossing reduction step. It should be set to one of the following values: LD_AGGRESSIVE_TRUE, which uses the aggressive crossing reduction, or LD_AGGRESSIVE_FALSE, does not use the aggressive crossing reduction.

### setAggressiveOption

    public void setAggressiveOption(int a)

  Specify a new way to consider reducing crossings.

  Parameters:
    `a` - one of LD_AGGRESSIVE_TRUE or LD_AGGRESSIVE_FALSE

### getPackOption

    public int getPackOption()

  The options used by the standard implementation of the straightenAndPack method. By default this is (LD_PACK_EXPAND | LD_PACK_STRAIGHTEN | LD_PACK_MEDIAN).

### setPackOption

    public void setPackOption(int p)

  Specify possible behaviors (and performance) of the straightenAndPack method. The best results (and also the slowest) usually come when turning on all of the options: setPackOption(LD_PACK_EXPAND | LD_PACK_STRAIGHTEN | LD_PACK_MEDIAN).

  Parameters:
    `p` - a bitwise combination of LD_PACK_EXPAND | LD_PACK_STRAIGHTEN | LD_PACK_MEDIAN

### getMaxLayer

    public int getMaxLayer()

  Accessor to private variable maxLayer. After layering is finished, all nodes U's layer field will be <= maxLayer, with equality in at least one case.

### getMaxIndex

    public int getMaxIndex()

  Accessor to private variable maxIndex. After initializing indices, all nodes U's index field will be <= maxIndex, with equality in at least one case.

### getMaxColumn

    public int getMaxColumn()

  Accessor to private variable maxColumn. After initializing columns, all nodes U's column field will be <= maxColumn, with equality in at least one case.

### getMinIndexLayer

    public int getMinIndexLayer()

  Accessor to private variable minIndexLayer. After initializing indices, minIndexLayer indicates the layer whcih has a minimal number of nodes.

### getMaxIndexLayer

    public int getMaxIndexLayer()

  Accessor to private variable maxIndexLayer. After initializing indices, maxIndexLayer indicates the layer which has a maximal number of nodes.

### getIndices

    public int[] getIndices()

  Accessor to private variable indices. After initializing indices, indices[layer] indicates the number of nodes in the layer.

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD