babylon.models.topology_metrics

Topology metrics data models for the Condensation Monitor (Sprint 3.1).

These Pydantic models capture the state of the solidarity network at each tick, enabling phase transition detection using percolation theory.

Models:

TopologySnapshot: Metrics snapshot at a specific tick ResilienceResult: Result of purge simulation (Sword of Damocles)

Theoretical Background (4-Phase Model):
  • Gaseous State: percolation < 0.1 (atomized, no coordination)

  • Transitional State: 0.1 <= percolation < 0.5 (emerging structure)

  • Liquid State: percolation >= 0.5, cadre_density < 0.5 (mass movement)

  • Solid State: percolation >= 0.5, cadre_density >= 0.5 (vanguard party)

Key Metric:

cadre_density = actual_liquidity / max(1, potential_liquidity)

Classes

ResilienceResult(**data)

Result of purge simulation (Sword of Damocles test).

TopologySnapshot(**data)

Metrics snapshot of the solidarity subgraph at a specific tick.

class babylon.models.topology_metrics.TopologySnapshot(**data)[source]

Bases: BaseModel

Metrics snapshot of the solidarity subgraph at a specific tick.

Captures the topological state of SOLIDARITY edges in the social graph, enabling detection of phase transitions from atomized (gaseous) to condensed (liquid) movement states.

Parameters:
tick

Simulation tick when snapshot was taken

num_components

Number of disconnected subgraphs (solidarity cells)

max_component_size

Size of the largest connected component (L_max)

total_nodes

Total number of social_class nodes (N)

percolation_ratio

L_max / N, measures giant component dominance

potential_liquidity

Count of SOLIDARITY edges > 0.1 (sympathizers)

actual_liquidity

Count of SOLIDARITY edges > 0.5 (cadre)

is_resilient

Whether movement survives 20% purge (optional)

Interpretation (4-Phase Model):
  • percolation_ratio < 0.1: Gaseous (atomized, no coordination)

  • 0.1 <= percolation_ratio < 0.5: Transitional (emerging structure)

  • percolation_ratio >= 0.5 AND cadre_density < 0.5: Liquid (mass movement)

  • percolation_ratio >= 0.5 AND cadre_density >= 0.5: Solid (vanguard party)

  • potential >> actual: Broad but brittle (lacks cadre discipline)

model_config: ClassVar[ConfigDict] = {'frozen': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

tick: int
num_components: int
max_component_size: int
total_nodes: int
percolation_ratio: Probability
potential_liquidity: int
actual_liquidity: int
cadre_density: float
is_resilient: bool | None
class babylon.models.topology_metrics.ResilienceResult(**data)[source]

Bases: BaseModel

Result of purge simulation (Sword of Damocles test).

Tests whether the solidarity network survives targeted removal of a percentage of nodes. A resilient network maintains its giant component after losing key members.

Parameters:
is_resilient

True if post-purge L_max > threshold of original L_max

original_max_component

Size of L_max before purge

post_purge_max_component

Size of L_max after purge

removal_rate

Fraction of nodes removed (e.g., 0.2 = 20%)

survival_threshold

Required fraction of original L_max to survive

seed

RNG seed for reproducibility (None if random)

Interpretation:
  • is_resilient=True: Network can survive targeted repression

  • is_resilient=False: “Sword of Damocles” - purge would destroy movement

model_config: ClassVar[ConfigDict] = {'frozen': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

is_resilient: bool
original_max_component: int
post_purge_max_component: int
removal_rate: float
survival_threshold: float
seed: int | None