Version: dev

expression_graph (type)

Stable type · Graphs

Tier: stable · Kind: type · Topic: Graphs

JuliaTypeScriptPythonRustGo
not exportednot exportednot exportedExpressionGraphExpressionGraph

Julia

Julia does not export this type.

TypeScript

TypeScript does not export this type.

Python

Python does not export this type.

Rust

pub struct ExpressionGraph {
    pub nodes: Vec<VariableNode>,
    pub edges: Vec<DependencyEdge>,
}

impl ExpressionGraph { pub fn adjacency(&self, name: &str) -> Vec<String> }

impl ExpressionGraph { pub fn predecessors(&self, name: &str) -> Vec<String> }

impl ExpressionGraph { pub fn successors(&self, name: &str) -> Vec<String> }

impl ExpressionGraph { pub fn to_dot(&self) -> String }

impl ExpressionGraph { pub fn to_mermaid(&self) -> String }

impl ExpressionGraph { pub fn to_json_graph(&self) -> String }

Expression graph representing variable dependencies within expressions

Source · Rust docs

Example (expression_graph)

let doc = load_path(fixture("decay.esm"))?;
let model = &doc.models.as_ref().unwrap()["Decay"];
let graph = expression_graph(model);
let json = to_json_graph(&graph);
println!("{json}");
assert!(json.contains("\"lambda\"") && json.contains("\"N\""));

From docs/api/examples/rust/graphs.rs

Go

type ExpressionGraph struct {
	Nodes []VariableNode                            `json:"nodes"`
	Edges []GraphEdge[VariableNode, DependencyEdge] `json:"edges"`
}

func (g *ExpressionGraph) AdjacencyVariable(node VariableNode) []VariableAdjacency

func (g *ExpressionGraph) PredecessorsVariable(node VariableNode) []VariableNode

func (g *ExpressionGraph) SuccessorsVariable(node VariableNode) []VariableNode

ExpressionGraph is a specialized graph for variable dependencies

Methods

func (g *ExpressionGraph) AdjacencyVariable(node VariableNode) []VariableAdjacency

AdjacencyVariable returns the neighbours of a node in the expression graph, together with the dependency edge that reaches each. Adjacency is UNDIRECTED; one entry is returned per incident edge.

func (g *ExpressionGraph) PredecessorsVariable(node VariableNode) []VariableNode

PredecessorsVariable returns the distinct nodes with a dependency edge pointing TO the given variable node, in sorted-name order.

func (g *ExpressionGraph) SuccessorsVariable(node VariableNode) []VariableNode

SuccessorsVariable returns the distinct nodes the given variable node has a dependency edge pointing TO, in sorted-name order.

Source · Go docs