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 com.google.common.base.Function<? super E,Integer> |
lengthFunction |
protected int |
repulsion_range_sq |
protected com.google.common.cache.LoadingCache<V,SpringLayout.SpringVertexData> |
springVertexData |
protected double |
stretch |
graph, initialized, locations, size
Constructor and Description |
---|
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,
com.google.common.base.Function<? super E,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() |
double |
getForceMultiplier() |
int |
getRepulsionRange() |
double |
getStretch() |
void |
initialize()
Initializes fields in the node that may not have
been set during the constructor.
|
boolean |
isIncremental() |
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(Dimension size)
When a visualization is resized, it presumably wants to fix the
locations of the vertices and possibly to reinitialize its data.
|
void |
setStretch(double stretch)
Sets the stretch parameter for this instance.
|
void |
step()
Relaxation step.
|
apply, getGraph, getSize, getX, getY, isLocked, lock, lock, offsetVertex, setGraph, setInitializer, setLocation, setLocation
protected double stretch
protected int repulsion_range_sq
protected double force_multiplier
protected com.google.common.cache.LoadingCache<V,SpringLayout.SpringVertexData> springVertexData
public SpringLayout(Graph<V,E> g)
g
- the graph on which the layout algorithm is to operatepublic SpringLayout(Graph<V,E> g, com.google.common.base.Function<? super E,Integer> length_function)
g
- the graph on which the layout algorithm is to operatelength_function
- provides a length for each edgepublic double getStretch()
public void setSize(Dimension size)
AbstractLayout
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
- the stretch parameterpublic int getRepulsionRange()
public void setRepulsionRange(int range)
range
- the maximum repulsion rangepublic double getForceMultiplier()
public void setForceMultiplier(double force)
force
- an energy field created by all living things that binds the galaxy togetherpublic 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 © 2015. All rights reserved.