What & why
The most basic graph metric is a vertex's degree — in-degree, out-degree,
total. It's a building block for many heavier algorithms, but there's no built-in
one-shot version yet. This is the best possible first taste of the
vertex-centric / message-passing model: simpler than PageRank, but you still walk
the full algorithm interface end to end.
图分析最基础的指标就是顶点的度(入度/出度/总度),它是很多复杂算法的前置特征,
但目前没有内置算法。这是入门"顶点中心 / 消息传递"模型的最佳第一题——比 PageRank 简单,
却完整走一遍算法接口。
The task
Implement Degree: for each vertex, output (id, in_degree, out_degree).
No message passing needed — you can count directly with loadEdges(IN/OUT),
which makes it a clean way to learn the API.
实现 Degree:每个顶点输出 (id, in_degree, out_degree)。不用消息传递,直接用
loadEdges(IN/OUT) 统计即可,特别适合熟悉 API。
Where to look
- The simplest reference is
udf/graph/KCore.java. Implement the
AlgorithmUserFunction<Object, ?> interface — init / process / finish / getOutputType — and in process count edges with
context.loadEdges(EdgeDirection.IN/OUT).
- Register in
BuildInSqlFunctionTable.java (the UDGA section).
- Test with
modern_graph.sql under query/ + expect/, verifying each
vertex's in/out degree by hand.
Done when
What & why
The most basic graph metric is a vertex's degree — in-degree, out-degree,
total. It's a building block for many heavier algorithms, but there's no built-in
one-shot version yet. This is the best possible first taste of the
vertex-centric / message-passing model: simpler than PageRank, but you still walk
the full algorithm interface end to end.
图分析最基础的指标就是顶点的度(入度/出度/总度),它是很多复杂算法的前置特征,
但目前没有内置算法。这是入门"顶点中心 / 消息传递"模型的最佳第一题——比 PageRank 简单,
却完整走一遍算法接口。
The task
Implement
Degree: for each vertex, output(id, in_degree, out_degree).No message passing needed — you can count directly with
loadEdges(IN/OUT),which makes it a clean way to learn the API.
实现
Degree:每个顶点输出(id, in_degree, out_degree)。不用消息传递,直接用loadEdges(IN/OUT)统计即可,特别适合熟悉 API。Where to look
udf/graph/KCore.java. Implement theAlgorithmUserFunction<Object, ?>interface —init / process / finish / getOutputType— and inprocesscount edges withcontext.loadEdges(EdgeDirection.IN/OUT).BuildInSqlFunctionTable.java(the UDGA section).modern_graph.sqlunderquery/+expect/, verifying eachvertex's in/out degree by hand.
Done when
.sql+.txttests pass, expectations checked by hand