Skip to content

fix: sum duplicate sparse adjacency weights - #907

Open
yucheng-du wants to merge 1 commit into
igraph:mainfrom
yucheng-du:fix/sparse-weighted-adjacency
Open

yucheng-du wants to merge 1 commit into
igraph:mainfrom
yucheng-du:fix/sparse-weighted-adjacency

Conversation

@yucheng-du

Copy link
Copy Markdown

Fixes #903.

Sum entries at the same sparse matrix coordinate before creating weighted edges. When two edges of weight 1 from NetworkX occupy the same coordinate, the resulting edge has weight 2, just as it does with a dense adjacency matrix. Entries that cancel produce no edge.

The tests cover COO arrays and matrices, all seven adjacency modes and preservation of the input. The full Python suite passed with 536 tests and 3 skips.

LLM assistance: GPT-6.2 Astra (ultra reasoning effort).

  • By submitting this pull request, I assign the copyright of my contribution to The igraph development team.

@szhorvat

szhorvat commented Dec 1, 2026

Copy link
Copy Markdown
Member

Thank you, but please let us know in advance before starting work on an issue. I actually had a local fix for this on my machine but it was blocking on related issues that were discovered while developing the fix.

Note that checking the copyright assignment box is needed before any PR can be merged.

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.

What aggregation does Weighted_Adjacency assume for COO matrices with repeated coordinates?

2 participants