// Katz centrality — attenuated walk counting, where a node is central when many short walks end at it and a walk of length k is worth alphaᵏ
eles.katzCentrality(options?: KatzCentralityOptions): AlgoRun<KatzCentralityResult>Katz centrality — attenuated walk counting, where a node is central when many short walks end at it and a walk of length k is worth alphaᵏ. Async: returns a promise, and executor ('cpu' | 'gpu' | 'auto', default 'auto'; 'workers' runs the reference on one pool worker) picks where the iteration runs; like pageRank, 'auto' always uses the sparse CPU iteration and the GPU path serves an explicit 'gpu'. katzNormalized divides by the largest score, or by the scores' Euclidean norm under normalization: 'l2' — NetworkX's normalized=True.
| Name | Description |
|---|---|
options: KatzCentralityOptions? |
|
Fields of options
| Name | Description |
|---|---|
alpha: number? | the walk attenuation per step (default 0.1); must be positive, and under 1/λ_max of the adjacency for the iteration to converge |
beta: number? | the baseline every node starts each step with (default 1) |
maxIterations: number? | iteration cap when the tolerance is never met (default 200) |
tolerance: number? | stop once Σ|Δx| < n · tolerance (default 1e-6) |
directed: boolean? | count incoming walks only |
weight: WeightFn? | |
normalization: 'max' | 'l2'? | how |
executor: AlgoExecutor? | where the run executes; see |
AlgoRun<KatzCentralityResult>a promise of the { katz, katzNormalized } accessors — with cancel() on it: a pending run rejects with CancelledError, a 'cpu' run has already completed
Example
const run = eles.katzCentrality({ executor: 'cpu' });const result = await run;console.log(result.katz(cy.getElementById('a')) > 0); // trueif executor, alpha, beta or normalization is invalid; rejects if executor: 'gpu' is unavailable in this environment