babylon.models.entities.community
Community membership models for the hypergraph layer (Feature 022).
Communities are n-ary membership structures represented as XGI hyperedges. This module defines the data models for community state and agent membership.
See also
babylon.engine.systems.community: CommunitySystem that operates on these models.
Constitution II.7: Edges vs Hyperedges (NetworkX + XGI).
Functions
|
Compute effective infiltration ceiling reduced by community resistance. |
|
Return True if the community is on the hegemonic side of any axis. |
|
Return True if the community is marginalized (including institutional exclusion). |
Return marginalized communities shared by two agents. |
Classes
|
An agent's membership in a community. |
|
State of a community, independent of its members. |
- babylon.models.entities.community.is_hegemonic(community)[source]
Return True if the community is on the hegemonic side of any axis.
- Parameters:
community (
CommunityType) – A CommunityType member.- Return type:
- Returns:
True if hegemonic, False otherwise.
- babylon.models.entities.community.is_marginalized(community)[source]
Return True if the community is marginalized (including institutional exclusion).
- Parameters:
community (
CommunityType) – A CommunityType member.- Return type:
- Returns:
True if marginalized, False otherwise.
Return marginalized communities shared by two agents.
- Parameters:
agent_a_communities (
set[CommunityType]) – Set of community types agent A belongs to.agent_b_communities (
set[CommunityType]) – Set of community types agent B belongs to.
- Return type:
- Returns:
Set of CommunityType that are in both agents’ sets AND are marginalized.
- class babylon.models.entities.community.CommunityState(**data)[source]
Bases:
BaseModelState of a community, independent of its members.
Each community has collective attributes tracking state attention, internal cohesion, organizational infrastructure, and material modifiers applied to all members.
- Parameters:
community_type (CommunityType) – Identity of this community.
heat (Annotated[float, Ge(ge=0.0), Le(le=1.0), AfterValidator(func=~babylon.utils.math.quantize)]) – State attention/surveillance intensity [0, 1].
legal_status (LegalStatus) – Current legal designation (one-way escalation).
cohesion (Annotated[float, Ge(ge=0.0), Le(le=1.0), AfterValidator(func=~babylon.utils.math.quantize)]) – Internal trust and mutual aid effectiveness [0, 1].
infrastructure (Annotated[float, Ge(ge=0.0), Le(le=1.0), AfterValidator(func=~babylon.utils.math.quantize)]) – Organizational capacity (meeting spaces, comms) [0, 1].
visibility (Annotated[float, Ge(ge=0.0), Le(le=1.0), AfterValidator(func=~babylon.utils.math.quantize)]) – Community legibility to state surveillance [0, 1].
reproduction_cost_modifier (Annotated[float, Ge(ge=0)]) – Multiplier on V_reproduction for members.
rent_access_modifier (Annotated[float, Ge(ge=0.0), Le(le=1.0), AfterValidator(func=~babylon.utils.math.quantize)]) – Multiplier on imperial rent received by members.
category (HyperedgeCategory)
consciousness (TernaryConsciousness)
- model_config: ClassVar[ConfigDict] = {'frozen': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- community_type: CommunityType
- category: HyperedgeCategory
- heat: Probability
- legal_status: LegalStatus
- cohesion: Probability
- infrastructure: Probability
- visibility: Probability
- reproduction_cost_modifier: float
- rent_access_modifier: Coefficient
- consciousness: CommunityConsciousness
- education_pressure: float
- babylon.models.entities.community.effective_infiltration_ceiling(base_ceiling, target_community_states)[source]
Compute effective infiltration ceiling reduced by community resistance.
- Parameters:
base_ceiling (
float) – Base infiltration ceiling [0, 1].target_community_states (
list[CommunityState]) – Communities the target belongs to.
- Return type:
- Returns:
Reduced ceiling. At max resistance (~1.0), drops to ~30% of base.
- class babylon.models.entities.community.CommunityMembership(**data)[source]
Bases:
BaseModelAn agent’s membership in a community.
Represents the relationship between an individual agent and a community hyperedge. Each membership has a role determining integration level and a visibility determining legibility to state.
- Parameters:
agent_id (str) – Identifier of the member agent.
community_type (CommunityType) – Which community this membership is in.
role (MembershipRole) – Integration level within the community.
strength (Annotated[float, Ge(ge=0.0), Le(le=1.0), AfterValidator(func=~babylon.utils.math.quantize)]) – Membership weight [0, 1], derived from role default.
visibility (Annotated[float, Ge(ge=0.0), Le(le=1.0), AfterValidator(func=~babylon.utils.math.quantize)]) – Base legibility to state [0, 1].
overt (bool) – Publicly identified — overrides visibility to 1.0.
- model_config: ClassVar[ConfigDict] = {'frozen': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- agent_id: str
- community_type: CommunityType
- role: MembershipRole
- strength: Coefficient
- visibility: Probability
- overt: bool