Add KADABRA betweenness centrality approximation algorithm - #518
Open
DerSchmachtin wants to merge 1 commit into
Open
Add KADABRA betweenness centrality approximation algorithm#518DerSchmachtin wants to merge 1 commit into
DerSchmachtin wants to merge 1 commit into
Conversation
DerSchmachtin
force-pushed
the
master
branch
2 times, most recently
from
July 31, 2026 18:26
a71b033 to
47fd306
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #518 +/- ##
==========================================
+ Coverage 97.46% 97.62% +0.16%
==========================================
Files 127 129 +2
Lines 7766 8340 +574
==========================================
+ Hits 7569 8142 +573
- Misses 197 198 +1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
DerSchmachtin
force-pushed
the
master
branch
5 times, most recently
from
August 5, 2026 07:42
1b7aaad to
6d1291d
Compare
DerSchmachtin
force-pushed
the
master
branch
5 times, most recently
from
August 14, 2026 11:30
0298521 to
e213fd1
Compare
Member
|
Hi there, sorry for the delay in responding. I was very busy thoughout the last couple of weeks, and haven't had the time to look into the new PRs. I will try to review this within a week. Thank you!! |
DerSchmachtin
force-pushed
the
master
branch
from
September 1, 2026 11:31
d5ffc7a to
869c0ca
Compare
Implements the KADABRA approximation algorithm for betweenness
centrality (Borassi & Natale, 2019), including the adaptive
delta-calibration phase, and registers it in the docs, CHANGELOG
and test suite.
The top-k confidence-budget allocation follows the paper rather than the
authors' C++ reference, which transposes the two rank gaps relative to the
stopping test its own Algorithm 2 performs, leaves lambda_L(v_1)
unconstrained, and never applies the tie-collapse rule to the pair
(v_k, v_{k+1}) that the external-exclusion test is built around. The
allocation is a heuristic for where to spend the delta budget, not part of
the (err, delta) guarantee, so both readings are valid approximations and
differ only in cost. Over 4 SNAP graphs x k in {3, 5, 10, 100} x 3 seeds at
err = 1e-4, the paper's allocation needed 0.80 +- 0.18 times as many samples
as the reference's for identical top-k accuracy, and collapsing the boundary
pair additionally removes the cases where a top-k query cost more than
computing every centrality. The rationale is documented at the call sites in
`compute_bet_err!`. k = 0 does not enter this code path.
Also switches the JET testset to `target_modules=(Graphs,)`, since
`target_defined_modules` was removed in JET 0.12 and now raises a
JETConfigError.
DerSchmachtin
force-pushed
the
master
branch
from
September 1, 2026 22:57
869c0ca to
f5d137c
Compare
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.
Description
This Pull Request introduces the KADABRA (K-ADaptive Approximation of Betweenness centRAlity) algorithm to
Graphs.jl.Computing exact betweenness centrality can be prohibitively expensive on very large graphs. KADABRA provides a fast and highly scalable randomized approximation of the betweenness centrality, as well as an efficient method to find the top-k nodes with the highest betweenness.
The implementation includes two main exported functions:
kadabra_centrality: Approximates the betweenness centrality for all vertices.kadabra_top_k: Returns the topkvertices with the highest betweenness centrality.Reference:
A note on the top-k allocation
In top-k mode KADABRA sizes each vertex's confidence interval from its rank gaps before sampling begins. Here the implementation follows the paper (Section 5.2) rather than the authors' C++ reference, which NetworKit's
KadabraBetweennessalso copies — so a reviewer comparing against either will find a deliberate difference rather than a porting bug:lambda_L(v_1)unconstrained — pinning the top vertex's lower budget, the only one its own test uses, at the minimum.(v_k, v_{k+1}), the single pair the external-exclusion test is built around, which deadlocks both vertices once their gap falls below2*err.The allocation is a heuristic for where to spend the
deltabudget, not part of the(err, delta)guarantee, so each variant remains a valid approximation and they differ only in how many samples they need. Measured over 4 SNAP graphs ×k ∈ {3, 5, 10, 100}× 3 seeds aterr = 1e-4, the paper's allocation needed0.80 ± 0.18times as many samples as the reference's, at identical top-k accuracy — the same overlap with the exact ranking and the same Kendall τ over the top k to three decimals. Collapsing the boundary pair additionally removes the cases where a top-k query cost more than computing every centrality. See the number of samples in comparison to 'k=0' below.k = 0is unaffected: it does not enter this code path.I am separately seeking confirmation from the KADABRA authors on whether the reference's ordering was deliberate (I'm pretty sure it was overlooked), and will report back here. In the meantime I am happy to switch to the reference's behaviour instead if you would prefer bug-for-bug compatibility with NetworKit.
Checklist
kadabra.jltosrc/centrality/test/centrality/kadabra.jland registered it inruntests.jlJuliaFormatter.jlaccording to BlueStyleGraphs.jlGraphs.jlconventions using standard library importsAll tests pass locally. Let me know if there are any changes or further optimizations you would like me to make!
Benchmarks & Performance
To verify the performance, I ran some benchmarks comparing this Julia implementation against the original, highly optimized C++ version from the authors.
Hardware Setup:
All benchmarks were executed on an AMD Ryzen Threadripper 3960X 24-Core Processor (3.80 GHz, 48 threads) with 125 GiB of RAM running Ubuntu 22.04 LTS.
The Julia implementation is competitive compared to the Original C++ Implementation.
Here are the results (using
k=0,delta=0.1andepsilon=0.0001) on a few test instances taken from SNAP: