# DependencyGraph

Artifact: [androidx.constraintlayout:constraintlayout-core](https://developer.android.com/jetpack/androidx/releases/constraintlayout) [View Source](https://cs.android.com/search?q=file:androidx/constraintlayout/core/widgets/analyzer/DependencyGraph.java+class:androidx.constraintlayout.core.widgets.analyzer.DependencyGraph) Added in [1.1.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#1.1.2)

*** ** * ** ***


```
public class DependencyGraph
```

<br />

*** ** * ** ***

## Summary

| ### Public constructors |
|---|
| `https://developer.android.com/reference/androidx/constraintlayout/core/widgets/analyzer/DependencyGraph#DependencyGraph(androidx.constraintlayout.core.widgets.ConstraintWidgetContainer)(https://developer.android.com/reference/androidx/constraintlayout/core/widgets/ConstraintWidgetContainer container)` |

| ### Public methods |
|---|---|
| `void` | `https://developer.android.com/reference/androidx/constraintlayout/core/widgets/analyzer/DependencyGraph#buildGraph()()` |
| `void` | `https://developer.android.com/reference/androidx/constraintlayout/core/widgets/analyzer/DependencyGraph#buildGraph(java.util.ArrayList<androidx.constraintlayout.core.widgets.analyzer.WidgetRun>)(https://developer.android.com/reference/java/util/ArrayList.html<https://developer.android.com/reference/androidx/constraintlayout/core/widgets/analyzer/WidgetRun> runs)` |
| `void` | `https://developer.android.com/reference/androidx/constraintlayout/core/widgets/analyzer/DependencyGraph#defineTerminalWidgets(androidx.constraintlayout.core.widgets.ConstraintWidget.DimensionBehaviour,androidx.constraintlayout.core.widgets.ConstraintWidget.DimensionBehaviour)( https://developer.android.com/reference/androidx/constraintlayout/core/widgets/ConstraintWidget.DimensionBehaviour horizontalBehavior, https://developer.android.com/reference/androidx/constraintlayout/core/widgets/ConstraintWidget.DimensionBehaviour verticalBehavior )` Find and mark terminal widgets (trailing widgets) -- they are the only ones we need to care for wrap_content checks |
| `boolean` | `https://developer.android.com/reference/androidx/constraintlayout/core/widgets/analyzer/DependencyGraph#directMeasure(boolean)(boolean optimizeWrap)` Try to measure the layout by solving the graph of constraints directly |
| `boolean` | `https://developer.android.com/reference/androidx/constraintlayout/core/widgets/analyzer/DependencyGraph#directMeasureSetup(boolean)(boolean optimizeWrap)` |
| `boolean` | `https://developer.android.com/reference/androidx/constraintlayout/core/widgets/analyzer/DependencyGraph#directMeasureWithOrientation(boolean,int)(boolean optimizeWrap, int orientation)` |
| `void` | `https://developer.android.com/reference/androidx/constraintlayout/core/widgets/analyzer/DependencyGraph#invalidateGraph()()` Invalidate the graph of constraints |
| `void` | `https://developer.android.com/reference/androidx/constraintlayout/core/widgets/analyzer/DependencyGraph#invalidateMeasures()()` Mark the widgets as needing to be remeasured |
| `void` | `https://developer.android.com/reference/androidx/constraintlayout/core/widgets/analyzer/DependencyGraph#measureWidgets()()` |
| `void` | `https://developer.android.com/reference/androidx/constraintlayout/core/widgets/analyzer/DependencyGraph#setMeasurer(androidx.constraintlayout.core.widgets.analyzer.BasicMeasure.Measurer)(https://developer.android.com/reference/androidx/constraintlayout/core/widgets/analyzer/BasicMeasure.Measurer measurer)` |

## Public constructors

### DependencyGraph

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

```
public DependencyGraph(ConstraintWidgetContainer container)
```

## Public methods

### buildGraph

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

```
public void buildGraph()
```

### buildGraph

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

```
public void buildGraph(ArrayList<WidgetRun> runs)
```

### defineTerminalWidgets

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

```
public void defineTerminalWidgets(
    ConstraintWidget.DimensionBehaviour horizontalBehavior,
    ConstraintWidget.DimensionBehaviour verticalBehavior
)
```

Find and mark terminal widgets (trailing widgets) -- they are the only ones we need to care for wrap_content checks

### directMeasure

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

```
public boolean directMeasure(boolean optimizeWrap)
```

Try to measure the layout by solving the graph of constraints directly

| Parameters |
|---|---|
| `boolean optimizeWrap` | use the wrap_content optimizer |

| Returns |
|---|---|
| `boolean` | true if all widgets have been resolved |

### directMeasureSetup

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

```
public boolean directMeasureSetup(boolean optimizeWrap)
```

### directMeasureWithOrientation

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

```
public boolean directMeasureWithOrientation(boolean optimizeWrap, int orientation)
```

### invalidateGraph

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

```
public void invalidateGraph()
```

Invalidate the graph of constraints

### invalidateMeasures

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

```
public void invalidateMeasures()
```

Mark the widgets as needing to be remeasured

### measureWidgets

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

```
public void measureWidgets()
```

### setMeasurer

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

```
public void setMeasurer(BasicMeasure.Measurer measurer)
```