One Logo Pool Ball
ComputeGraph · IOS API REFERENCE

ComputeNodeGraph

struct · iOS 27.0+ · SDK 27.1

struct ComputeNodeGraph

Members (17)

method · iOS 27.0+

addNode

TypeScript
addNode(node: ComputeNodeGraph_Node): number
Swift declaration
mutating func addNode(_ node: ComputeNodeGraph.Node) throws -> ComputeNodeGraph.NodeID

Adds a node to the graph. - Parameter node: The node to add. - Returns: The key assigned to the newly added node. - Throws: A `NodeError` if the node cannot be added.

method · iOS 27.0+

canAddNode

TypeScript
canAddNode(node: ComputeNodeGraph_Node): boolean
Swift declaration
func canAddNode(_ node: ComputeNodeGraph.Node) -> Bool

Returns whether the given node can be added to the graph. This is the non-throwing preflight check for ``addNode(_:)``. Use it to validate a node — for example, to gate UI affordances — without modifying the graph. - Parameter node: The node to test. - Returns: `true` if calling ``addNode(_:)`` with this node would succeed.

method · iOS 27.0+

removeNode

TypeScript
removeNode(node: number): void
Swift declaration
mutating func removeNode(_ node: ComputeNodeGraph.NodeID) throws

Removes a node from the graph. - Parameter node: The key of the node to remove. - Throws: if the node cannot be removed.

method · iOS 27.0+

updateNode

TypeScript
updateNode(node: ComputeNodeGraph_Node, nodeID: number): void
Swift declaration
mutating func updateNode(_ node: ComputeNodeGraph.Node, forKey nodeID: ComputeNodeGraph.NodeID) throws

Updates an existing node in the graph. - Parameters: - node: The updated node data. - forKey: The key of the node to update. - Throws: if the node cannot be updated.

method · iOS 27.0+

canAddEdge

TypeScript
canAddEdge(edge: ComputeNodeGraph_Edge): boolean
Swift declaration
func canAddEdge(_ edge: ComputeNodeGraph.Edge) -> Bool

Returns whether the given edge can be added to the graph. This is the non-throwing preflight check for ``addEdge(_:)``. Use it to validate a connection — for example, to highlight compatible ports during drag-and-drop — without modifying the graph. - Parameter edge: The edge to test. - Returns: `true` if calling ``addEdge(_:)`` with this edge would succeed.

method · iOS 27.0+

removeEdge

TypeScript
removeEdge(edge: ComputeNodeGraph_Edge): boolean
Swift declaration
@discardableResult mutating func removeEdge(_ edge: ComputeNodeGraph.Edge) -> Bool

Removes an edge from the graph. - Parameter edge: The edge to remove. - Throws: if the edge cannot be removed. - Returns: `true` if the edge was found and removed.

method · iOS 27.0+

replaceAll

TypeScript
replaceAll(nodes: Record<number, ComputeNodeGraph_Node>, edges: Array<ComputeNodeGraph_Edge>): void
Swift declaration
mutating func replaceAll(nodes: [ComputeNodeGraph.NodeID : ComputeNodeGraph.Node], edges: [ComputeNodeGraph.Edge]) throws

Replaces all nodes and edges in the graph with the provided collections. This bulk operation allows for efficient wholesale replacement of the graph's structure. - Parameters: - nodes: A sequence of nodes and their keys to add to the graph. - edges: A sequence of edges to add to the graph. - Throws: An error if the replacement operation fails.

method · iOS 27.0+

data

TypeScript
data(format: ComputeNodeGraph_Format): ArrayBuffer
Swift declaration
func data(using format: ComputeNodeGraph.Format) throws -> Data

Returns the graph encoded in the specified format. To reconstruct the graph, pass the data to ``ComputeNodeGraph/init(data:)``. - Parameter format: The serialization format to use when encoding the graph. - Returns: The graph encoded using the specified format. - Throws: An error if the graph can't be encoded in the requested format.

init · iOS 27.0+

init

TypeScript
static initData(data: ArrayBuffer): ComputeNodeGraph
Swift declaration
init(data: Data) throws

Creates a graph by decoding a computegraph. This initializer infers the serialization format from the contents of `data`, so you can pass data produced by ``ComputeNodeGraph/data(using:)`` regardless of the ``Format`` you chose when encoding. - Parameter data: The encoded graph data to decode. - Throws: An error if `data` isn't a recognized graph format, or if the contents can't be decoded into a valid graph.

get · iOS 27.0+

edges

TypeScript
get edges(): Array<ComputeNodeGraph_Edge>
Swift declaration
var edges: [ComputeNodeGraph.Edge] { get }
get · iOS 27.0+

nodes

TypeScript
get nodes(): Record<number, ComputeNodeGraph_Node>
Swift declaration
var nodes: [ComputeNodeGraph.NodeID : ComputeNodeGraph.Node]
set · iOS 27.0+

nodes

TypeScript
set nodes(value: Record<number, ComputeNodeGraph_Node>)
Swift declaration
var nodes: [ComputeNodeGraph.NodeID : ComputeNodeGraph.Node]
method · iOS 27.0+

addEdge

TypeScript
addEdge(edge: ComputeNodeGraph_Edge): void
Swift declaration
mutating func addEdge(_ edge: ComputeNodeGraph.Edge) throws
method · iOS 27.0+

contains

TypeScript
containsEdge(edge: ComputeNodeGraph_Edge): boolean
Swift declaration
func contains(edge: ComputeNodeGraph.Edge) -> Bool

Returns whether the graph contains the given edge. - Parameter edge: The edge to look up. - Returns: `true` if the graph contains the edge; otherwise, `false`.

method · iOS 27.0+

contains

TypeScript
containsNode(node: number): boolean
Swift declaration
func contains(node: ComputeNodeGraph.NodeID) -> Bool

Returns whether the graph contains a node with the given key. - Parameter node: The key of the node to look up. - Returns: `true` if the graph contains the node; otherwise, `false`.

init · iOS 27.0+

init

TypeScript
static init(): ComputeNodeGraph
Swift declaration
init()
subscript · iOS 27.0+

subscript

TypeScript
subscript(node: number): (ComputeNodeGraph_Node) | null
Swift declaration
subscript(node: ComputeNodeGraph.NodeID) -> ComputeNodeGraph.Node? { get }

Accesses the node associated with the given key. - Parameter node: The key identifying the node to retrieve. - Returns: The node if it exists, or `nil` if no node is associated with the key.

Skipped declarations

No declarations were skipped in this snapshot.

All ComputeGraph types →