MCPcopy Index your code
hub / github.com/clips/pattern / eigenvector_centrality

Method eigenvector_centrality

pattern/graph/__init__.py:454–463  ·  view source on GitHub ↗

Calculates eigenvector centrality and returns a node => weight dictionary. Node.weight is updated in the process. Node.weight is higher for nodes with a lot of (indirect) incoming traffic.

(self, normalized=True, reversed=True, rating={}, iterations=100, tolerance=0.0001)

Source from the content-addressed store, hash-verified

452 return p
453
454 def eigenvector_centrality(self, normalized=True, reversed=True, rating={}, iterations=100, tolerance=0.0001):
455 """ Calculates eigenvector centrality and returns a node => weight dictionary.
456 Node.weight is updated in the process.
457 Node.weight is higher for nodes with a lot of (indirect) incoming traffic.
458 """
459 ec = eigenvector_centrality(self, normalized, reversed, rating, iterations, tolerance)
460 ec = nodedict(self, ((self[id], w) for id, w in ec.iteritems()))
461 for n, w in ec.iteritems():
462 n._weight = w
463 return ec
464
465 def betweenness_centrality(self, normalized=True, directed=False):
466 """ Calculates betweenness centrality and returns a node => weight dictionary.

Callers 4

weightMethod · 0.80
_dataMethod · 0.80
test_cacheMethod · 0.80

Calls 3

eigenvector_centralityFunction · 0.85
nodedictClass · 0.85
iteritemsMethod · 0.80

Tested by 2

test_cacheMethod · 0.64