Skip to content

eles.markovClustering(options?)

eles.markovClustering — Collection > Algorithms > Clustering. Cytoscape.js signatures, parameters and return contract.

eles.markovClustering — Collection › Algorithms › Clustering

Preview · Collection › Algorithms › Clustering

Read in the complete API reference · All API members

// Markov clustering (MCL) — flow simulation over the graph, so unlike the attribute-space algorithms this one clusters by structure
eles.markovClustering(options?: MarkovClusteringOptions): AlgoRun<Collection<NodeData, EdgeData, NodeData>[]>

Markov clustering (MCL) — flow simulation over the graph, so unlike the attribute-space algorithms this one clusters by structure.

Async: returns a promise, and executor ('cpu' | 'gpu' | 'auto', default 'auto'; 'workers' runs the reference on one pool worker) picks where the expand/inflate iteration runs; 'cpu' is the reproducible reference. maxIterations defaults to 100 (as Python markov_clustering and R MCL), and pruneThreshold (default 0) drops each inflated matrix's entries under it, keeping each column's largest, as markov_clustering's pruning_threshold does.

Parameters
NameDescription
options: MarkovClusteringOptions?

{ attributes, expandFactor, inflateFactor, multFactor, maxIterations, pruneThreshold, executor }

Fields of options
NameDescription
expandFactor: number?
inflateFactor: number?
multFactor: number?
maxIterations: number?

the iteration cap (default 100, as Python markov_clustering and R MCL)

pruneThreshold: number?

after each inflation, drop entries under this to 0, keeping each column's largest (default 0: no pruning) — Python markov_clustering's pruning_threshold

attributes: MarkovAttributeFn[]?
executor: AlgoExecutor?

where the run executes; see AlgoExecutor (default 'auto')

Returns AlgoRun<Collection<NodeData, EdgeData, NodeData>[]>

a promise of one collection per cluster — with cancel() on it: a pending run rejects with CancelledError, a 'cpu' run has already completed

Example

const run = eles.markovClustering({ executor: 'cpu' });
const result = await run;
console.log(result.reduce((sum, cluster) => sum + cluster.length, 0)); // 3

Example graph and handle setup

Throws

if executor or pruneThreshold is invalid; rejects if executor: 'gpu' is unavailable in this environment

Also spelled eles.mcl.