Convert nodegroups list to communities object

nodegroups2communities(nodegroups, algorithm = NULL, ...)

Arguments

algorithm

character or NULL, indicating the name of the community detection algorithm used.

  • When algorithm is defined, it is used instead of attr(nodegroups, "algorithm").

  • When algorithm is NULL, attribute(nodegroups, "algorithm") is used if defined, otherwise algorithm="nodegroups".

...

additional arguments are ignored.

wc

communities object as returned by igraph functions such as cluster_optimal(), cluster_walktrap(), or cluster_leading_eigen().

Value

community object, which is essentially a list with specific required elements:

  • "membership" - integer assignment of nodes to clusters

  • "names" - character list of node names

  • "vcount" - integer number of nodes

  • "algorithm" - character string with the name of the community detection method used.

  • "cluster_names" - character labels associated with membership index values. These names are not generated by igraph community detection, and are therefore optional for use in most igraph workflows. However, they are used in some multienrichjam functions, specifically make_point_hull() which optionally displays a label beside each node cluster during plotting.

Details

Note that this function is "lossy", in that the output communities object will not contain any supporting data specific to the community detection algorithm originally used. However, the output communities object will be accepted by most igraph related functions that require that object type as an input value.

The names(nodegroups) are used to define a new element in the output communities object "cluster_names", so the names will be maintained in the data. Default igraph functions do not use these names, but they are used by multienrichjam for example by function make_point_hull() which uses these names to label each cluster during plotting.