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

# data(using:)

Returns the graph encoded in the specified format.

```
func data(using format: ComputeNodeGraph.Format) throws -> Data
```

## Parameters

`format`

The serialization format to use when encoding the
graph.

## Return Value

The graph encoded using the specified format.

## Discussion

To reconstruct the graph, pass the data to [`init(data:)`](/documentation/ComputeGraph/ComputeNodeGraph/init(data:)).

> Throws: An error if the graph can’t be encoded in the requested format.

---

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)