context
¶
DAGContext
dataclass
¶
A context for a directed acyclic graph (DAG).
all_nodes
cached
property
¶
all_nodes: list[Node]
All nodes in the graph sorted by the number of upstream nodes.
all_streams
cached
property
¶
all_streams: list[Stream]
All streams in the graph sorted by the number of upstream nodes and the index of the stream.
outgoing_nodes
cached
property
¶
A dictionary of outgoing nodes for each stream.
outgoing_streams
cached
property
¶
A dictionary of outgoing streams for each node.
node_labels
cached
property
¶
node_labels: dict[Node, str]
A dictionary of outgoing streams for each node.
build
classmethod
¶
build(node: Node) -> DAGContext
create a DAG context based on the given node
Parameters:
Name | Type | Description | Default |
---|---|---|---|
node |
Node
|
The root node of the DAG. |
required |
Returns:
Type | Description |
---|---|
DAGContext
|
A DAG context based on the given node. |
get_outgoing_nodes
¶
get_node_label
¶
get_node_label(node: Node) -> str
Get the label of the node.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
node |
Node
|
The node to get the label of. |
required |
Returns:
Type | Description |
---|---|
str
|
The label of the node. |
get_outgoing_streams
¶
render
¶
render(obj: Any) -> Any
Render the object to a string.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
obj |
Any
|
The object to render. |
required |
Returns:
Type | Description |
---|---|
Any
|
The rendered object. |