Class Network3D
- All Implemented Interfaces:
Iterable<Node3D>, Collection<Node3D>, Iterator<Node3D>, List<Node3D>, SequencedCollection<Node3D>
- Direct Known Subclasses:
Network3DGWT
-
Nested Class Summary
Nested classes/interfaces inherited from class Network
Network.LayoutListener, Network.Status -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final Vector3DHelper variable to store intermediate results when considering the potential energy resulting from the attraction between neighbouring nodes.private static final doubleThe inverse size of the baseline 3D universe.private static final doubleThe inverse squared size of the baseline 3D universe,1/R<sup>2</sup>.private static final doubleSmallest admissible squared center-to-center distance during layout calculations.private final Vector3DHelper variable to store intermediate results when considering the potential energy resulting from the repulsion between nodes.private static final doubleFraction of the nominal nearest-neighbour spacing used as radial shell thickness.static final doubleThe baseline size of the 3D universe.private final Vector3DTemporary storage for the directional vector connecting two nodes.Fields inherited from class Network
accuracy, engine, fLinks, geometry, GOLDEN_ANGLE, HARD_CORE_STIFFNESS, initialAdjust, isRunning, layoutProgress, layoutTimeout, listener, MAX_LINK_COUNT, MIN_DISTANCE, MIN_SCALED_DISTANCE, nLinks, nNodes, nodes, norm, potential, prevAdjust, prevPotential, radius, rng, status, timestampFields inherited from class AbstractList
modCount -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedNetwork3D(EvoLudo engine, AbstractGeometry geometry) Create a new network in 3D 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.private static ArrayList<double[]> createFibonacciShells(int nNodes) Create a deterministic ball composed of concentric phyllotactic shells.booleanvoidPrepare graph for display: shift center of mass into origin rescale size of graph find number of linksprivate static doublefractional(double value) Return the fractional part ofvalue.get(int index) inthashCode()voidinitNodes(double pnorm, double nnorm, double unitradius) Generate the initial placement of all nodes.private static int[]nodesPerShell(double maxR, int nShells, int sNodes) Apportion the non-central nodes across concentric shells in proportion to shell volume using the largest-remainder method.private doublepairDistance(Node3D from, Node3D to, int fromidx, int toidx) Setvecto the directional vector fromfromtotoand return the corresponding center-to-center distance.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.Node3D[]toArray()private static doublevolumeMeanRadius(double iR, double oR) Compute the radius that best represents the shell volume between two boundaries.Methods inherited from class Network
cancelLayout, clear, collectEdges, collectLinks, completeLayout, contains, doLayout, doLayoutPrep, getConvergenceAccuracy, getGeometry, getLayoutTimout, getNLinks, getRadius, getStatus, getTimestamp, getUnitRadius, hasNext, indexOf, isStatus, iterator, lastIndexOf, linkNodes, next, reset, sampleIndices, scaledNodeRadius, scaleRadiusTo, set, setLayoutListener, setLayoutTimout, setRadius, setStatus, shake, size, updateLayoutProgressMethods 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
-
SHELL_THICKNESS_SCALE
private static final double SHELL_THICKNESS_SCALEFraction of the nominal nearest-neighbour spacing used as radial shell thickness. Values below one create more shells than a strict packing estimate, which makes the seed look more organic while still filling the volume.- See Also:
-
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. -
UNIVERSE_RADIUS
public static final double UNIVERSE_RADIUSThe baseline size of the 3D universe.- See Also:
-
IR
private static final double IRThe inverse size of the baseline 3D universe. Convenience constant.- See Also:
-
IR2
private static final double IR2The inverse squared size of the baseline 3D universe,1/R<sup>2</sup>. Convenience constant.- See Also:
-
MIN_DISTANCE2
private static final double MIN_DISTANCE2Smallest admissible squared center-to-center distance during layout calculations.- See Also:
-
-
Constructor Details
-
Network3D
Create a new network in 3D for the given engine and geometry.- Parameters:
engine- the pacemaker for running the modelgeometry- the structure of the population
-
-
Method Details
-
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. -
createFibonacciShells
Create a deterministic ball composed of concentric phyllotactic shells. Node zero is kept at the origin, while the remaining nodes are distributed over spherical shells with populations proportional to shell volume.- Parameters:
nNodes- the number of nodes to distribute- Returns:
- the shell positions sorted from the center to the boundary
-
nodesPerShell
private static int[] nodesPerShell(double maxR, int nShells, int sNodes) Apportion the non-central nodes across concentric shells in proportion to shell volume using the largest-remainder method.- Parameters:
maxR- the radius of the seed ballnShells- the number of shellssNodes- the number of nodes on shells- Returns:
- the number of nodes placed on each shell
-
volumeMeanRadius
private static double volumeMeanRadius(double iR, double oR) Compute the radius that best represents the shell volume between two boundaries. This uses the radius averaged with respect to volume density.- Parameters:
iR- the inner shell boundaryoR- the outer shell boundary- Returns:
- the representative shell radius
-
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). Implementations may include additional short-range penalties here, for example to discourage overlap between nodes with finite size.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).- Specified by:
attractionin classNetwork<Node3D>- Parameters:
nodeidx- the index of the node to relax- Returns:
- the potential energy of the node
-
pairDistance
Setvecto the directional vector fromfromtotoand return the corresponding center-to-center distance. Coincident nodes are separated by a deterministic fallback direction to keep layouting stable and reproducible.- Parameters:
from- the source nodeto- the target nodefromidx- the index of the source nodetoidx- the index of the target node- Returns:
- the center-to-center distance
-
fractional
private static double fractional(double value) Return the fractional part ofvalue.- Parameters:
value- the value to reduce to its fractional part- Returns:
- the fractional part in the interval
[0,1)
-
finishLayout
public void finishLayout()Prepare graph for display:- shift center of mass into origin
- rescale size of graph
- find number of links
- Specified by:
finishLayoutin classNetwork<Node3D>
-
toArray
- Specified by:
toArrayin interfaceCollection<Node3D>- Specified by:
toArrayin interfaceList<Node3D>- Overrides:
toArrayin classAbstractCollection<Node3D>
-
get
-
equals
-
hashCode
-