Skip to content

[fix] Vermeer: handle Louvain degenerate inputs safely - #26

Closed
imbajin wants to merge 5 commits into
fix/vermeer-louvain-output-race-20261105from
fix/vermeer-louvain-degenerate-inputs-20261105
Closed

imbajin wants to merge 5 commits into
fix/vermeer-louvain-output-race-20261105from
fix/vermeer-louvain-degenerate-inputs-20261105

Conversation

@imbajin

@imbajin imbajin commented Nov 5, 2026 •

Copy link
Copy Markdown

Summary

This is a stacked correctness PR on top of #25. It closes deterministic Louvain failures without changing the normal positive-weight optimization path.

Problems fixed

Empty and zero-weight graphs

Both Louvain variants divided resolution by the total effective edge weight. For an empty graph, an isolated-only graph, or a weighted graph whose edges all have weight 0, that denominator is 0.

The result is now defined explicitly:

  • every vertex remains in its own community;
  • modularity is published as 0;
  • temporary graph state is released;
  • output is marked ready without entering the optimization loop.

Invalid numeric parameters

The following values are rejected before computation:

  • louvain.resolution <= 0, NaN, or Inf;
  • louvain.threshold < 0, NaN, or Inf;
  • louvain.step <= 0.

Invalid weighted edges

Weighted Louvain now:

  • rejects negative and non-finite edge weights with the property, global vertex ID, and edge index in the error;
  • ignores zero-weight edges rather than creating meaningless adjacency entries;
  • preserves existing behavior for positive int32 and float32 weights.

Before / after

Before                              After
------                              -----
edge weight sum = 0                 edge weight sum = 0
resolution /= 0                     identity communities
NaN/Inf propagates                  modularity = 0
partial/invalid result              outputReady = true

Regression coverage

Tests now exercise real worker lifecycle paths rather than only helpers:

  • unweighted Init() → BeforeStep() with zero edges;
  • weighted Init() → BeforeStep() with zero effective weight;
  • identity community IDs, modularity 0, ready output, cleared temporary adjacency, and firstStep=false;
  • negative, NaN, and ±Inf edge weights through the real weighted Init() path;
  • error context includes property name, global vertex ID, and incoming edge index;
  • effectively isolated weighted vertices do not enter community-move scheduling.

The ORG review request for lifecycle and invalid-edge coverage has been addressed and resolved.

Scope

Validation

Latest head 43a37c8 passed:

  • Vermeer CI run 83;
  • CodeQL run 103;
  • license checker run 129.

Upstream: 🔗 ASF Computer #373

@coderabbitai

coderabbitai Bot commented Nov 5, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 51 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

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: 5920ffe4-92e2-4bad-9e3f-562275ea7da4
Commits

Reviewing files that changed from the base of the PR and between 471b2e3 and 43a37c8.

Files selected for processing: 3

  • vermeer/algorithms/louvain.go
  • vermeer/algorithms/louvain_validation_test.go
  • vermeer/algorithms/louvain_weighted.go
  • 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:28:49.495069Z a0f64d1 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.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 394a430a5f

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread vermeer/algorithms/louvain_weighted.go Resolved
@imbajin
imbajin force-pushed the fix/vermeer-louvain-degenerate-inputs-20261105 branch from 7b8e3c3 to 9074fa5 Compare November 5, 2026 10:21
@bitflicker64

bitflicker64 commented Nov 5, 2026 •

Copy link
Copy Markdown
Member

Review summary (R1, FULL)

Verdict: no Critical or Important defects introduced by this PR. There is one Minor test gap and no blocker.

Reviewed: abbbae8e (#25 head, stacked base) → 9074fa5d. Only this PR's own diff: 3 files, +216/-8.

Score: 9.8 / 10 (mean of all 4 scored reviews: 9.75)

Reviewer Raw Corrections Adjusted
Reviewer A (GPT-6) 10 none 10
Reviewer B (Gemini 3.8 Flash) 10 none 10
Reviewer C (Claude Opus 5.5) 9.5 none (Minor −0.5 confirmed) 9.5
Reviewer D (Gemini 4 Argon) 9.5 none (same Minor −0.5) 9.5

Confirmed:

Uncertain: none.

Earlier thread: the reviewers checked that the head handles the mixed zero-weight edge panic.

Pre-existing, not scored: on the base branch, the generic modularity statistic in vermeer/apps/compute/statistics.go can produce NaN for a graph that has vertices but no edges.

Checks: with Go 1.23.7, go test and go test -race passed on ./algorithms and ./apps/worker. go vet and git diff --check were clean. A local mutation check confirmed the step-3 guard test catches its bug. Multi-worker integration tests were not run.

Comment thread vermeer/algorithms/louvain.go Resolved
@imbajin
imbajin added this pull request to stack #35 November 5, 2026 17:01
@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