Skip to main content

Crate dagex

Crate dagex 

Source
Expand description

§dagex

A pure Rust DAG executor supporting implicit node connections, branching, and config sweeps.

§Features

  • Implicit Node Connections: Nodes are automatically connected based on execution order
  • Branching: Create parallel execution paths with .branch()
  • Config Sweeps: Use .variants() to create configuration variations
  • DAG Optimization: Automatic inspection and optimization of execution paths
  • Mermaid Visualization: Generate diagrams with to_mermaid()

§Example

use dagex::{Graph, GraphData};
use std::collections::HashMap;

fn data_source(_: &HashMap<String, GraphData>) -> HashMap<String, GraphData> {
    let mut result = HashMap::new();
    result.insert("output".to_string(), GraphData::string("Hello, World!"));
    result
}

fn processor(inputs: &HashMap<String, GraphData>) -> HashMap<String, GraphData> {
    let mut result = HashMap::new();
    if let Some(data) = inputs.get("input").and_then(|d| d.as_string()) {
        result.insert("output".to_string(), GraphData::string(data.to_uppercase()));
    }
    result
}

let mut graph = Graph::new();
graph.add(data_source, Some("Source"), None, Some(vec![("output", "output")]));
graph.add(processor, Some("Processor"), Some(vec![("output", "input")]), Some(vec![("output", "output")]));

let dag = graph.build();

Structs§

CacheBackendStats
Snapshot of backend-level storage statistics.
CacheOptions
Per-run cache controls.
CacheRunStats
Per-run cache observability.
Dag
Directed Acyclic Graph representing the optimized execution plan
DagStats
ExecutionResult
Execution result that tracks outputs per node and per branch
FileCacheBackend
Minimal disk-backed scaffold kept separate from the in-memory implementation.
Graph
Graph builder for constructing graphs with implicit node connections
MemoryCacheBackend
LRU/TTL in-memory backend.
MemoryCacheConfig
Configures the default in-memory cache backend.
NodeCacheStatus
Debug status for a node cache lookup during an execution.
PortSummary
Summary statistics for a single scalar output port.
StatResult
Output of Dag::predict().

Enums§

CacheDepth
Configures how aggressively node results may be reused.
CacheMissReason
Miss reasons surfaced by cache lookups.
Distribution
Parametric and empirical probability distributions.
GraphData
GraphData enum supporting multiple data types
PredictTarget
Specifies where the statistical forward pass should stop.

Traits§

CacheBackend
Pluggable cache backend interface.

Type Aliases§

DistContext
A mapping from port name → Distribution, mirroring ExecutionContext.
DistTransferFn
Optional analytical distribution transfer for a node.
ExecutionContext
Execution context for storing variable values during graph execution
NodeFunction
Type alias for node execution functions using GraphData Takes GraphData ports as input, returns output ports
NodeId
Unique identifier for a node