def betweenness_centrality_parallel(G, processes=None):
 p = Pool(processes=processes)
 node_divisor = (len(p._pool) * 4)
 node_chunks = list(chunks(G.nodes(), int((G.order() / node_divisor))))
 num_chunks = len(node_chunks)
 bt_sc = p.map(_betmap, zip(([G] * num_chunks), ([True] * num_chunks), ([None] * num_chunks), node_chunks))
 bt_c = bt_sc[0]
 for bt in bt_sc[1:]:
  for n in bt:
   bt_c[n] += bt[n]
 return bt_c

def betweenness_centrality_parallel ( G , processes = None ) : p = Pool ( processes = processes ) node_divisor = ( len ( p . _pool ) * 4 ) node_chunks = list ( chunks ( G . nodes ( ) , int ( ( G . order ( ) / node_divisor ) ) ) ) num_chunks = len ( node_chunks ) bt_sc = p . map ( _betmap , zip ( ( [ G ] * num_chunks ) , ( [ True ] * num_chunks ) , ( [ None ] * num_chunks ) , node_chunks ) ) bt_c = bt_sc [ 0 ] for bt in bt_sc [ 1 : ] : for n in bt : bt_c [ n ] += bt [ n ] return bt_c
parallel betweenness centrality function .