本文整理汇总了Python中networkx.load_centrality方法的典型用法代码示例。如果您正苦于以下问题:Python networkx.load_centrality方法的具体用法?Python networkx.load_centrality怎么用?Python networkx.load_centrality使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类networkx
的用法示例。
在下文中一共展示了networkx.load_centrality方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_florentine_families_load
# 需要导入模块: import networkx [as 别名]
# 或者: from networkx import load_centrality [as 别名]
def test_florentine_families_load(self):
G=self.F
c=nx.load_centrality(G)
d={'Acciaiuoli': 0.000,
'Albizzi': 0.211,
'Barbadori': 0.093,
'Bischeri': 0.104,
'Castellani': 0.055,
'Ginori': 0.000,
'Guadagni': 0.251,
'Lamberteschi': 0.000,
'Medici': 0.522,
'Pazzi': 0.000,
'Peruzzi': 0.022,
'Ridolfi': 0.117,
'Salviati': 0.143,
'Strozzi': 0.106,
'Tornabuoni': 0.090}
for n in sorted(G):
assert_almost_equal(c[n],d[n],places=3)
示例2: test_unnormalized_krackhardt_load
# 需要导入模块: import networkx [as 别名]
# 或者: from networkx import load_centrality [as 别名]
def test_unnormalized_krackhardt_load(self):
G=self.K
c=nx.load_centrality(G,normalized=False)
d={0: 1.667,
1: 1.667,
2: 0.000,
3: 7.333,
4: 0.000,
5: 16.667,
6: 16.667,
7: 28.000,
8: 16.000,
9: 0.000}
for n in sorted(G):
assert_almost_equal(c[n],d[n],places=3)
示例3: test_unnormalized_florentine_families_load
# 需要导入模块: import networkx [as 别名]
# 或者: from networkx import load_centrality [as 别名]
def test_unnormalized_florentine_families_load(self):
G=self.F
c=nx.load_centrality(G,normalized=False)
d={'Acciaiuoli': 0.000,
'Albizzi': 38.333,
'Barbadori': 17.000,
'Bischeri': 19.000,
'Castellani': 10.000,
'Ginori': 0.000,
'Guadagni': 45.667,
'Lamberteschi': 0.000,
'Medici': 95.000,
'Pazzi': 0.000,
'Peruzzi': 4.000,
'Ridolfi': 21.333,
'Salviati': 26.000,
'Strozzi': 19.333,
'Tornabuoni': 16.333}
for n in sorted(G):
assert_almost_equal(c[n],d[n],places=3)
示例4: test_florentine_families_load
# 需要导入模块: import networkx [as 别名]
# 或者: from networkx import load_centrality [as 别名]
def test_florentine_families_load(self):
G = self.F
c = nx.load_centrality(G)
d = {'Acciaiuoli': 0.000,
'Albizzi': 0.211,
'Barbadori': 0.093,
'Bischeri': 0.104,
'Castellani': 0.055,
'Ginori': 0.000,
'Guadagni': 0.251,
'Lamberteschi': 0.000,
'Medici': 0.522,
'Pazzi': 0.000,
'Peruzzi': 0.022,
'Ridolfi': 0.117,
'Salviati': 0.143,
'Strozzi': 0.106,
'Tornabuoni': 0.090}
for n in sorted(G):
assert_almost_equal(c[n], d[n], places=3)
示例5: test_unnormalized_krackhardt_load
# 需要导入模块: import networkx [as 别名]
# 或者: from networkx import load_centrality [as 别名]
def test_unnormalized_krackhardt_load(self):
G = self.K
c = nx.load_centrality(G, normalized=False)
d = {0: 1.667,
1: 1.667,
2: 0.000,
3: 7.333,
4: 0.000,
5: 16.667,
6: 16.667,
7: 28.000,
8: 16.000,
9: 0.000}
for n in sorted(G):
assert_almost_equal(c[n], d[n], places=3)
示例6: test_unnormalized_florentine_families_load
# 需要导入模块: import networkx [as 别名]
# 或者: from networkx import load_centrality [as 别名]
def test_unnormalized_florentine_families_load(self):
G = self.F
c = nx.load_centrality(G, normalized=False)
d = {'Acciaiuoli': 0.000,
'Albizzi': 38.333,
'Barbadori': 17.000,
'Bischeri': 19.000,
'Castellani': 10.000,
'Ginori': 0.000,
'Guadagni': 45.667,
'Lamberteschi': 0.000,
'Medici': 95.000,
'Pazzi': 0.000,
'Peruzzi': 4.000,
'Ridolfi': 21.333,
'Salviati': 26.000,
'Strozzi': 19.333,
'Tornabuoni': 16.333}
for n in sorted(G):
assert_almost_equal(c[n], d[n], places=3)
示例7: test_not_strongly_connected
# 需要导入模块: import networkx [as 别名]
# 或者: from networkx import load_centrality [as 别名]
def test_not_strongly_connected(self):
b = nx.load_centrality(self.D)
result = {0: 5./12,
1: 1./4,
2: 1./12,
3: 1./4,
4: 0.000}
for n in sorted(self.D):
assert_almost_equal(result[n], b[n], places=3)
assert_almost_equal(result[n], nx.load_centrality(self.D, n), places=3)
示例8: test_weighted_load
# 需要导入模块: import networkx [as 别名]
# 或者: from networkx import load_centrality [as 别名]
def test_weighted_load(self):
b=nx.load_centrality(self.G,weight='weight',normalized=False)
for n in sorted(self.G):
assert_equal(b[n],self.exact_weighted[n])
示例9: test_k5_load
# 需要导入模块: import networkx [as 别名]
# 或者: from networkx import load_centrality [as 别名]
def test_k5_load(self):
G=self.K5
c=nx.load_centrality(G)
d={0: 0.000,
1: 0.000,
2: 0.000,
3: 0.000,
4: 0.000}
for n in sorted(G):
assert_almost_equal(c[n],d[n],places=3)
示例10: test_p3_load
# 需要导入模块: import networkx [as 别名]
# 或者: from networkx import load_centrality [as 别名]
def test_p3_load(self):
G=self.P3
c=nx.load_centrality(G)
d={0: 0.000,
1: 1.000,
2: 0.000}
for n in sorted(G):
assert_almost_equal(c[n],d[n],places=3)
c=nx.load_centrality(G,v=1)
assert_almost_equal(c,1.0)
c=nx.load_centrality(G,v=1,normalized=True)
assert_almost_equal(c,1.0)
示例11: test_p2_load
# 需要导入模块: import networkx [as 别名]
# 或者: from networkx import load_centrality [as 别名]
def test_p2_load(self):
G=nx.path_graph(2)
c=nx.load_centrality(G)
d={0: 0.000,
1: 0.000}
for n in sorted(G):
assert_almost_equal(c[n],d[n],places=3)
示例12: test_unnormalized_k5_load
# 需要导入模块: import networkx [as 别名]
# 或者: from networkx import load_centrality [as 别名]
def test_unnormalized_k5_load(self):
G=self.K5
c=nx.load_centrality(G,normalized=False)
d={0: 0.000,
1: 0.000,
2: 0.000,
3: 0.000,
4: 0.000}
for n in sorted(G):
assert_almost_equal(c[n],d[n],places=3)
示例13: test_unnormalized_p3_load
# 需要导入模块: import networkx [as 别名]
# 或者: from networkx import load_centrality [as 别名]
def test_unnormalized_p3_load(self):
G=self.P3
c=nx.load_centrality(G,normalized=False)
d={0: 0.000,
1: 2.000,
2: 0.000}
for n in sorted(G):
assert_almost_equal(c[n],d[n],places=3)
示例14: test_not_strongly_connected
# 需要导入模块: import networkx [as 别名]
# 或者: from networkx import load_centrality [as 别名]
def test_not_strongly_connected(self):
b = nx.load_centrality(self.D)
result = {0: 5. / 12,
1: 1. / 4,
2: 1. / 12,
3: 1. / 4,
4: 0.000}
for n in sorted(self.D):
assert_almost_equal(result[n], b[n], places=3)
assert_almost_equal(result[n], nx.load_centrality(self.D, n), places=3)
示例15: test_weighted_load
# 需要导入模块: import networkx [as 别名]
# 或者: from networkx import load_centrality [as 别名]
def test_weighted_load(self):
b = nx.load_centrality(self.G, weight='weight', normalized=False)
for n in sorted(self.G):
assert_equal(b[n], self.exact_weighted[n])