View source: R/community_detection.R
comm_detect | R Documentation |
comm_detect
)The comm_detect
function runs a set of several commonly-used community detection routines on a network and provides community assignments from these routines. Need to mention that only supports undirected nets and that for some routines the median community value is used.
comm_detect(g, modres = 1, slow_routines = FALSE, shiny = FALSE)
g |
An igraph object. If the igraph object contains a directed network, the function will treat the network as undirected before running community detection routines. |
modres |
A modularity resolution parameter used when performing community detection using the Leiden method. |
slow_routines |
A logical indicating whether time-intensive community detection routines should be performed on larger networks. Edge betweenness, leading eigenvector, link communities, and stochastic blockmodeling each take a very long time to identify communities in networks consisting of more than a few thousand nodes. By default, |
shiny |
An argument indicating whether the output from the |
comm_detect
returns a list contianing three data frames. comm_members
indicates each node's assigned community membership from each community detection routine. comm_summaries
indicates the number of communities inferred from each routine as well as the modularity score arising from community assignments. comp_scores
contains a matrix indicating the similarity of community assignments between each pair of community detection routines, measured using adjusted rand scores. A fourth element in the list, plots
, contains a series of network visualizations in which nodes are colored by their assigned community memberships from each routine. If shiny == FALSE
, this function will display these visualizations in the user's plot window.
# Run netwrite
nw_fauxmesa <- netwrite(nodelist = fauxmesa_nodes,
node_id = "id",
i_elements = fauxmesa_edges$from,
j_elements = fauxmesa_edges$to,
directed = TRUE,
net_name = "faux_mesa",
output = "graph")
# Run comm_detect
faux_communities <- comm_detect(g = nw_fauxmesa$faux_mesa)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.