DAG structure
Every Reasoning Graph contains three tiers of nodes connected by directed edges:
Only active metrics (those with a non-zero weight in your config) appear in the graph. Disabled or zero-weight metrics are silently excluded from both computation and visualization.
Color coding
Node and edge colors communicate trust level at a glance:
The thresholds used for coloring are pulled from each metric’s own config — for example,
STRONG_GROUNDING and PARTIAL_GROUNDING for the Evidence Coverage node — so the colors reflect the same thresholds you configured for the labels.
Building the graph
Callbuild_reasoning_graph() on the result returned by get_trust_score(). The graph is a pure data structure (ReasoningGraph) — no rendering happens yet.
Visualizing the graph
Pass theReasoningGraph to visualize() and choose a graph_type. TrustifAI supports two renderers:
PyVis output
The PyVis renderer produces a self-contained HTML file (reasoning_graph.html by default) with a physics-based interactive layout. Metric nodes are arranged in a circle around the central aggregation diamond. You can drag nodes, zoom, and hover over any node to see its score, label, and diagnostic explanation in a tooltip.
PyVis requires the optional pyvis package:

Mermaid output
The Mermaid renderer returns a fenced code block ready for embedding in GitHub, Notion, or any documentation site that renders Mermaid diagrams. Each node is styled with the same color coding as the PyVis graph. Example output:Complete example
The following snippet shows the full evaluate-then-visualize workflow in both output formats:Graph data model
If you need to process the graph programmatically — for logging, serialization, or custom rendering — callgraph.to_dict():
trace_id (UUID4) so you can correlate graphs with specific evaluation runs in logs or tracing systems.
The Reasoning Graph is built purely from the
get_trust_score() result dict — it does not make any additional API calls. You can safely rebuild or re-render it as many times as needed from the same result object.