# PetscSFGetGraphLayout
Get the global indices and `PetscLayout` that describe this star forest 
## Synopsis
```
#include "petscsf.h"   
PetscErrorCode PetscSFGetGraphLayout(PetscSF sf, PetscLayout *layout, PetscInt *nleaves, const PetscInt *ilocal[], PetscInt *gremote[])
```
Collective


## Input Parameter

- ***sf -*** star forest



## Output Parameters

- ***layout -*** `PetscLayout` defining the global space for roots
- ***nleaves -*** number of leaf vertices on the current process, each of these references a root on any process
- ***ilocal -*** locations of leaves in leafdata buffers, or NULL for contiguous storage
- ***gremote -*** root vertices in global numbering corresponding to leaves in ilocal





## Notes
The outputs are such that passing them as inputs to `PetscSFSetGraphLayout()` would lead to the same star forest.
The outputs layout and gremote are freshly created each time this function is called,
so they need to be freed by user and cannot be qualified as const.


## See Also
 `PetscSF`, `PetscSFSetGraphLayout()`, `PetscSFCreate()`, `PetscSFView()`, `PetscSFSetGraph()`, `PetscSFGetGraph()`

## Level
intermediate

## Location
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/vec/is/sf/utils/sfutils.c.html#PetscSFGetGraphLayout">src/vec/is/sf/utils/sfutils.c</A>


---
[Edit on GitLab](https://gitlab.com/petsc/petsc/-/edit/release/src/vec/is/sf/utils/sfutils.c)


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