title: networkx - meaning of weight in betwenness and current flow betweenness
body: <p>I'm using Python Networkx 2.1 to calculate Betweenness Centrality and Current Flow Betweenness Centrality on an undirected graph, with <strong>weighted</strong> edges.
  My concern is about the meaning of the parameter 'weight' in the networkx functions. Please consider the graph given by the following example</p>
  
  <pre><code>G= nx.Graph()
  G.add_path([1, 2,4])
  G.add_path([1, 3,4])
  G[1][2]['weight'] = 20
  G[1][3]['weight'] = 1
  G[2][4]['weight'] = 1
  G[3][4]['weight'] = 1
  
  for u,v,d in G.edges(data=True):
      if 'weight' in d:
          if d['weight'] != 0:
              d['reciprocal'] = 1/d['weight']
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/bvyZI.jpg" rel="noreferrer"><img src="https://i.stack.imgur.com/bvyZI.jpg" alt="enter image description here"></a>
  Edges weight in my case is strength of relationship, therefore <strong>something positive</strong>. The idea is that edges with higher weights should contribute more to betweenness.
  Given this idea, am I correct in saying that the right formulas to calculate node Weighted Betweenness Centrality and Weighted Current Flow Betweenness Centrality are the following?</p>
  
  <pre><code>b = nx.betweenness_centrality(G, weight= 'reciprocal', normalized=False)
  Out[46]: {1: 1.0, 2: 1.0, 3: 0.0, 4: 0.0}
  
  f = nx.current_flow_betweenness_centrality(G, normalized= False, weight= 'weight', solver='lu')
  Out[48]: 
  {1: 1.3114754098360655,
   2: 1.3114754098360657,
   3: 0.6885245901639343,
   4: 0.6885245901639347}
  </code></pre>
  
  <p>Please note that in the <strong>first formula I used the reciprocal of edge weights</strong> as it is my feeling that these are interpreted by the algorithm as distances, so something 'bad'.
  In the <strong>second formula</strong>, on the other hand, <strong>I used the original weight</strong>, as in the algorithm of current flow betweenness it seems this gives more importance to nodes 1 and 2, as in betweenness. Therefore here weights seems to be 'positive'.</p>
  
  <p>I'm wondering if I do something wrong. In fact, on larger graphs the two measures correlate more if I use the same weight parameter, and not the reciprocal.
  <strong>How is weight treated in these two algorithms?</strong></p>