# MatColoringSetDistance
Sets the distance of the coloring 
## Synopsis
```
#include "petscmat.h"  
PetscErrorCode MatColoringSetDistance(MatColoring mc, PetscInt dist)
```
Logically Collective


## Input Parameters

- ***mc -*** the `MatColoring` context
- ***dist -*** the distance the coloring should compute



## Options Database Key

- ***-mat_coloring_type -*** the type of coloring algorithm used. See `MatColoringType`.





## Note
The distance of the coloring denotes the minimum number
of edges in the graph induced by the matrix any two vertices
of the same color are.  Distance-1 colorings are the classical
coloring, where no two vertices of the same color are adjacent.
distance-2 colorings are useful for the computation of Jacobians.


## See Also
 `MatColoring`, `MatColoringSetFromOptions()`, `MatColoringGetDistance()`, `MatColoringApply()`

## Level
beginner

## Location
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/mat/color/interface/matcoloring.c.html#MatColoringSetDistance">src/mat/color/interface/matcoloring.c</A>


---
[Edit on GitLab](https://gitlab.com/petsc/petsc/-/edit/release/src/mat/color/interface/matcoloring.c)


[Index of all MatOrderings routines](index.md)  
[Table of Contents for all manual pages](/docs/manualpages/index.md)  
[Index of all manual pages](/docs/manualpages/singleindex.md)  
