import networkx as nx
import matplotlib.pyplot as plt
G = nx.Graph()
G.add_edges_from([('A', 'B'), ('A', 'C'),
('B', 'C'), ('E', 'F'),
('D', 'E'), ('A', 'D'),
('D', 'C'), ('C', 'F'),
('D', 'E')])
ego = 'A'
pos = nx.spring_layout(G)
nx.draw(G, pos, node_color="lavender",
node_size=800, with_labels=True)
options = {"node_size": 1200, "node_color": "r"}
nx.draw_networkx_nodes(G, pos, nodelist=[ego], **options)
plt.show()
'
我想为自我网络创建箭头。I want it like this.This is my current output
我没有尝试任何东西,因为我不知道如何添加箭头。
1条答案
按热度按时间ej83mcc01#
要显示箭头,您可以定义:
arrows=True
和arrowstyle