Skip to content
A package for clustering of Signed Networks
Python Jupyter Notebook
Branch: master
Clone or download
Latest commit 7a63cf1 Jul 26, 2019
Type Name Latest commit message Commit time
Failed to load latest commit information.
.gitattributes Initial commit Sep 5, 2018
.gitignore removed Icon and added them to gitignore Sep 25, 2018
requirements.txt Add requirements.txt with '.' only to try alternate requirements inst… Sep 10, 2018 Modify to work around numpy dependency in ecos Sep 10, 2018



A package for clustering of Signed Networks, the following algorithms were implemented:

  • Standard spectral clustering with

    • Adjacency matrix (with multiple normalisations)
    • Signed Laplacian matrix (with multiple normalisations)
    • Balance Ratio Cut
    • Balance Normalised Cut
  • Semidefinite programming clustering (with exact and approximate solvers)

  • Generalised eigenproblem clustering (with multiple normalisations)

  • Clustering using a signed variant of the Bethe Hessian matrix

Typical usage

from signet.cluster import Cluster 
from signet.block_models import SSBM
from sklearn.metrics import adjusted_rand_score

# simple test on the signed stochastic block model 

    n = 50000  # number of nodes
    k = 2      # number of clusters
    eta = 0.1  # sign flipping probability
    p = 0.0002 # edge probability

(Ap, An), true_assignment = SSBM(n = n, k = k, pin = p, etain = eta) # construct a graph

c = Cluster((Ap, An))

predictions = c.spectral_cluster_laplacian(k = k, normalisation='sym') # cluster with the signed laplacian
score = adjusted_rand_score(predictions, true_assignment)



Install the latest version from this Github repository.

pip install git+

API Reference

The documentation of this package was automatically generated using Sphinx. To generate the documentation locally:

  1. Install sphinx and the readthedocs theme
  • pip install sphinx -U
  • pip install sphinx_rtd_theme -U
  1. Switch to the docs folder and build the docs with make html

Alternatively, the documentation can be found at


To check that the code is working for you, try to download and run the jupyter notebook inside the "tests" folder.

Current Authors

If you have problems with the code please contact

You can’t perform that action at this time.