hydra.graphviz.coder module

Functions for converting Hydra terms to Graphviz DOT graphs.

hydra.graphviz.coder.collect_let_refs(path: SubtermPath, node: TermNode) → Sequence[tuple[Name, str]]

Collect (target binding, printed path) for every let-reference in a term node’s tree.

hydra.graphviz.coder.graph_to_subterm_dot_graph(graph: Graph) → Graph

Convert a typed graph to a subterm-style (link-view) DOT graph.

hydra.graphviz.coder.graph_to_subterm_dot_stmts(namespaces: Mapping[ModuleName, str], graph: Graph) → Sequence[Stmt]

Convert a typed graph to binding-level DOT statements over the term graph.

hydra.graphviz.coder.label_attr(lab: str) → EqualityPair

Create a DOT label attribute.

hydra.graphviz.coder.label_attrs(style: str, lab: str) → AttrList

Create DOT label attributes with a node style.

hydra.graphviz.coder.term_label(compact: bool, namespaces: Mapping[ModuleName, str], term: Term) → tuple[str, str]

Compute a label and node style for a term.

hydra.graphviz.coder.term_to_dot_graph(term: Term) → Graph

Convert a term to a full DOT graph.

hydra.graphviz.coder.term_to_dot_stmts(namespaces: Mapping[ModuleName, str], term: Term) → Sequence[Stmt]

Convert a term to full DOT statements showing term structure.

hydra.graphviz.coder.to_edge_stmt(i1: Id, i2: Id, attrs: object) → Stmt

Create a DOT edge statement.

hydra.graphviz.coder.to_node_id(i: Id) → NodeId

Create a DOT NodeId from an Id.

hydra.graphviz.coder.to_node_or_subgraph(i: Id) → NodeOrSubgraph

Create a DOT NodeOrSubgraph from an Id.