Skip to content

SpeakEasy-2/speakeasy2-toolbox

Repository files navigation

Open SpeakEasy2 in MATLAB Online View SpeakEasy2 on File Exchange Genome article

SpeakEasy 2: Champagne MATLAB toolbox

A MATLAB toolbox for calling the SpeakEasy 2 (SE2) community detection algorithm. Calls the SpeakEasy2 C library. Clusters graphs represented as adjacency matrices (see matlab-igraph for working with graphs in MATLAB).

Installation

Prebuilt toolboxes (recommended)

The toolbox can be installed via MATLAB's add-on manager (accessed inside the MATLAB IDE, see Get and Manage Add-Ons.) This will also provide notifications about updates. Alternatively, the toolbox can be download from the GitHub release page.

Building from source

This package uses CMake and git submodules for handling some of the dependencies. External dependencies are bison, flex, and libxml2.

To setup clone the git repo and download the git submodules using:

git clone "https://github.com/SpeakEasy-2/speakeasy2-toolbox"
git submodule update --init --recursive

For CMake run:

cmake -B build .
cmake --build build

This will build mex files to ./build/src/mex to run the toolbox in the current directory, you can link all mex files to toolbox/private. This will allow the mex files to be rebuilt without needing to repeatedly copy them to the toolbox.

Use

blockSizes = [10 10 10 10 20 20 30];
adj = igraph.randgame("preference", blockSizes=blockSizes, mixingParam=0.2, repr = "full");
adj = (adj + adj') > 0; % Make symmetric
membership = speakeasy2(adj);
igraph.plot(adj, "kk", nodeColor=membership)

Options

The options can also be found by running help speakeasy2.

Option type default effect
independentRuns integer 10 number of independent runs to perform. Each run gets its own set of initial conditions.
targetPartitions integer 5 Number of partitions to find per independent run.
discardTransient integer 3 Ignore this many partitions before tracking.
targetClusters integer dependent on size of graph Expected number of clusters to find. Used for creating the initial conditions. The final partition is not constrained to having this many clusters.
subCluster integer 1 How many iterations of community detection to perform. If > 1, community detection is performed on each community from the previous level.
minCluster integer 5 Minimum community size to perform subclustering on. If subCluster == 1, ignored.
seed integer randomly generated a random seed for reproducibility.
maxThreads integer independentRUns number of parallel threads to use. (Use 1 to prevent parallel processing.)
verbose logical false Whether to print extra information about the running process.

Use name-value pairs for setting options:

speakeasy2(adj, 'seed', 1234, 'verbose', true, 'independentRuns', 5);

Or options can also be supplied in name=value format:

speakeasy2(adj, discardTransient=5, verbose=true);

See help speakeasy2 for more information.