aryagraph.sim.degroot#

aryagraph.sim.degroot(g: Any, initial: Any, *, steps: int = 50, weight: str | Callable[[Hashable, Hashable, dict], float] | None = None, self_weight: float = 1.0, tol: float | None = None) → SimulationResult[source]#

DeGroot averaging x(t+1) = W x(t).

W is row-stochastic: node v averages itself (weight self_weight plus any self-loop weight) and its in-neighbours u (weight w(u, v)), normalised to sum to one. A node with nothing to listen to keeps its value.

Parameters:
  • initial – {node: value} for every node, or values in graph order.

  • tol – Stop once no value moves by more than tol in a step.

Returns:

SimulationResult – Continuous. When the listening structure has a single closed class that is aperiodic (always true with self_weight > 0), the values converge to the consensus π · x(0), where π is the left eigenvector of W for eigenvalue 1 (each node’s social power); meta["consensus"] and meta["influence"] then hold them, computed exactly for classes up to CONSENSUS_MAX_NODES nodes (else, and when there is no consensus, None).