gcpPHATE: Community Detection with PHATE : Partitional Approach

Description Usage Examples

View source: R/later_cluster_gcpPHATE.R

Description

Community Detection with PHATE : Partitional Approach

Usage

1
2
3
4
5
6
7
gcpPHATE(
  graph,
  k = 2,
  metrize = c("effective", "shortest"),
  nnbd = 5,
  alpha = 2
)

Examples

 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)

kisungyou/T4network documentation built on Dec. 21, 2021, 6:44 a.m.