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

Python networkx.davis_southern_women_graph函数代码示例

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

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



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

示例1: setUp

 def setUp(self):
     self.P4 = nx.path_graph(4)
     self.K3 = nx.complete_bipartite_graph(3,3)
     self.C4 = nx.cycle_graph(4)
     self.davis = nx.davis_southern_women_graph()
     self.top_nodes = [n for n,d in self.davis.nodes(data=True) 
                       if d['bipartite']==0]
开发者ID:123jefferson,项目名称:MiniBloq-Sparki,代码行数:7,代码来源:test_centrality.py


示例2: test_davis_southern_women_graph

 def test_davis_southern_women_graph(self):
     G = nx.davis_southern_women_graph()
     nx.set_edge_attributes(G, 1, 'capacity')
     for flow_func in flow_funcs:
         T = nx.gomory_hu_tree(G, flow_func=flow_func)
         assert_true(nx.is_tree(T))
         for u, v in combinations(G, 2):
             cut_value, edge = self.minimum_edge_weight(T, u, v)
             assert_equal(nx.minimum_cut_value(G, u, v),
                          cut_value)
开发者ID:aparamon,项目名称:networkx,代码行数:10,代码来源:test_gomory_hu.py


示例3: setUp

 def setUp(self):
     self.Gnp = nx.gnp_random_graph(20, 0.8)
     self.Anp = _AntiGraph(nx.complement(self.Gnp))
     self.Gd = nx.davis_southern_women_graph()
     self.Ad = _AntiGraph(nx.complement(self.Gd))
     self.Gk = nx.karate_club_graph()
     self.Ak = _AntiGraph(nx.complement(self.Gk))
     self.GA = [(self.Gnp, self.Anp),
                (self.Gd, self.Ad),
                (self.Gk, self.Ak)]
开发者ID:yamaguchiyuto,项目名称:networkx,代码行数:10,代码来源:test_kcomponents.py


示例4: GraphType

def GraphType(num_nodes, str, p=0.05, m=3):
    """
    :param num_nodes: the number of nodes of the graph (if that option is available)
    :param str: the type of graph that is used. We have
                'erdos'         an erdos renyi graph
                'powerlaw'      a graph with powerlaw degree distribution
                'enron'         a social network graph loaded from
                                http://snap.stanford.edu/data/email-Enron.html. (36692 nodes)
                'karateclub'    some karate club graph
                'women'         women social network
    :return: the graph
    """
    if str == 'erdos':
        graph = nx.erdos_renyi_graph(num_nodes, p)
    elif str == 'powerlaw':
        graph = nx.powerlaw_cluster_graph(num_nodes, m, p)
    elif str == 'enron':
        graph = nx.Graph()
        edges = np.loadtxt('Enron.txt',skiprows=4)
        graph.add_edges_from(edges)
    elif str == 'karateclub':
        graph = nx.karate_club_graph()
    elif str == 'women':
        graph = nx.davis_southern_women_graph()
    elif str == 'pair':
        graph = nx.DiGraph()
        graph.add_edge(0,1)
        graph.add_edge(1,0)
    elif str == 'star':
        graph = nx.star_graph(num_nodes)
    elif str == 'cycle':
        graph = nx.cycle_graph(num_nodes)
    elif str == 'config':
        max_degree = int(num_nodes/5)
        #Create some degrees
        degrees = np.asarray(np.round(np.exp(np.log(max_degree) * np.random.uniform(size=num_nodes))), np.int)
        #Ensure the total number of degrees is even
        if sum(degrees) % 2 != 0:
            degrees[np.random.randint(num_nodes)] += 2 * np.random.randint(2) - 1
        #Create a graph and apply the configuration model
        graph = nx.Graph()
        graph = nx.configuration_model(degrees, graph)
        graph = graph.to_directed()

    return graph
开发者ID:tillahoffmann,项目名称:opinion_dynamics,代码行数:45,代码来源:helper_functions.py


示例5: test_generalized_similarity

def test_generalized_similarity():
    """
    Calculate the generalized similarities between events and women 
    in the "classical" Southern Women graph.
    """

    graph = nx.davis_southern_women_graph()
    women, events, eps, iters = generalized.generalized_similarity(graph)

    print("Number of iterations:", iters)
    print("Attained precision:", eps)
    print("Event network:", len(events), "nodes")
    print("Least similar events:", 
          sorted(events.edges(data=True), key=lambda x: x[2]['weight'])[0][0:2])
    print("Women network:", len(women), "nodes")
    print("Least similar women:", 
          sorted(women.edges(data=True), key=lambda x: x[2]['weight'])[0][0:2])
    with open("examples/women.graphml","wb") as ofile:
        nx.write_graphml(women, ofile)
    with open("examples/events.graphml","wb") as ofile:
        nx.write_graphml(events, ofile)
开发者ID:dzinoviev,项目名称:generalizedsimilarity,代码行数:21,代码来源:generalized_test.py


示例6: main

def main():
    g = nx.Graph()
    nodes = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10,32]
    edges= [(0, 1), (0, 2), (0, 3), (0, 4), (0, 5), (0, 6), (0, 7), (0, 8), (0, 10), (1, 2), (1, 3), (1, 7),
            (2, 3), (2, 32), (2, 7), (2, 8), (2, 9),(3, 7),(4, 10), (4, 6),(5, 10), (5, 6)]
    g.add_nodes_from(nodes)
    g.add_edges_from(edges)
    source = 0
    
    #the default method delivered from the networkx
    print list(nx.bfs_edges(g,0))
    
    #call to the bfs
    final_edges = bfs(g,source)
    display_graph(final_edges)
    print "bfs done"
    #Call to the pivot random walk
    pivot_random_walk(g,source,20)
    print "pivot random done"
    #Call to the pivot random walk
    g= nx.davis_southern_women_graph()
    weighted_independence(g,25)
    print "completion"
开发者ID:satishkumar-m19,项目名称:SocialNetworkAnalysis,代码行数:23,代码来源:bfs_randomwalkDegree_weightedNodeSampling.py


示例7: test_davis_southern_women_detail_3_and_4

def test_davis_southern_women_detail_3_and_4():
    solution = {
        3: [{
            'Nora Fayette',
            'E10',
            'Myra Liddel',
            'E12',
            'E14',
            'Frances Anderson',
            'Evelyn Jefferson',
            'Ruth DeSand',
            'Helen Lloyd',
            'Eleanor Nye',
            'E9',
            'E8',
            'E5',
            'E4',
            'E7',
            'E6',
            'E1',
            'Verne Sanderson',
            'E3',
            'E2',
            'Theresa Anderson',
            'Pearl Oglethorpe',
            'Katherina Rogers',
            'Brenda Rogers',
            'E13',
            'Charlotte McDowd',
            'Sylvia Avondale',
            'Laura Mandeville',
            },
        ],
        4: [{
            'Nora Fayette',
            'E10',
            'Verne Sanderson',
            'E12',
            'Frances Anderson',
            'Evelyn Jefferson',
            'Ruth DeSand',
            'Helen Lloyd',
            'Eleanor Nye',
            'E9',
            'E8',
            'E5',
            'E4',
            'E7',
            'E6',
            'Myra Liddel',
            'E3',
            'Theresa Anderson',
            'Katherina Rogers',
            'Brenda Rogers',
            'Charlotte McDowd',
            'Sylvia Avondale',
            'Laura Mandeville',
            },
        ],
    }
    G = nx.davis_southern_women_graph()
    result = nx.k_components(G)
    for k, components in result.items():
        if k < 3:
            continue
        assert_true(len(components) == len(solution[k]))
        for component in components:
            assert_true(component in solution[k])
开发者ID:4c656554,项目名称:networkx,代码行数:68,代码来源:test_kcomponents.py


示例8: test_davis_southern_women

def test_davis_southern_women():
    G = nx.davis_southern_women_graph()
    _check_connectivity(G)
开发者ID:4c656554,项目名称:networkx,代码行数:3,代码来源:test_kcomponents.py


示例9: of

        adj_iter : iterator
           An iterator of (node, adjacency set) for all nodes in
           the graph.

        """
        for n in self.adj:
            yield (n, set(self.adj) - set(self.adj[n]) - set([n]))


if __name__ == '__main__':
    # Build several pairs of graphs, a regular graph
    # and the AntiGraph of it's complement, which behaves
    # as if it were the original graph.
    Gnp = nx.gnp_random_graph(20,0.8)
    Anp = AntiGraph(nx.complement(Gnp))
    Gd = nx.davis_southern_women_graph()
    Ad = AntiGraph(nx.complement(Gd))
    Gk = nx.karate_club_graph()
    Ak = AntiGraph(nx.complement(Gk))
    pairs = [(Gnp, Anp), (Gd, Ad), (Gk, Ak)]
    # test connected components
    for G, A in pairs:
        gc = [set(c) for c in nx.connected_components(G)]
        ac = [set(c) for c in nx.connected_components(A)]
        for comp in ac:
            assert comp in gc
    # test biconnected components
    for G, A in pairs:
        gc = [set(c) for c in nx.biconnected_components(G)]
        ac = [set(c) for c in nx.biconnected_components(A)]
        for comp in ac:
开发者ID:rvu95,项目名称:networkx,代码行数:31,代码来源:antigraph.py


示例10: test_is_aperiodic_bipartite

def test_is_aperiodic_bipartite():
    # Bipartite graph
    G = nx.DiGraph(nx.davis_southern_women_graph())
    assert_false(nx.is_aperiodic(G))
开发者ID:aparamon,项目名称:networkx,代码行数:4,代码来源:test_dag.py


示例11: test_biconnected_davis

def test_biconnected_davis():
    D = nx.davis_southern_women_graph()
    bcc = list(biconnected.biconnected_components(D))[0]
    assert_true(set(D) == bcc) # All nodes in a giant bicomponent
    # So no articulation points
    assert_equal(list(biconnected.articulation_points(D)),[])
开发者ID:NikitaVAP,项目名称:pycdb,代码行数:6,代码来源:test_biconnected.py


示例12: test_davis_southern_women

def test_davis_southern_women():
    G = nx.davis_southern_women_graph()
    result = nx.k_components(G)
    _check_connectivity(G, result)
开发者ID:jianantian,项目名称:networkx,代码行数:4,代码来源:test_kcomponents.py


示例13: test_ra_clustering_davis

def test_ra_clustering_davis():
    G = nx.davis_southern_women_graph()
    cc4 = round(bipartite.robins_alexander_clustering(G), 3)
    assert_equal(cc4, 0.468)
开发者ID:ProgVal,项目名称:networkx,代码行数:4,代码来源:test_cluster.py


示例14:

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

graphs = [
  ('karate_club_graph', nx.karate_club_graph()),
  ('davis_southern_women_graph', nx.davis_southern_women_graph()),
  ('florentine_families_graph', nx.florentine_families_graph()),
]

plot_multigraph(graphs, 2, 2, node_size=50)
plt.savefig('graphs/social.png')
开发者ID:FangMath,项目名称:networkx-examples,代码行数:12,代码来源:social_graphs.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Python networkx.degree函数代码示例发布时间:2022-05-27
下一篇:
Python networkx.cycle_graph函数代码示例发布时间: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