Skip to content

Add the Betweenness Centrality graph algorithm #801

Description

@Leomrlin

What & why

GeaFlow has PageRank and ClosenessCentrality, but not Betweenness Centrality
a measure of how often a vertex sits on shortest paths between other vertices,
i.e. how much of a "bridge" it is. It's a core metric for social-network and
key-node analysis. It's also genuinely hard: the classic Brandes algorithm has
two phases (shortest-path counting + dependency accumulation), which makes it a
satisfying high-difficulty challenge.

GeaFlow 有 PageRank、ClosenessCentrality,但缺介数中心性(Betweenness)——衡量一个
顶点作为"最短路径桥梁"的重要性,是社交网络/关键节点分析的核心指标。它实现难度大
(经典 Brandes 算法需要两阶段:最短路径计数 + 依赖累积),非常适合作为高难度挑战题。

The task

Implement Betweenness Centrality on GeaFlow's vertex-centric / message-passing
model (an unweighted-graph version is a fine first cut).

基于 GeaFlow 的顶点中心/消息传递模型实现介数中心性(可先做无权图版本)。

Where to look / 怎么做

  1. Reference the more complex existing algorithms:
    udf/graph/PageRank.java (multi-iteration + convergence) and
    SingleSourceShortestPath.java (shortest paths).
  2. Implement AlgorithmUserFunction using multi-round iteration + sendMessage
    for shortest-path counting and dependency back-propagation (the Brandes approach).
  3. Register in BuildInSqlFunctionTable.java.
  4. Use a small graph (5–7 nodes), compute the standard answer by hand, and turn
    it into .sql/.txt tests.

Done when

  • Implemented and registered; CALL betweenness() YIELD (id, score) works
  • Results match hand-calculation / NetworkX on a small graph (attach the comparison in the PR)
  • Complexity and suitable scale documented (note it's for small/medium graphs if so)
  • Tests pass

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions