Skip to content

Build · Topology (graph)

kleinberg_small_world

Generates a 2D Kleinberg small-world graph on an n x n toroidal grid.

kleinberg_small_world

Connectivity and weight matrix on a small reservoir.
from resdag.layers import ESNLayer

reservoir = ESNLayer(484, feedback_size=3, recurrent_initializer='kleinberg_small_world', spectral_radius=0.9, seed=7)
parameter default
q 2
k 1
directed False
weighted False
beta 2

Override parameters with recurrent_initializer=("kleinberg_small_world", {...}) or pre-configure with get_recurrent_initializer("kleinberg_small_world", ...). The existing topology= spelling and get_topology() also work.

A layer spectral_radius rescales this matrix after construction. Use get_recurrent_initializer(..., rescale=False) to keep the native scale.

See also