Module Analysis_and_optimization.Factor_graph

type factor =
  1. | TargetTerm of Middle.Expr.Typed.t
  2. | Reject
  3. | LPFunction of Core.string * Middle.Expr.Typed.t Core.list
val factor_of_sexp : Sexplib0.Sexp.t -> factor
val sexp_of_factor : factor -> Sexplib0.Sexp.t
val sexp_of_factor_graph : factor_graph -> Sexplib0.Sexp.t
val extract_factors_statement : (Middle.Expr.Typed.t, 'a) Middle.Stmt.Pattern.t -> factor Core.List.t
val extract_factors : ('a, (Middle.Expr.Typed.t, 'a) Middle.Stmt.Pattern.t * 'b) Core.Map.Poly.t -> 'a -> ('a * factor) Core.List.t
val build_adjacency_maps : (Dataflow_types.label * factor * Dataflow_types.vexpr Core.Set.Poly.t) Core.List.t -> factor_graph

Helper function to generate the factor graph adjacency map representation from a factor-adjacency list

val prog_factor_graph : ?exclude_data_facs:??? -> Middle.Program.Typed.t -> factor_graph

Build a factor graph from prog.log_prob using dependency analysis

BFS on 'fg' with initial frontier 'starts' and terminating at any element of 'goals'

Priors of V are neighbors of V which have no connection to any data except though V So for graph G and each parameter V: G' = G\V; For each neighbor F: Use BFS starting from F in G' and search for any data, if there is none, F is a prior

val string_of_factor : factor -> Core.string
val string_of_vexpr : Dataflow_types.vexpr -> Core.string
val factor_graph_to_dot : factor_graph -> Core.string

Utility to print a factor graph to the Graphviz dot language for visualization