View source: R/network-utils.R
| select_nodes | R Documentation |
Selects nodes by name, index, rank on a centrality measure, neighborhood, connected component, or filter expressions on node columns, centrality measures and structural variables.
select_nodes(
x,
...,
name = NULL,
index = NULL,
top = NULL,
by = "degree",
neighbors_of = NULL,
order = 1L,
component = NULL,
keep_edges = c("internal", "none"),
keep_format = FALSE,
directed = NULL,
.keep_edges = NULL
)
x |
Network input: cograph_network, matrix, igraph, network, or tna object. |
... |
Filter expressions using node columns, centrality measures, or global context variables. Centrality measures are computed lazily (only those actually referenced). Available variables:
|
name |
Character vector. Select nodes by name/label. |
index |
Integer vector. Select nodes by index (1-based). |
top |
Integer. Select top N nodes by centrality measure. |
by |
Character. Centrality measure for top selection. Default |
neighbors_of |
Character or integer. Select neighbors of these nodes (by name or index). |
order |
Integer. Neighborhood order (1 = direct neighbors, 2 = neighbors of neighbors, etc.). Default 1. |
component |
Selection mode for connected components:
|
keep_edges |
How to handle edges. One of:
|
keep_format |
Logical. If TRUE, matrix, igraph, statnet network and tna inputs are returned in that format. Default FALSE returns cograph_network. |
directed |
Logical or NULL. If NULL (default), auto-detect. |
.keep_edges |
Deprecated. Use |
Selection criteria are combined with AND logic, so a node is selected only
when it satisfies all of them. The top ranking is applied to the
nodes that pass name, index, component and
neighbors_of, and the filter expressions in ... are applied
afterwards. For example,
select_nodes(x, top = 10, component = "largest") selects the 10
highest-degree nodes within the largest component.
Only the centrality measures referenced in expressions or in by are
computed.
For networks with negative edge weights, betweenness,
closeness and pagerank are undefined and return NA,
with a cograph_negative_weights warning.
A cograph_network object with selected nodes. If keep_format = TRUE,
matrix, igraph, statnet network and tna inputs are converted back to that type.
filter_nodes, select_neighbors,
select_component, select_top
select_nodes(regulation_net, top = 3, by = "pagerank")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.