public class SugiyamaLayout<V,E>
extends edu.uci.ics.jung.algorithms.layout.AbstractLayout<V,E>
Modifier and Type | Class and Description |
---|---|
(package private) static class |
SugiyamaLayout.CellWrapper<VV>
cell wrapper contains all values for one node
|
static class |
SugiyamaLayout.Orientation |
Modifier and Type | Field and Description |
---|---|
private static int |
DEFAULT_HORIZONTAL_SPACING |
private static SugiyamaLayout.Orientation |
DEFAULT_ORIENTATION |
private static int |
DEFAULT_VERTICAL_SPACING |
private boolean |
executed |
private int |
gridAreaSize
represents the size of the grid in horizontal grid elements
|
private int |
horzSpacing |
private SugiyamaLayout.Orientation |
orientation |
private java.util.Set<V> |
traversalSet |
private int |
vertSpacing |
private java.util.Map<V,SugiyamaLayout.CellWrapper<V>> |
vertToWrapper |
Constructor and Description |
---|
SugiyamaLayout(edu.uci.ics.jung.graph.Graph<V,E> g) |
SugiyamaLayout(edu.uci.ics.jung.graph.Graph<V,E> g,
SugiyamaLayout.Orientation orientation,
int horzSpacing,
int vertSpacing) |
Modifier and Type | Method and Description |
---|---|
private void |
fillLevels(java.util.LinkedList<java.util.LinkedList<SugiyamaLayout.CellWrapper<V>>> levels,
int level,
V rootNode)
Fills the LinkedList for the specified level with a wrapper for the MyGraphCell.
|
private java.util.LinkedList<java.util.LinkedList<SugiyamaLayout.CellWrapper<V>>> |
fillLevels(java.util.LinkedList<V> roots,
java.util.Set<V> vertexSet)
Method fills the levels and stores them in the member levels.
|
private java.util.Collection<E> |
getNeighborEdges(V v) |
void |
initialize() |
private boolean |
move(boolean toRight,
java.util.LinkedList<SugiyamaLayout.CellWrapper<V>> currentLevel,
int currentIndexInTheLevel,
int currentPriority) |
private int |
moveToBarycenter(java.util.LinkedList<java.util.LinkedList<SugiyamaLayout.CellWrapper<V>>> levels,
int levelIndex) |
private void |
moveToBarycenter(java.util.LinkedList<java.util.LinkedList<SugiyamaLayout.CellWrapper<V>>> levels,
java.util.Set<V> vertexSet) |
void |
reset() |
private java.util.LinkedList<java.util.LinkedList<SugiyamaLayout.CellWrapper<V>>> |
runSugiyama()
Implementation.
|
private java.util.LinkedList<V> |
searchRoots(java.util.Set<V> vertexSet)
Searches all Roots for the current Graph First the method marks any Node as not visited.
|
private int |
solveEdgeCrosses(boolean down,
java.util.LinkedList<java.util.LinkedList<SugiyamaLayout.CellWrapper<V>>> levels,
int levelIndex)
Solve edge crosses
|
private void |
solveEdgeCrosses(java.util.LinkedList<java.util.LinkedList<SugiyamaLayout.CellWrapper<V>>> levels)
Solve edge crosses
|
java.lang.String |
toString() |
private static final SugiyamaLayout.Orientation DEFAULT_ORIENTATION
private static final int DEFAULT_HORIZONTAL_SPACING
private static final int DEFAULT_VERTICAL_SPACING
private boolean executed
private int gridAreaSize
private final int horzSpacing
private final int vertSpacing
private final java.util.Set<V> traversalSet
private final java.util.Map<V,SugiyamaLayout.CellWrapper<V>> vertToWrapper
private final SugiyamaLayout.Orientation orientation
public SugiyamaLayout(edu.uci.ics.jung.graph.Graph<V,E> g, SugiyamaLayout.Orientation orientation, int horzSpacing, int vertSpacing)
public void initialize()
public java.lang.String toString()
toString
in class java.lang.Object
private java.util.LinkedList<java.util.LinkedList<SugiyamaLayout.CellWrapper<V>>> runSugiyama()
levels
. The Member levels contains LinkedList Objects and the LinkedList per level contains Cell Wrapper Objects. After that the
Algorithm tries to solve the edge crosses from level to level and goes top down and bottom up. After minimization of the edge crosses the algorithm moves
each node to its bary center.private java.util.LinkedList<V> searchRoots(java.util.Set<V> vertexSet)
vertexSet
- verticessearchRoots(java.util.Set<V>)
private java.util.LinkedList<java.util.LinkedList<SugiyamaLayout.CellWrapper<V>>> fillLevels(java.util.LinkedList<V> roots, java.util.Set<V> vertexSet)
levels
LinkedList.roots
- rootsvertexSet
- verticesprivate void fillLevels(java.util.LinkedList<java.util.LinkedList<SugiyamaLayout.CellWrapper<V>>> levels, int level, V rootNode)
levels
- The level for the graphCelllevel
- The levels for the graphCellrootNode
- The root nodeprivate void solveEdgeCrosses(java.util.LinkedList<java.util.LinkedList<SugiyamaLayout.CellWrapper<V>>> levels)
levels
- levelsprivate int solveEdgeCrosses(boolean down, java.util.LinkedList<java.util.LinkedList<SugiyamaLayout.CellWrapper<V>>> levels, int levelIndex)
down
- downlevels
- levelslevelIndex
- level indexprivate void moveToBarycenter(java.util.LinkedList<java.util.LinkedList<SugiyamaLayout.CellWrapper<V>>> levels, java.util.Set<V> vertexSet)
private int moveToBarycenter(java.util.LinkedList<java.util.LinkedList<SugiyamaLayout.CellWrapper<V>>> levels, int levelIndex)
private boolean move(boolean toRight, java.util.LinkedList<SugiyamaLayout.CellWrapper<V>> currentLevel, int currentIndexInTheLevel, int currentPriority)
toRight
- true = try to move the currentWrapper to right; false = try to move the currentWrapper to left;currentLevel
- LinkedList which contains the CellWrappers for the current levelcurrentIndexInTheLevel
- Current index in the levelcurrentPriority
- Current prioritypublic void reset()