Class LayeredArrangement
- All Implemented Interfaces:
GraphArrangement
An arrangement for flows: every edge points the same way, from one layer to the next, with as few crossings as it can find.
This is the method of Sugiyama, Tagawa and Toda in four passes. Cycles are broken by reversing the edges a depth first search finds going back; nodes are put on layers by their longest path from a source; an edge that spans several layers gets a hidden point on each so it bends around the nodes between; the order inside each layer is improved by sweeping down and up, moving each node to the median of its neighbours; and each node is then pulled towards its neighbours without overlapping the next one.
The edges get routes through their hidden points. Pinned nodes are placed like any other: a layered picture has no room for a node that stays put.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intLayers run across the screen and edges point right.static final intLayers run down the screen and edges point down. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionarrange(GraphModel model) Computes a position for every node, and a route for edges the arrangement bends.intTOP_TO_BOTTOM, the default, orLEFT_TO_RIGHT.doubleThe space between layers in world units.doubleThe space between nodes on one layer in world units.voidsetDirection(int direction) Sets the direction edges point.voidsetLayerGap(double layerGap) Sets the space between layers.voidsetNodeGap(double nodeGap) Sets the space between nodes on one layer.
-
Field Details
-
TOP_TO_BOTTOM
public static final int TOP_TO_BOTTOMLayers run down the screen and edges point down.- See Also:
-
LEFT_TO_RIGHT
public static final int LEFT_TO_RIGHTLayers run across the screen and edges point right.- See Also:
-
-
Constructor Details
-
LayeredArrangement
public LayeredArrangement()
-
-
Method Details
-
getDirection
public int getDirection()TOP_TO_BOTTOM, the default, orLEFT_TO_RIGHT. -
setDirection
public void setDirection(int direction) Sets the direction edges point. -
getLayerGap
public double getLayerGap()The space between layers in world units. -
setLayerGap
public void setLayerGap(double layerGap) Sets the space between layers. -
getNodeGap
public double getNodeGap()The space between nodes on one layer in world units. -
setNodeGap
public void setNodeGap(double nodeGap) Sets the space between nodes on one layer. -
arrange
Description copied from interface:GraphArrangementComputes a position for every node, and a route for edges the arrangement bends.- Specified by:
arrangein interfaceGraphArrangement
-