Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

subcomponent

In- or out- component of a vertex


Description

Finds all vertices reachable from a given vertex, or the opposite: all vertices from which a given vertex is reachable via a directed path.

Usage

subcomponent(graph, v, mode = c("all", "out", "in"))

Arguments

graph

The graph to analyze.

v

The vertex to start the search from.

mode

Character string, either “in”, “out” or “all”. If “in” all vertices from which v is reachable are listed. If “out” all vertices reachable from v are returned. If “all” returns the union of these. It is ignored for undirected graphs.

Details

A breadh-first search is conducted starting from vertex v.

Value

Numeric vector, the ids of the vertices in the same component as v.

Author(s)

See Also

Examples

g <- sample_gnp(100, 1/200)
subcomponent(g, 1, "in")
subcomponent(g, 1, "out")
subcomponent(g, 1, "all")

igraph

Network Analysis and Visualization

v1.2.10
GPL (>= 2)
Authors
See AUTHORS file.
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.