Print Functions API
The groups below separate graph/model printers from inference-result and WLS printers used during interactive inspection.
Model and Graph
FactorGraph.printModel — Function
printModel(graph::GaussianFactorGraph)Print a compact summary of variables and factors.
Arguments
graph: Gaussian factor graph or Gaussian tree view.
Notes
This helper is intended for interactive inspection.
Example
x1 = GaussianVariable(:x1, 1)
f1 = GaussianFactor(:x1, 0.0, 1.0, 0.1; label = "f1")
graph = factorGraph([x1], [f1])
printModel(graph)FactorGraph.printGraph — Function
printGraph(graph::AbstractFactorGraph)Print variables, factors, and edge connectivity as tables.
Arguments
graph: Gaussian or discrete factor graph, or tree view.
Notes
The output shows each variable with connected factor labels and edge IDs, each factor with connected variable labels and edge IDs, and finally the edge list. This function is intended for interactive inspection.
Example
x1 = GaussianVariable(:x1, 1)
f1 = GaussianFactor(:x1, 0.0, 1.0, 0.1; label = "f1")
graph = factorGraph([x1], [f1])
printGraph(graph)FactorGraph.printEdges — Function
printEdges(graph::AbstractFactorGraph)Print one line per graph edge.
Arguments
graph: Gaussian or discrete factor graph, or tree view.
Notes
Each line has the form edge_id: variable <-> factor.
Example
x1 = GaussianVariable(:x1, 1)
f1 = GaussianFactor(:x1, 0.0, 1.0, 0.1; label = "f1")
graph = factorGraph([x1], [f1])
printEdges(graph)Inference
FactorGraph.printMessages — Function
printMessages(
graph::AbstractFactorGraph, inference::AbstractInference;
variable = nothing, factor = nothing
)Print messages using exactly one keyword filter:
Arguments
graph: Gaussian or discrete factor graph, or tree view.inference: Matching inference object.
Keywords
variable: Variable ID or label for variable-to-factor messages.factor: Factor index or label for factor-to-variable messages.
Notes
Use exactly one keyword filter. variable = label prints messages from the variable node to connected factor nodes. factor = label prints messages from the factor node to connected variable nodes.
The printed fields depend on the inference form: moment form prints mean and covariance, canonical form prints information and precision, and min-sum form prints costs or quadratic-message data.
Example
x1 = GaussianVariable(:x1, 1)
f1 = GaussianFactor(:x1, 0.0, 1.0, 0.1; label = "f1")
graph = factorGraph([x1], [f1])
inference = moment(graph)
messages!(graph, inference)
printMessages(graph, inference; variable = :x1)FactorGraph.printMarginal — Function
printMarginal(
graph::AbstractFactorGraph, inference::AbstractSumProductInference;
variable = nothing
)Print variable marginals. If variable is omitted, all variable marginals are printed.
Arguments
graph: Gaussian or discrete factor graph, or tree view.inference: Matching inference object.
Keywords
variable: Optional variable ID or label.
Notes
Moment-form marginals print mean and covariance. Canonical-form marginals also print information and precision.
Example
x1 = GaussianVariable(:x1, 1)
f1 = GaussianFactor(:x1, 0.0, 1.0, 0.1; label = "f1")
graph = factorGraph([x1], [f1])
inference = moment(graph)
gbp!(graph, inference)
printMarginal(graph, inference; variable = :x1)FactorGraph.printEstimate — Function
printEstimate(
graph::AbstractFactorGraph, inference::AbstractMinSumInference;
variable = nothing
)Print min-sum MAP estimates. If variable is omitted, all variable estimates are printed.
Arguments
graph: Gaussian or discrete factor graph, or tree view.inference: Matching min-sum inference object.
Keywords
variable: Optional variable ID or label.
Example
x1 = GaussianVariable(:x1, 1)
f1 = GaussianFactor(:x1, 0.0, 1.0, 0.1; label = "f1")
graph = factorGraph([x1], [f1])
inference = minsum(graph)
gbp!(graph, inference)
printEstimate(graph, inference; variable = :x1)Weighted Least Squares
FactorGraph.printWLS — Function
printWLS(
graph::Union{GaussianFactorGraph, TreeFactorGraph{GaussianFactorGraph}},
result::WeightedLeastSquaresResult
)Print a weighted least-squares result.
Arguments
graph: Gaussian factor graph or tree view.result: Weighted least-squares result.
Notes
Prints one mean and covariance block per Gaussian variable.
Example
x1 = GaussianVariable(:x1, 1)
f1 = GaussianFactor(:x1, 0.0, 1.0, 0.1; label = "f1")
graph = factorGraph([x1], [f1])
result = solveWLS(graph)
printWLS(graph, result)