Expand description
§Sangha — Sociology Engine
सङ्घ (Sanskrit: community, assembly)
A Rust library for computational sociology: social networks, game theory, group dynamics, population models, opinion dynamics, inequality, coalition formation, collective decision-making, trust, and contagion.
§Modules
network— Social network graphs, Watts-Strogatz, Barabasi-Albert, BFS, centralitygame_theory— Nash equilibria, prisoner’s dilemma, iterated gamescoordination— N-player public goods, auctions, tragedy of the commons, folk theoremcoalition— Shapley value, core stability, faction merge/splitcollective— Voting (plurality, Borda, Condorcet), jury theorem, wisdom of crowdstrust— Trust propagation, reputation aggregation, decay, betrayalcontagion— Hatfield emotional contagion, SIS dynamics, mood propagationopinion— Bounded confidence, echo chambers, consensusgroup— Tuckman stages, social loafing, groupthinkpopulation— Logistic growth, SIR model, herd immunityinfluence— Conformity, social proof, Bass diffusioninequality— Gini coefficient, Lorenz curve
§Example
use sangha::population;
// Herd immunity threshold for R0 = 3
let h = population::herd_immunity_threshold(3.0).unwrap();
assert!((h - 2.0 / 3.0).abs() < 1e-10); // ~66.7%
// Gini coefficient of equal distribution
let g = sangha::inequality::gini_coefficient(&[100.0, 100.0, 100.0]).unwrap();
assert!(g.abs() < 1e-10); // perfect equalityRe-exports§
pub use error::SanghaError;
Modules§
- coalition
- Coalition game theory — Shapley value, core stability, faction dynamics.
- collective
- Group decision-making — voting methods, wisdom of crowds, jury theorem.
- contagion
- Emotional and behavioral contagion — Hatfield model, SIS dynamics, mood propagation.
- coordination
- Multi-agent coordination — public goods games, auctions, mechanism design.
- error
- Error types for the sangha sociology engine.
- game_
theory - Game theory — Nash equilibria, prisoner’s dilemma, evolutionary strategies.
- group
- Group dynamics — cohesion, social loafing, groupthink, Tuckman stages.
- inequality
- Inequality — Gini coefficient, Lorenz curve, distribution metrics.
- influence
- Social influence — conformity, diffusion, social proof.
- network
- Social networks — graph models, metrics, small-world properties.
- opinion
- Opinion dynamics — voter model, bounded confidence, polarization.
- population
- Population dynamics — growth models, epidemiology (SIR).
- trust
- Trust and reputation — trust propagation, reputation aggregation, decay, betrayal.