335 lines
9.6 KiB
Markdown
335 lines
9.6 KiB
Markdown
# Temporal Attractor Networks with MinCut Analysis
|
||
|
||
This example demonstrates how networks evolve toward stable "attractor states" and how minimum cut analysis helps detect convergence to these attractors.
|
||
|
||
## What are Temporal Attractors?
|
||
|
||
In **dynamical systems theory**, an **attractor** is a state toward which a system naturally evolves over time, regardless of initial conditions (within a basin).
|
||
|
||
### Real-World Analogies
|
||
|
||
```
|
||
๐๏ธ Gravitational Attractor
|
||
โฑโฒ ball
|
||
โฑ โฒ โ
|
||
โฑ____โฒ valley (attractor)
|
||
|
||
๐ Hydraulic Attractor
|
||
โฑโฒ โฑโฒ
|
||
โฑ โฒ_โฑ โฒ โ water flows to lowest point
|
||
|
||
๐ธ๏ธ Network Attractor
|
||
Sparse โ Dense
|
||
โฏ โฏ โฏโโฏ
|
||
โฒโฑ โ โโณโ (maximum connectivity)
|
||
โฏ โฏโโฏ
|
||
```
|
||
|
||
### Three Types of Network Attractors
|
||
|
||
#### 1๏ธโฃ Optimal Attractor (Maximum Connectivity)
|
||
|
||
**What it is**: Network evolves toward maximum connectivity and robustness.
|
||
|
||
```
|
||
Initial State (Ring): Final State (Dense):
|
||
โฏโโฏโโฏ โฏโโฏโโฏ
|
||
โ โ โโณโโณโ
|
||
โฏโโฏโโฏ โฏโโฏโโฏ
|
||
MinCut: 1 MinCut: 6+
|
||
```
|
||
|
||
**MinCut Evolution**:
|
||
```
|
||
Step: 0 10 20 30 40 50
|
||
โ โ โ โ โ โ
|
||
MinCut 1 โโโ2โโโโ4โโโโ5โโโโ6โโโโ6 (stable)
|
||
โ โ
|
||
Adding edges Converged!
|
||
```
|
||
|
||
**Why it matters for swarms**:
|
||
- โ
Fault-tolerant communication
|
||
- โ
Maximum information flow
|
||
- โ
Robust against node failures
|
||
- โ
Optimal for multi-agent coordination
|
||
|
||
#### 2๏ธโฃ Fragmented Attractor (Network Collapse)
|
||
|
||
**What it is**: Network fragments into disconnected clusters.
|
||
|
||
```
|
||
Initial State (Connected): Final State (Fragmented):
|
||
โฏโโฏโโฏ โฏโโฏ โฏ
|
||
โ โ โฒโ
|
||
โฏโโฏโโฏ โฏ โฏโโฏ
|
||
MinCut: 1 MinCut: 0
|
||
```
|
||
|
||
**MinCut Evolution**:
|
||
```
|
||
Step: 0 10 20 30 40 50
|
||
โ โ โ โ โ โ
|
||
MinCut 1 โโโ1โโโโ0โโโโ0โโโโ0โโโโ0 (stable)
|
||
โ โ
|
||
Removing edges Disconnected!
|
||
```
|
||
|
||
**Why it matters for swarms**:
|
||
- โ Communication breakdown
|
||
- โ Isolated agents
|
||
- โ Coordination failure
|
||
- โ Poor swarm performance
|
||
|
||
#### 3๏ธโฃ Oscillating Attractor (Limit Cycle)
|
||
|
||
**What it is**: Network oscillates between states periodically.
|
||
|
||
```
|
||
State A: State B: State A:
|
||
โฏโโฏ โฏโโฏ โฏโโฏ
|
||
โ โ โ โ โ โ โ โ ...
|
||
โฏโโฏ โฏโโฏ โฏโโฏ
|
||
```
|
||
|
||
**MinCut Evolution**:
|
||
```
|
||
Step: 0 10 20 30 40 50
|
||
โ โ โ โ โ โ
|
||
MinCut 1 โโโ3โโโโ1โโโโ3โโโโ1โโโโ3 (periodic)
|
||
โ โ โ โ โ โ โ โ
|
||
Oscillating pattern!
|
||
```
|
||
|
||
**Why it matters for swarms**:
|
||
- โ ๏ธ Unstable equilibrium
|
||
- โ ๏ธ May indicate resonance
|
||
- โ ๏ธ Requires damping
|
||
- โ ๏ธ Unpredictable behavior
|
||
|
||
## How MinCut Detects Convergence
|
||
|
||
The **minimum cut value** serves as a "thermometer" for network health:
|
||
|
||
### Convergence Patterns
|
||
|
||
```
|
||
๐ INCREASING MinCut โ Strengthening
|
||
0โ1โ2โ3โ4โ5โ6โ6โ6 โ
Converging to optimal
|
||
โโโดโ Stable (attractor reached)
|
||
|
||
๐ DECREASING MinCut โ Fragmenting
|
||
6โ5โ4โ3โ2โ1โ0โ0โ0 โ Network collapsing
|
||
โโโดโ Stable (disconnected)
|
||
|
||
๐ OSCILLATING MinCut โ Limit Cycle
|
||
1โ3โ1โ3โ1โ3โ1โ3โ1 โ ๏ธ Periodic pattern
|
||
โโโดโโดโโดโโดโโดโโดโโโ Oscillating attractor
|
||
```
|
||
|
||
### Mathematical Interpretation
|
||
|
||
**Variance Analysis**:
|
||
```
|
||
Variance = ฮฃ(MinCut[i] - Mean)ยฒ / N
|
||
|
||
Low Variance (< 0.5): STABLE โ Attractor reached โ
|
||
High Variance (> 5): OSCILLATING โ Limit cycle โ ๏ธ
|
||
Medium Variance: TRANSITIONING โ Still evolving
|
||
```
|
||
|
||
## Why This Matters for Swarms
|
||
|
||
### Multi-Agent Systems Naturally Form Attractors
|
||
|
||
```
|
||
Agent Swarm Evolution:
|
||
|
||
t=0: Random deployment t=20: Self-organizing t=50: Converged
|
||
๐ค ๐ค ๐คโ๐ค ๐คโ๐ค
|
||
๐ค ๐ค ๐ค โฑโ โโฒ โโณโโณโ
|
||
๐ค ๐ค ๐คโ๐คโ๐ค ๐คโ๐คโ๐ค
|
||
|
||
MinCut: 0 MinCut: 2 MinCut: 6 (stable)
|
||
(disconnected) (organizing) (optimal attractor)
|
||
```
|
||
|
||
### Real-World Applications
|
||
|
||
1. **Drone Swarms**: Need optimal attractor for coordination
|
||
- MinCut monitors communication strength
|
||
- Detects when swarm has stabilized
|
||
- Warns if swarm is fragmenting
|
||
|
||
2. **Distributed Computing**: Optimal attractor = efficient topology
|
||
- MinCut shows network resilience
|
||
- Identifies bottlenecks early
|
||
- Validates load balancing
|
||
|
||
3. **Social Networks**: Understanding community formation
|
||
- MinCut reveals cluster strength
|
||
- Detects community splits
|
||
- Predicts group stability
|
||
|
||
## Running the Example
|
||
|
||
```bash
|
||
# Build and run
|
||
cd /home/user/ruvector/examples/mincut/temporal_attractors
|
||
cargo run --release
|
||
|
||
# Expected output: 3 scenarios showing different attractor types
|
||
```
|
||
|
||
### Understanding the Output
|
||
|
||
```
|
||
Step | MinCut | Edges | Avg Conn | Time(ฮผs) | Status
|
||
------|--------|-------|----------|----------|------------------
|
||
0 | 1 | 10 | 1.00 | 45 | evolving...
|
||
5 | 2 | 15 | 1.50 | 52 | evolving...
|
||
10 | 4 | 23 | 2.30 | 68 | evolving...
|
||
15 | 6 | 31 | 3.10 | 89 | evolving...
|
||
20 | 6 | 34 | 3.40 | 95 | โ CONVERGED
|
||
```
|
||
|
||
**Key Metrics**:
|
||
- **MinCut**: Network's bottleneck capacity
|
||
- **Edges**: Total connections
|
||
- **Avg Conn**: Average edges per node
|
||
- **Time**: Performance per evolution step
|
||
- **Status**: Convergence detection
|
||
|
||
## Code Structure
|
||
|
||
### Main Components
|
||
|
||
```rust
|
||
// 1. Network snapshot (state at each time step)
|
||
NetworkSnapshot {
|
||
step: usize,
|
||
mincut: u64,
|
||
edge_count: usize,
|
||
avg_connectivity: f64,
|
||
}
|
||
|
||
// 2. Attractor network (evolving system)
|
||
AttractorNetwork {
|
||
graph: Graph,
|
||
attractor_type: AttractorType,
|
||
history: Vec<NetworkSnapshot>,
|
||
}
|
||
|
||
// 3. Evolution methods (dynamics)
|
||
evolve_toward_optimal() // Add shortcuts, strengthen edges
|
||
evolve_toward_fragmented() // Remove edges, weaken connections
|
||
evolve_toward_oscillating() // Alternate add/remove
|
||
```
|
||
|
||
### Key Methods
|
||
|
||
```rust
|
||
// Evolve one time step
|
||
network.evolve_step() -> NetworkSnapshot
|
||
|
||
// Check if converged to attractor
|
||
network.has_converged(window: usize) -> bool
|
||
|
||
// Get evolution history
|
||
network.history() -> &[NetworkSnapshot]
|
||
|
||
// Calculate current mincut
|
||
calculate_mincut() -> u64
|
||
```
|
||
|
||
## Key Insights
|
||
|
||
### 1. MinCut as Health Monitor
|
||
|
||
```
|
||
High MinCut (6+): Healthy, robust network โ
|
||
Medium MinCut (2-5): Moderate connectivity โ ๏ธ
|
||
Low MinCut (1): Fragile, single bottleneck โ ๏ธ
|
||
Zero MinCut (0): Disconnected, failed โ
|
||
```
|
||
|
||
### 2. Convergence Detection
|
||
|
||
```rust
|
||
// Stable variance โ Attractor reached
|
||
variance < 0.5 โน Equilibrium
|
||
variance > 5.0 โน Oscillating
|
||
```
|
||
|
||
### 3. Evolution Speed
|
||
|
||
```
|
||
Optimal Attractor: Fast convergence (10-20 steps)
|
||
Fragmented Attractor: Medium speed (15-30 steps)
|
||
Oscillating Attractor: Never converges (limit cycle)
|
||
```
|
||
|
||
## Advanced Topics
|
||
|
||
### Basin of Attraction
|
||
|
||
```
|
||
Optimal Basin Fragmented Basin
|
||
โฑ โฒ โฑ โฒ
|
||
โ โโโโโโโโโโโ โ โ โโโโโโโ โ
|
||
โ โ Optimal โ โ โ โ Fragโ โ
|
||
โ โAttractorโ โ โ โment โ โ
|
||
โ โโโโโโโโโโโ โ โ โโโโโโโ โ
|
||
โฒ โฑ โฒ โฑ
|
||
Any initial state Any initial state
|
||
in this region โ in this region โ
|
||
converges here converges here
|
||
```
|
||
|
||
### Bifurcation Points
|
||
|
||
Critical thresholds where attractor type changes:
|
||
```
|
||
Parameter (e.g., edge addition rate)
|
||
โ
|
||
โ โโโโโโโโโโโโโโ Optimal
|
||
โ โฑ
|
||
โโโโโโโโโโโโโโโโโโ Bifurcation point
|
||
โ โฒ
|
||
โ โโโโโโโโโโโโโโ Fragmented
|
||
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
||
```
|
||
|
||
### Lyapunov Stability
|
||
|
||
MinCut variance measures stability:
|
||
```
|
||
dMinCut/dt < 0 โ Stable attractor
|
||
dMinCut/dt > 0 โ Unstable, moving away
|
||
dMinCut/dt โ 0 โ Near equilibrium
|
||
```
|
||
|
||
## References
|
||
|
||
- **Dynamical Systems Theory**: Strogatz, "Nonlinear Dynamics and Chaos"
|
||
- **Network Science**: Barabรกsi, "Network Science"
|
||
- **Swarm Intelligence**: Bonabeau et al., "Swarm Intelligence"
|
||
- **MinCut Algorithms**: Stoer-Wagner (1997), Karger (2000)
|
||
|
||
## Performance Notes
|
||
|
||
- **Time Complexity**: O(Vยณ) per step (dominated by mincut calculation)
|
||
- **Space Complexity**: O(V + E + H) where H is history length
|
||
- **Typical Runtime**: ~50-100ฮผs per step for 10-node networks
|
||
|
||
## Educational Value
|
||
|
||
This example teaches:
|
||
1. โ
What temporal attractors are and why they matter
|
||
2. โ
How networks naturally evolve toward stable states
|
||
3. โ
Using MinCut as a convergence detector
|
||
4. โ
Interpreting attractor basins and stability
|
||
5. โ
Applying these concepts to multi-agent swarms
|
||
|
||
Perfect for understanding how swarms self-organize and how to monitor their health!
|