<!--
{
  "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/init(data:)",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "Compute Graph",
      "ComputeGraph"
    ],
    "preciseIdentifier" : "s:12ComputeGraph0a4NodeB0V4dataAC10Foundation4DataV_tKcfc"
  },
  "title" : "init(data:)"
}
-->

# init(data:)

Creates a graph by decoding a computegraph.

```
init(data: Data) throws
```

## Parameters

`data`

The encoded graph data to decode.

## Discussion

This initializer infers the serialization format from the contents of
`data`, so you can pass data produced by
[`data(using:)`](/documentation/ComputeGraph/ComputeNodeGraph/data(using:)) regardless of the [`ComputeNodeGraph.Format`](/documentation/ComputeGraph/ComputeNodeGraph/Format) you chose
when encoding.

> Throws: An error if `data` isn’t a recognized graph format, or if the
> contents can’t be decoded into 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)