---
title: "addNode(_:)"
framework: Compute Graph
role: symbol
role_heading: Instance Method
platforms: [iOS 27.0+, iPadOS 27.0+, Mac Catalyst 27.0+, macOS 27.0+, tvOS 27.0+, visionOS 27.0+]
path: "computegraph/computenodegraph/addnode(_:)"
---

# addNode(_:)

Adds a node to the graph.

## Declaration

```swift
mutating func addNode(_ node: ComputeNodeGraph.Node) throws -> ComputeNodeGraph.NodeID
```

## Parameters

- `node`: The node to add.

## Return Value

Return Value The key assigned to the newly added node.

## Discussion

Discussion note: A NodeError if the node cannot be added.
