// All-pairs random-walk-with-restart proximity — the full matrix S = c·(I − (1−c)·W)⁻¹, whose column s is the walk restarting at s
eles.randomWalkWithRestartProximity(options?: RandomWalkWithRestartOptions): AlgoRun<RandomWalkWithRestartProximityResult>All-pairs random-walk-with-restart proximity — the full matrix S = c·(I − (1−c)·W)⁻¹, whose column s is the walk restarting at s. Async: executor ('cpu' | 'gpu' | 'workers' | 'auto', default 'auto') picks between one sparse solve per column on the CPU, the same solves spread over the worker pool (matching 'cpu') and the dense Neumann iteration on the GPU — under 'auto' the GPU from 256 nodes at any density, else the pool from 128. All-pairs (O(n²) memory). dangling is the seed form's: dead ends restart at the column's node by default, or absorb.
| Name | Description |
|---|---|
options: RandomWalkWithRestartOptions? |
|
Fields of options
| Name | Description |
|---|---|
seeds: Collection | null? | the nodes the walk restarts at (required for the seed form) |
restartProbability: number? | the restart probability c (default 0.15); must sit in (0, 1) |
maxIterations: number? | iteration cap when the tolerance is never met (default 200) |
tolerance: number? | stop once the L1 step drops under |
directed: boolean? | walk out-edges only |
weight: WeightFn? | |
dangling: 'restart' | 'absorb'? | where a walker at a node with no out-edges goes:
|
executor: AlgoExecutor? | where the run executes; see |
AlgoRun<RandomWalkWithRestartProximityResult>a promise of the { proximity } accessor — with cancel() on it: a pending run rejects with CancelledError, a 'cpu' run has already completed
Example
const run = eles.randomWalkWithRestartProximity({ seeds: cy.getElementById('a'), executor: 'cpu' });const result = await run;console.log(result.proximity(cy.getElementById('a'), cy.getElementById('a')) > 0); // trueif executor, restartProbability or dangling is invalid; rejects if executor: 'gpu' is unavailable in this environment