|
JGraph |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.jgraph.layout.organic.JGraphSelfOrganizingOrganicLayout
public class JGraphSelfOrganizingOrganicLayout
This layout is an implementation of inverted self-organising maps as
described by Bernd Meyer in his 1998 paper "Self-Organizing Graphs - A Neural
Network Perspective of Graph Layout". Self-organizing maps have some
similarities with force-directed layouts, linked nodes tends to cluster.
However, a difference with the maps is that there is a uniform space filling
distrubtion of nodes. This makes the bounds within which the layout takes
place important to calculate correctly at the start. The implementation
assumes an average density by default. ISOM layouts are better suited to well
connected graphs.
The computational effort per iteration is linear, O(|N|). This comes from the
effort of finding the closest node to the random point. When JGraph
implements the spatial index structure this will improve to O(log|N|). Only a
selection of nodes are moved per iteration and so a greater number of
iterations are required for larger graphs. Generally, the number of
iterations required is proportional to the number of vertices and so the
computational effort including the number of iterations will always be
O(|N|). The paper describes 500 iterations as being enough for 25 nodes, thus
maxIterationsMultiple
, which defines the vertices to number
of iterations factor, defaults to 20.
This implementation attempt to calculate sensible values for certain
configuration parameters, based on the input graph. The number of iterations,
the start radius used, the bounds of the end graph and the narrowing interval
are calculated for the user, if the user does not set their own values. If a
layout is used repeatedly, the values calculated may become less suitable as
the graph changes. To make the layout re-calculate it's own suggested values,
set the appropriate value to zero. The parameters that can be reset like this
are: maxIterationsMultiple
,startRadius
and
narrowingInterval
.
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface com.jgraph.layout.JGraphLayout |
---|
JGraphLayout.Stoppable |
Field Summary | |
---|---|
protected double |
adaption
The current adaption value |
protected Rectangle2D |
bounds
The bounds of the graph prior to the layout |
protected double[][] |
cellLocation
An array of locally stored X co-ordinate positions for the vertices |
protected double |
coolingFactor
The rate at which the rate of the change of the graph decreases |
protected double |
densityFactor
The factor by which the suggest area of the graph bound is multipled by. |
protected int |
iteration
The current iteration of the layout |
protected double |
maxAdaption
The start adaption value |
protected int |
maxIterationsMultiple
The multiple of the number of vertices to find the total number of iterations of this layout applied. |
protected double |
minAdaption
The minimum adaption value |
protected int |
minRadius
The lowest radius value allowed. |
protected int |
narrowingInterval
The number of iterations after which the radius is decremented. |
protected int[][] |
neighbours
Local copy of cell neighbours |
protected int |
radius
The current radius of the layout. |
protected double |
randomX
The X-coordinate of the random point (termed the random vector in the paper) |
protected double |
randomY
The Y-coordinate of the random point (termed the random vector in the paper) |
protected Stack |
stack
A stack of nodes to be visited in the adjustment phase |
protected int |
startRadius
The radius value at on the first iteration. |
protected int |
totalIterations
The layout sets this variable to the number of vertices multipled by maxIterationsMultiple since the number of iterations
required in linear with the number of nodes |
protected Object[] |
vertexArray
An array of all vertices to be laid out |
protected int[] |
vertexDistance
An array of the number of edges any particular node is from the winning node. |
protected boolean[] |
vertexVisited
An array of which vertices have been visited during the current iteration. |
Fields inherited from interface com.jgraph.layout.JGraphLayout |
---|
VERSION |
Constructor Summary | |
---|---|
JGraphSelfOrganizingOrganicLayout()
|
Method Summary | |
---|---|
double |
getCoolingFactor()
|
double |
getDensityFactor()
|
double |
getMaxAdaption()
|
int |
getMaxIterationsMultiple()
|
double |
getMinAdaption()
|
int |
getMinRadius()
|
int |
getStartRadius()
|
void |
run(JGraphFacade graph)
Runs the ISOM layout using the graph information specified in the facade. |
void |
setCoolingFactor(double coolingFactor)
|
void |
setDensityFactor(double densityFactor)
|
void |
setMaxAdaption(double maxAdaption)
|
void |
setMaxIterationsMultiple(int maxIterationsMultiple)
|
void |
setMinAdaption(double minAdaption)
|
void |
setMinRadius(int minRadius)
|
void |
setStartRadius(int startRadius)
|
String |
toString()
Returns Self Organizing , the name of this algorithm. |
protected void |
updateToRandomNode()
Picks a random point and detemines to the closest nodes to that point |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected Rectangle2D bounds
protected int totalIterations
maxIterationsMultiple
since the number of iterations
required in linear with the number of nodes
protected int maxIterationsMultiple
protected int iteration
protected int radius
minRadius
as the layout progresses.
protected int startRadius
protected int minRadius
protected double densityFactor
protected int narrowingInterval
protected double adaption
protected double maxAdaption
protected double minAdaption
protected double coolingFactor
protected Stack stack
protected int[][] neighbours
protected Object[] vertexArray
protected boolean[] vertexVisited
protected int[] vertexDistance
stack
then its corresponding
value in this array will not be valid.
protected double[][] cellLocation
protected double randomX
protected double randomY
Constructor Detail |
---|
public JGraphSelfOrganizingOrganicLayout()
Method Detail |
---|
public void run(JGraphFacade graph)
run
in interface JGraphLayout
graph
- the facade describing the input graphprotected void updateToRandomNode()
public double getCoolingFactor()
public void setCoolingFactor(double coolingFactor)
coolingFactor
- The coolingFactor to set.public int getMaxIterationsMultiple()
public void setMaxIterationsMultiple(int maxIterationsMultiple)
maxIterationsMultiple
- The maxIterationsMultiple to set.public double getMinAdaption()
public void setMinAdaption(double minAdaption)
minAdaption
- The minAdaption to set.public int getStartRadius()
public void setStartRadius(int startRadius)
startRadius
- The startRadius to set.public double getMaxAdaption()
public void setMaxAdaption(double maxAdaption)
maxAdaption
- The maxAdaption to set.public int getMinRadius()
public void setMinRadius(int minRadius)
minRadius
- The minRadius to set.public double getDensityFactor()
public void setDensityFactor(double densityFactor)
densityFactor
- The densityFactor to set.public String toString()
Self Organizing
, the name of this algorithm.
toString
in class Object
|
JGraph |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |