PropFlow Documentation
PropFlow is a Python toolkit for building and experimenting with belief propagation and other distributed constraint optimization (DCOP) algorithms on factor graphs.
Quick Start
Install PropFlow from PyPI:
pip install propflow
Basic Example:
from propflow import BPEngine, FGBuilder
from propflow.configs import create_random_int_table
# Create a simple factor graph
fg = FGBuilder.build_cycle_graph(
num_vars=5,
domain_size=2,
ct_factory=create_random_int_table,
ct_params={'low': 1, 'high': 10}
)
# Run belief propagation
engine = BPEngine(fg)
engine.run(max_iter=20)
print(f"Solution: {engine.assignments}")
Learning Path
PropFlow’s documentation follows the same top-down pipeline implemented in the runtime:
Quick Start Guide gives you runnable snippets using the recommended flow (
FGBuilder→ engine → simulator).PropFlow User Guide dives into each layer in detail—from agents up through snapshot tooling—highlighting when to rely on helpers versus manual wiring.
Snapshot How-To (Updated) provides a comprehensive guide to capturing, analyzing, and visualizing algorithm state at each iteration—essential for debugging and validating convergence.
PropFlow Handbook covers operational practices, deployments, and deeper troubleshooting once you’re running larger studies.
Key Features
Belief propagation variants: Min-Sum, Max-Sum, Sum-Product, and Max-Product computators
Policy engines: damping, Q/R damping, splitting, mid-run splitting, cost reduction, diffusion, pruning, and TRW
Dynamic graph construction: cycle, random, lemniscate, unary-augmented, and manual factor graphs
Simulation and analysis: multiprocessing-backed comparisons through
SimulatorSnapshot tooling: automatic
EngineSnapshotcapture plus analyzer and visualizer helpers