Skip to contents

Graph Components

Usage

subcomponent(graph, vid, mode = 1L)

subcomponents(graph, vids, mode = 1L)

Arguments

graph

An igraph_ptr object.

vid

An integer value of vertex ID.

mode

An integer value of edge type to count; {1: OUT, 2: IN, 3: ALL}.

vids

An integer vector of vertex IDs.

Value

subcomponent() returns the IDs of the vertices reachable from the given vertex.

subcomponents() returns a list of integer vectors by applying subcomponent() for each vertex in vids.

Examples

g = graph_tree(5L)
subcomponent(g, 2L)
#> [1] 2 4 5
subcomponents(g, c(1L, 2L))
#> [[1]]
#> [1] 1 2 3 4 5
#> 
#> [[2]]
#> [1] 2 4 5
#>