1919
2020class Graph [T : StateProtocol = StateProtocol , S : SharedProtocol = SharedProtocol ]:
2121 """
22- Create and execute a graph defined by a list of edges
22+ Create and execute a graph defined by a list of edges.
2323
2424
2525 ## Generic Typing
2626 The graph supports different state management strategies through generic parameters:
2727
28- * **Simple Inheritance (Covariance):** Extend `State` and `Shared` classes.
28+ - **Simple Inheritance (Covariance):** Extend `State` and `Shared` classes.
2929 Ideal for smaller projects with minimal boilerplate.
30- * **Protocol-based (Duck Typing):** Implement `StateProtocol` and `SharedProtocol`.
30+ - **Protocol-based (Duck Typing):** Implement `StateProtocol` and `SharedProtocol`.
3131 Recommended for scalable projects where multiple state types are merged.
32- * **Disabled Type Checking:** Use `typing.Any` to bypass strict typing.
32+ - **Disabled Type Checking:** Use `typing.Any` to bypass strict typing.
3333
3434 ---
3535
@@ -66,24 +66,26 @@ class Graph[T: StateProtocol = StateProtocol, S: SharedProtocol = SharedProtocol
6666
6767 - **Internal (Step Sync)**
6868 Parallel executing nodes in branches are synchronized at each step.
69- The state is merged after each step.
69+ All branch internal states are merged after each step.
7070
7171 - **External (Branch Sync)**
7272 Branches are synchronized at the `join` point.
7373
7474
7575 ### Spawning
7676 A branch is triggered **immediately before** its `Source` is executed in another branch.
77- * `START`: Initial execution point.
78- * `Node`: Spawns when a specific node is executed in another branch.
79- * `List[Node]`: Spawns when any node in the list is executed in another branch.
77+
78+ - `START`: Initial execution point.
79+ - `Node`: Spawns when a specific node is executed in another branch.
80+ - `List[Node]`: Spawns when any node in the list is executed in another branch.
8081
8182
8283 ### Joining
8384 Joining synchronizes multiple branches before moving to the next step.
84- * `None`: No synchronization and no merge of the state.
85- * `END`: Joins all branches at the graph's conclusion to return the merged state.
86- * `Node`: Other branches wait until all branches targeting this node have arrived and then merge the states before executing the node.
85+
86+ - `None`: No synchronization and no merge of the state.
87+ - `END`: Joins all branches at the graph's conclusion to return the merged state.
88+ - `Node`: Other branches wait until all branches targeting this node have arrived and then merge the states before executing the node.
8789
8890 ---
8991
@@ -97,8 +99,9 @@ class Graph[T: StateProtocol = StateProtocol, S: SharedProtocol = SharedProtocol
9799
98100 ### Error Handling
99101 The `Exception` source can be used to create fallback paths:
100- * `Exception`: Catches any error in preceding nodes of the same branch.
101- * `(Exception, [node1, node2])`: Specifically handles errors occurring in `node1` or `node2`.
102+
103+ - `Exception`: Catches any error in preceding nodes of the same branch.
104+ - `(Exception, [node1, node2])`: Specifically handles errors occurring in `node1` or `node2`.
102105
103106 Attributes:
104107 edges: A list of branches with compatible nodes that build the graph.
0 commit comments