当前位置: 首页>>代码示例>>Python>>正文


Python networkx.load_centrality方法代码示例

本文整理汇总了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) 
开发者ID:SpaceGroupUCL,项目名称:qgisSpaceSyntaxToolkit,代码行数:22,代码来源:test_load_centrality.py

示例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) 
开发者ID:SpaceGroupUCL,项目名称:qgisSpaceSyntaxToolkit,代码行数:18,代码来源:test_load_centrality.py

示例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) 
开发者ID:SpaceGroupUCL,项目名称:qgisSpaceSyntaxToolkit,代码行数:23,代码来源:test_load_centrality.py

示例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) 
开发者ID:holzschu,项目名称:Carnets,代码行数:22,代码来源:test_load_centrality.py

示例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) 
开发者ID:holzschu,项目名称:Carnets,代码行数:18,代码来源:test_load_centrality.py

示例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) 
开发者ID:holzschu,项目名称:Carnets,代码行数:23,代码来源:test_load_centrality.py

示例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) 
开发者ID:SpaceGroupUCL,项目名称:qgisSpaceSyntaxToolkit,代码行数:12,代码来源:test_load_centrality.py

示例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]) 
开发者ID:SpaceGroupUCL,项目名称:qgisSpaceSyntaxToolkit,代码行数:6,代码来源:test_load_centrality.py

示例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) 
开发者ID:SpaceGroupUCL,项目名称:qgisSpaceSyntaxToolkit,代码行数:12,代码来源:test_load_centrality.py

示例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) 
开发者ID:SpaceGroupUCL,项目名称:qgisSpaceSyntaxToolkit,代码行数:14,代码来源:test_load_centrality.py

示例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) 
开发者ID:SpaceGroupUCL,项目名称:qgisSpaceSyntaxToolkit,代码行数:9,代码来源:test_load_centrality.py

示例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) 
开发者ID:SpaceGroupUCL,项目名称:qgisSpaceSyntaxToolkit,代码行数:12,代码来源:test_load_centrality.py

示例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) 
开发者ID:SpaceGroupUCL,项目名称:qgisSpaceSyntaxToolkit,代码行数:10,代码来源:test_load_centrality.py

示例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) 
开发者ID:holzschu,项目名称:Carnets,代码行数:12,代码来源:test_load_centrality.py

示例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]) 
开发者ID:holzschu,项目名称:Carnets,代码行数:6,代码来源:test_load_centrality.py


注:本文中的networkx.load_centrality方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。