Repository navigation
Conversation
Since the C core accepts directed graphs, `cluster_leiden()` returned a membership for them without a warning. It passed no in-weights and scaled the resolution for undirected modularity, so it effectively optimized undirected modularity at twice the resolution, and its `$quality` disagreed with `modularity()`. It now raises the error that igraph 2.3.4 raises. Proper directed support would need the in-weights exposed and the resolution scaled by the edge count. The tests pin the rejection and, on undirected graphs, the agreement of `$quality` with `modularity()`. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015GouVEqbVWVYs6hH8zvrRc
krlmlr
added this pull request to stack #2993
October 18, 2026 12:45
This was referenced Oct 18, 2026
This branch has not been deployed
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.
The R check moves to
mainin #2996; this commit drops out when the series is forwarded.Draft, do not merge: review vehicle for a fix collected for the series rebuild on
main-fwd-build. Merging would move themain-greenmirror, which the series loop owns.This is the second of three stacked review vehicles. It is based on
claude/f2-lad-time-limit(#2990) and was rebased onto it without conflicts, so its diff shows only this fix.What it changes
Since igraph 1.0 the C core accepts directed graphs, so
cluster_leiden()returned a membership for a directed graph without any warning. The wrapper passes no in-weights and scales the resolution for undirected modularity, so it effectively optimized undirected modularity at twice the resolution, and the reported$qualitydisagreed withmodularity().cluster_leiden()now raises the error that igraph 2.3.4 raises for directed graphs ("Leiden algorithm is only implemented for undirected graphs."). Proper directed support would need the in-weights exposed and the resolution scaled by the edge count, which is beyond a fix.This reverses the last sentence of the corrected message proposed for series commit a7a553a (see the third PR, #2992), which says that
cluster_leiden()now runs on a directed graph. The rebuild must either adjust that message or fold this fix into that commit.Tests
The branch adds three tests to
tests/testthat/test-community.R: they pin the rejection of directed graphs and, on undirected graphs, the agreement of$qualitywithmodularity(). The package was built and installed from the tip of the whole chain (head of the third PR, which includes this branch) into a scratch library, andtest-community.Rwas run against the installed package withNOT_CRAN=true: 37 tests, 355 expectations, 0 failures, 0 errors, 0 skips.air format --checkis clean on all changed R files.Provenance
Made by a Claude subsession: https://claude.ai/code/session_015GouVEqbVWVYs6hH8zvrRc
https://claude.ai/code/session_01JXnA76zWTu4ZD8BQCSYRpk
Generated by Claude Code