<!--
{
  "availability" : [
    "iOS: 9.0.0 -",
    "iPadOS: 9.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.11.0 -",
    "tvOS: 9.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "GameplayKit",
  "identifier" : "/documentation/GameplayKit/GKGraphNode2D",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "GameplayKit"
    ],
    "preciseIdentifier" : "c:objc(cs)GKGraphNode2D"
  },
  "title" : "GKGraphNode2D"
}
-->

# GKGraphNode2D

A node in a navigation graph, associated with a point in continuous 2D space.

```
class GKGraphNode2D
```

## Overview

Together, a network of nodes form a graph that describes the navigability of a game world. Use graph nodes with a [`GKGraph`](/documentation/GameplayKit/GKGraph), [`GKObstacleGraph`](/documentation/GameplayKit/GKObstacleGraph), or [`GKMeshGraph`](/documentation/GameplayKit/GKMeshGraph) object to perform actions that relate to the network of nodes as a whole, such as pathfinding to determine routes through the network.

When you use the [`GKObstacleGraph`](/documentation/GameplayKit/GKObstacleGraph) or [`GKMeshGraph`](/documentation/GameplayKit/GKMeshGraph) class to describe a game world in terms of open spaces interrupted by obstacles, GameplayKit automatically creates and manages [`GKGraphNode2D`](/documentation/GameplayKit/GKGraphNode2D) instances that represent positions along possible paths that navigate around those obstacles.

To learn more about graphs and pathfinding, see [Pathfinding](https://developer.apple.com/library/archive/documentation/General/Conceptual/GameplayKit_Guide/Pathfinding.html#//apple_ref/doc/uid/TP40015172-CH3) in [GameplayKit Programming Guide](https://developer.apple.com/library/archive/documentation/General/Conceptual/GameplayKit_Guide/index.html#//apple_ref/doc/uid/TP40015172).

## Topics

### Creating a Graph Node

[`-  initWithPoint:`](/documentation/GameplayKit/GKGraphNode2D/init(point:))

Initializes a graph node with the specified point.

[`+  nodeWithPoint:`](/documentation/GameplayKit/GKGraphNode2D/node(withPoint:))

Creates a graph node with the specified point.

### Inspecting a Node’s Position

[`position`](/documentation/GameplayKit/GKGraphNode2D/position)

The position of the node in continuous 2D space.

## Relationships

### Conforms To

[`NSCoding`](/documentation/Foundation/NSCoding)

[`Equatable`](/documentation/Swift/Equatable)

[`CustomStringConvertible`](/documentation/Swift/CustomStringConvertible)

[`NSSecureCoding`](/documentation/Foundation/NSSecureCoding)

[`CVarArg`](/documentation/Swift/CVarArg)

[`Hashable`](/documentation/Swift/Hashable)

[`CustomDebugStringConvertible`](/documentation/Swift/CustomDebugStringConvertible)

[`NSObjectProtocol`](/documentation/ObjectiveC/NSObjectProtocol)

### Inherits From

[`GKGraphNode`](/documentation/GameplayKit/GKGraphNode)

---

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)