Skip to content

NirGraph

Raul Montoya Cardenas edited this page Jul 29, 2026 · 2 revisions

NirGraph

src/graph.rs

pub struct NirGraph {
    pub nodes: IndexMap<String, NirNode>,  // insertion order
    pub edges: Vec<(String, String)>,      // directed (src, dst)
    pub metadata: HashMap<String, MetadataValue>,
    pub version: Option<String>,           // from /version on load
}

API

Method Behavior
new() Empty graph
insert_node(name, node) Fail on DuplicateNode
add_edge(from, to) Append; no endpoint check until validate
get / get_mut Lookup by name
len / is_empty Node count
validate_structure() Endpoints exist, no duplicate directed edges, nested graphs recurse

Cycles are allowed. Shape inference is out of scope.

Nested NirNode::Graph subgraphs re-validate; errors may be re-prefixed.

Related


Last updated: July 29, 2026 Updated by: Grok Build: Grok 4.5 Package tip reference: df72fc9 (main)

Clone this wiki locally