Skip to content

Build · Topology (graph)

erdos_renyi

Generates an Erdos-Renyi (G(n, p)) graph.

erdos_renyi

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

reservoir = ESNLayer(500, feedback_size=3, recurrent_initializer='erdos_renyi', spectral_radius=0.9, seed=7)
parameter default
p 0.1
directed True
self_loops True

Override parameters with recurrent_initializer=("erdos_renyi", {...}) or pre-configure with get_recurrent_initializer("erdos_renyi", ...). 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