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