fix(kcore): swap sendMsgToSrc/sendMsgToDst column references#802
Merged
SemyonSinchenko merged 2 commits intographframes:mainfrom Mar 4, 2026
Merged
Conversation
Each directed edge (u,v) was sending u's own kcore back to u and v's
own kcore back to v, so no vertex ever received a neighbour's value.
The algorithm converged immediately after one superstep returning
kcore = degree for all vertices.
Fix: swap Pregel.src <-> Pregel.dst so each endpoint receives the
opposite end's value, matching the Mandal & Hasan (2017) algorithm.
Also:
- Document that the implementation treats the graph as undirected
(total degree + bidirectional message passing per edge); supplying
both (u,v) and (v,u) double-counts and produces wrong results.
- Fix star-graph test: expected center kcore 3 -> 1 (correct textbook
value; no 2-core can form when leaves each have one neighbour).
- Replace chain-graph test: was a copy of the triangle test with the
same cyclic edges; now uses an actual open chain (0->1->2) with the
correct assertion kcore=1 for all vertices and an explanatory comment.
- Tighten medium-graph range assertions to values produced by the
correct algorithm (distinct count >= 3, central vertex >= 3).
- Add triangle-with-tail regression test with exact oracle values
(kcore={1:2,2:2,3:2,4:1,5:1}) that catches the swapped-message bug.
Co-Authored-By: Claude <noreply@anthropic.com>
6 tasks
SemyonSinchenko
approved these changes
Mar 4, 2026
Collaborator
SemyonSinchenko
left a comment
There was a problem hiding this comment.
LGTM! Thanks a lot @DavidGi!
6 tasks
Collaborator
|
@DavidGi running |
Contributor
Author
thanks @SemyonSinchenko , i've applied the formatting! |
Collaborator
|
Thanks for the contribution, @DavidGi ! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue 801
Each directed edge (u,v) was sending u's own kcore back to u and v's own kcore back to v, so no vertex ever received a neighbour's value. The algorithm converged immediately after one superstep returning kcore = degree for all vertices.
Fix: swap Pregel.src <-> Pregel.dst so each endpoint receives the opposite end's value, matching the Mandal & Hasan (2017) algorithm.
Also:
Tested with Spark 3.5.x, 4.0.x, 4.1.x, and verified against NetworkX core_number().