voronoi_cells {igraph} | R Documentation |
Voronoi partitioning of a graph
Description
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.
Usage
voronoi_cells(
graph,
generators,
...,
weights = NULL,
mode = c("out", "in", "all", "total"),
tiebreaker = c("random", "first", "last")
)
Arguments
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. |
Value
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 |
See Also
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()
Examples
g <- make_lattice(c(10,10))
clu <- voronoi_cells(g, c(25, 43, 67))
groups(clu)
plot(g, vertex.color=clu$membership)