DAG 定义:节点 + 边 + 拓扑排序。
Summary
Functions
返回拓扑分层结果:每一层内部所有节点彼此独立,可并行执行;层与层串行。
Types
@type edge_def() :: %{ :from => String.t(), :to => String.t(), optional(:label) => String.t() | nil, optional(:branch) => String.t() | nil }
边定义。
:from/:to— 必填,节点 ID:label— 可选展示名:branch— 可选;若上游为:router节点,仅当 router 输出%{route: branch}时该边才被激活,其它分支会被剪枝(ADP 第 2 章 Routing)
@type node_type() :: :agent | :aggregator | :router | :gate | :debate | :hierarchy
Functions
返回拓扑分层结果:每一层内部所有节点彼此独立,可并行执行;层与层串行。
对应 Agentic Design Patterns 第 3 章 Parallelization 模式。