Conceptual Overview
1. What PropFlow Solves
PropFlow is a belief propagation (BP) experimentation platform. It builds factor graphs, runs synchronous BP with configurable policies, and records the evolution of messages, assignments, and costs. The toolkit targets researchers and engineers who need a reproducible environment for comparing BP variants such as pure Min-Sum, damped updates, splitting, or custom convergence strategies.
2. Core Runtime Concepts
Concept |
Description |
---|---|
Factor Graph |
Bipartite graph of |
Message |
Directed data structure ( |
Engine |
Implementation of the BP update loop ( |
Policy |
Optional behaviours applied during message computation: damping, splitting, cost reduction, pruning. Policies live under |
Simulator |
High-level runner ( |
History & Snapshots |
Built-in engine history stores assignments, costs, and optional BCT artefacts. External snapshot tooling ( |
Analyzer Utilities |
Lightweight visual tools such as the |
3. Creation Pipeline (Top-Down)
PropFlow’s runtime mirrors the documentation flow:
Agents —
VariableAgent
andFactorAgent
live insrc/propflow/core/agents.py
. They encapsulate message mailboxes and call into computators.Factor graphs —
FactorGraph
(src/propflow/bp/factor_graph.py
) stitches agents together, assigns dimension indices, and triggers cost-table creation. UseFGBuilder
helpers (src/propflow/utils/fg_utils.py
) wherever possible.Engines —
BPEngine
and variants (src/propflow/bp/engine_base.py
,src/propflow/bp/engines.py
) orchestrate the synchronous message schedule, apply policies, and record history.Simulator —
Simulator
(src/propflow/simulator.py
) executes batches of engine configurations over one or many graphs, typically for benchmarks or parameter sweeps.Analyzer — Modules under
src/analyzer/
capture snapshots and visualise results, letting you inspect or report on specific runs.
The quickest path for an end user is thus:
FGBuilder → BPEngine (or variant) → Simulator (optional) → Analyzer tooling
.
Drop down to manual factor graph construction only when you need a topology that
FGBuilder
does not support, taking care to supply ordered factor–variable edge
lists so cost-table dimensions remain aligned.
4. Directory Layout
src/
propflow/
bp/ # Engines, engine components, factor graph primitives
core/ # Shared agent/message abstractions
policies/ # Damping, splitting, convergence controls
configs/ # Global defaults, logging, registries
utils/ # Graph builders, tooling (FGBuilder, etc.)
simulator.py # High-level simulation orchestrator
cli.py # Placeholder CLI entrypoint
analyzer/
snapshot_recorder.py # External recorder for per-step data capture
snapshot_visualizer.py # Visualiser for argmin trajectories
README.md # Snapshot tooling guide
examples/ # Demonstrations (e.g. min-sum walkthrough)
tests/ # Pytest suite covering engines, policies, utilities
docs/handbook/ # Deployment & operations handbook (this document)
configs/ # Logs and generated artefacts (excluded from version control)
5. Data Flow Through an Engine Step
Variable Phase: Variable agents read inbox messages (
Mailer
component), compute outgoing Q-messages via the assigned computator (default Min-Sum), and stage them.Variable Send & Reset: Messages are dispatched; inboxes are cleared in preparation for the next iteration.
Factor Phase: Factor agents assemble incoming Q-messages and cost tables to compute R-messages back to neighbours.
Factor Send & Reset: R-messages are sent, and mailboxes are cleared.
Bookkeeping: Engine updates the global cost, logs history, and (optionally) emits snapshot records via
SnapshotManager
or external recorders.Convergence Checks: Using
ConvergenceMonitor
and the configured thresholds, engines decide whether to halt.
This loop repeats for each iteration until convergence or the configured maximum is reached.
6. Extensibility Points
Custom Engines: Subclass
BPEngine
and override hooks (post_var_compute
,pre_factor_compute
, etc.). Register the class in simulation configs for reuse.Policies: Implement new policies under
src/propflow/policies
and wire them into engines or simulator configs.Cost Table Factories: Extend
CTFactory
registries insrc/propflow/configs/global_config_mapping.py
to generate domain-specific cost tables.Analysis: Use
EngineSnapshotRecorder
to capture structured outputs suitable for dashboards, machine learning pipelines, or audits.
7. Operational Roles
Simulation Engineer: Configures factor graphs, chooses engine variants, evaluates convergence metrics.
Algorithm Researcher: Modifies computators, policies, or engines to test new BP strategies.
Data Analyst: Uses snapshot recordings and visualisers to interpret message dynamics and assignment stability.
DevOps / Platform Team: Deploys the simulator into production or research clusters, automates pipelines, and monitors resource consumption.
Understanding these components provides the foundation for the remaining sections, which focus on getting the project running, deploying it reliably, and maintaining it over time.