public class SpringLayout<V,E> extends AbstractLayout<V,E> implements IterativeContext
relax()
, the SpringLayout moves the
visualization forward one step.Modifier and Type | Class and Description |
---|---|
class |
SpringLayout.SpringDimensionChecker
Used for changing the size of the layout in response to a component's size.
|
protected static class |
SpringLayout.SpringVertexData |
Modifier and Type | Field and Description |
---|---|
protected double |
force_multiplier |
protected org.apache.commons.collections15.Transformer<E,java.lang.Integer> |
lengthFunction |
protected int |
repulsion_range_sq |
protected java.util.Map<V,SpringLayout.SpringVertexData> |
springVertexData |
protected double |
stretch |
graph, initialized, locations, size
Constructor and Description |
---|
SpringLayout()
Creates an instance which does not initialize the vertex locations.
|
SpringLayout(Graph<V,E> g)
Constructor for a SpringLayout for a raw graph with associated
dimension--the input knows how big the graph is.
|
SpringLayout(Graph<V,E> g,
org.apache.commons.collections15.Transformer<E,java.lang.Integer> length_function)
Constructor for a SpringLayout for a raw graph with associated component.
|
Modifier and Type | Method and Description |
---|---|
protected void |
calculateRepulsion() |
boolean |
done()
For now, we pretend it never finishes.
|
double |
getForceMultiplier()
Returns the current value for the edge length force multiplier.
|
int |
getRepulsionRange()
Returns the current value for the node repulsion range.
|
double |
getStretch()
Returns the current value for the stretch parameter.
|
void |
initialize()
Initializes fields in the node that may not have
been set during the constructor.
|
boolean |
isIncremental()
This one is an incremental visualization
|
protected void |
moveNodes() |
protected void |
relaxEdges() |
void |
reset()
No effect.
|
void |
setForceMultiplier(double force)
Sets the force multiplier for this instance.
|
void |
setRepulsionRange(int range)
Sets the node repulsion range (in drawing area units) for this instance.
|
void |
setSize(java.awt.Dimension size)
Sets the dimensions of the available space for layout to
size . |
void |
setStretch(double stretch)
Sets the stretch parameter for this instance.
|
void |
step()
Relaxation step.
|
getGraph, getSize, getX, getY, isLocked, lock, lock, offsetVertex, setGraph, setInitializer, setLocation, setLocation, transform
protected double stretch
protected org.apache.commons.collections15.Transformer<E,java.lang.Integer> lengthFunction
protected int repulsion_range_sq
protected double force_multiplier
protected java.util.Map<V,SpringLayout.SpringVertexData> springVertexData
public SpringLayout()
public SpringLayout(Graph<V,E> g)
public double getStretch()
setStretch(double)
public void setSize(java.awt.Dimension size)
size
.public void setStretch(double stretch)
Sets the stretch parameter for this instance. This value specifies how much the degrees of an edge's incident vertices should influence how easily the endpoints of that edge can move (that is, that edge's tendency to change its length).
The default value is 0.70. Positive values less than 1 cause high-degree vertices to move less than low-degree vertices, and values > 1 cause high-degree vertices to move more than low-degree vertices. Negative values will have unpredictable and inconsistent results.
stretch
- public int getRepulsionRange()
setRepulsionRange(int)
public void setRepulsionRange(int range)
range
- public double getForceMultiplier()
setForceMultiplier(double)
public void setForceMultiplier(double force)
public void initialize()
Layout
initialize
in interface Layout<V,E>
public void step()
step
in interface IterativeContext
protected void relaxEdges()
protected void calculateRepulsion()
protected void moveNodes()
public boolean isIncremental()
public boolean done()
done
in interface IterativeContext
Copyright © 2021, 2022 Herve Girod. All Rights Reserved. Documentation and source under the BSD 3-Clause licence