MCPcopy Index your code
hub / github.com/simstudioai/sim / createLinearDAG

Function createLinearDAG

packages/testing/src/factories/dag.factory.ts:145–161  ·  view source on GitHub ↗
(nodeIds: string[])

Source from the content-addressed store, hash-verified

143 * ```
144 */
145export function createLinearDAG(nodeIds: string[]): DAG {
146 const nodes = new Map<string, DAGNode>()
147
148 for (let i = 0; i < nodeIds.length; i++) {
149 const id = nodeIds[i]
150 const outgoingEdges: DAGEdge[] = i < nodeIds.length - 1 ? [{ target: nodeIds[i + 1] }] : []
151 const incomingEdges = i > 0 ? [nodeIds[i - 1]] : []
152
153 nodes.set(id, createDAGNode({ id, outgoingEdges, incomingEdges }))
154 }
155
156 return {
157 nodes,
158 loopConfigs: new Map(),
159 parallelConfigs: new Map(),
160 }
161}
162
163/**
164 * Adds a node to an existing DAG.

Callers

nothing calls this directly

Calls 2

createDAGNodeFunction · 0.85
setMethod · 0.65

Tested by

no test coverage detected