R: Group nodes and edges based on community structure

group_graph {tidygraph} | R Documentation

## Group nodes and edges based on community structure

### Description

These functions are wrappers around the various clustering functions provided by `igraph`. As with the other wrappers they automatically use the graph that is being computed on, and otherwise passes on its arguments to the relevant clustering function. The return value is always a numeric vector of group memberships so that nodes or edges with the same number are part of the same group. Grouping is predominantly made on nodes and currently the only grouping of edges supported is biconnected components.

### Usage

    group_components(type = "weak")

    group_edge_betweenness(weights = NULL, directed = TRUE)

    group_fast_greedy(weights = NULL)

    group_infomap(weights = NULL, node_weights = NULL, trials = 10)

    group_label_prop(weights = NULL, label = NULL, fixed = NULL)

    group_leading_eigen(weights = NULL, steps = -1, label = NULL,
      options = igraph::arpack_defaults)

    group_louvain(weights = NULL)

    group_optimal(weights = NULL)

    group_spinglass(weights = NULL, ...)

    group_walktrap(weights = NULL, steps = 4)

    group_biconnected_component()

### Arguments

`type` | The type of component to find. Either `'weak'` or `'strong'`
`weights` | The weight of the edges to use for the calculation. Will be evaluated in the context of the edge data.
`directed` | Should direction of edges be used for the calculations
`node_weights` | The weight of the nodes to use for the calculation. Will be evaluated in the context of the node data.
`trials` | Number of times partition of the network should be attempted
`label` | The initial groups of the nodes. Will be evaluated in the context of the node data.
`fixed` | A logical vector determining which nodes should keep their initial groups. Will be evaluated in the context of the node data.
`steps` | The number of steps in the random walks
`options` | Settings passed on to `igraph::arpack()`
`...` | arguments passed on to `igraph::cluster_spinglass()`

### Value

a numeric vector with the membership for each node in the graph

### Functions

- `group_components`: Group by connected compenents using `igraph::components()`

- `group_edge_betweenness`: Group densely connected nodes using `igraph::cluster_edge_betweenness()`

- `group_fast_greedy`: Group nodes by optimising modularity using `igraph::cluster_fast_greedy()`

- `group_infomap`: Group nodes by minimizing description length using `igraph::cluster_infomap()`

- `group_label_prop`: Group nodes by propagating labels using `igraph::cluster_label_prop()`

- `group_leading_eigen`: Group nodes based on the leading eigenvector of the modularity matrix using `igraph::cluster_leading_eigen()`

- `group_louvain`: Group nodes by multilevel optimisation of modularity using `igraph::cluster_louvain()`

- `group_optimal`: Group nodes by optimising the moldularity score using `igraph::cluster_optimal()`

- `group_spinglass`: Group nodes using simulated annealing with `igraph::cluster_spinglass()`

- `group_walktrap`: Group nodes via short random walks using `igraph::cluster_walktrap()`

- `group_biconnected_component`: Group edges by their membership of the maximal binconnected components using `igraph::biconnected_components()`

### Examples

    create_notable('tutte') %>%
      activate(nodes) %>%
      mutate(group = group_infomap())

[Package tidygraph version 1.0.0 Index]