# Optimize

> Optimize the graph.

## Definition

* **Type:** Method
* **Namespace:** [UnityEditor.Search](/engine/6000.5/script-reference/unityeditor/search.md)
* **Assembly:** UnityEditor

## Optimize(bool, bool)

Optimize the graph.

```csharp
public void Optimize(bool propagateNotToLeaves, bool swapNotToRightHandSide)
```

### Parameters

**** (\[bool]\(https\://learn.microsoft.com/dotnet/api/system.boolean)): Propagate "Not" operations to leaves, so only leaves can have "Not" operations as parents.**** (\[bool]\(https\://learn.microsoft.com/dotnet/api/system.boolean)): Swaps "Not" operations to the right-hand side of combining operations (i.e. "And", "Or"). Useful if a "Not" operation is slow.

## Optimize(QueryGraphOptimizationOptions)

Optimize the graph.

```csharp
public void Optimize(QueryGraphOptimizationOptions options)
```

### Parameters

**** (\[QueryGraphOptimizationOptions]\(/engine/6000.5/script-reference/unityeditor/search/querygraphoptimizationoptions)): Optimization options.
