notebook_syntax_net_graph.py 文件源码

python
阅读 22 收藏 0 点赞 0 评论 0

项目:storygraph 作者: hurrycane 项目源码 文件源码
def draw_graph(edges):
    G = nx.DiGraph()
    G.add_edges_from(edges)

    values = [1.0 for node in G.nodes()]

    # Specify the edges you want here
    edge_colours = ['black' for edge in G.edges()]
    black_edges = [edge for edge in G.edges()]

    # Need to create a layout when doing
    # separate calls to draw nodes and edges
    pos = nx.spring_layout(G)
    nx.draw_networkx_nodes(G, pos, cmap=plt.get_cmap('Reds'), node_color = values, node_size=4800)
    nx.draw_networkx_edges(G, pos, edgelist=black_edges, arrows=True)
    nx.draw_networkx_labels(G,pos,font_size=12,font_family='sans-serif')

    plt.axis('off')
    plt.show()


# In[183]:
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号