bloc.plotting.network_mermaid#

Render a STONE model’s network topology as a Mermaid flowchart.

Derives the diagram straight from a model’s YAML network: (or staged stages:) section – the same source Boulder’s Cytoscape graph reads – instead of hand-drawing a diagram that would need to be kept in sync by hand. Only structural fields are read (node/connector id and kind, source, target): no operating parameters, so the output is safe to commit even for proprietary models.

CLI:

python -m bloc.plotting.network_mermaid models/SPRING_A4B/SPRING_A4B_BG.yaml

prints a ```` `mermaid `` fenced block ready to paste into a README. Add --sync-readme to instead write it into that model’s README.md, between auto-generated markers – rerunning updates only that section.

Functions#

generate_mermaid(yaml_path[, direction])

Return Mermaid flowchart source for the network in yaml_path.

sync_readme(yaml_path)

Write/replace the auto-generated diagram section in the model's README.

main([argv])

Module Contents#

bloc.plotting.network_mermaid.generate_mermaid(yaml_path, direction='LR')#

Return Mermaid flowchart source for the network in yaml_path.

Staged configs (stages: + per-stage entry lists) render one subgraph per stage; a flat network: renders unwrapped.

bloc.plotting.network_mermaid.sync_readme(yaml_path)#

Write/replace the auto-generated diagram section in the model’s README.

Looks for README.md next to yaml_path. Idempotent: a section already bounded by _DIAGRAM_START/_DIAGRAM_END is replaced in place; otherwise the section is appended at the end of the file.

bloc.plotting.network_mermaid.main(argv=None)#