ClosestN

open class ClosestN<T, P : Position<P>> @JvmOverloads constructor(environment: Environment<T, P>, nodeCount: Int, expectedNodes: Int = 0) : NetworkModel<T>

Network model linking every enabled node to its nodeCount closest enabled nodes, and to the enabled nodes that count it among their nodeCount closest; ties are broken by the lowest node id. No node is linked while environment holds fewer than expectedNodes nodes.

The closest nodes of each node whose neighborhood is observed are tracked: they are recomputed whenever a node moves, appears, disappears, or changes its enablement within the distance of the farthest of them. Neighborhoods account for the closest nodes of the nodes whose neighborhoods are observed, as the environment does for all of its nodes.

Type Parameters

T

concentration type

P

position type

Inheritors

Constructors

Link copied to clipboard
constructor(environment: Environment<T, P>, nodeCount: Int, expectedNodes: Int = 0)

Properties

Link copied to clipboard

The neighborhood of this node, as provided by neighborhoodOf.

Functions

Link copied to clipboard
open override fun neighborhoodOf(center: Node<T>): Observable<Neighborhood<T>>

The neighborhood of center, a node of the environment of this model, as an observable of immutable snapshots that emits whenever the neighborhood changes.

Link copied to clipboard
infix fun NetworkModel<*>.shouldEqual(other: NetworkModel<*>)
Link copied to clipboard
open override fun toString(): String