MatColoringSetMaxColors — PETSc 3.22.5 documentation

Skip to main content
`Ctrl`+`K`

# 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

src/mat/graphops/color/interface/matcoloring.c

Index of all MatGraphOperations routines
Table of Contents for all manual pages
Index of all manual pages