as_membership | R Documentation |

This is useful if you want to use functions defined on membership vectors, but your membership vector does not come from an igraph clustering method.

```
as_membership(x)
```

`x` |
The input vector. |

The input vector, with the `membership`

class added.

Community detection
`cluster_edge_betweenness()`

,
`cluster_fast_greedy()`

,
`cluster_fluid_communities()`

,
`cluster_infomap()`

,
`cluster_label_prop()`

,
`cluster_leading_eigen()`

,
`cluster_leiden()`

,
`cluster_louvain()`

,
`cluster_optimal()`

,
`cluster_spinglass()`

,
`cluster_walktrap()`

,
`compare()`

,
`groups()`

,
`make_clusters()`

,
`membership()`

,
`modularity.igraph()`

,
`plot_dendrogram()`

,
`split_join_distance()`

,
`voronoi_cells()`

```
## Compare to the correct clustering
g <- (make_full_graph(10) + make_full_graph(10)) %>%
rewire(each_edge(p = 0.2))
correct <- rep(1:2, each = 10) %>% as_membership()
fc <- cluster_fast_greedy(g)
compare(correct, fc)
compare(correct, membership(fc))
```

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.