DifferenceCoupling
experimental.network_dynamics.coupling.DifferenceCoupling(
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 |
|---|---|---|---|
| incoming_states | str or list of str | State name(s) to collect from connected nodes (required) | None |
| local_states | 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(incoming_states='x', local_states='x', G=1.0)Methods
| Name | Description |
|---|---|
| post | Apply coupling strength to summed differences. |
| pre | Compute difference between incoming and local states (per-edge). |
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 difference between incoming and local states (per-edge).
Args: incoming_states: States from connected nodes in per-edge format [n_incoming, n_nodes_target, n_nodes_source] local_states: States from current node [n_local, n_nodes] params: Coupling parameters (not used in pre)
Returns: State differences [n_incoming, n_nodes, n_nodes] (per-edge)