Skip to content

feat: support degree algorithm (#795)#812

Open
ArmxG wants to merge 1 commit into
apache:masterfrom
ArmxG:feat/degree-algorithm
Open

feat: support degree algorithm (#795)#812
ArmxG wants to merge 1 commit into
apache:masterfrom
ArmxG:feat/degree-algorithm

Conversation

@ArmxG

@ArmxG ArmxG commented Jul 15, 2026

Copy link
Copy Markdown

What this PR does

This PR adds a built-in Degree graph algorithm (UDGA), as requested in #795.

For each vertex, it returns:

(id, in_degree, out_degree)

Approach

  • Counts the incoming and outgoing edges for each vertex using context.loadEdges(EdgeDirection.IN/OUT).
  • Since each vertex can calculate its own degree, the algorithm does not use message passing and finishes in a single iteration.
  • Registers degree() in BuildInSqlFunctionTable, similar to the existing built-in algorithms such as KCore.

Tests

  • Added gql_algorithm_degree.sql and the expected output file gql_algorithm_degree.txt.
  • Verified the output on the test graph, including a vertex with an out-degree of 0.
  • Added testAlgorithmDegree in GQLAlgorithmTest, following the existing algorithm test pattern.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant