pub struct ExprGraph { /* private fields */ }Expand description
Topologically ordered, serializable representation of an Expr DAG.
Implementations§
Source§impl ExprGraph
impl ExprGraph
Sourcepub fn with_parameters<N, I>(&self, updates: I) -> ParamResult<Self>
pub fn with_parameters<N, I>(&self, updates: I) -> ParamResult<Self>
Return a copy of this graph with a batch of parameter updates applied.
Updates are keyed by parameter name and every occurrence of a named scalar parameter is updated. The operation is atomic: duplicate or unknown names, invalid patches, conflicts, and invalid final definitions leave the original graph untouched.
§Errors
Returns ParamError when an update is duplicated, unknown, invalid,
or leaves parameter definitions in conflict.
Replaces tagged components that match none of tags with zero.
Untagged nodes remain active, and a matching tagged node retains its entire subtree.
§Panics
Panics only if an internal graph-rebuild invariant is violated.
Sourcepub fn from_parts(
root: ExprId,
nodes: Vec<ExprNode>,
metadata: Vec<ExprMetadata>,
) -> Result<Self, ExprGraphError>
pub fn from_parts( root: ExprId, nodes: Vec<ExprNode>, metadata: Vec<ExprMetadata>, ) -> Result<Self, ExprGraphError>
Validates and constructs a graph from its serialized parts.
Child nodes must precede their parents, metadata must have one entry per
node, and root must identify an existing node.
§Errors
Returns ExprGraphError when the graph is empty, the metadata and
node lengths differ, root is invalid, or a child identifier is
invalid or does not precede its parent.
Sourcepub fn node(&self, id: ExprId) -> Option<&ExprNode>
pub fn node(&self, id: ExprId) -> Option<&ExprNode>
Returns the node identified by id, if it exists.
Sourcepub fn metadata(&self, id: ExprId) -> Option<&ExprMetadata>
pub fn metadata(&self, id: ExprId) -> Option<&ExprMetadata>
Returns the metadata associated with id, if it exists.
Source§impl ExprGraph
impl ExprGraph
Sourcepub fn display_tree(&self) -> ExprGraphTreeDisplay<'_>
pub fn display_tree(&self) -> ExprGraphTreeDisplay<'_>
Creates a configurable indented-tree display.
Sourcepub fn display_equation(&self) -> ExprGraphEquationDisplay<'_>
pub fn display_equation(&self) -> ExprGraphEquationDisplay<'_>
Creates a configurable compact-equation display.
Sourcepub fn display_latex(&self) -> ExprGraphLatexDisplay<'_>
pub fn display_latex(&self) -> ExprGraphLatexDisplay<'_>
Creates a configurable LaTeX equation display.
Sourcepub fn display_dot(&self) -> ExprGraphDotDisplay<'_>
pub fn display_dot(&self) -> ExprGraphDotDisplay<'_>
Creates a configurable Graphviz DOT display.