# DMPlexGetAdjacency
Return all points adjacent to the given point 
## Synopsis
```
#include "petscdmplex.h"   
#include "petscdmlabel.h"  
PetscErrorCode DMPlexGetAdjacency(DM dm, PetscInt p, PetscInt *adjSize, PetscInt *adj[])
```

## Input Parameters

- ***dm -*** The DM object
- ***p  -*** The point



## Input/Output Parameters

- ***adjSize -*** The maximum size of adj if it is non-NULL, or PETSC_DETERMINE;
on output the number of adjacent points
- ***adj -*** Either NULL so that the array is allocated, or an existing array with size adjSize;
on output contains the adjacent points





## Notes
The user must PetscFree the adj array if it was not passed in.


## See Also
 `DMSetAdjacency()`, `DMPlexDistribute()`, `DMCreateMatrix()`, `DMPlexPreallocateOperator()`

## Level
advanced

## Location
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/dm/impls/plex/plexdistribute.c.html#DMPlexGetAdjacency">src/dm/impls/plex/plexdistribute.c</A>

## Implementations

<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/dm/impls/plex/plexdistribute.c.html#DMPlexGetAdjacency_Internal">DMPlexGetAdjacency_Internal in src/dm/impls/plex/plexdistribute.c</A><BR>


---
[Edit on GitLab](https://gitlab.com/petsc/petsc/-/edit/release/src/dm/impls/plex/plexdistribute.c)


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