@@ -28,23 +28,23 @@ Get the current graph state.
2828#### set \_state
2929
3030```python
31- def set_state (state : dict[str , Any]) -> " Graph "
31+ def set_state (state : dict[str , Any]) -> Graph
3232```
3333
3434Set the graph state .
3535
3636#### update \_state
3737
3838```python
39- def update_state (values : dict[str , Any]) -> " Graph "
39+ def update_state (values : dict[str , Any]) -> Graph
4040```
4141
4242Update the graph state with new values .
4343
4444#### reset \_state
4545
4646```python
47- def reset_state () -> " Graph "
47+ def reset_state () -> Graph
4848```
4949
5050Reset the graph state to an empty dict .
@@ -53,7 +53,7 @@ Reset the graph state to an empty dict.
5353
5454```python
5555def add_edge (source : NodeProtocol | str ,
56- destination : NodeProtocol | str ) -> " Graph "
56+ destination : NodeProtocol | str ) -> Graph
5757```
5858
5959Adds an edge between two nodes that already exist in the graph .
@@ -63,6 +63,20 @@ Adds an edge between two nodes that already exist in the graph.
6363- `source` - The source node or its name.
6464- `destination` - The destination node or its name.
6565
66+ # ### compile
67+
68+ ```python
69+ def compile () -> " Graph"
70+ ```
71+
72+ Validate the graph:
73+ - exactly one start node present (or Graph.start_node set )
74+ - at least one end node present
75+ - all edges reference known nodes
76+ - no cycles
77+ - all nodes reachable from the start
78+ Returns self on success; raises GraphCompileError otherwise.
79+
6680# ### get\_callback
6781
6882```python
@@ -89,3 +103,13 @@ as the default callback when no callback is passed to the `execute` method.
89103
90104- `callback_class` (`Type[Callback]` ): The callback class to use as the default callback.
91105
106+ # ### visualize
107+
108+ ```python
109+ def visualize (* , save_path : str | None = None )
110+ ```
111+
112+ Render the current graph. If matplotlib is not installed,
113+ raise a helpful error telling users to install the viz extra.
114+ Optionally save to a file via ` save_path ` .
115+
0 commit comments