---
title: "addConnections(to:bidirectional:)"
framework: gameplaykit
role: symbol
role_heading: Instance Method
path: "gameplaykit/gkgraphnode/addconnections(to:bidirectional:)"
---

# addConnections(to:bidirectional:)

Connects this node to all nodes in the specified list.

## Declaration

```swift
func addConnections(to nodes: [GKGraphNode], bidirectional: Bool)
```

## Parameters

- `nodes`: The list of nodes to which to form connections.
- `bidirectional`: doc://com.apple.documentation/documentation/Swift/true to create a connection in both directions; doc://com.apple.documentation/documentation/Swift/false to create only connections from this node to each of the specified nodes.

## Discussion

Discussion In GameplayKit, the connections between nodes in a graph are directional. For example, if the connectedNodes list of Node A contains Node B, then a traveler on the graph can move directly from Node A to Node B. For the reverse to also be true, the connectedNodes list of Node B must contain Node A. Use the bidirectional parameter to choose whether to automatically create connections in both directions or create only one-way connections.

## See Also

### Working with Connections

- [connectedNodes](gameplaykit/gkgraphnode/connectednodes.md)
- [removeConnections(to:bidirectional:)](gameplaykit/gkgraphnode/removeconnections(to:bidirectional:).md)
