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).Wis row-stochastic: node v averages itself (weightself_weightplus any self-loop weight) and its in-neighboursu(weightw(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 ofWfor eigenvalue 1 (each node’s social power);meta["consensus"]andmeta["influence"]then hold them, computed exactly for classes up toCONSENSUS_MAX_NODESnodes (else, and when there is no consensus,None).