| voronoi_cells | R Documentation |
This function partitions the vertices of a graph based on a set of generator vertices. Each vertex is assigned to the generator vertex from (or to) which it is closest.
groups() may be used on the output of this function.
voronoi_cells(
graph,
generators,
...,
weights = NULL,
mode = c("out", "in", "all", "total"),
tiebreaker = c("random", "first", "last")
)
graph |
The graph to partition into Voronoi cells. |
generators |
The generator vertices of the Voronoi cells. |
... |
These dots are for future extensions and must be empty. |
weights |
Possibly a numeric vector giving edge weights. If this is
|
mode |
Character string. In directed graphs, whether to compute
distances from generator vertices to other vertices ( |
tiebreaker |
Character string that specifies what to do when a vertex
is at the same distance from multiple generators. |
A named list with two components:
membership |
numeric vector giving the cluster id to which each vertex belongs. |
distances |
numeric vector giving the distance of each vertex from its generator |
distances()
Community detection
as_membership(),
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()
g <- make_lattice(c(10,10))
clu <- voronoi_cells(g, c(25, 43, 67))
groups(clu)
plot(g, vertex.color=clu$membership)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.