# MatColoringSetMaxColors
Sets the maximum number of colors to produce 
## Synopsis
```
#include "petscmat.h"  
PetscErrorCode MatColoringSetMaxColors(MatColoring mc, PetscInt maxcolors)
```
Logically Collective


## Input Parameters

- ***mc -*** the `MatColoring` context
- ***maxcolors -*** the maximum number of colors to produce





## Notes
Vertices not in an available color are set to have color maxcolors+1, which is not
a valid color as they may be adjacent.

This works only for  `MATCOLORINGGREEDY` and `MATCOLORINGJP`

This may be used to compute a certain number of
independent sets from the graph.  For instance, while using
`MATCOLORINGGREEDY` and maxcolors = 1, one gets out an MIS.


## See Also
 `MatColoring`, `MatColoringGetMaxColors()`, `MatColoringApply()`

## Level
beginner

## Location
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/mat/color/interface/matcoloring.c.html#MatColoringSetMaxColors">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)  
