Draw a graph with edges using Networkx

空扰寡人 提交于 2019-12-06 09:56:27

Here is a solution that works.

import matplotlib.pyplot as plt
import networkx as nx

# Create a basic Graph
g=nx.Graph()
g.add_node(1)
g.add_node(2)
g.add_edge(1,2)

# Output the result
nx.draw(g)
plt.show()
import networkx as nx
g=nx.Graph()
g.add_node(1)
g.add_node(2)
g.add_edge(1,2)
nx.draw(g)
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!