• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python networkx.krackhardt_kite_graph函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中networkx.krackhardt_kite_graph函数的典型用法代码示例。如果您正苦于以下问题:Python krackhardt_kite_graph函数的具体用法?Python krackhardt_kite_graph怎么用?Python krackhardt_kite_graph使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了krackhardt_kite_graph函数的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: setUp

    def setUp(self):

        G=nx.Graph();
        G.add_edge(0,1,weight=3)
        G.add_edge(0,2,weight=2)
        G.add_edge(0,3,weight=6)
        G.add_edge(0,4,weight=4)
        G.add_edge(1,3,weight=5)
        G.add_edge(1,5,weight=5)
        G.add_edge(2,4,weight=1)
        G.add_edge(3,4,weight=2)
        G.add_edge(3,5,weight=1)
        G.add_edge(4,5,weight=4)
        self.G=G
        self.exact_weighted={0: 4.0, 1: 0.0, 2: 8.0, 3: 6.0, 4: 8.0, 5: 0.0}

        self.K = nx.krackhardt_kite_graph()
        self.P3 = nx.path_graph(3)
        self.P4 = nx.path_graph(4)
        self.K5 = nx.complete_graph(5)

        self.C4=nx.cycle_graph(4)
        self.T=nx.balanced_tree(r=2, h=2)
        self.Gb = nx.Graph()
        self.Gb.add_edges_from([(0,1), (0,2), (1,3), (2,3), 
                                (2,4), (4,5), (3,5)])


        F = nx.florentine_families_graph()
        self.F = F
开发者ID:AhmedPho,项目名称:NetworkX_fork,代码行数:30,代码来源:test_load_centrality.py


示例2: test_krackhardt_kite_graph_normalized

    def test_krackhardt_kite_graph_normalized(self):
        """Betweenness centrality: Krackhardt kite graph normalized"""
        G = nx.krackhardt_kite_graph()
        b_answer = {0: 0.023, 1: 0.023, 2: 0.000, 3: 0.102, 4: 0.000, 5: 0.231, 6: 0.231, 7: 0.389, 8: 0.222, 9: 0.000}
        b = nx.betweenness_centrality(G, weight=None, normalized=True)

        for n in sorted(G):
            assert_almost_equal(b[n], b_answer[n], places=3)
开发者ID:kswgit,项目名称:networkx,代码行数:8,代码来源:test_betweenness_centrality.py


示例3: test_krackhardt_kite_graph

    def test_krackhardt_kite_graph(self):
        """Betweenness centrality: Krackhardt kite graph"""
        G=networkx.krackhardt_kite_graph()
        b_answer={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 b in b_answer:
            b_answer[b]/=2.0
        b=networkx.betweenness_centrality(G, weight=False, normalized=False)

        for n in sorted(G):
            assert_almost_equal(b[n],b_answer[n],places=3)
开发者ID:kishori82,项目名称:Correlation_Network,代码行数:11,代码来源:compute_centrality.py


示例4: setUp

    def setUp(self):

        self.K = nx.krackhardt_kite_graph()
        self.P3 = nx.path_graph(3)
        self.P4 = nx.path_graph(4)
        self.K5 = nx.complete_graph(5)

        self.C4 = nx.cycle_graph(4)
        self.T = nx.balanced_tree(r=2, h=2)
        self.Gb = nx.Graph()
        self.Gb.add_edges_from([(0, 1), (0, 2), (1, 3), (2, 3), (2, 4), (4, 5), (3, 5)])

        F = nx.florentine_families_graph()
        self.F = F
开发者ID:CrazyPython,项目名称:networkx,代码行数:14,代码来源:test_closeness_centrality.py


示例5: setUp

    def setUp(self):

        G=nx.Graph();
        G.add_edge(0,1,weight=3)
        G.add_edge(0,2,weight=2)
        G.add_edge(0,3,weight=6)
        G.add_edge(0,4,weight=4)
        G.add_edge(1,3,weight=5)
        G.add_edge(1,5,weight=5)
        G.add_edge(2,4,weight=1)
        G.add_edge(3,4,weight=2)
        G.add_edge(3,5,weight=1)
        G.add_edge(4,5,weight=4)
        self.G=G
        self.exact_weighted={0: 4.0, 1: 0.0, 2: 8.0, 3: 6.0, 4: 8.0, 5: 0.0}

        self.K = nx.krackhardt_kite_graph()
        self.P3 = nx.path_graph(3)
        self.P4 = nx.path_graph(4)
        self.K5 = nx.complete_graph(5)

        self.C4=nx.cycle_graph(4)
        self.T=nx.balanced_tree(r=2, h=2)
        self.Gb = nx.Graph()
        self.Gb.add_edges_from([(0,1), (0,2), (1,3), (2,3), 
                                (2,4), (4,5), (3,5)])


        F = nx.Graph() # Florentine families
        F.add_edge('Acciaiuoli','Medici')
        F.add_edge('Castellani','Peruzzi')
        F.add_edge('Castellani','Strozzi')
        F.add_edge('Castellani','Barbadori')
        F.add_edge('Medici','Barbadori')
        F.add_edge('Medici','Ridolfi')
        F.add_edge('Medici','Tornabuoni')
        F.add_edge('Medici','Albizzi')
        F.add_edge('Medici','Salviati')
        F.add_edge('Salviati','Pazzi')
        F.add_edge('Peruzzi','Strozzi')
        F.add_edge('Peruzzi','Bischeri')
        F.add_edge('Strozzi','Ridolfi')
        F.add_edge('Strozzi','Bischeri')
        F.add_edge('Ridolfi','Tornabuoni')
        F.add_edge('Tornabuoni','Guadagni')
        F.add_edge('Albizzi','Ginori')
        F.add_edge('Albizzi','Guadagni')
        F.add_edge('Bischeri','Guadagni')
        F.add_edge('Guadagni','Lamberteschi')    
        self.F = F
开发者ID:c0ns0le,项目名称:zenoss-4,代码行数:50,代码来源:test_load_centrality.py


示例6: __init__

    def __init__(self):

        self.K = nx.krackhardt_kite_graph()
        self.P3 = nx.path_graph(3)
        self.K5 = nx.complete_graph(5)

        F = nx.Graph() # Florentine families
        F.add_edge('Acciaiuoli','Medici')
        F.add_edge('Castellani','Peruzzi')
        F.add_edge('Castellani','Strozzi')
        F.add_edge('Castellani','Barbadori')
        F.add_edge('Medici','Barbadori')
        F.add_edge('Medici','Ridolfi')
        F.add_edge('Medici','Tornabuoni')
        F.add_edge('Medici','Albizzi')
        F.add_edge('Medici','Salviati')
        F.add_edge('Salviati','Pazzi')
        F.add_edge('Peruzzi','Strozzi')
        F.add_edge('Peruzzi','Bischeri')
        F.add_edge('Strozzi','Ridolfi')
        F.add_edge('Strozzi','Bischeri')
        F.add_edge('Ridolfi','Tornabuoni')
        F.add_edge('Tornabuoni','Guadagni')
        F.add_edge('Albizzi','Ginori')
        F.add_edge('Albizzi','Guadagni')
        F.add_edge('Bischeri','Guadagni')
        F.add_edge('Guadagni','Lamberteschi')    
        self.F = F

        G = nx.DiGraph()
        G.add_edge(0,5)
        G.add_edge(1,5)
        G.add_edge(2,5)
        G.add_edge(3,5)
        G.add_edge(4,5)
        G.add_edge(5,6)
        G.add_edge(5,7)
        G.add_edge(5,8)
        self.G = G
开发者ID:123jefferson,项目名称:MiniBloq-Sparki,代码行数:39,代码来源:test_degree_centrality.py


示例7: setUp

    def setUp(self):

        self.K = nx.krackhardt_kite_graph()
        self.P3 = nx.path_graph(3)
        self.P4 = nx.path_graph(4)
        self.K5 = nx.complete_graph(5)

        self.C4=nx.cycle_graph(4)
        self.T=nx.balanced_tree(r=2, h=2)
        self.Gb = nx.Graph()
        self.Gb.add_edges_from([(0,1), (0,2), (1,3), (2,3), 
                                (2,4), (4,5), (3,5)])


        F = nx.Graph() # Florentine families
        F.add_edge('Acciaiuoli','Medici')
        F.add_edge('Castellani','Peruzzi')
        F.add_edge('Castellani','Strozzi')
        F.add_edge('Castellani','Barbadori')
        F.add_edge('Medici','Barbadori')
        F.add_edge('Medici','Ridolfi')
        F.add_edge('Medici','Tornabuoni')
        F.add_edge('Medici','Albizzi')
        F.add_edge('Medici','Salviati')
        F.add_edge('Salviati','Pazzi')
        F.add_edge('Peruzzi','Strozzi')
        F.add_edge('Peruzzi','Bischeri')
        F.add_edge('Strozzi','Ridolfi')
        F.add_edge('Strozzi','Bischeri')
        F.add_edge('Ridolfi','Tornabuoni')
        F.add_edge('Tornabuoni','Guadagni')
        F.add_edge('Albizzi','Ginori')
        F.add_edge('Albizzi','Guadagni')
        F.add_edge('Bischeri','Guadagni')
        F.add_edge('Guadagni','Lamberteschi')    
        self.F = F
开发者ID:c0ns0le,项目名称:zenoss-4,代码行数:36,代码来源:test_closeness_centrality.py


示例8: len

            color=colors[i % len(colors)],
            linestyle=linestyles[i / len(colors) % len(linestyles)],
            linewidth=linewidth,
            shifts=shifts,
        )
        for e in path:
            edge2shift[e] += single_shift

    return


##########################################
if __name__ == "__main__":

    # Example

    import networkx

    g = networkx.krackhardt_kite_graph()
    g.remove_node(9)
    path1 = networkx.shortest_path(g, 2, 8)
    path2 = networkx.shortest_path(g, 0, 8)
    path3 = [(1, 0), (0, 5), (5, 7)]
    path4 = [3, 5, 7, 6]
    pos = networkx.drawing.spring_layout(g)
    normalize_layout(pos)
    networkx.draw(g, pos, node_size=140)
    draw_many_paths(g, pos, [path1, path2, path3, path4], max_shift=0.03)
    matplotlib.pyplot.savefig("PathDrawer.png")
    matplotlib.pyplot.show()
开发者ID:sk2,项目名称:ank_legacy_v2,代码行数:30,代码来源:PathDrawer.py


示例9: setUpClass

 def setUpClass(cls):
     cls.g = qt.QueueNetworkDiGraph(nx.krackhardt_kite_graph())
     np.random.seed(10)
开发者ID:djordon,项目名称:queueing-tool,代码行数:3,代码来源:test_qndigraph.py


示例10: Hagberg

"""
# Author: Aric Hagberg ([email protected])
# Date: 2005-05-12 14:33:11 -0600 (Thu, 12 May 2005)
# Revision: 998

#    Copyright (C) 2004-2019 by
#    Aric Hagberg <[email protected]>
#    Dan Schult <[email protected]>
#    Pieter Swart <[email protected]>
#    All rights reserved.
#    BSD license.

import matplotlib.pyplot as plt
import networkx as nx

G = nx.krackhardt_kite_graph()

print("Betweenness")
b = nx.betweenness_centrality(G)
for v in G.nodes():
    print("%0.2d %5.3f" % (v, b[v]))

print("Degree centrality")
d = nx.degree_centrality(G)
for v in G.nodes():
    print("%0.2d %5.3f" % (v, d[v]))

print("Closeness centrality")
c = nx.closeness_centrality(G)
for v in G.nodes():
    print("%0.2d %5.3f" % (v, c[v]))
开发者ID:jg-you,项目名称:networkx,代码行数:31,代码来源:plot_krackhardt_centrality.py


示例11:

import networkx as nx
import matplotlib.pylab as plt
from plot_multigraph import plot_multigraph

graphs = [
  ("bull", nx.bull_graph()),
  ("chvatal", nx.chvatal_graph()),
  ("cubical", nx.cubical_graph()),
  ("desargues", nx.desargues_graph()),
  ("diamond", nx.diamond_graph()),
  ("dodecahedral", nx.dodecahedral_graph()),
  ("frucht", nx.frucht_graph()),
  ("heawood", nx.heawood_graph()),
  ("house", nx.house_graph()),
  ("house_x", nx.house_x_graph()),
  ("icosahedral", nx.icosahedral_graph()),
  ("krackhardt_kite", nx.krackhardt_kite_graph()),
  ("moebius_kantor", nx.moebius_kantor_graph()),
  ("octahedral", nx.octahedral_graph()),
  ("pappus", nx.pappus_graph()),
  ("petersen", nx.petersen_graph()),
  ("sedgewick_maze", nx.sedgewick_maze_graph()),
  ("tetrahedral", nx.tetrahedral_graph()),
  ("truncated_cube", nx.truncated_cube_graph()),
  ("truncated_tetrahedron", nx.truncated_tetrahedron_graph()),
]

plot_multigraph(graphs, 4, 5, node_size=50)
plt.savefig('graphs/small.png')

开发者ID:FangMath,项目名称:networkx-examples,代码行数:29,代码来源:small_graphs.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python networkx.laplacian_matrix函数代码示例发布时间:2022-05-27
下一篇:
Python networkx.katz_centrality_numpy函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap