<!--
{
  "availability" : [
    "iOS: 27.0.0 -",
    "iPadOS: 27.0.0 -",
    "tvOS: 27.0.0 -",
    "visionOS: 27.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "RealityKit",
  "identifier" : "/documentation/RealityKit/ShaderGraph/replace(nodes:edges:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "RealityKit"
    ],
    "preciseIdentifier" : "s:11ShaderGraphAAC7replace5nodes5edgesySDySSAB4NodeVG_SayAB4EdgeVGtKF"
  },
  "title" : "replace(nodes:edges:)"
}
-->

# replace(nodes:edges:)

Replaces all nodes and edges in the graph.

```
final func replace(nodes: [String : ShaderGraph.Node], edges: [ShaderGraph.Edge]) throws
```

## Discussion> Throws: If the provided nodes and edges do not form a valid graph.

---

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)