Skip to content

[fix] Vermeer: correct distributed closeness traversal - #27

Closed
imbajin wants to merge 5 commits into
fix/vermeer-final-output-values-20261105from
fix/vermeer-closeness-correctness-20261105
Closed

imbajin wants to merge 5 commits into
fix/vermeer-final-output-values-20261105from
fix/vermeer-closeness-correctness-20261105

Conversation

@imbajin

@imbajin imbajin commented Nov 5, 2026 •

Copy link
Copy Markdown

Background

The existing closeness_centrality implementation could return incorrect or partial results under distributed execution:

  1. source distance maps used a local offset instead of the global vertex ID;
  2. compute goroutines observed shared stop flags before the step barrier;
  3. each worker validated only its local completion state, so one partition could begin writing while another rejected output;
  4. a source was marked complete one superstep after its farthest distance had already been discovered;
  5. invalid parameters were checked only after large per-vertex allocations;
  6. distance accumulation used int32, sampled edges were not treated as one stable run graph, and output after step 1 could expose adjacency rather than scores.

Design

worker-local BFS completion
        ↓ aggregate
closeness_unfinished (global)
        ↓ final aggregate delivered by base PR #29
all workers validate the same value
        ↓
all write, or all reject output

This PR is stacked on #29 because output validation must receive the final master aggregate before any writer starts.

Traversal changes

  • seed every source with VertIDStart + localID;
  • validate sample_rate and wf_improved before graph-sized allocations;
  • sample adjacency only once in step 1;
  • keep per-source frontiers and finalize a source in AfterStep() as soon as its current frontier has no unseen neighbor;
  • aggregate the number of unfinished sources as an Int64 compute value;
  • make both the master stop rule and worker output validation consume that same global count;
  • accumulate distance sums in 64 bits and always return closeness values in output mode.

Finishing after the scatter barrier is important: step 1 can inspect remote adjacency safely, and a path with eccentricity k now completes in step k, not k + 1.

Regression coverage

Tests exercise the actual worker/master lifecycle rather than only helper functions:

  • a non-zero-offset partition on the path 0 → 1 → 2 → 3 → 4;
  • Init() → Compute() → AfterStep() across all four BFS layers;
  • master continuation values 3 → 2 → 1 → 0;
  • completion with compute.max_step == eccentricity;
  • expected closeness scores for the owned vertices;
  • two partitions where one is locally complete but both must reject the same global unfinished count;
  • parameter rejection before graph storage is dereferenced or allocated;
  • connected, disconnected, isolated, WF-improved, and wide-distance score cases.

Scope relative to #29

  • 2 algorithm files;
  • 397 additions / 76 deletions;
  • framework lifecycle changes remain isolated in the base PR;
  • all four ORG review threads have been addressed and resolved.

Validation

Latest head 0246855 passed:

  • Vermeer CI run 68;
  • CodeQL run 88;
  • license checker run 114.

Upstream: 🔗 ASF Computer #374. Until ASF apache#376 is merged, the upstream diff also contains the stacked final-aggregate lifecycle commit.

@coderabbitai

coderabbitai Bot commented Nov 5, 2026 •

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 8f532681-6d9b-4946-a7f8-6469cdc9f6cb

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 5, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-05T14:42:32.486193Z 0246855 New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@bitflicker64 bitflicker64 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

R1 inline findings for 545843cc; the summary follows in a separate comment.

@bitflicker64

bitflicker64 commented Nov 5, 2026 •

Copy link
Copy Markdown
Member

R1 review: correct distributed closeness traversal

Verdict: not ready yet. The traversal fixes look right (global source IDs, per-partition stop counters, one-time sampling, int64 distance sums), but two Important correctness items remain: complete traversals can be rejected at compute.max_step, and a failed, non-converged run can still write partial output. The new tests don't exercise the traversal.

Reviewed: head 545843cc against base d06a23b0, FULL scope (both changed files plus the superstep, aggregation and output paths).

Score: 8.0 / 10 (mean of all four reviews, N = 4/4)

Reviewer Raw Adjusted Deductions
Reviewer A (Codex / GPT-6, exact model not reported) 8.0 8.0 Important −2: per-worker convergence check
Reviewer B (Gemini 3.8 Flash) 9.5 9.5 Minor −0.5: validation after allocations
Reviewer C (Claude Opus 5.5) 5.0 5.5 Important −2: off-by-one at max_step; Important −2: test gap; Minor −0.5: undocumented behaviour changes
Reviewer D (Gemini 4 Argon) 8.5 9.0 Minor −0.5: off-by-one at max_step; Minor −0.5: test gap

Corrections: Reviewers C and D each lost a Minor −0.5 for sampling before deduplication, because base already sampled each step-1 in-edge separately (pre-existing behaviour). Reviewers C and D rated the off-by-one and the test gap at different severities; each score keeps its own reviewer's rating.

Findings

Checks: go test -race ./algorithms ./apps/worker and go vet ./algorithms passed under Go 1.23.7. Multi-worker end-to-end runs were not tested.

@bitflicker64 bitflicker64 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

R1 additional inline findings for 545843cc (late reviewer); the R1 summary comment has been updated.

@imbajin
imbajin changed the base branch from master to fix/vermeer-final-output-values-20261105 November 5, 2026 14:32
@imbajin imbajin closed this Nov 5, 2026
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.

2 participants