last_node() — langchain Function Reference
Architecture documentation for the last_node() function in graph.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD 6b97cc3d_1205_0325_4d44_e903570471b2["last_node()"] 646f3bb5_a594_563e_cfbf_e18bdc9efb90["Graph"] 6b97cc3d_1205_0325_4d44_e903570471b2 -->|defined in| 646f3bb5_a594_563e_cfbf_e18bdc9efb90 6764536f_15b8_5436_aa1a_53ff3f1956c2["extend()"] 6764536f_15b8_5436_aa1a_53ff3f1956c2 -->|calls| 6b97cc3d_1205_0325_4d44_e903570471b2 5ce5505c_4a08_f190_13f7_65b75fa4fde9["trim_last_node()"] 5ce5505c_4a08_f190_13f7_65b75fa4fde9 -->|calls| 6b97cc3d_1205_0325_4d44_e903570471b2 b9f04a0f_6507_1a21_7a91_357a589c2c3a["draw_mermaid()"] b9f04a0f_6507_1a21_7a91_357a589c2c3a -->|calls| 6b97cc3d_1205_0325_4d44_e903570471b2 6607eba9_2327_f10b_2f7a_81bdd9ce1d84["_last_node()"] 6b97cc3d_1205_0325_4d44_e903570471b2 -->|calls| 6607eba9_2327_f10b_2f7a_81bdd9ce1d84 style 6b97cc3d_1205_0325_4d44_e903570471b2 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/core/langchain_core/runnables/graph.py lines 469–479
def last_node(self) -> Node | None:
"""Find the single node that is not a source of any edge.
If there is no such node, or there are multiple, return `None`.
When drawing the graph, this node would be the destination.
Returns:
The last node, or None if there is no such node or multiple
candidates.
"""
return _last_node(self)
Domain
Subdomains
Defined In
Calls
Called By
Source
Frequently Asked Questions
What does last_node() do?
last_node() is a function in the langchain codebase, defined in libs/core/langchain_core/runnables/graph.py.
Where is last_node() defined?
last_node() is defined in libs/core/langchain_core/runnables/graph.py at line 469.
What does last_node() call?
last_node() calls 1 function(s): _last_node.
What calls last_node()?
last_node() is called by 3 function(s): draw_mermaid, extend, trim_last_node.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free