Skip to content
Learning Graphs from Data via Spectral Constraints for k-component, bipartite, and k-component bipartite graphs
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.
.circleci update circleci configs May 11, 2019
R improve code coverage May 11, 2019
R_buildignore small revision May 7, 2019
benchmarks add node time complexity plot experiment May 21, 2019
inst update CITATION file Apr 24, 2019
papers update papers folder Apr 29, 2019
src improve code coverage May 11, 2019
tests improve code coverage May 11, 2019
vignettes DOC: fix typo in vignette and align image in README May 16, 2019
.Rbuildignore Fix license issue with CRAN. May 7, 2019
.compileAttributes.R use constant references as per Eigen recommendation Aug 13, 2018
.gitattributes add gitattributes Dec 29, 2018
.gitignore remove CRAN links Apr 30, 2019
.roxygenize.R update documentation and notation Aug 21, 2018
.travis.yml update .travis.yml May 6, 2019
DESCRIPTION update DESCRIPTION according to suggestions by CRAN May 21, 2019
Dockerfile update .Rbuildignore May 3, 2019
LICENSE Added LICENSE. Apr 30, 2019
Makefile add utility function to compute relative error, objective function, a… Sep 7, 2018
NAMESPACE everything is green Apr 29, 2019 update May 8, 2019
README.Rmd DOC: fix typo in vignette and align image in README May 16, 2019
README.html DOC: fix typo in vignette and align image in README May 16, 2019 DOC: fix typo in vignette and align image in README May 16, 2019
appveyor.yml update appveyor.yml and circleci May 6, 2019
azure-pipelines.yml add travis appveyor and azure for continuous integration Apr 30, 2019 @mirca Please update these two files. Apr 30, 2019
spectralGraphTopology.Rproj Package restructuring Aug 14, 2018

CRAN_Status_Badge CRAN Downloads CRAN Downloads Total Rcpp

codecov Travis-CI-Badge Build status CircleCI Docker Build Status Build Status

spectralGraphTopology provides estimators to learn k-component, bipartite, and k-component bipartite graphs from data by imposing spectral constraints on the eigenvalues and eigenvectors of the Laplacian and adjacency matrices. Those estimators leverages spectral properties of the graphical models as a prior information, which turn out to play key roles in unsupervised machine learning tasks such as community detection.



From inside an R session, type:

> install.packages("spectralGraphTopology")

Alternatively, you can install the development version from GitHub:

> devtools::install_github("dppalomar/spectralGraphTopology")

Microsoft Windows

On MS Windows environments, make sure to install the most recent version of Rtools.


spectralGraphTopology depends on RcppArmadillo which requires gfortran.

Usage: clustering

We illustrate the usage of the package with simulated data, as follows:


# generate graph and data
n <- 50  # number of nodes per cluster
twomoon <- clusterSim::shapes.two.moon(n)  # generate datapoints
k <- 2  # number of components

# estimate underlying graph
S <- crossprod(t(twomoon$data))
graph <- learn_k_component_graph(S, k = k, beta = .5, verbose = FALSE, abstol = 1e-3)

# plot
# build network
net <- igraph::graph_from_adjacency_matrix(graph$Adjacency, mode = "undirected", weighted = TRUE)
# colorify nodes and edges
colors <- c("#706FD3", "#FF5252")
V(net)$cluster <- twomoon$clusters
E(net)$color <- apply(, 1,
                      function(x) ifelse(V(net)$cluster[x[1]] == V(net)$cluster[x[2]],
                                        colors[V(net)$cluster[x[1]]], '#000000'))
V(net)$color <- colors[twomoon$clusters]
# plot nodes
plot(net, layout = twomoon$data, vertex.label = NA, vertex.size = 3)


We welcome all sorts of contributions. Please feel free to open an issue to report a bug or discuss a feature request.


If you made use of this software please consider citing:

In case you made use of the function cluster_k_component_graph, consider citing:


Package: CRAN and GitHub.

README file: CRAN-readme and GitHub-readme.

Vignette: CRAN-html-vignette, CRAN-pdf-vignette, GitHub-html-vignette

You can’t perform that action at this time.