---
title: "init(data:)"
framework: Compute Graph
role: symbol
role_heading: Initializer
platforms: [iOS 27.0+, iPadOS 27.0+, Mac Catalyst 27.0+, macOS 27.0+, tvOS 27.0+, visionOS 27.0+]
path: "computegraph/computenodegraph/init(data:)"
---

# init(data:)

Creates a graph by decoding a computegraph.

## Declaration

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

## Parameters

- `data`: The encoded graph data to decode.

## Discussion

Discussion This initializer infers the serialization format from the contents of data, so you can pass data produced by data(using:) regardless of the ComputeNodeGraph.Format you chose when encoding. note: An error if data isn’t a recognized graph format, or if the contents can’t be decoded into a valid graph.
