UNPKG

@graphty/algorithms

Version:

Graph algorithms library for browser environments implemented in TypeScript

30 lines 1.16 kB
import type { Graph } from "../../core/graph.js"; import type { CentralityOptions, CentralityResult } from "../../types/index.js"; /** * Katz centrality implementation * * A generalization of eigenvector centrality that gives each node a base amount * of influence regardless of its position in the network. Uses an attenuation * factor (alpha) to control how much a node's centrality depends on its neighbors. * * Katz centrality = alpha * sum(neighbors' centrality) + beta * * Time complexity: O(V + E) per iteration * Space complexity: O(V) */ export interface KatzCentralityOptions extends CentralityOptions { alpha?: number; beta?: number; maxIterations?: number; tolerance?: number; } /** * Calculate Katz centrality for all nodes in the graph * Uses iterative method to compute centrality scores */ export declare function katzCentrality(graph: Graph, options?: KatzCentralityOptions): CentralityResult; /** * Calculate Katz centrality for a specific node */ export declare function nodeKatzCentrality(graph: Graph, nodeId: string | number, options?: KatzCentralityOptions): number; //# sourceMappingURL=katz.d.ts.map