:orphan:
# MatPartitioningSetVertexWeights
Sets the weights for vertices for a partitioning. 
## Synopsis
```
#include "petscmat.h" 
PetscErrorCode MatPartitioningSetVertexWeights(MatPartitioning part, const PetscInt weights[])
```
Logically Collective


## Input Parameters

- ***part -*** the partitioning context
- ***weights -*** the weights, on each process this array must have the same size as the number of local rows times the value passed with `MatPartitioningSetNumberVertexWeights()` or
1 if that is not provided





## Notes
The array weights is freed by PETSc so the user should not free the array. In C/C++
the array must be obtained with a call to `PetscMalloc()`, not malloc().

The weights may not be used by some partitioners


## See Also
 [](ch_matrices), `Mat`, `MatPartitioning`, `MatPartitioningCreate()`, `MatPartitioningSetType()`, `MatPartitioningSetPartitionWeights()`, `MatPartitioningSetNumberVertexWeights()`

## Level
beginner

## Location
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/mat/partition/partition.c.html#MatPartitioningSetVertexWeights">src/mat/partition/partition.c</A>

## Examples
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/mat/tutorials/ex15.c.html">src/mat/tutorials/ex15.c</A><BR>


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


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