# Is there a way to inspect the graph of a sparse matrix with PETSc?

I am currently trying to code the CA-CG method within the PETSc framework. A mandatory step in this process is the implementation of the "matrix powers kernel" algorithm for a generic sparse matrix.

This requires the computation of the index set obtained exploring the graph associated with the sparse matrix for s-steps, starting from the index set of the local rows "owned" by each process.

Is there a clean way to retrieve this kind of information using the PETSc API?

-

Use MatIncreaseOverlap() just like PCASM (additive Schwarz preconditioner) to get the overlapping region, then MatGetSubMatrices() (also like PCASM) to pull out the overlapping part of the matrix.
For further technical discussion of implementation, we encourage you to subscribe to petsc-dev@mcs.anl.gov or just email petsc-maint@mcs.anl.gov.