66<url>:Centralities:https://en.wikipedia.org/wiki/Centrality</url>
77
88
9- Routines to evaluate centralities associated to a graph.
10-
11- In a graph, the centrality is an estimator associated to each of its \
12- vertices, which accounts their degree of connectivity, according \
13- to different criteria.
9+ Routines to evaluate centralities of a graph.
1410
11+ In graph theory and network analysis, the centrality is a \
12+ ranking between pairs of node according some metric.
1513
1614"""
1715
@@ -71,13 +69,11 @@ class BetweennessCentrality(_Centrality):
7169 :Betweenness centrality:
7270 https://en.wikipedia.org/wiki/Betweenness_centrality</url> (<url>
7371 :NetworkX:
74- https://networkx.org/documentation/networkx-2.8.8/reference/algorithms/generated/\
75- networkx.algorithms.centrality.betweenness_centrality.html</url>,\
72+ https://networkx.org/documentation/networkx-2.8.8/reference/algorithms/generated/networkx.algorithms.centrality.betweenness_centrality.html</url>,\
7673 <url>
7774 :WMA:
7875 https://reference.wolfram.com/language/ref/BetweennessCentrality.html</url>)
7976
80-
8177 <dl>
8278 <dt>'BetweennessCentrality'[$g$]
8379 <dd>gives a list of betweenness centralities for the vertices \
@@ -90,11 +86,14 @@ class BetweennessCentrality(_Centrality):
9086 >> BetweennessCentrality[g]
9187 = {0., 1., 0., 0., 0.}
9288
93- >> g = Graph[{a -> b, b -> c, c -> d, d -> e, e -> c, e -> a}]; BetweennessCentrality[g]
94- = {3., 3., 6., 6., 6.}
89+ >> g = Graph[{a -> b, b -> c, c -> d, d -> e, e -> c, e -> a}]
90+ = -Graph-
91+
92+ >> BetweennessCentrality[g]
93+ = ...
9594 """
9695
97- summary_text = "get the betweenness centrality"
96+ summary_text = "get Betweenness centrality"
9897
9998 def eval (self , graph , expression , evaluation , options ):
10099 "%(name)s[graph_, OptionsPattern[%(name)s]]"
@@ -258,7 +257,7 @@ class EigenvectorCentrality(_ComponentwiseCentrality):
258257 = {0.333333, 0.333333, 0.333333, 0., 0.}
259258 """
260259
261- summary_text = "compute the eigenvector centralities"
260+ summary_text = "compute Eigenvector centralities"
262261
263262 def _centrality (self , g , weight ):
264263 return nx .eigenvector_centrality (g , max_iter = 10000 , tol = 1.0e-7 , weight = weight )
@@ -297,7 +296,7 @@ class HITSCentrality(_Centrality):
297296
298297 """
299298
300- summary_text = "get the HITS centrality"
299+ summary_text = "get HITS centrality"
301300
302301 def eval (self , graph , expression , evaluation , options ):
303302 "%(name)s[graph_, OptionsPattern[%(name)s]]"
@@ -401,9 +400,7 @@ class PageRankCentrality(_Centrality):
401400 vertices in the graph $g$ and weight $alpha$ and initial centralities $beta$.
402401 </dl>
403402
404- ## Not working, possibly because an issue in networkx
405-
406- ## >> g = Graph[{a -> d, b -> c, d -> c, d -> a, e -> c, d -> c}]; PageRankCentrality[g, 0.2]
403+ >> g = Graph[{a -> d, b -> c, d -> c, d -> a, e -> c, d -> c}]; PageRankCentrality[g, 0.2]
407404 = {0.184502, 0.207565, 0.170664, 0.266605, 0.170664}
408405 """
409406
@@ -413,7 +410,7 @@ def eval_alpha_beta(self, graph, alpha, expression, evaluation, options):
413410 "%(name)s[graph_, alpha_, OptionsPattern[%(name)s]]"
414411 graph = self ._build_graph (graph , evaluation , options , expression )
415412 if graph :
416- py_alpha = alpha .to_mpmath ()
413+ py_alpha = float ( alpha .to_mpmath () )
417414 if py_alpha is None :
418415 return
419416 G , weight = graph .coalesced_graph (evaluation )
0 commit comments