View source: R/later_cluster_gcpPHATE.R
Community Detection with PHATE : Partitional Approach
1 2 3 4 5 6 7 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | ## load the data
data(karate, package="T4network")
## community detection & given label
lab.true = karate$label
lab.eff = gcpPHATE(karate$A, k=2, metrize="effective")$cluster
lab.spd = gcpPHATE(karate$A, k=2, metrize="shortest")$cluster
## prepare for plotting with 'igraph' with fixed layout
obj.igraph = igraph::graph_from_adjacency_matrix(karate$A, mode="undirected")
obj.igraph$layout <- igraph::layout_with_kk
## visualize
opar <- par(no.readonly=TRUE)
par(mfrow=c(1,3))
plot(obj.igraph, vertex.label=NA, vertex.color=lab.true, main="given label")
plot(obj.igraph, vertex.label=NA, vertex.color=lab.eff, main="gcPHATE-effective")
plot(obj.igraph, vertex.label=NA, vertex.color=lab.spd, main="gcPHATE-shortest")
par(opar)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.