Skip to content

Fix the pagerank and triangle centrality examples - #162

Merged
ViralBShah merged 3 commits into
v11from
vs/fix-old-examples
Oct 27, 2026
Merged

ViralBShah merged 3 commits into
v11from
vs/fix-old-examples

Conversation

@ViralBShah

Copy link
Copy Markdown
Member

Ports examples/pagerank.jl and examples/triangle_centrality.jl to the current API and fixes two correctness bugs in triangle centrality:

  • triangle_centrality used .-, which broadcasts as emul (intersection). That dropped vertices that are in no triangle but have neighbours that are, e.g. a pendant vertex hanging off a triangle got 0 instead of its correct value.
  • triangle_centrality1 multiplied y by the triangle counts in T instead of its pattern, so vertices on edges shared by several triangles came out wrong.

pagerank only needed the removed GBArray annotation dropped. Its results match a dense power iteration.

Both now have reference headers, tests in test/examples.jl (hand-computed centralities; PageRank on a cycle and against a dense iteration), and rows in the docs Examples table. Full Pkg.test() and the doctests pass on nightly.

🤖 Generated with Claude Code

ViralBShah and others added 2 commits October 27, 2026 16:48
- pagerank: drop the removed `GBArray` annotation and import `second`.
- triangle_centrality: pass the Descriptor as `desc=` and import
  `second`. Use `-` (eadd) instead of `.-`, which broadcasts as emul and
  dropped vertices that are in no triangle but have triangle neighbours.
- triangle_centrality1: multiply by the pattern of T (`(+, second)`)
  instead of its triangle counts, as in the definition.
- Add reference headers.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@codecov

codecov Bot commented Oct 27, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 66.10%. Comparing base (605a518) to head (b7cc737).
⚠️ Report is 1 commits behind head on v11.

Additional details and impacted files
@@            Coverage Diff             @@
##              v11     #162      +/-   ##
==========================================
+ Coverage   65.87%   66.10%   +0.22%     
==========================================
  Files          54       54              
  Lines        4449     4449              
==========================================
+ Hits         2931     2941      +10     
+ Misses       1518     1508      -10     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@ViralBShah
ViralBShah merged commit 2fe30ea into v11 Oct 27, 2026
5 checks passed
@ViralBShah
ViralBShah deleted the vs/fix-old-examples branch October 27, 2026 16:59
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