Neighborhood of vertices
Arguments
- graph
An
igraph_ptr
object.- vids
An integer vector of vertex IDs.
- order
An integer giving the order of the neighborhood; e.g.,
order = 1L
considers only the immediate neighbors.- mode
An integer value of edge type to count; {1: OUT, 2: IN, 3: ALL}.
- mindist
The minimum distance to include a vertex in the counting; e.g.,
mindist = 1L
excludes the starting vertex itself, and2L
excludes the immediate neighbors.
Value
neighborhood_size()
returns an integer vector of the neighborhood
sizes for the given vertices.
neighborhood()
returns a list of integer vectors, each containing the
vertex IDs of the neighbors of the given vertices.
Examples
g = graph_tree(5L)
neighborhood_size(g)
#> [1] 3 3 1 1 1
neighborhood(g)
#> [[1]]
#> [1] 1 2 3
#>
#> [[2]]
#> [1] 2 4 5
#>
#> [[3]]
#> [1] 3
#>
#> [[4]]
#> [1] 4
#>
#> [[5]]
#> [1] 5
#>