Skip to content

eles.motifCensus(options?)

eles.motifCensus — Collection > Algorithms > Structural measures. Cytoscape.js signatures, parameters and return contract.

eles.motifCensus — Collection › Algorithms › Structural measures

Preview · Collection › Algorithms › Structural measures

Read in the complete API reference · All API members

// The triad census — every three-node subgraph classified into the sixteen Holland–Leinhardt classes ('003' … '300'; '030T' is the feed-forward loop)
eles.motifCensus(options?: MotifCensusOptions): AlgoRun<MotifCensusResult>

The triad census — every three-node subgraph classified into the sixteen Holland–Leinhardt classes ('003' … '300'; '030T' is the feed-forward loop). The counts sum to C(n, 3). Async: executor ('cpu' | 'gpu' | 'auto', default 'auto'; 'workers' runs the reference on one pool worker) picks between sparse wedge walks on the CPU and matmul trace products on the GPU — under 'auto' the GPU only on dense graphs (a mean degree of 64). directed: false reads every edge as mutual, so only 003 / 102 / 201 / 300 (empty / one-edge / path / triangle) can be non-zero.

Parameters
NameDescription
options: MotifCensusOptions?

{ directed, executor }

Fields of options
NameDescription
directed: boolean?

read edge direction (default true — the census is a directed notion; false reads every edge as mutual, so only 003/102/201/ 300 can be non-zero)

executor: AlgoExecutor?

where the run executes; see AlgoExecutor (default 'auto'). 'auto' routes to the GPU only on graphs dense enough that the O(n³) trace products beat the CPU's O(Σ deg²) wedge walks.

Returns AlgoRun<MotifCensusResult>

a promise of { counts } — with cancel() on it: a pending run rejects with CancelledError, a 'cpu' run has already completed

Example

const run = eles.motifCensus({ executor: 'cpu' });
const result = await run;
console.log(result.counts['021C']); // 1

Example graph and handle setup

Throws

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