Skip to content

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:

from honey_badgeria.visualization import DagVisualizer

viz = DagVisualizer(graph)
viz.render()

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

hbia viz flows/payment.yaml --ascii

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):

pip install honey-badgeria[viz]
from honey_badgeria.visualization import GraphvizRenderer

renderer = GraphvizRenderer(graph)
svg = renderer.render(output="graph", title="Payment Flow")

CLI

hbia viz flows/payment.yaml

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

hbia explain flows/payment.yaml

Output includes vertex count, edge count, sources, sinks, execution stages, and the complete edge list.