You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

54 lines
3.4 KiB

4 months ago
import type { EdgeData, GraphData } from '../spec';
import type { EdgeDirection, ID, NodeCentralityOptions } from '../types';
export type CentralityResult = Map<ID, number>;
export declare const getNodeCentralities: (graphData: GraphData, getRelatedEdgesData: (id: ID, direction?: EdgeDirection) => EdgeData[], centrality: NodeCentralityOptions) => CentralityResult;
export declare const initCentralityResult: (graphData: GraphData) => CentralityResult;
/**
* <zh/>
*
* <en/> Calculate the betweenness centrality for each node in the graph
* @param graphData - <zh/> | <en/>Graph data
* @param directed - <zh/> | <en/>Whether the graph is directed
* @param weightPropertyName - <zh/> | <en/>The weight property name of the edge
* @returns <zh/> | <en/>The betweenness centrality for each node
*/
export declare const computeNodeBetweennessCentrality: (graphData: GraphData, directed?: boolean, weightPropertyName?: string) => CentralityResult;
/**
* <zh/>
*
* <en/> Calculate the closeness centrality for each node in the graph
* @param graphData - <zh/> | <en/>Graph data
* @param directed - <zh/> | <en/>Whether the graph is directed
* @param weightPropertyName - <zh/> | <en/>The weight property name of the edge
* @returns <zh/> | <en/>The closeness centrality for each node
*/
export declare const computeNodeClosenessCentrality: (graphData: GraphData, directed?: boolean, weightPropertyName?: string) => CentralityResult;
/**
* <zh/> PageRank
*
* <en/> Calculate the PageRank centrality for each node in the graph
* @param graphData - <zh/> | <en/>Graph data
* @param epsilon - <zh/> PageRank | <en/>The convergence tolerance of the PageRank algorithm
* @param linkProb - <zh/> PageRank 访访 0.85 | <en/>The damping factor of the PageRank algorithm, which refers to the probability that a user will continue to visit the next node linked to a node at any time, with an empirical value of 0.85
* @returns <zh/> PageRank | <en/>The PageRank centrality for each node
*/
export declare const computeNodePageRankCentrality: (graphData: GraphData, epsilon?: number, linkProb?: number) => CentralityResult;
/**
* <zh/>
*
* <en/> Calculate the eigenvector centrality for each node in the graph.
* @param graphData - <zh/> | <en/>Graph data
* @param directed - <zh/> | <en/>Whether the graph is directed
* @returns The eigenvector centrality for each node.
*/
export declare const computeNodeEigenvectorCentrality: (graphData: GraphData, directed?: boolean) => CentralityResult;
/**
* <zh/>
*
* <en/> Create the adjacency matrix for the graph.
* @param graphData - <zh/> | <en/>Graph data
* @param directed - <zh/> | <en/>Whether the graph is directed
* @returns <zh/> | <en/>The adjacency matrix
*/
export declare const createAdjacencyMatrix: (graphData: GraphData, directed?: boolean) => number[][];