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

# data(using:)

Returns the graph encoded in the specified format.

## Declaration

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

## Parameters

- `format`: The serialization format to use when encoding the graph.

## Return Value

Return Value The graph encoded using the specified format.

## Discussion

Discussion To reconstruct the graph, pass the data to init(data:). note: An error if the graph can’t be encoded in the requested format.
