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.
- ...
These dots are for future extensions and must be empty.
- mode
Character string, either “in”, “out” or “all”. If “in” all vertices from which
vis reachable are listed. If “out” all vertices reachable fromvare returned. If “all” returns the union of these. It is ignored for undirected graphs.
See also
Other structural.properties:
bfs(),
component_distribution(),
connect(),
constraint(),
coreness(),
degree(),
dfs(),
distance_table(),
edge_density(),
feedback_arc_set(),
feedback_vertex_set(),
girth(),
is_acyclic(),
is_dag(),
is_matching(),
k_shortest_paths(),
knn(),
reciprocity(),
subgraph(),
topo_sort(),
transitivity(),
unfold_tree(),
which_multiple(),
which_mutual()
Author
Gabor Csardi csardi.gabor@gmail.com
Examples
g <- sample_gnp(100, 1 / 200)
subcomponent(g, 1, "in")
#> Warning: Calling `subcomponent()` with positional or abbreviated arguments was
#> deprecated in igraph 3.0.0.
#> ℹ Detected call: subcomponent(graph, v, mode)
#> ℹ Use instead: subcomponent(graph, v, mode = )
#> ── <vertex sequence> 1/100 · from 8de38b5 ──────────────────────────────────────
#> [1] 1
subcomponent(g, 1, "out")
#> ── <vertex sequence> 1/100 · from 8de38b5 ──────────────────────────────────────
#> [1] 1
subcomponent(g, 1, "all")
#> ── <vertex sequence> 1/100 · from 8de38b5 ──────────────────────────────────────
#> [1] 1
