Skip to content

Commit 0c1e691

Browse files
committed
fixed docs
1 parent 3f248d9 commit 0c1e691

3 files changed

Lines changed: 20 additions & 18 deletions

File tree

src/edgygraph/graph/graphs.py

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -19,17 +19,17 @@
1919

2020
class 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.

src/edgygraph/graph/hooks.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,9 @@ async def on_spawn_branch_start(self, state: T, shared: S, branch: Branch[T, S],
6464
state: The state of the graph.
6565
shared: The shared state of the graph.
6666
branch: The branch to be spawned.
67+
trigger: The node that spawned the branch.
6768
branch_registry: The branch registry of the graph.
68-
source_node: The node that spawned the branch.
69+
join_registry: The current join registry of the graph.
6970
"""
7071

7172
pass
@@ -79,8 +80,9 @@ async def on_spawn_branch_end(self, state: T, shared: S, branch: Branch[T, S], t
7980
state: The state of the graph.
8081
shared: The shared state of the graph.
8182
branch: The branch that was spawned.
82-
branch_registry: The branch registry of the graph.
8383
trigger: The node that spawned the branch.
84+
branch_registry: The branch registry of the graph.
85+
join_registry: The current join registry of the graph.
8486
"""
8587

8688
pass

src/edgygraph/nodes.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,6 @@ def copy(self) -> Node[T, S]:
4343
"""
4444
Creates a copy of the node. This can be used when the same node is used multiple times in the graph.
4545
46-
Args:
47-
node: The node to copy.
48-
4946
Returns:
5047
A copy of the node.
5148
"""

0 commit comments

Comments
 (0)