UNPKG

@graphty/algorithms

Version:

Graph algorithms library for browser environments implemented in TypeScript

34 lines 1.23 kB
import type { Graph } from "../../core/graph.js"; import type { NodeId } from "../../types/index.js"; /** * Betweenness centrality implementation using Brandes' algorithm * * Measures the extent to which a node lies on paths between other nodes. * Uses the fast O(VE) algorithm by Ulrik Brandes. */ /** * Betweenness centrality options */ export interface BetweennessCentralityOptions { /** * Whether to normalize the centrality values (default: false) */ normalized?: boolean; /** * Whether to use endpoints in path counting (default: false) */ endpoints?: boolean; } /** * Calculate betweenness centrality for all nodes using Brandes' algorithm */ export declare function betweennessCentrality(graph: Graph, options?: BetweennessCentralityOptions): Record<string, number>; /** * Calculate betweenness centrality for a specific node */ export declare function nodeBetweennessCentrality(graph: Graph, targetNode: NodeId, options?: BetweennessCentralityOptions): number; /** * Calculate edge betweenness centrality */ export declare function edgeBetweennessCentrality(graph: Graph, options?: BetweennessCentralityOptions): Map<string, number>; //# sourceMappingURL=betweenness.d.ts.map