[BGL] brandes betweenness vs networkx

What is the rationale behind division by 2 for the undirected Brandes
calcuation?
Also, can someone show me how to get the weighted version of brandes?
The following code calculates the unweighted version.
#include "boost/graph/adjacency_list.hpp"
#include "boost/graph/graph_utility.hpp"
#include "boost/graph/betweenness_centrality.hpp"
using namespace boost;
int main(int argc, char * argv[]){
const int N = 6;
typedef property < edge_weight_t, double > WeightMap;
typedef property < vertex_centrality_t, double > CentralityMap;
typedef adjacency_list

Also, can someone show me how to get the weighted version of brandes? The following code calculates the unweighted version.
Unfortunately, no. I've never used it. So, boost is exactly 1/2 of networkx's solution.
Is one version wrong? Or is this some kind of convention that boost and networkx disagree on?
I would guess that the difference has to do with networkx's normalization of between values, but I couldn't say for certain. It might also be that networkx is following undirected edges twice, resulting in twice the value. That would definitely be worth looking into. Andrew Sutton andrew.n.sutton@gmail.com

Also, can someone show me how to get the weighted version of brandes? The following code calculates the unweighted version.
Unfortunately, no. I've never used it.
So, boost is exactly 1/2 of networkx's solution.
Is one version wrong? Or is this some kind of convention that boost and networkx disagree on?
I would guess that the difference has to do with networkx's normalization of between values, but I couldn't say for certain. It might also be that networkx is following undirected edges twice, resulting in twice the value. That would definitely be worth looking into.
I turned off networkx's normalization - so that is not it. The boost code explicitly divides by 2 for undirected at the end. I'll try calculating one by hand and see which code comes up with what I think is Brandes metric. Thanks, Matt

I would guess that the difference has to do with networkx's normalization
of between values, but I couldn't say for certain. It might also be that networkx is following undirected edges twice, resulting in twice the value. That would definitely be worth looking into.
I turned off networkx's normalization - so that is not it. The boost code explicitly divides by 2 for undirected at the end.
I'll try calculating one by hand and see which code comes up with what I think is Brandes metric.
I did not catch that... I have absolutely no idea what the rationale for this is. I might guess that the author's intent was to normalize (kind of) w.r.t. degree. You know, degree of a vertex in an undirected graph is twice that of the same directed graph... That probably isn't the right thing to do in this case. If you're by-hand computation matches network-x, then file a ticket on it and I'll patch it up tomorrow or Friday. Andrew Sutton andrew.n.sutton@gmail.com
participants (2)
-
Andrew Sutton
-
Matthew Galati