Graph
dagpipe.graph
Defines DAG structure connecting Nodes.
Summary
Graph describes execution topology only. It does not execute nodes or manage State. Execution is handled by Engine.
Notes
Responsibilities:
1 2 3 | |
Classes
Graph
Directed Acyclic Graph defining execution topology of Nodes.
Notes
Responsibilities:
1 2 | |
Guarantees:
1 2 | |
Create an empty Graph.
Initializes node registry and edge mappings.
Functions
add_edge
Add directed edge from src to dst.
Parameters
src : Node required: True source node
Node
required: True destination node
Raises
TypeError if src or dst is not a Node
ValueError if edge would create a cycle
ValueError if src and dst are the same node
Behavior
- validates node types
- prevents cycles
- registers nodes if not present
- updates parent and child mappings
add_root
Add a root node with no parents.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
node |
Node
|
Node to add as a root. |
required |
Raises:
| Type | Description |
|---|---|
TypeError
|
If node is not a Node instance. |
children
nodes
Return all nodes in the graph.
Returns:
| Type | Description |
|---|---|
Tuple[Node, ...]
|
Tuple[Node, ...]: All registered nodes. |