View source: R/generate_community_graph.R
| generate_community_graph | R Documentation |
This function generates a random symmetric adjacency matrix representing a brain network with community structure. Nodes within the same community have a higher probability of being connected compared to nodes from different communities.
generate_community_graph(
n_nodes = 100,
n_communities = 4,
community_sizes = NULL,
intra_prob = 0.8,
inter_prob = 0.2,
seed = NULL
)
n_nodes |
An integer specifying the total number of nodes (brain regions). Default is 100. |
n_communities |
An integer specifying the number of communities. Default is 4. |
community_sizes |
An integer vector specifying the sizes of each community. If NULL, communities are of equal size. Default is NULL. |
intra_prob |
A numeric value between 0 and 1, or a numeric vector of
length |
inter_prob |
A numeric value between 0 and 1 specifying the probability of an edge existing between nodes from different communities. Default is 0.2. |
seed |
An optional integer for setting the random seed to ensure reproducibility. Default is NULL. |
A symmetric binary adjacency matrix with no self-loops, representing a brain network with community structure.
# Generate a brain network with community structure
G <- generate_community_graph(n_nodes = 100, n_communities = 4, intra_prob = 0.8, inter_prob = 0.2)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.