Class Network2D
- All Implemented Interfaces:
Iterable<Node2D>, Collection<Node2D>, Iterator<Node2D>, List<Node2D>, SequencedCollection<Node2D>
- Direct Known Subclasses:
Network2DGWT
-
Nested Class Summary
Nested classes/interfaces inherited from class Network
Network.LayoutListener, Network.Status -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final Vector2DHelper variable to store intermediate results when considering the potential energy resulting from the attraction between neighbouring nodes.protected static final doubleThe inverse size of the baseline 2D universe.protected static final doubleThe inverse squared size of the baseline 2D universe,1/R<sup>2</sup>.protected Path2DThe links in this network.static final doubleThe baseline size of the 2D universe.private final Vector2DHelper variable to store intermediate results when considering the potential energy resulting from the repulsion between nodes.private final Vector2DTemporary storage for the directional vector connecting two nodes.Fields inherited from class Network
accuracy, engine, fLinks, geometry, isRunning, layoutTimeout, listener, MAX_LINK_COUNT, nLinks, nNodes, nodes, norm, potential, prevAdjust, prevPotential, radius, rng, status, timestampFields inherited from class AbstractList
modCount -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedNetwork2D(EvoLudo engine, AbstractGeometry geometry) Create a new network in 2D for the given engine and geometry. -
Method Summary
Modifier and TypeMethodDescriptionprotected doubleattraction(int nodeidx) Calculate the potential energy based on attraction to its neighbours for the node with indexnodeidx.booleanvoidAdd the finishing touches to the graph layout: shift center of mass into origin rescale size of graph find number of linksget(int index) getLinks()Get the links in this network for the GUI to draw.inthashCode()voidinitNodes(double pnorm, double nnorm, double unitradius) Generate the initial placement of all nodes.voidGenerate the links for the current configuration of the network.doublerelax(int nodeidx) Relax the potential energy a single node with indexnodeidxby adjusting its position.doublerelax(int nodeidx, double dt) Relaxes the network node with indexnodeidx.protected doublerepulsion(int nodeidx) Calculate the potential energy based on repulsion for the node with indexnodeidx.Node2D[]toArray()Methods inherited from class Network
cancelLayout, clear, contains, doLayout, doLayoutPrep, getGeometry, getLayoutTimout, getNLinks, getRadius, getStatus, getTimestamp, hasNext, indexOf, isStatus, iterator, lastIndexOf, next, reset, scaleRadiusTo, set, setLayoutListener, setLayoutTimout, setRadius, setStatus, shake, sizeMethods inherited from class AbstractList
add, add, addAll, listIterator, listIterator, remove, removeRange, subListMethods inherited from class AbstractCollection
addAll, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toStringMethods inherited from interface Collection
parallelStream, removeIf, stream, toArrayMethods inherited from interface Iterator
forEachRemaining, removeMethods inherited from interface List
addAll, addFirst, addLast, containsAll, getFirst, getLast, isEmpty, remove, removeAll, removeFirst, removeLast, replaceAll, retainAll, reversed, sort, spliterator, toArray
-
Field Details
-
links
The links in this network. -
attraction
Helper variable to store intermediate results when considering the potential energy resulting from the attraction between neighbouring nodes. -
repulsion
Helper variable to store intermediate results when considering the potential energy resulting from the repulsion between nodes. -
vec
Temporary storage for the directional vector connecting two nodes. -
R
public static final double RThe baseline size of the 2D universe.- See Also:
-
IR
protected static final double IRThe inverse size of the baseline 2D universe. Convenience constant.- See Also:
-
IR2
protected static final double IR2The inverse squared size of the baseline 2D universe,1/R<sup>2</sup>. Convenience constant.- See Also:
-
-
Constructor Details
-
Network2D
Create a new network in 2D for the given engine and geometry.- Parameters:
engine- the pacemaker for running the modelgeometry- the structure of the population
-
-
Method Details
-
getLinks
Get the links in this network for the GUI to draw.- Returns:
- the links in this network
-
initNodes
public void initNodes(double pnorm, double nnorm, double unitradius) Description copied from class:NetworkGenerate the initial placement of all nodes. The size of nodes scales with their total number of incoming and outgoing links in heterogeneous networks. -
relax
public double relax(int nodeidx) Description copied from class:NetworkRelax the potential energy a single node with indexnodeidxby adjusting its position. The potential energy increases proportional toDwhereDdenotes the distance to its neighbours and decreases proportional to1/D<sup>2</sup>whereDrefers to the distance from all other nodes. -
relax
public double relax(int nodeidx, double dt) Description copied from class:NetworkRelaxes the network node with indexnodeidx. The attraction and repulsion forces act on the node for a time intervaldt, which limits the changes in the position of the node. -
repulsion
protected double repulsion(int nodeidx) Description copied from class:NetworkCalculate the potential energy based on repulsion for the node with indexnodeidx. Return the net repulsion (overall direction and magnitude) acting on it inNetwork.repulsion(int).Note:
To prevent disjoint parts of a network (and unstructured populations, in particular) to continue to fly apart, the repulsion changes sign, i.e. turns into attraction, once the distance between nodes exceeds the radius of the universe. -
attraction
protected double attraction(int nodeidx) Description copied from class:NetworkCalculate the potential energy based on attraction to its neighbours for the node with indexnodeidx. Return the net attraction (overall direction and magnitude) acting on it inNetwork.attraction(int).TODO: Prevent nodes from overlapping.
- Specified by:
attractionin classNetwork<Node2D>- Parameters:
nodeidx- the index of the node to relax- Returns:
- the potential energy of the node
-
finishLayout
public void finishLayout()Description copied from class:NetworkAdd the finishing touches to the graph layout:- shift center of mass into origin
- rescale size of graph
- find number of links
- Specified by:
finishLayoutin classNetwork<Node2D>
-
linkNodes
-
toArray
- Specified by:
toArrayin interfaceCollection<Node2D>- Specified by:
toArrayin interfaceList<Node2D>- Overrides:
toArrayin classAbstractCollection<Node2D>
-
get
-
equals
-
hashCode
-