Skip to content

K-Core early termination in PKC_original_serial#19

Open
adthoms wants to merge 1 commit into
MIT-SPARK:masterfrom
adthoms:unit5-kcore-early-termination
Open

K-Core early termination in PKC_original_serial#19
adthoms wants to merge 1 commit into
MIT-SPARK:masterfrom
adthoms:unit5-kcore-early-termination

Conversation

@adthoms
Copy link
Copy Markdown

@adthoms adthoms commented Apr 15, 2026

Summary

  • Add level-skipping optimization to PKC_original_serial in src/pkc.cpp: when no vertices exist at the current core level, jump directly to the next non-empty level by tracking the minimum degree above the current level during the vertex scan
  • This avoids redundant iterations for sparse graphs with gaps in core numbers (e.g., K5 + isolated vertices skips levels 1-3 entirely)
  • Add 4 new test sections verifying correctness: sparse graph with mixed core numbers, K5 + isolated vertices (large gap), complete graph (no gap), and empty graph

Test plan

  • Verify PKC_SERIAL and BZ_SERIAL produce identical core numbers on mixed graphs
  • Verify K5 + isolated vertices: cores 0 and 4 with levels 1-3 skipped
  • Verify complete K5: max core number == 4, all 5 vertices in max k-core
  • Verify empty graph: no crash, empty max k-core
  • Existing random graph tests still pass (cross-validate all 4 solver modes)

🤖 Generated with Claude Code

Skip empty core levels by tracking the minimum degree above the current
level during the vertex scan. When no vertices exist at the current level,
jump directly to the next non-empty level instead of incrementing by one.
This avoids redundant scans for sparse graphs with gaps in core numbers.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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