Filter a tidygraph object by component size.
filter_component_size(.data, min_size = 0, max_size = Inf)
.data | a tidygraph object (for use in a pipeline) |
---|---|
min_size, max_size | minumum and maximum sizes of components to keep (inclussive bounds) |
An object of the same class as .data
.
gr <- tidygraph::bind_graphs(tidygraph::play_barabasi_albert(3, 2), tidygraph::play_barabasi_albert(6, 2)) igraph::count_components(gr)#> [1] 2new_gr <- filter_component_size(gr, min_size = 4)#> Warning: `as_quosure()` requires an explicit environment as of rlang 0.3.0. #> Please supply `env`. #> This warning is displayed once per session.#> [1] 1