<!--
{
  "availability" : [
    "Reality Composer Pro: -",
    "iOS: 27.0.0 -",
    "iPadOS: 27.0.0 -",
    "macCatalyst: 27.0.0 -",
    "macOS: 27.0.0 -",
    "tvOS: 27.0.0 -",
    "visionOS: 27.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "ComputeGraph",
  "identifier" : "/documentation/ComputeGraph/ComputeNodeGraph/replaceAll(nodes:edges:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Compute Graph",
      "ComputeGraph"
    ],
    "preciseIdentifier" : "s:12ComputeGraph0a4NodeB0V10replaceAll5nodes5edgesySDySiAC0C0VG_SayAC4EdgeVGtKF"
  },
  "title" : "replaceAll(nodes:edges:)"
}
-->

# replaceAll(nodes:edges:)

Replaces all nodes and edges in the graph with the provided collections.

```
mutating func replaceAll(nodes: [ComputeNodeGraph.NodeID : ComputeNodeGraph.Node], edges: [ComputeNodeGraph.Edge]) throws
```

## Parameters

`nodes`

A sequence of nodes and their keys to add to the graph.

`edges`

A sequence of edges to add to the graph.

## Discussion

This bulk operation allows for efficient wholesale replacement of the graph’s
structure.

> Throws: An error if the replacement operation fails.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)