Sangha
सङ्घ (Sanskrit: community, assembly) — Sociology engine for social networks, game theory, and group dynamics.
Part of the AGNOS science crate ecosystem.
Key Capabilities
- Social Networks: Watts-Strogatz small-world, Barabasi-Albert scale-free, BFS shortest path, average path length, betweenness centrality, clustering coefficient, degree distribution, density
- Game Theory: Nash equilibria, prisoner's dilemma, iterated games, tit-for-tat
- Coordination: N-player public goods, sealed-bid auctions (first/second price), tragedy of the commons, repeated game discounting, folk theorem
- Coalition Game Theory: Shapley value, core stability, coalition value, faction merge/split
- Collective Decision-Making: Plurality vote, Borda count, Condorcet winner, majority rule, wisdom of crowds, Condorcet jury theorem
- Trust & Reputation: Directed trust networks, trust propagation, reputation aggregation, exponential decay, betrayal impact
- Emotional Contagion: Hatfield model with feedback, SIS dynamics, mood propagation, epidemic threshold
- Opinion Dynamics: Deffuant bounded confidence, echo chamber detection, consensus
- Group Dynamics: Tuckman stages, social loafing (Ringelmann), groupthink risk, collective intelligence
- Population Models: Logistic growth, SIR epidemiological model, herd immunity
- Social Influence: Conformity (Asch), social proof, Bass diffusion
- Inequality: Gini coefficient, Lorenz curve
Quick Start
use ;
// Herd immunity threshold for R0 = 3
let h = herd_immunity_threshold.unwrap;
assert!; // ~66.7%
// Gini coefficient
let g = gini_coefficient.unwrap;
assert!; // perfect equality
// Nash equilibrium of prisoner's dilemma
let eq = find_nash_equilibria;
assert_eq!;
// Shapley value of a 3-player majority game
let mut values = vec!;
values = 1.0; values = 1.0;
values = 1.0; values = 1.0;
let game = new.unwrap;
let sv = shapley_value.unwrap;
assert!;
// Condorcet jury theorem: 101 jurors with 60% individual accuracy
let prob = jury_theorem.unwrap;
assert!;
Feature Flags
| Feature | Default | Description |
|---|---|---|
std |
Yes | Standard library support |
hisab |
No | Advanced math via hisab |
pramana |
No | Statistics via pramana |
logging |
No | Tracing subscriber |
full |
No | All features |
License
GPL-3.0-only