Added edge-betweenness.jl to centralities#277
Added edge-betweenness.jl to centralities#277jwassmer wants to merge 17 commits intoJuliaGraphs:masterfrom
Conversation
Codecov Report
@@ Coverage Diff @@
## master #277 +/- ##
==========================================
- Coverage 97.29% 97.28% -0.02%
==========================================
Files 114 115 +1
Lines 6659 6694 +35
==========================================
+ Hits 6479 6512 +33
- Misses 180 182 +2 |
|
Hi Jonas, thanks for your contribution. Code reviews here take quite a while at the moment, especially when the reviewer tries to understand the algorithm and we are also a bit understaffed, just to warn you :) That being said, the first thing that you definitely should also implement are some tests - that is why the codecov bot is complaining so loudly. If you want to use them, we recently introduced some graph types called |
Co-authored-by: Simon Schölly <sischoel@gmail.com>
|
You may want to add the Furthermore, you actually need to include the Lastly, you also need to add |
gdalle
left a comment
There was a problem hiding this comment.
Thank you for the contribution! I'll try to review it, and have asked a few questions to understand the procedure a bit better
| to get an estimate of the edge betweenness centrality. Including more nodes yields better more accurate estimates. | ||
| Return a Sparse Matrix representing the centrality calculated for each edge in `g`. | ||
| It is defined as the sum of the fraction of all-pairs shortest paths that pass through `e` | ||
| `` |
There was a problem hiding this comment.
have you checked how this displays by building the docs?
There was a problem hiding this comment.
pkg> activate docs
julia> include("docs/make.jl")| `normalize=true` : If set to true, the edge betweenness values will be normalized by the total number of possible distinct paths between all pairs of nodes in the graph. | ||
| For undirected graphs, the normalization factor is calculated as ``2 / (|V|(|V|-1))``, where |V| is the number of vertices. For directed graphs, the normalization factor | ||
| is calculated as ``1 / (|V|(|V|-1))``. | ||
| `vs=vertices(g)`: A subset of nodes in the graph g for which the edge betweenness centrality is to be estimated. By including more nodes in this subset, |
There was a problem hiding this comment.
what is the relation between k and vs?
| while length(seen) > 0 | ||
| w = pop!(seen) | ||
|
|
||
| coeff = (1.0 + δ[w]) / σ[w] |
There was a problem hiding this comment.
can you explain the dynamics of coeff and δ through this loop?
|
|
||
|
|
||
| ### References | ||
| - Brandes 2001 & Brandes 2008 |
There was a problem hiding this comment.
can you give more details to help us check the algorithm?
| @@ -0,0 +1,81 @@ | |||
|
|
|||
| @testset "Edge Betweenness" begin | |||
There was a problem hiding this comment.
how did you pick your test cases?
I have added a new file
edge-betweenness.jltosrc/centrality/. Here I include a function to compute the edge betweenness of a graph (directed and weighted). In theory I could also add a version for MultiGraphs, but these are not in the base version of Graphs atm. My code is based on the version from networkX.This is my first contribution, and I hope I have followed all the guidelines correctly.
Jonas