Skip to content

eles.heatKernel(options?)

eles.heatKernel — Collection > Algorithms > Similarity, diffusion and resistance. Cytoscape.js signatures, parameters and return contract.

eles.heatKernel — Collection › Algorithms › Similarity, diffusion and resistance

Preview · Collection › Algorithms › Similarity, diffusion and resistance

Read in the complete API reference · All API members

// The all-pairs heat kernel exp(−t·L) — heat(from, to) is the heat at to after unit heat starts at from (symmetric)
eles.heatKernel(options?: HeatDiffusionOptions): AlgoRun<HeatKernelResult>

The all-pairs heat kernel exp(−t·L) — heat(from, to) is the heat at to after unit heat starts at from (symmetric). Async: executor ('cpu' | 'gpu' | 'workers' | 'auto', default 'auto') picks between per-column sparse series on the CPU, the same columns spread over the worker pool (bit-identical to 'cpu') and the dense scaling-and-squaring chain on the GPU — under 'auto' the GPU from 256 nodes at any density, else the pool from 256. laplacian ('combinatorial' | 'normalized', default 'combinatorial') picks L = D − A or I − D^{-½}AD^{-½}. All-pairs (O(n²) memory).

Parameters
NameDescription
options: HeatDiffusionOptions?

{ time, weight, laplacian, executor }

Fields of options
NameDescription
seeds: Collection | null?

the nodes the heat starts on (required for the seed form)

time: number?

how long the heat flows (default 0.1); must be positive

weight: WeightFn?
laplacian: HeatLaplacian?

which Laplacian drives the diffusion (default 'combinatorial', L = D − A, heat-conserving); 'normalized' is I − D^{-½}AD^{-½}, whose spectrum is bounded by 2 so the scaling exponent depends on time alone — heat is then not conserved

executor: AlgoExecutor?

where the run executes; see AlgoExecutor (default 'auto'). The seed form has no GPU path; the kernel form takes the GPU from GPU_MIN_N nodes at any density (72.6).

Returns AlgoRun<HeatKernelResult>

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

Example

const run = eles.heatKernel({ seeds: cy.getElementById('a'), executor: 'cpu' });
const result = await run;
console.log(result.heat(cy.getElementById('a'), cy.getElementById('a')) > 0); // true

Example graph and handle setup

Throws

if executor, time or laplacian is invalid, or if an edge weight is not positive