# neighbors

From igraph v1.0.0
by Gabor Csardi

##### Neighboring (adjacent) vertices in a graph

A vertex is a neighbor of another one (in other words, the two vertices are adjacent), if they are incident to the same edge.

##### Usage

`neighbors(graph, v, mode = c("out", "in", "all", "total"))`

##### Arguments

- graph
- The input graph.
- v
- The vertex of which the adjacent vertices are queried.
- mode
- Whether to query outgoing (
out ), incoming (in ) edges, or both types (all ). This is ignored for undirected graphs.

##### Value

- A vertex sequence containing the neighbors of the input vertex.

##### See Also

Other structural queries: `[.igraph`

;
`[[.igraph`

; `adjacent_vertices`

;
`are.connected`

, `are_adjacent`

;
`ecount`

, `gsize`

;
`ends`

, `get.edge`

,
`get.edges`

; `get.edge.ids`

;
`gorder`

, `vcount`

;
`head_of`

; `incident_edges`

;
`incident`

; `is.directed`

,
`is_directed`

; `tail_of`

##### Examples

```
g <- make_graph("Zachary")
n1 <- neighbors(g, 1)
n34 <- neighbors(g, 34)
intersection(n1, n34)
```

*Documentation reproduced from package igraph, version 1.0.0, License: GPL (>= 2)*

### Community examples

Looks like there are no examples yet.