:orphan:
# MatCreateGraph
create a scalar matrix (that is a matrix with one vertex for each block vertex in the original matrix), for use in graph algorithms and possibly removes small values from the graph structure. 
## Synopsis
```
#include "petscmat.h" 
PetscErrorCode MatCreateGraph(Mat A, PetscBool sym, PetscBool scale, PetscReal filter, Mat *graph)
```
Collective


## Input Parameters

- ***A -*** the matrix
- ***sym -*** `PETSC_TRUE` indicates that the graph should be symmetrized
- ***scale -*** `PETSC_TRUE` indicates that the graph edge weights should be symmetrically scaled with the diagonal entry
- ***filter -*** filter value - < 0: does nothing; == 0: removes only 0.0 entries; otherwise: removes entries with abs(entries) <= value



## Output Parameter

- ***graph -*** the resulting graph





## See Also
 [](ch_matrices), `Mat`, `MatCreate()`, `PCGAMG`

## Level
advanced

## Location
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/mat/interface/matrix.c.html#MatCreateGraph">src/mat/interface/matrix.c</A>


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


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