@graphty/algorithms
Version:
Graph algorithms library for browser environments implemented in TypeScript
38 lines • 1.34 kB
TypeScript
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;
/**
* Whether to use optimized BFS implementation for large graphs
*/
optimized?: 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