Expand description
Task dependency graph with topological scheduling, cycle detection, and critical-path analysis.
This module provides a lightweight, metadata-only DAG for expressing tasks with explicit
data dependencies. Unlike super::TaskGraph which carries typed compute closures,
DependencyGraph stores only scheduling metadata (name, priority, cost) so it can be
used for planning without executing.
§Overview
| Type | Description |
|---|---|
DependencyGraph | DAG container for task metadata and dependencies |
DepTaskNode | Task node with name, priority, cost, and metadata |
DependencyGraphConfig | Configuration for graph behaviour |
TopologicalAlgorithm | Choice of Kahn vs DFS topological sort |
§Example
use scirs2_core::task_graph::dependency_graph::{DependencyGraph, DependencyGraphConfig};
use std::collections::HashSet;
let mut g = DependencyGraph::new(DependencyGraphConfig::default());
let a = g.add_task("fetch", 1);
let b = g.add_task("process", 0);
let c = g.add_task("store", 0);
g.add_dependency(b, a).expect("b depends on a");
g.add_dependency(c, b).expect("c depends on b");
let order = g.topological_sort().expect("acyclic");
assert_eq!(order.len(), 3);
let completed: HashSet<u64> = [a].into();
assert!(g.is_ready(b, &completed));
assert!(!g.is_ready(c, &completed));Structs§
- DepTask
Node - A single node in a
DependencyGraph. - Dependency
Graph - A directed-acyclic graph (DAG) of tasks with metadata only.
- Dependency
Graph Config - Configuration for
DependencyGraphbehaviour.
Enums§
- Topological
Algorithm - Choice of algorithm for topological sorting.
Type Aliases§
- TaskId
- Opaque 64-bit identifier for tasks in a
DependencyGraph.