pub struct ExprGraph { /* private fields */ }Expand description
Topologically ordered, serializable representation of an Expr DAG.
Implementations§
Source§impl ExprGraph
impl ExprGraph
Sourcepub fn fix_parameter(&self, name: &str, value: f64) -> ParamResult<Self>
pub fn fix_parameter(&self, name: &str, value: f64) -> ParamResult<Self>
Return a copy of this graph with the named scalar parameter fixed.
§Errors
Returns ParamError::UnknownName when the graph has no scalar
parameter named name, or ParamError::FixedValueOutOfBounds when
value is outside that parameter’s bounds.
Sourcepub fn free_parameter(&self, name: &str) -> ParamResult<Self>
pub fn free_parameter(&self, name: &str) -> ParamResult<Self>
Return a copy of this graph with the named scalar parameter free.
§Errors
Returns ParamError::UnknownName when the graph has no scalar
parameter named name.
Replaces tagged components that match none of tags with zero.
Untagged nodes remain active, and a matching tagged node retains its entire subtree.
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.
Sourcepub fn display_tree(&self) -> ExprGraphTreeDisplay<'_>
pub fn display_tree(&self) -> ExprGraphTreeDisplay<'_>
Creates a configurable indented-tree display.
Sourcepub fn display_dot(&self) -> ExprGraphDotDisplay<'_>
pub fn display_dot(&self) -> ExprGraphDotDisplay<'_>
Creates a configurable Graphviz DOT display.