pygraphistry icon indicating copy to clipboard operation
pygraphistry copied to clipboard

Docs: add Mermaid/DOT exports for small graphs (PyGraphistry -> viz)

Open lmeyerov opened this issue 1 month ago • 0 comments

Summary

Add export targets for Mermaid and DOT from PyGraphistry (small graphs), and use them to auto-generate visuals in docs (e.g., GFQL examples) so readers get rendered diagrams across GitHub/RTD/notebooks/PDF.

Motivation

  • GitHub Markdown renders Mermaid natively; DOT/Graphviz can be rendered to SVG/PNG for broad compatibility (RTD, PDFs, notebooks).
  • Our GFQL docs (e.g., hop examples) could benefit from small graph diagrams alongside code/output.
  • Cross-platform rendering is easier if we pre-render DOT/Mermaid to images during docs build.

Proposal

  1. PyGraphistry export helpers
  • Add small-graph export to Mermaid and DOT (e.g., , ) for CPU/GPU graphs.
  • Keep outputs small/deterministic (sampling/limits) to stay doc-friendly.
  1. Docs integration
  • Add a docs render step that takes / and emits SVG/PNG for inclusion in Sphinx/nbsphinx (Graphviz or mermaid-cli), committed or built in CI.
  • Use these in GFQL docs (e.g., hop_bounds, quick/spec) to show the toy graphs as diagrams (with labels where appropriate).
  • Prefer DOT as canonical (Graphviz works well for HTML/PDF), optionally include Mermaid text for GitHub MD niceties.
  1. Tooling
  • Add a Make target/script (e.g., ) to collect exports and render to /.
  • If RTD can’t run mermaid-cli/node, commit rendered assets; otherwise render in docs CI.

Open Questions

  • Should Mermaid be first-class or just DOT + optional Mermaid sidecar?
  • Where to hook export: Plottable method vs. helper util (to keep API surface small)?
  • How to sample/limit graph size for readable diagrams (node/edge caps, layout choice)?

lmeyerov avatar Nov 30 '25 06:11 lmeyerov