Skip to main content
`Ctrl`+`K`

# 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, PetscInt num_idx, PetscInt index[], 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

- num_idx - size of ‘index’ array

- index - array of block indices to use for graph strength of connection weight

## Output Parameter

- graph - the resulting graph

## See Also

Matrices, `Mat`, `MatCreate()`, `PCGAMG`

## Level

advanced

## Location

src/mat/interface/matrix.c

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