DifferenceCoupling
experimental.network_dynamics.coupling.DifferenceCoupling(
source=None,
local=None,
*,
incoming_states=None,
local_states=None,
**kwargs,
)Diffusive coupling based on state differences.
Computes coupling based on the difference between incoming and local states, implementing:
\[c_i = G \cdot \sum_{j} w_{ij} (x_j - x_i)\]
This type of coupling is useful for synchronization and consensus dynamics, as it drives nodes toward common states. Automatically uses sparse-optimized computation for sparse graphs.
Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| source | str or list of str | State name(s) to collect from connected nodes (required) | None |
| local | str or list of str | State name(s) from current node (required for computing differences) | None |
Attributes
| Name | Type | Description |
|---|---|---|
| N_OUTPUT_STATES | int | Number of output coupling states: 1 |
| DEFAULT_PARAMS | Bunch | Default parameters: G=1.0 (global coupling strength) |
Examples
>>> # Diffusive coupling via 'x' state
>>> coupling = DifferenceCoupling(source='x', local='x', G=1.0)Methods
| Name | Description |
|---|---|
| post | Apply coupling strength to summed differences. |
| pre | Compute an elementwise difference on aligned messages. |
post
experimental.network_dynamics.coupling.DifferenceCoupling.post(
summed_inputs,
local_states,
params,
)Apply coupling strength to summed differences.
Args: summed_inputs: Summed differences [n_inputs, n_nodes] local_states: Local states (not used) params: Bunch with G
Returns: Scaled coupling [n_inputs, n_nodes]
pre
experimental.network_dynamics.coupling.DifferenceCoupling.pre(
incoming_states,
local_states,
params,
)Compute an elementwise difference on aligned messages.
Args: incoming_states: Source states [n_incoming, *M]. local_states: Target states aligned as [n_local, *M]. params: Coupling parameters (not used in pre)
Returns: State differences [n_output, *M]. M is a dense target/source grid or the prepared sparse edge axis.