NeoGraph 0.10.0
A C++17 Graph Agent Engine Library — LangGraph for C++
Loading...
Searching...
No Matches
neograph::graph::SubgraphNode Class Reference

Node that runs a compiled GraphEngine as a single node (hierarchical composition). More...

#include <node.h>

Inheritance diagram for neograph::graph::SubgraphNode:
[legend]
Collaboration diagram for neograph::graph::SubgraphNode:
[legend]

Public Member Functions

std::string get_name () const override
 Get the node's unique name within the graph.
 
asio::awaitable< NodeOutputrun (NodeInput in) override
 v0.4 PR 9a: unified run — drives the child engine via run_async (or run_stream_async when in.stream_cb is non-null), maps channels through input_map / output_map.
 
 SubgraphNode (const std::string &name, std::shared_ptr< GraphEngine > subgraph, std::map< std::string, std::string > input_map={}, std::map< std::string, std::string > output_map={})
 Construct a subgraph node.
 

Detailed Description

Node that runs a compiled GraphEngine as a single node (hierarchical composition).

Enables the Supervisor pattern and nested workflows. Channels are mapped between parent and child graphs via input_map and output_map.

// Map parent "messages" -> child "messages", child "result" -> parent "findings"
auto sub = std::make_shared<SubgraphNode>("inner", subgraph,
{{"messages", "messages"}}, // input_map: parent -> child
{{"result", "findings"}}); // output_map: child -> parent

Definition at line 320 of file node.h.

Constructor & Destructor Documentation

◆ SubgraphNode()

neograph::graph::SubgraphNode::SubgraphNode ( const std::string &  name,
std::shared_ptr< GraphEngine subgraph,
std::map< std::string, std::string >  input_map = {},
std::map< std::string, std::string >  output_map = {} 
)

Construct a subgraph node.

Parameters
nameUnique node name within the parent graph.
subgraphCompiled GraphEngine to run as a sub-workflow.
input_mapMapping of parent_channel -> child_channel for input.
output_mapMapping of child_channel -> parent_channel for output.

Member Function Documentation

◆ get_name()

std::string neograph::graph::SubgraphNode::get_name ( ) const
inlineoverridevirtual

Get the node's unique name within the graph.

Returns
Node name string.

Implements neograph::graph::GraphNode.

Definition at line 341 of file node.h.

◆ run()

asio::awaitable< NodeOutput > neograph::graph::SubgraphNode::run ( NodeInput  in)
overridevirtual

v0.4 PR 9a: unified run — drives the child engine via run_async (or run_stream_async when in.stream_cb is non-null), maps channels through input_map / output_map.

in.ctx.cancel_token flows through into the child run's RunConfig so a parent cancel cascades to the subgraph.

Implements neograph::graph::GraphNode.


The documentation for this class was generated from the following file: