View source: R/get_critical_nodes.R
| get_critical_nodes | R Documentation |
Given the output of identify_critical_links, this function
identifies the unique nodes involved in the critical edges and summarizes
their participation. Each node is reported with the number of critical edges
it participates in (its critical degree). If node labels are supplied,
they are included in the output.
get_critical_nodes(result, node_labels = NULL)
result |
The list returned by |
node_labels |
An optional character vector of length |
A data frame with the following columns, ordered by decreasing
critical_degree:
Integer node index.
Character label for the node (only present when
node_labels is not NULL).
Number of critical edges incident on this node.
If no critical edges were found (result$critical_edges is
NULL or has zero rows), an empty data frame with the same columns
is returned.
# Generate two synthetic populations with different community structure
control <- generate_category_graphs(n_graphs = 15, n_nodes = 10,
n_communities = 2, base_intra_prob = 0.8, base_inter_prob = 0.2, seed = 1)
patient <- generate_category_graphs(n_graphs = 15, n_nodes = 10,
n_communities = 2, base_intra_prob = 0.5, base_inter_prob = 0.5, seed = 2)
populations <- list(Control = control, Patient = patient)
# Identify critical edges
result <- identify_critical_links(populations, alpha = 0.05,
method = "fisher", n_permutations = 200, seed = 42)
# Extract critical nodes (no labels)
get_critical_nodes(result)
# With labels
labels <- paste0("Region_", 1:10)
get_critical_nodes(result, node_labels = labels)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.