Visualization¶
HBIA provides two visualization backends for rendering DAGs: ASCII art (works out of the box) and Graphviz (requires the viz extra).
DagVisualizer¶
The DagVisualizer auto-detects the best available renderer:
If Graphviz is installed, it uses the Graphviz renderer. Otherwise, it falls back to ASCII.
ASCII Renderer¶
Terminal-friendly visualization:
from honey_badgeria.visualization import AsciiRenderer
renderer = AsciiRenderer(graph)
output = renderer.render()
print(output)
CLI¶
Output Example¶
╔═══════════════════════════════════════════════════════╗
║ HBIA DAG
║ flows: create_user
║ 3 vertices · 2 edges
╚═══════════════════════════════════════════════════════╝
┌── Step 1 ─────────────────────────────────────────┐
│ ▶ normalize_user → normalize
└────────────────────────────────────────────────────┘
↓ validate_user
┌── Step 2 ─────────────────────────────────────────┐
│ validate_user → validate
└────────────────────────────────────────────────────┘
↓ save_user
┌── Step 3 ─────────────────────────────────────────┐
│ save_user → save
└────────────────────────────────────────────────────┘
Connections
─────────────────────────────────────────────────────
normalize_user ──▶ validate_user
validate_user ──▶ save_user
Graphviz Renderer¶
For graphical output (SVG, PNG, PDF):
from honey_badgeria.visualization import GraphvizRenderer
renderer = GraphvizRenderer(graph)
svg = renderer.render(output="graph", title="Payment Flow")
CLI¶
Graph Explainer¶
For text-based descriptions rather than visual diagrams:
from honey_badgeria.back.explain import GraphExplainer
explainer = GraphExplainer(graph)
explainer.explain() # Print to stdout
lines = explainer.explain_lines() # list[str]
dict_view = explainer.to_dict() # dict for AI consumption
CLI¶
Output includes vertex count, edge count, sources, sinks, execution stages, and the complete edge list.