cluster_k_component_graph: Cluster a k-component graph from data using the Constrained...

Description Usage Arguments Value Author(s) References Examples

View source: R/constrLaplacianRank.R

Description

Cluster a k-component graph from data using the Constrained Laplacian Rank algorithm

Cluster a k-component graph on the basis of an observed data matrix. Check out https://mirca.github.io/spectralGraphTopology for code examples.

Usage

1
2
cluster_k_component_graph(Y, k = 1, m = 5, lmd = 1, eigtol = 1e-09,
  edgetol = 1e-06, maxiter = 1000)

Arguments

Y

a pxn data matrix, where p is the number of nodes and n is the number of features (or data points per node)

k

the number of components of the graph

m

the maximum number of possible connections for a given node used to build an affinity matrix

lmd

L2-norm regularization hyperparameter

eigtol

value below which eigenvalues are considered to be zero

edgetol

value below which edge weights are considered to be zero

maxiter

the maximum number of iterations

Value

A list containing the following elements:

Laplacian

the estimated Laplacian Matrix

Adjacency

the estimated Adjacency Matrix

eigvals

the eigenvalues of the Laplacian Matrix

lmd_seq

sequence of lmd values at every iteration

elapsed_time

elapsed time at every iteration

Author(s)

Ze Vinicius and Daniel Palomar

References

Nie, Feiping and Wang, Xiaoqian and Jordan, Michael I. and Huang, Heng. The Constrained Laplacian Rank Algorithm for Graph-based Clustering, 2016, AAAI'16. http://dl.acm.org/citation.cfm?id=3016100.3016174

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
library(clusterSim)
library(spectralGraphTopology)
library(igraph)
set.seed(1)
# number of nodes per cluster
N <- 30
# generate datapoints
twomoon <- shapes.two.moon(N)
# estimate underlying graph
graph <- cluster_k_component_graph(twomoon$data, k = 2)
# build network
net <- graph_from_adjacency_matrix(graph$Adjacency, mode = "undirected", weighted = TRUE)
# colorify nodes and edges
colors <- c("#706FD3", "#FF5252", "#33D9B2")
V(net)$cluster <- twomoon$clusters
E(net)$color <- apply(as.data.frame(get.edgelist(net)), 1,
                      function(x) ifelse(V(net)$cluster[x[1]] == V(net)$cluster[x[2]],
                                        colors[V(net)$cluster[x[1]]], '#000000'))
V(net)$color <- c(colors[1], colors[2])[twomoon$clusters]
# plot network
plot(net, layout = twomoon$data, vertex.label = NA, vertex.size = 3)

spectralGraphTopology documentation built on Oct. 12, 2019, 9:05 a.m.