graph.py 文件源码

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

项目:uai2017_learning_to_acquire_information 作者: evanthebouncy 项目源码 文件源码
def draw_graph(gv, ge, name):
  Gr = nx.Graph()
  for i in range(N):
    Gr.add_node(i, pos=gv[i])

  for i in range(N):
    for j in range(N):
      if ge[i][j]:
        Gr.add_edge(i,j)

  labels = dict()
  for i in range(N):
    labels[i] = str(i)

  pos=nx.get_node_attributes(Gr,'pos')

  nx.draw(Gr, pos=pos, 
      node_size=400, with_labels=False)
  nx.draw_networkx_labels(Gr, pos, labels)

  plt.savefig(name)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号