@graphty/algorithms
Version:
Graph algorithms library for browser environments implemented in TypeScript
39 lines • 1.36 kB
TypeScript
import type { Graph } from "../../core/graph.js";
import type { NodeId } from "../../types/index.js";
/**
* Simplified Delta-based PageRank that matches the standard algorithm
* but only processes active nodes for efficiency.
*
* Key optimization: Supports incremental updates when graph structure changes,
* avoiding full recomputation from scratch.
*/
export declare class SimpleDeltaPageRank {
private graph;
private nodeCount;
private previousScores;
constructor(graph: Graph);
compute(options?: {
dampingFactor?: number;
tolerance?: number;
maxIterations?: number;
personalization?: Map<NodeId, number>;
weight?: string;
}): Map<NodeId, number>;
/**
* Perform incremental update after graph modification.
* This is where delta-based approach provides significant speedup.
*
* @param modifiedNodes Set of nodes that were modified (edges added/removed)
* @param options Computation options
* @returns Updated PageRank scores
*/
update(modifiedNodes: Set<NodeId>, options?: {
dampingFactor?: number;
tolerance?: number;
maxIterations?: number;
personalization?: Map<NodeId, number>;
weight?: string;
}): Map<NodeId, number>;
private normalizeMap;
}
//# sourceMappingURL=delta-pagerank-simple.d.ts.map