Calculates betweenness centrality and returns a node => weight dictionary. Node.centrality is updated in the process. Node.centrality is higher for nodes with a lot of passing traffic.
(self, normalized=True, directed=False)
| 463 | return ec |
| 464 | |
| 465 | def betweenness_centrality(self, normalized=True, directed=False): |
| 466 | """ Calculates betweenness centrality and returns a node => weight dictionary. |
| 467 | Node.centrality is updated in the process. |
| 468 | Node.centrality is higher for nodes with a lot of passing traffic. |
| 469 | """ |
| 470 | bc = brandes_betweenness_centrality(self, normalized, directed) |
| 471 | bc = nodedict(self, ((self[id], w) for id, w in bc.iteritems())) |
| 472 | for n, w in bc.iteritems(): |
| 473 | n._centrality = w |
| 474 | return bc |
| 475 | |
| 476 | def sorted(self, order=WEIGHT, threshold=0.0): |
| 477 | """ Returns a list of nodes sorted by WEIGHT or CENTRALITY. |