當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。