# PetscSFCreateEmbeddedRootSF
removes edges from all but the selected roots, does not remap indices 
## Synopsis
```
#include "petscsf.h" 
PetscErrorCode PetscSFCreateEmbeddedRootSF(PetscSF sf, PetscInt nselected, const PetscInt *selected, PetscSF *esf)
```
Collective


## Input Parameters

- ***sf -*** original star forest
- ***nselected  -*** number of selected roots on this process
- ***selected   -*** indices of the selected roots on this process



## Output Parameter

- ***esf -*** new star forest





## Note
To use the new `PetscSF`, it may be necessary to know the indices of the leaves that are still participating. This can
be done by calling PetscSFGetGraph().


## See Also
 `PetscSF`, `PetscSFSetGraph()`, `PetscSFGetGraph()`

## Level
advanced

## Location
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/vec/is/sf/interface/sf.c.html#PetscSFCreateEmbeddedRootSF">src/vec/is/sf/interface/sf.c</A>

## Examples
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/vec/is/sf/tutorials/ex1.c.html">src/vec/is/sf/tutorials/ex1.c.html</A><BR>

## Implementations

<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/vec/is/sf/impls/basic/alltoall/sfalltoall.c.html#PetscSFCreateEmbeddedRootSF_Alltoall">PetscSFCreateEmbeddedRootSF_Alltoall in src/vec/is/sf/impls/basic/alltoall/sfalltoall.c</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/vec/is/sf/impls/basic/sfbasic.c.html#PetscSFCreateEmbeddedRootSF_Basic">PetscSFCreateEmbeddedRootSF_Basic in src/vec/is/sf/impls/basic/sfbasic.c</A><BR>


---
[Edit on GitLab](https://gitlab.com/petsc/petsc/-/edit/release/src/vec/is/sf/interface/sf.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)  
