# NavGraph

Artifact: [androidx.navigation:navigation-common](https://developer.android.com/jetpack/androidx/releases/navigation) [View Source](https://cs.android.com/search?q=file:androidx/navigation/NavGraph.+class:androidx.navigation.NavGraph) Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/navigation#1.0.0)

*** ** * ** ***


```
public class NavGraph extends NavDestination implements Iterable<@NonNull NavDestination>
```

<br />

|---|---|---|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object.html) |||
| ↳ | [androidx.navigation.NavDestination](https://developer.android.com/reference/androidx/navigation/NavDestination) ||
|   | ↳ | [androidx.navigation.NavGraph](https://developer.android.com/reference/androidx/navigation/NavGraph) |

Known direct subclasses [DynamicGraphNavigator.DynamicNavGraph](https://developer.android.com/reference/androidx/navigation/dynamicfeatures/DynamicGraphNavigator.DynamicNavGraph)

|---|---|
| `https://developer.android.com/reference/androidx/navigation/dynamicfeatures/DynamicGraphNavigator.DynamicNavGraph` | The `https://developer.android.com/reference/androidx/navigation/NavGraph` for dynamic features. |

*** ** * ** ***

NavGraph is a collection of `https://developer.android.com/reference/androidx/navigation/NavDestination` nodes fetchable by ID.

A NavGraph serves as a 'virtual' destination: while the NavGraph itself will not appear on the back stack, navigating to the NavGraph will cause the `https://developer.android.com/reference/androidx/navigation/NavGraph#startDestinationId()` to be added to the back stack.

Construct a new NavGraph. This NavGraph is not valid until you `https://developer.android.com/reference/androidx/navigation/NavGraph#addDestination(androidx.navigation.NavDestination)` and `https://developer.android.com/reference/androidx/navigation/NavGraph#setStartDestination(kotlin.String)`.

## Summary

| ### Public constructors |
|---|
| `https://developer.android.com/reference/androidx/navigation/NavGraph#NavGraph(androidx.navigation.Navigator)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/navigation/Navigator<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/navigation/NavGraph> navGraphNavigator)` |

| ### Public methods |
|---|---|
| `final void` | `https://developer.android.com/reference/androidx/navigation/NavGraph#addAll(androidx.navigation.NavGraph)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/navigation/NavGraph other)` Add all destinations from another collection to this one. |
| `final void` | `https://developer.android.com/reference/androidx/navigation/NavGraph#addDestination(androidx.navigation.NavDestination)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/navigation/NavDestination node)` Adds a destination to this NavGraph. |
| `final void` | `https://developer.android.com/reference/androidx/navigation/NavGraph#addDestinations(kotlin.collections.Collection)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/util/Collection.html<https://developer.android.com/reference/androidx/navigation/NavDestination> nodes)` Adds multiple destinations to this NavGraph. |
| `final void` | `https://developer.android.com/reference/androidx/navigation/NavGraph#addDestinations(kotlin.Array)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/navigation/NavDestination... nodes)` Adds multiple destinations to this NavGraph. |
| `final void` | `https://developer.android.com/reference/androidx/navigation/NavGraph#clear()()` Clear all destinations from this navigation graph. |
| `boolean` | `https://developer.android.com/reference/androidx/navigation/NavGraph#equals(kotlin.Any)(https://developer.android.com/reference/java/lang/Object.html other)` |
| `boolean` | `https://developer.android.com/reference/androidx/navigation/NavGraph#equals(kotlin.Any)(https://developer.android.com/reference/java/lang/Object.html other)` |
| `final https://developer.android.com/reference/androidx/navigation/NavDestination` | `<T extends https://developer.android.com/reference/java/lang/Object.html> https://developer.android.com/reference/androidx/navigation/NavGraph#findNode()()` Finds a destination in the collection by route from `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.reflect/-k-class/index.html`. |
| `final https://developer.android.com/reference/androidx/navigation/NavDestination` | `https://developer.android.com/reference/androidx/navigation/NavGraph#findNode(kotlin.Int)(@https://developer.android.com/reference/androidx/annotation/IdRes int resId)` Finds a destination in the collection by ID. |
| `final https://developer.android.com/reference/androidx/navigation/NavDestination` | `https://developer.android.com/reference/androidx/navigation/NavGraph#findNode(kotlin.reflect.KClass)(@https://developer.android.com/reference/androidx/annotation/NonNull https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.reflect/-k-class/index.html<@https://developer.android.com/reference/androidx/annotation/NonNull ?> route)` Finds a destination in the collection by route from `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.reflect/-k-class/index.html`. |
| `final https://developer.android.com/reference/androidx/navigation/NavDestination` | `<T extends https://developer.android.com/reference/java/lang/Object.html> https://developer.android.com/reference/androidx/navigation/NavGraph#findNode(kotlin.Any)(T route)` Finds a destination in the collection by route from Object. |
| `final https://developer.android.com/reference/androidx/navigation/NavDestination` | `https://developer.android.com/reference/androidx/navigation/NavGraph#findNode(kotlin.String)(https://developer.android.com/reference/java/lang/String.html route)` Finds a destination in the collection by route. |
| `final https://developer.android.com/reference/androidx/navigation/NavDestination` | `https://developer.android.com/reference/androidx/navigation/NavGraph#findNodeComprehensive(kotlin.Int,androidx.navigation.NavDestination,kotlin.Boolean,androidx.navigation.NavDestination)( int resId, https://developer.android.com/reference/androidx/navigation/NavDestination lastVisited, boolean searchChildren, https://developer.android.com/reference/androidx/navigation/NavDestination matchingDest )` Searches all children and parents recursively. |
| `static final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/navigation/NavDestination` | `https://developer.android.com/reference/androidx/navigation/NavGraph#(androidx.navigation.NavGraph).findStartDestination()(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/navigation/NavGraph receiver)` Finds the actual start destination of the graph, handling cases where the graph's starting destination is itself a NavGraph. |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/navigation/NavGraph#getDisplayName()()` |
| `final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/navigation/NavGraph#getStartDestDisplayName()()` |
| `final @https://developer.android.com/reference/androidx/annotation/IdRes int` | `[getStartDestination](https://developer.android.com/reference/androidx/navigation/NavGraph#getStartDestination())()` **This method is deprecated.** Use getStartDestinationId instead. |
| `final @https://developer.android.com/reference/androidx/annotation/IdRes int` | `https://developer.android.com/reference/androidx/navigation/NavGraph#getStartDestinationId()()` The starting destination id for this NavGraph. |
| `final https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/navigation/NavGraph#getStartDestinationRoute()()` The route for the starting destination for this NavGraph. |
| `int` | `https://developer.android.com/reference/androidx/navigation/NavGraph#hashCode()()` |
| `int` | `https://developer.android.com/reference/androidx/navigation/NavGraph#hashCode()()` |
| `final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/util/Iterator.html<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/navigation/NavDestination>` | `https://developer.android.com/reference/androidx/navigation/NavGraph#iterator()()` |
| `void` | `https://developer.android.com/reference/androidx/navigation/NavGraph#onInflate(android.content.Context,android.util.AttributeSet)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/content/Context.html context, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/util/AttributeSet.html attrs)` Called when inflating a destination from a resource. |
| `final void` | `https://developer.android.com/reference/androidx/navigation/NavGraph#remove(androidx.navigation.NavDestination)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/navigation/NavDestination node)` Remove a given destination from this NavGraph |
| `final void` | `<T extends https://developer.android.com/reference/java/lang/Object.html> https://developer.android.com/reference/androidx/navigation/NavGraph#setStartDestination()()` Sets the starting destination for this NavGraph. |
| `final void` | `https://developer.android.com/reference/androidx/navigation/NavGraph#setStartDestination(kotlin.Int)(int startDestId)` Sets the starting destination for this NavGraph. |
| `final void` | `https://developer.android.com/reference/androidx/navigation/NavGraph#setStartDestination(kotlin.String)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html startDestRoute)` Sets the starting destination for this NavGraph. |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/navigation/NavGraph#toString()()` |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/navigation/NavGraph#toString()()` |

| ### Extension functions |
|---|---|
| `final boolean` | `https://developer.android.com/reference/androidx/navigation/NavGraphKt.https://developer.android.com/reference/androidx/navigation/NavGraph#(androidx.navigation.NavGraph).contains(kotlin.Int)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/navigation/NavGraph receiver, @https://developer.android.com/reference/androidx/annotation/IdRes int id)` Returns `true` if a destination with `id` is found in this navigation graph. |
| `final boolean` | `<T extends https://developer.android.com/reference/java/lang/Object.html> https://developer.android.com/reference/androidx/navigation/NavGraphKt.https://developer.android.com/reference/androidx/navigation/NavGraph#(androidx.navigation.NavGraph).contains(kotlin.reflect.KClass)( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/navigation/NavGraph receiver, @https://developer.android.com/reference/androidx/annotation/NonNull https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.reflect/-k-class/index.html<@https://developer.android.com/reference/androidx/annotation/NonNull T> route )` Returns `true` if a destination with `route` is found in this navigation graph. |
| `final boolean` | `https://developer.android.com/reference/androidx/navigation/NavGraphKt.https://developer.android.com/reference/androidx/navigation/NavGraph#(androidx.navigation.NavGraph).contains(kotlin.String)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/navigation/NavGraph receiver, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html route)` Returns `true` if a destination with `route` is found in this navigation graph. |
| `final boolean` | `<T extends https://developer.android.com/reference/java/lang/Object.html> https://developer.android.com/reference/androidx/navigation/NavGraphKt.https://developer.android.com/reference/androidx/navigation/NavGraph#(androidx.navigation.NavGraph).contains(kotlin.Any)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/navigation/NavGraph receiver, @https://developer.android.com/reference/androidx/annotation/NonNull T route)` Returns `true` if a destination with `route` is found in this navigation graph. |
| `final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/navigation/NavDestination` | `https://developer.android.com/reference/androidx/navigation/NavGraphKt.https://developer.android.com/reference/androidx/navigation/NavGraph#(androidx.navigation.NavGraph).get(kotlin.Int)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/navigation/NavGraph receiver, @https://developer.android.com/reference/androidx/annotation/IdRes int id)` Returns the destination with `id`. |
| `final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/navigation/NavDestination` | `<T extends https://developer.android.com/reference/java/lang/Object.html> https://developer.android.com/reference/androidx/navigation/NavGraphKt.https://developer.android.com/reference/androidx/navigation/NavGraph#(androidx.navigation.NavGraph).get(kotlin.reflect.KClass)( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/navigation/NavGraph receiver, @https://developer.android.com/reference/androidx/annotation/NonNull https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.reflect/-k-class/index.html<@https://developer.android.com/reference/androidx/annotation/NonNull T> route )` Returns the destination with `route` from `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.reflect/-k-class/index.html`. |
| `final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/navigation/NavDestination` | `https://developer.android.com/reference/androidx/navigation/NavGraphKt.https://developer.android.com/reference/androidx/navigation/NavGraph#(androidx.navigation.NavGraph).get(kotlin.String)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/navigation/NavGraph receiver, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html route)` Returns the destination with `route`. |
| `final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/navigation/NavDestination` | `<T extends https://developer.android.com/reference/java/lang/Object.html> https://developer.android.com/reference/androidx/navigation/NavGraphKt.https://developer.android.com/reference/androidx/navigation/NavGraph#(androidx.navigation.NavGraph).get(kotlin.Any)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/navigation/NavGraph receiver, @https://developer.android.com/reference/androidx/annotation/NonNull T route)` Returns the destination with `route` from an Object. |
| `final void` | `https://developer.android.com/reference/androidx/navigation/NavGraphKt.https://developer.android.com/reference/androidx/navigation/NavGraph#(androidx.navigation.NavGraph).minusAssign(androidx.navigation.NavDestination)( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/navigation/NavGraph receiver, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/navigation/NavDestination node )` Removes `node` from this navigation graph. |
| `final void` | `https://developer.android.com/reference/androidx/navigation/NavGraphKt.https://developer.android.com/reference/androidx/navigation/NavGraph#(androidx.navigation.NavGraph).plusAssign(androidx.navigation.NavDestination)( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/navigation/NavGraph receiver, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/navigation/NavDestination node )` Adds a destination to this NavGraph. |
| `final void` | `https://developer.android.com/reference/androidx/navigation/NavGraphKt.https://developer.android.com/reference/androidx/navigation/NavGraph#(androidx.navigation.NavGraph).plusAssign(androidx.navigation.NavGraph)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/navigation/NavGraph receiver, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/navigation/NavGraph other)` Add all destinations from another collection to this one. |

### Inherited methods

From [kotlin.collections.Iterable](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-iterable/index.html) `void` `https://developer.android.com/reference/java/lang/Iterable.html#forEach(java.util.function.Consumer&lt;? super T&gt;)(@https://developer.android.com/reference/androidx/annotation/RecentlyNonNull @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/util/function/Consumer.html<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/navigation/NavDestination> action)` `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/util/Spliterator.html<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/navigation/NavDestination>` `@https://developer.android.com/reference/androidx/annotation/RecentlyNonNull
https://developer.android.com/reference/java/lang/Iterable.html#spliterator()()` From [androidx.navigation.NavDestination](https://developer.android.com/reference/androidx/navigation/NavDestination) `final void` `https://developer.android.com/reference/androidx/navigation/NavDestination#addArgument(kotlin.String,androidx.navigation.NavArgument)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html argumentName, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/navigation/NavArgument argument)`

Sets an argument type for an argument name
`final void` `https://developer.android.com/reference/androidx/navigation/NavDestination#addDeepLink(androidx.navigation.NavDeepLink)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/navigation/NavDeepLink navDeepLink)`

Add a deep link to this destination.
`final void` `https://developer.android.com/reference/androidx/navigation/NavDestination#addDeepLink(kotlin.String)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html uriPattern)`

Add a deep link to this destination.
`final https://developer.android.com/reference/java/lang/String.html` `https://developer.android.com/reference/androidx/navigation/NavDestination#fillInLabel(android.content.Context,android.os.Bundle)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/content/Context.html context, https://developer.android.com/reference/android/os/Bundle.html bundle)`

Parses a dynamic label containing arguments into a String.
`final https://developer.android.com/reference/androidx/navigation/NavAction` `https://developer.android.com/reference/androidx/navigation/NavDestination#getAction(kotlin.Int)(@https://developer.android.com/reference/androidx/annotation/IdRes int id)`

Returns the `https://developer.android.com/reference/androidx/navigation/NavAction` for the given action ID.
`final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/util/Map.html<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/navigation/NavArgument>` `https://developer.android.com/reference/androidx/navigation/NavDestination#getArguments()()`

The arguments supported by this destination.
`final @https://developer.android.com/reference/androidx/annotation/IdRes int` `https://developer.android.com/reference/androidx/navigation/NavDestination#getId()()`

The destination's unique ID.
`final https://developer.android.com/reference/java/lang/CharSequence.html` `https://developer.android.com/reference/androidx/navigation/NavDestination#getLabel()()`

The descriptive label of this destination.
`final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html` `https://developer.android.com/reference/androidx/navigation/NavDestination#getNavigatorName()()`

The name associated with this destination's `https://developer.android.com/reference/androidx/navigation/Navigator`.
`final https://developer.android.com/reference/androidx/navigation/NavGraph` `https://developer.android.com/reference/androidx/navigation/NavDestination#getParent()()`

Gets the `https://developer.android.com/reference/androidx/navigation/NavGraph` that contains this destination.
`final https://developer.android.com/reference/java/lang/String.html` `https://developer.android.com/reference/androidx/navigation/NavDestination#getRoute()()`

The destination's unique route.
`boolean` `https://developer.android.com/reference/androidx/navigation/NavDestination#hasDeepLink(androidx.navigation.NavDeepLinkRequest)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/navigation/NavDeepLinkRequest deepLinkRequest)`

Checks the given `https://developer.android.com/reference/androidx/navigation/NavDeepLinkRequest`, and determines whether it matches a `https://developer.android.com/reference/androidx/navigation/NavDeepLink` added to the destination by a call to `https://developer.android.com/reference/androidx/navigation/NavDestination#addDeepLink(kotlin.String)`.
`boolean` `https://developer.android.com/reference/androidx/navigation/NavDestination#hasDeepLink(android.net.Uri)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/net/Uri.html deepLink)`

Checks the given deep link `https://developer.android.com/reference/androidx/navigation/NavUri`, and determines whether it matches a Uri pattern added to the destination by a call to `https://developer.android.com/reference/androidx/navigation/NavDestination#addDeepLink(kotlin.String)` .
`final void` `https://developer.android.com/reference/androidx/navigation/NavDestination#putAction(kotlin.Int,androidx.navigation.NavAction)(@https://developer.android.com/reference/androidx/annotation/IdRes int actionId, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/navigation/NavAction action)`

Sets the `https://developer.android.com/reference/androidx/navigation/NavAction` destination for an action ID.
`final void` `https://developer.android.com/reference/androidx/navigation/NavDestination#putAction(kotlin.Int,kotlin.Int)(@https://developer.android.com/reference/androidx/annotation/IdRes int actionId, @https://developer.android.com/reference/androidx/annotation/IdRes int destId)`

Creates a `https://developer.android.com/reference/androidx/navigation/NavAction` for the given `https://developer.android.com/reference/androidx/navigation/NavDestination#putAction(kotlin.Int,kotlin.Int)` and associates it with the `https://developer.android.com/reference/androidx/navigation/NavDestination#putAction(kotlin.Int,kotlin.Int)`.
`final void` `https://developer.android.com/reference/androidx/navigation/NavDestination#removeAction(kotlin.Int)(@https://developer.android.com/reference/androidx/annotation/IdRes int actionId)`

Unsets the `https://developer.android.com/reference/androidx/navigation/NavAction` for an action ID.
`final void` `https://developer.android.com/reference/androidx/navigation/NavDestination#removeArgument(kotlin.String)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html argumentName)`

Unsets the argument type for an argument name.
`final void` `https://developer.android.com/reference/androidx/navigation/NavDestination#setId(kotlin.Int)(int value)`

The destination's unique ID.
`final void` `https://developer.android.com/reference/androidx/navigation/NavDestination#setLabel(kotlin.CharSequence)(https://developer.android.com/reference/java/lang/CharSequence.html value)`

The descriptive label of this destination.
`final void` `https://developer.android.com/reference/androidx/navigation/NavDestination#setParent(androidx.navigation.NavGraph)(https://developer.android.com/reference/androidx/navigation/NavGraph value)`

Gets the `https://developer.android.com/reference/androidx/navigation/NavGraph` that contains this destination.
`final void` `https://developer.android.com/reference/androidx/navigation/NavDestination#setRoute(kotlin.String)(https://developer.android.com/reference/java/lang/String.html value)`

The destination's unique route.

## Public constructors

### NavGraph

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/navigation#1.0.0)

```
public NavGraph(@NonNull Navigator<@NonNull NavGraph> navGraphNavigator)
```

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/navigation/Navigator<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/navigation/NavGraph> navGraphNavigator` | The `https://developer.android.com/reference/androidx/navigation/NavGraphNavigator` which this destination will be associated with. Generally retrieved via a `https://developer.android.com/reference/androidx/navigation/NavController`'s`https://developer.android.com/reference/androidx/navigation/NavigatorProvider#getNavigator(kotlin.String)` method. |

## Public methods

### addAll

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/navigation#1.0.0)

```
public final void addAll(@NonNull NavGraph other)
```

Add all destinations from another collection to this one. As each destination has at most one parent, the destinations will be removed from the given NavGraph.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/navigation/NavGraph other` | collection of destinations to add. All destinations will be removed from this graph after being added to this graph. |

### addDestination

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/navigation#1.0.0)

```
public final void addDestination(@NonNull NavDestination node)
```

Adds a destination to this NavGraph. The destination must have an `https://developer.android.com/reference/androidx/navigation/NavDestination#id()` id} set.

The destination must not have a `https://developer.android.com/reference/androidx/navigation/NavDestination#parent()` set. If the destination is already part of a `https://developer.android.com/reference/androidx/navigation/NavGraph`, call `https://developer.android.com/reference/androidx/navigation/NavGraph#remove(androidx.navigation.NavDestination)` before calling this method.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/navigation/NavDestination node` | destination to add |

| Throws |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-illegal-argument-exception/index.html` | if destination does not have an id, the destination has the same id as the graph, or the destination already has a parent. |

### addDestinations

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/navigation#1.0.0)

```
public final void addDestinations(@NonNull Collection<NavDestination> nodes)
```

Adds multiple destinations to this NavGraph. Each destination must have an `https://developer.android.com/reference/androidx/navigation/NavDestination#id()` id} set.

Each destination must not have a `https://developer.android.com/reference/androidx/navigation/NavDestination#parent()` set. If any destination is already part of a `https://developer.android.com/reference/androidx/navigation/NavGraph`, call `https://developer.android.com/reference/androidx/navigation/NavGraph#remove(androidx.navigation.NavDestination)` before calling this method.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/util/Collection.html<https://developer.android.com/reference/androidx/navigation/NavDestination> nodes` | destinations to add |

### addDestinations

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/navigation#1.0.0)

```
public final void addDestinations(@NonNull NavDestination... nodes)
```

Adds multiple destinations to this NavGraph. Each destination must have an `https://developer.android.com/reference/androidx/navigation/NavDestination#id()` id} set.

Each destination must not have a `https://developer.android.com/reference/androidx/navigation/NavDestination#parent()` set. If any destination is already part of a `https://developer.android.com/reference/androidx/navigation/NavGraph`, call `https://developer.android.com/reference/androidx/navigation/NavGraph#remove(androidx.navigation.NavDestination)` before calling this method.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/navigation/NavDestination... nodes` | destinations to add |

### clear

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/navigation#1.0.0)

```
public final void clear()
```

Clear all destinations from this navigation graph.

### equals

```
public boolean equals(Object other)
```

### equals

```
public boolean equals(Object other)
```

### findNode

```
public final NavDestination <T extends Object> findNode()
```

Finds a destination in the collection by route from `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.reflect/-k-class/index.html`. This will recursively check the `https://developer.android.com/reference/androidx/navigation/NavDestination#parent()` of this navigation graph if node is not found in this navigation graph.

| Parameters |
|---|---|
| `<T extends https://developer.android.com/reference/java/lang/Object.html>` | Route from a `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.reflect/-k-class/index.html` to locate |

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/navigation/NavDestination` | the node with route - the node must have been created with a route from `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.reflect/-k-class/index.html` |

### findNode

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/navigation#1.0.0)

```
public final NavDestination findNode(@IdRes int resId)
```

Finds a destination in the collection by ID. This will recursively check the `https://developer.android.com/reference/androidx/navigation/NavDestination#parent()` of this navigation graph if node is not found in this navigation graph.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/IdRes int resId` | ID to locate |

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/navigation/NavDestination` | the node with ID resId |

### findNode

Added in [2.9.0](https://developer.android.com/jetpack/androidx/releases/navigation#2.9.0)

```
public final NavDestination findNode(@NonNull KClass<@NonNull ?> route)
```

Finds a destination in the collection by route from `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.reflect/-k-class/index.html`. This will recursively check the `https://developer.android.com/reference/androidx/navigation/NavDestination#parent()` of this navigation graph if node is not found in this navigation graph.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.reflect/-k-class/index.html<@https://developer.android.com/reference/androidx/annotation/NonNull ?> route` | Route from a `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.reflect/-k-class/index.html` to locate |

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/navigation/NavDestination` | the node with route - the node must have been created with a route from `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.reflect/-k-class/index.html` |

### findNode

Added in [2.8.0](https://developer.android.com/jetpack/androidx/releases/navigation#2.8.0)

```
public final NavDestination <T extends Object> findNode(T route)
```

Finds a destination in the collection by route from Object. This will recursively check the `https://developer.android.com/reference/androidx/navigation/NavDestination#parent()` of this navigation graph if node is not found in this navigation graph.

| Parameters |
|---|---|
| `T route` | Route to locate |

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/navigation/NavDestination` | the node with route - the node must have been created with a route from `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.reflect/-k-class/index.html` |

### findNode

Added in [2.4.0](https://developer.android.com/jetpack/androidx/releases/navigation#2.4.0)

```
public final NavDestination findNode(String route)
```

Finds a destination in the collection by route. This will recursively check the `https://developer.android.com/reference/androidx/navigation/NavDestination#parent()` of this navigation graph if node is not found in this navigation graph.

| Parameters |
|---|---|
| `https://developer.android.com/reference/java/lang/String.html route` | Route to locate |

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/navigation/NavDestination` | the node with route |

### findNodeComprehensive

```
public final NavDestination findNodeComprehensive(
    int resId,
    NavDestination lastVisited,
    boolean searchChildren,
    NavDestination matchingDest
)
```

Searches all children and parents recursively.

Does not revisit graphs (whether it's a child or parent) if it has already been visited.

| Parameters |
|---|---|
| `int resId` | the `https://developer.android.com/reference/androidx/navigation/NavDestination#id()` |
| `https://developer.android.com/reference/androidx/navigation/NavDestination lastVisited` | the previously visited node |
| `boolean searchChildren` | searches the graph's children for the node when true |
| `https://developer.android.com/reference/androidx/navigation/NavDestination matchingDest` | an optional NavDestination that the node should match with. This is because `https://developer.android.com/reference/androidx/navigation/NavGraph#findNodeComprehensive(kotlin.Int,androidx.navigation.NavDestination,kotlin.Boolean,androidx.navigation.NavDestination)` is only unique to a local graph. Nodes in sibling graphs can have the same id. |

### findStartDestination

Added in [2.4.0](https://developer.android.com/jetpack/androidx/releases/navigation#2.4.0)

```
public static final @NonNull NavDestination findStartDestination(@NonNull NavGraph receiver)
```

Finds the actual start destination of the graph, handling cases where the graph's starting destination is itself a NavGraph.

| Returns |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/navigation/NavDestination` | the actual startDestination of the given graph. |

### getDisplayName

```
public @NonNull String getDisplayName()
```

### getStartDestDisplayName

```
public final @NonNull String getStartDestDisplayName()
```

### getStartDestination

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/navigation#1.0.0) Deprecated in [2.4.0](https://developer.android.com/jetpack/androidx/releases/navigation#2.4.0)

```
public final @IdRes int [getStartDestination](https://developer.android.com/reference/androidx/navigation/NavGraph#getStartDestination())()
```

> [!CAUTION]
> **This method is deprecated.**   
> Use getStartDestinationId instead, use this instead:
>
> ```
> startDestinationId
> ```

Gets the starting destination for this NavGraph. When navigating to the NavGraph, this destination is the one the user will initially see.

| Returns |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/IdRes int` | the start destination |

### getStartDestinationId

Added in [2.4.0](https://developer.android.com/jetpack/androidx/releases/navigation#2.4.0)

```
public final @IdRes int getStartDestinationId()
```

The starting destination id for this NavGraph. When navigating to the NavGraph, the destination represented by this id is the one the user will initially see.

### getStartDestinationRoute

Added in [2.4.0](https://developer.android.com/jetpack/androidx/releases/navigation#2.4.0)

```
public final String getStartDestinationRoute()
```

The route for the starting destination for this NavGraph. When navigating to the NavGraph, the destination represented by this route is the one the user will initially see.

### hashCode

```
public int hashCode()
```

### hashCode

```
public int hashCode()
```

### iterator

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/navigation#1.0.0)

```
public final @NonNull Iterator<@NonNull NavDestination> iterator()
```

| Throws |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-no-such-element-exception/index.html` | if there no more elements |

### onInflate

```
public void onInflate(@NonNull Context context, @NonNull AttributeSet attrs)
```

Called when inflating a destination from a resource.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/content/Context.html context` | local context performing inflation |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/util/AttributeSet.html attrs` | attrs to parse during inflation |

### remove

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/navigation#1.0.0)

```
public final void remove(@NonNull NavDestination node)
```

Remove a given destination from this NavGraph

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/navigation/NavDestination node` | the destination to remove. |

### setStartDestination

```
public final void <T extends Object> setStartDestination()
```

Sets the starting destination for this NavGraph.

This will override any previously set `https://developer.android.com/reference/androidx/navigation/NavGraph#startDestinationId()`

| Parameters |
|---|---|
| `<T extends https://developer.android.com/reference/java/lang/Object.html>` | The route of the destination as a `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.reflect/-k-class/index.html` to be shown when navigating to this NavGraph. |

### setStartDestination

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/navigation#1.0.0)

```
public final void setStartDestination(int startDestId)
```

Sets the starting destination for this NavGraph.

This will clear any previously set `https://developer.android.com/reference/androidx/navigation/NavGraph#startDestinationRoute()`.

| Parameters |
|---|---|
| `int startDestId` | The id of the destination to be shown when navigating to this NavGraph. |

### setStartDestination

Added in [2.4.0](https://developer.android.com/jetpack/androidx/releases/navigation#2.4.0)

```
public final void setStartDestination(@NonNull String startDestRoute)
```

Sets the starting destination for this NavGraph.

This will override any previously set `https://developer.android.com/reference/androidx/navigation/NavGraph#startDestinationId()`

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html startDestRoute` | The route of the destination to be shown when navigating to this NavGraph. |

### toString

```
public @NonNull String toString()
```

### toString

```
public @NonNull String toString()
```

## Extension functions

### NavGraphKt.contains

Artifact: [androidx.navigation:navigation-common](https://developer.android.com/jetpack/androidx/releases/navigation) [View Source](https://cs.android.com/search?q=file:androidx/navigation/NavGraph.android.kt+function:contains)

```
public final boolean NavGraphKt.contains(@NonNull NavGraph receiver, @IdRes int id)
```

Returns `true` if a destination with `id` is found in this navigation graph.

### NavGraphKt.contains

Artifact: [androidx.navigation:navigation-common](https://developer.android.com/jetpack/androidx/releases/navigation) [View Source](https://cs.android.com/search?q=file:androidx/navigation/NavGraph.kt+function:contains)

```
public final boolean <T extends Object> NavGraphKt.contains(
    @NonNull NavGraph receiver,
    @NonNull KClass<@NonNull T> route
)
```

Returns `true` if a destination with `route` is found in this navigation graph.

### NavGraphKt.contains

Artifact: [androidx.navigation:navigation-common](https://developer.android.com/jetpack/androidx/releases/navigation) [View Source](https://cs.android.com/search?q=file:androidx/navigation/NavGraph.kt+function:contains)

```
public final boolean NavGraphKt.contains(@NonNull NavGraph receiver, @NonNull String route)
```

Returns `true` if a destination with `route` is found in this navigation graph.

### NavGraphKt.contains

Artifact: [androidx.navigation:navigation-common](https://developer.android.com/jetpack/androidx/releases/navigation) [View Source](https://cs.android.com/search?q=file:androidx/navigation/NavGraph.kt+function:contains)

```
public final boolean <T extends Object> NavGraphKt.contains(@NonNull NavGraph receiver, @NonNull T route)
```

Returns `true` if a destination with `route` is found in this navigation graph.

### NavGraphKt.get

Artifact: [androidx.navigation:navigation-common](https://developer.android.com/jetpack/androidx/releases/navigation) [View Source](https://cs.android.com/search?q=file:androidx/navigation/NavGraph.android.kt+function:get)

```
public final @NonNull NavDestination NavGraphKt.get(@NonNull NavGraph receiver, @IdRes int id)
```

Returns the destination with `id`.

| Throws |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-illegal-argument-exception/index.html` | if no destination is found with that id. |

### NavGraphKt.get

Artifact: [androidx.navigation:navigation-common](https://developer.android.com/jetpack/androidx/releases/navigation) [View Source](https://cs.android.com/search?q=file:androidx/navigation/NavGraph.kt+function:get)

```
public final @NonNull NavDestination <T extends Object> NavGraphKt.get(
    @NonNull NavGraph receiver,
    @NonNull KClass<@NonNull T> route
)
```

Returns the destination with `route` from `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.reflect/-k-class/index.html`.

| Throws |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-illegal-argument-exception/index.html` | if no destination is found with that route. |

### NavGraphKt.get

Artifact: [androidx.navigation:navigation-common](https://developer.android.com/jetpack/androidx/releases/navigation) [View Source](https://cs.android.com/search?q=file:androidx/navigation/NavGraph.kt+function:get)

```
public final @NonNull NavDestination NavGraphKt.get(@NonNull NavGraph receiver, @NonNull String route)
```

Returns the destination with `route`.

| Throws |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-illegal-argument-exception/index.html` | if no destination is found with that route. |

### NavGraphKt.get

Artifact: [androidx.navigation:navigation-common](https://developer.android.com/jetpack/androidx/releases/navigation) [View Source](https://cs.android.com/search?q=file:androidx/navigation/NavGraph.kt+function:get)

```
public final @NonNull NavDestination <T extends Object> NavGraphKt.get(@NonNull NavGraph receiver, @NonNull T route)
```

Returns the destination with `route` from an Object.

| Throws |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-illegal-argument-exception/index.html` | if no destination is found with that route. |

### NavGraphKt.minusAssign

Artifact: [androidx.navigation:navigation-common](https://developer.android.com/jetpack/androidx/releases/navigation) [View Source](https://cs.android.com/search?q=file:androidx/navigation/NavGraph.kt+function:minusAssign)

```
public final void NavGraphKt.minusAssign(
    @NonNull NavGraph receiver,
    @NonNull NavDestination node
)
```

Removes `node` from this navigation graph.

### NavGraphKt.plusAssign

Artifact: [androidx.navigation:navigation-common](https://developer.android.com/jetpack/androidx/releases/navigation) [View Source](https://cs.android.com/search?q=file:androidx/navigation/NavGraph.kt+function:plusAssign)

```
public final void NavGraphKt.plusAssign(
    @NonNull NavGraph receiver,
    @NonNull NavDestination node
)
```

Adds a destination to this NavGraph. The destination must have an `https://developer.android.com/reference/androidx/navigation/NavDestination#id()` set.

The destination must not have a `https://developer.android.com/reference/androidx/navigation/NavDestination#parent()` set. If the destination is already part of a `https://developer.android.com/reference/androidx/navigation/NavGraph`, call `https://developer.android.com/reference/androidx/navigation/NavGraph#remove(androidx.navigation.NavDestination)` before calling this method.

<br />

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/navigation/NavDestination node` | destination to add |

### NavGraphKt.plusAssign

Artifact: [androidx.navigation:navigation-common](https://developer.android.com/jetpack/androidx/releases/navigation) [View Source](https://cs.android.com/search?q=file:androidx/navigation/NavGraph.kt+function:plusAssign)

```
public final void NavGraphKt.plusAssign(@NonNull NavGraph receiver, @NonNull NavGraph other)
```

Add all destinations from another collection to this one. As each destination has at most one parent, the destinations will be removed from the given NavGraph.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/navigation/NavGraph other` | collection of destinations to add. All destinations will be removed from the parameter graph after being added to this graph. |