|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.nwoods.jgo.layout.JGoAutoLayout
com.nwoods.jgo.layout.JGoLayeredDigraphAutoLayout
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 |
public static final int LD_DIRECTION_UP
public static final int LD_DIRECTION_DOWN
public static final int LD_DIRECTION_LEFT
public static final int LD_DIRECTION_RIGHT
public static final int LD_CYCLEREMOVE_GREEDY
greedyCycleRemoval()
,
Constant Field Valuespublic static final int LD_CYCLEREMOVE_DFS
depthFirstSearchCycleRemoval()
,
Constant Field Valuespublic static final int LD_LAYERING_LONGESTPATHSINK
longestPathSinkLayering()
,
Constant Field Valuespublic static final int LD_LAYERING_LONGESTPATHSOURCE
longestPathSourceLayering()
,
Constant Field Valuespublic static final int LD_LAYERING_OPTIMALLINKLENGTH
optimalLinkLengthLayering()
,
Constant Field Valuespublic static final int LD_INITIALIZE_NAIVE
naiveInitializeIndices()
,
Constant Field Valuespublic static final int LD_INITIALIZE_DFSOUT
depthFirstOutInitializeIndices()
,
Constant Field Valuespublic static final int LD_INITIALIZE_DFSIN
depthFirstInInitializeIndices()
,
Constant Field Valuespublic static final int LD_AGGRESSIVE_TRUE
public static final int LD_AGGRESSIVE_FALSE
public static final int LD_PACK_EXPAND
public static final int LD_PACK_STRAIGHTEN
public static final int LD_PACK_MEDIAN
public static final int LD_PACK_ALL
Constructor Detail |
public JGoLayeredDigraphAutoLayout()
By default,
public JGoLayeredDigraphAutoLayout(JGoDocument doc)
doc
- the JGoDocument containing the JGoObjects to layoutpublic JGoLayeredDigraphAutoLayout(JGoDocument doc, JGoNetwork network)
doc
- the JGoDocument containing the JGoObjects to layoutnetwork
- the JGoNetwork representation of the JGoObjects to layoutpublic JGoLayeredDigraphAutoLayout(JGoDocument doc, int NlayerSpacing, int NcolumnSpacing, int NdirectionOption, int NcycleremoveOption, int NlayeringOption, int NinitializeOption, int Niterations, int NaggressiveOption)
Use the zero, one or two argument constructor instead--it's easier to call.
doc
- the JGoDocument containing the JGoObjects to layoutNlayerSpacing
- the default number of logical units between layers; use getNodeMinLayerSpace to ensure extra space around large nodesNcolumnSpacing
- the default number of logical units between columns; use getNodeMinColumnSpace to ensure extra space around large nodesNdirectionOption
- the direction that directed links should point: LD_DIRECTION_UP, LD_DIRECTION_DOWN, LD_DIRECTION_LEFT, LD_DIRECTION_RIGHTNcycleremoveOption
- the type of cycle removal to be used during layout: LD_CYCLEREMOVE_GREEDY, uses the GreedyCycleRemoval algorithm; LD_CYCLEREMOVE_DFS, uses the DepthFirstSearchCycleRemoval algorithmNlayeringOption
- 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 algorithmNinitializeOption
- 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 algorithmNiterations
- the number of iterations to be used during cycle removalNaggressiveOption
- 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 reductionpublic JGoLayeredDigraphAutoLayout(JGoDocument doc, JGoNetwork network, int NlayerSpacing, int NcolumnSpacing, int NdirectionOption, int NcycleremoveOption, int NlayeringOption, int NinitializeOption, int Niterations, int NaggressiveOption)
Use the zero, one or two argument constructor instead--it's easier to call.
doc
- the JGoDocument containing the JGoObjects to layoutnetwork
- the JGoNetwork representation of the JGoObjects to layoutNlayerSpacing
- the default number of logical units between layers; use getNodeMinLayerSpace to ensure extra space around large nodesNcolumnSpacing
- the default number of logical units between columns; use getNodeMinColumnSpace to ensure extra space around large nodesNdirectionOption
- the direction that directed links should point: LD_DIRECTION_UP, LD_DIRECTION_DOWN, LD_DIRECTION_LEFT, LD_DIRECTION_RIGHTNcycleremoveOption
- the type of cycle removal to be used during layout: LD_CYCLEREMOVE_GREEDY, uses the GreedyCycleRemoval algorithm; LD_CYCLEREMOVE_DFS, uses the DepthFirstSearchCycleRemoval algorithmNlayeringOption
- 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 algorithmNinitializeOption
- 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 algorithmNiterations
- the number of iterations to be used during cycle removalNaggressiveOption
- 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 reductionpublic JGoLayeredDigraphAutoLayout(JGoLayeredDigraphAutoLayout layout)
Method Detail |
public void performLayout()
performLayout
in class JGoAutoLayout
protected int getLinkMinLength(JGoNetworkLink pLink)
protected double getLinkLengthWeight(JGoNetworkLink pLink)
protected double getLinkStraightenWeight(JGoNetworkLink pLink)
protected int getNodeMinLayerSpace(JGoNetworkNode pNode)
protected int getNodeMinColumnSpace(JGoNetworkNode pNode)
protected int[] saveLayout()
restoreLayout(int[])
,
equalLayout(int[], int[])
protected void restoreLayout(int[] layout)
saveLayout()
,
equalLayout(int[], int[])
protected boolean equalLayout(int[] layoutA, int[] layoutB)
saveLayout()
,
restoreLayout(int[])
protected int[] crossingMatrix(int unfixedLayer, int direction)
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.
protected int countCrossings()
reduceCrossings()
protected double bends(int unfixedLayer, int direction, boolean weighted)
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)
protected double countBends(boolean weighted)
protected void normalize()
protected double[] barycenters(int unfixedLayer, int direction)
protected double[] medians(int unfixedLayer, int direction)
protected void tightComponent(JGoNetworkNode pNode, int component, boolean forw, boolean back)
protected void tightComponentUnset(JGoNetworkNode pNode, int component, int unset, boolean forw, boolean back)
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.
protected void component(JGoNetworkNode pNode, int component, boolean forw, boolean back)
protected void componentUnset(JGoNetworkNode pNode, int component, int unset, boolean forw, boolean back)
protected void removeCycles()
protected void greedyCycleRemoval()
protected JGoNetworkNode greedyCycleRemovalFindNode(JGoNetwork pGoNetwork)
protected JGoNetworkNode greedyCycleRemovalFindSink(JGoNetwork pGoNetwork)
protected JGoNetworkNode greedyCycleRemovalFindSource(JGoNetwork pGoNetwork)
protected JGoNetworkNode greedyCycleRemovalFindNodeMaxDegDiff(JGoNetwork pGoNetwork)
protected void depthFirstSearchCycleRemoval()
protected void depthFirstSearchCycleRemovalVisit(JGoNetworkNode pNode)
protected void assignLayers()
protected void longestPathSinkLayering()
protected int longestPathSinkLayeringLength(JGoNetworkNode pNode)
protected void longestPathSourceLayering()
protected int longestPathSourceLayeringLength(JGoNetworkNode pNode)
protected void optimalLinkLengthLayering()
getLinkMinLength(com.nwoods.jgo.layout.JGoNetworkLink)
,
getLinkLengthWeight(com.nwoods.jgo.layout.JGoNetworkLink)
protected void optimalLinkLengthLayeringDepthFirstSearch(JGoNetworkNode pNode)
optimalLinkLengthLayeringPull(com.nwoods.jgo.layout.JGoNetworkNode)
protected void optimalLinkLengthLayeringPull(JGoNetworkNode pNode)
protected void optimalLinkLengthLayeringPush(JGoNetworkNode pNode)
protected void makeProper()
protected void initializeIndices()
protected void naiveInitializeIndices()
protected void depthFirstOutInitializeIndices()
protected void depthFirstOutInitializeIndicesVisit(JGoNetworkNode pNode)
protected void depthFirstInInitializeIndices()
protected void depthFirstInInitializeIndicesVisit(JGoNetworkNode pNode)
protected void initializeColumns()
protected void reduceCrossings()
protected boolean medianBarycenterCrossingReduction(int unfixedLayer, int direction)
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.
protected boolean adjacentExchangeCrossingReductionBendStraighten(int unfixedLayer, int directionCR, boolean straighten, int directionBS)
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.
unfixedLayer
- the layer to be reordereddirectionCR
- indicates which adjacent layers should be taken into consideration when calculating the crossing matrixstraighten
- indicates whether or not to reorder to nodes to straighten linksdirectionBS
- indicates which adjacent layers should be taken into consideration when calculating the bends of a linkprotected void straightenAndPack()
protected boolean bendStraighten(int unfixedLayer, int direction)
protected boolean shiftBendStraighten(int unfixedLayer, int direction)
protected boolean medianStraighten(int unfixedLayer, int direction)
protected void pack()
protected boolean packAux(int column, int direction)
protected void tightPack()
protected boolean tightPackAux(int column, int 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.
protected void componentPack(int direction)
protected boolean componentPackAux(int column, int 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.
protected void layoutNodesAndLinks()
layoutNodes()
,
layoutLinks()
protected void layoutNodes()
layoutNodesAndLinks()
,
layoutLinks()
protected void layoutLinks()
layoutNodesAndLinks()
,
layoutNodes()
protected JGoLayeredDigraphAutoLayoutNodeData nodeData(JGoNetworkNode pNode)
protected JGoLayeredDigraphAutoLayoutLinkData linkData(JGoNetworkLink pLink)
protected void printNetworkData()
public int getLayerSpacing()
public void setLayerSpacing(int s)
s
- the new distance, must be positive.public int getColumnSpacing()
public void setColumnSpacing(int s)
s
- the new distance, must be positive.public int getDirectionOption()
public void setDirectionOption(int d)
d
- one of LD_DIRECTION_UP, LD_DIRECTION_DOWN, LD_DIRECTION_LEFT, LD_DIRECTION_RIGHTpublic int getCycleRemoveOption()
public void setCycleRemoveOption(int c)
c
- one of LD_CYCLEREMOVE_GREEDY or LD_CYCLEREMOVE_DFSpublic int getLayeringOption()
public void setLayeringOption(int l)
l
- one of LD_LAYERING_LONGESTPATHSINK, LD_LAYERING_LONGESTPATHSOURCE,
LD_LAYERING_OPTIMALLINKLENGTHpublic int getInitializeOption()
public void setInitializeOption(int i)
i
- one of LD_INITIALIZE_NAIVE, LD_INITIALIZE_DFSOUT, LD_INITIALIZE_DFSINpublic int getIterations()
public void setIterations(int i)
public int getAggressiveOption()
public void setAggressiveOption(int a)
a
- one of LD_AGGRESSIVE_TRUE or LD_AGGRESSIVE_FALSEpublic int getPackOption()
public void setPackOption(int p)
p
- a bitwise combination of LD_PACK_EXPAND | LD_PACK_STRAIGHTEN | LD_PACK_MEDIANpublic int getMaxLayer()
public int getMaxIndex()
public int getMaxColumn()
public int getMinIndexLayer()
public int getMaxIndexLayer()
public int[] getIndices()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |