Description Usage Arguments Value Examples
Performs community detection on networks using average shortest path distance
of vertex neighbors as the set of dissimilarities for heirarcal clustering
with "average" as the agglomeration method. If shortest paths are supplied,
this function is ~50% faster. It is also best to use a symmetric "matrix"
rather than a "dist" object if performance is critical. Time complexity is
O(n^2 log n) and space complexity is O(n^2). This function returns an
hclust
object rather than an igraph communities
object because the algorithm does not attempt to use modularity use or
maximize modularity (although the resulting partitioning results in a maximum
modularity that is competitive with the top community detection algorithms).
1 | cluster_redwalk(graph, nodes = V(graph), short_paths = NULL)
|
graph |
an igraph object. |
nodes |
a subset of the nodes in the graph to cluster, defaults to all nodes (full community detection) |
short_paths |
either a |V|x|V| symmetric dissimilarity matrix of the
vertices in |
cluster_redwalk
returns a hclust
object from
the stats package.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | require(stats, quietly = TRUE)
require(Rcpp, quietly = TRUE)
cb <- cluster_redwalk(karate)
## cb is an hclust object
plot(cb)
## membership for different community sizes (k)
cutree(cb, k = 2)
cutree(cb, k = 3)
## using precomputed shortest paths
sp <- shortest_path_lengths(dolphins)
cbd <- cluster_redwalk(dolphins, short_paths = sp)
plot(cbd)
cutree(cbd, k = 2)
cutree(cbd, k = 4)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.