---
title: "pathWithGraphNodes:radius:"
framework: gameplaykit
role: symbol
role_heading: Type Method
path: "gameplaykit/gkpath/pathwithgraphnodes:radius:"
---

# pathWithGraphNodes:radius:

Creates a path using the positions of the specified graph nodes.

## Declaration

```occ
+ (instancetype) pathWithGraphNodes:(NSArray<GKGraphNode *> *) graphNodes radius:(float) radius;
```

## Parameters

- `graphNodes`: An array of graph node objects containing 2D or 3D points.
- `radius`: The radius of the path.

## Return Value

Return Value A new path object.

## Discussion

Discussion Use this method to turn a list of nodes from a navigation graph (as returned by the GKGraph findPath(from:to:) method) into a path-following goal for an agent. If the nodes are GKGraphNode2D objects, this method creates a 2D path; if the nodes are GKGraphNode3D objects, this method creates a 3D path. The radius parameter defines the space occupied by the path—think of this space as the area created by sweeping a circle (or sphere, for 3D paths) of the specified radius along the path from vertex to vertex. Agents with path-related goals will attempt to move to or stay within this area. To use the newly created path to constrain an agent’s behavior, create a goal with the init(toStayOn:maxPredictionTime:) or init(toFollow:maxPredictionTime:forward:) method.

## See Also

### Creating a Path

- [initWithPoints:count:radius:cyclical:](gameplaykit/gkpath/initwithpoints:count:radius:cyclical:.md)
- [pathWithPoints:count:radius:cyclical:](gameplaykit/gkpath/pathwithpoints:count:radius:cyclical:.md)
- [initWithFloat3Points:count:radius:cyclical:](gameplaykit/gkpath/initwithfloat3points:count:radius:cyclical:.md)
- [pathWithFloat3Points:count:radius:cyclical:](gameplaykit/gkpath/pathwithfloat3points:count:radius:cyclical:.md)
- [init(graphNodes:radius:)](gameplaykit/gkpath/init(graphnodes:radius:).md)
