UNPKG

@graphty/algorithms

Version:

Graph algorithms library for browser environments implemented in TypeScript

35 lines 1.18 kB
import type { Graph } from "../../core/graph.js"; import type { CentralityOptions } from "../../types/index.js"; /** * HITS (Hyperlink-Induced Topic Search) algorithm implementation * * Identifies hub and authority scores for nodes in a graph. * - Authorities: nodes with valuable information (pointed to by hubs) * - Hubs: nodes that point to many authorities * * Originally designed for web page ranking but applicable to any directed network. * * Time complexity: O(V + E) per iteration * Space complexity: O(V) */ export interface HITSResult { hubs: Record<string, number>; authorities: Record<string, number>; } export interface HITSOptions extends CentralityOptions { maxIterations?: number; tolerance?: number; } /** * Calculate HITS hub and authority scores for all nodes in the graph * Uses iterative method with normalization */ export declare function hits(graph: Graph, options?: HITSOptions): HITSResult; /** * Calculate HITS scores for a specific node */ export declare function nodeHITS(graph: Graph, nodeId: string | number, options?: HITSOptions): { hub: number; authority: number; }; //# sourceMappingURL=hits.d.ts.map