[英]Networkx : Make a graph more readable
Good afternoon.下午好。
I'm on a shortest path finder with A* project, and for that I took some osm data with osmnx.我正在使用 A* 项目进行最短路径查找,为此我使用 osmnx 获取了一些 osm 数据。 When I want to plot my graph, I don't manage to print something good, even with changing the k parameter of spring_layout.当我想 plot 我的图表时,我无法打印出好的东西,即使更改了 spring_layout 的 k 参数。 Also, I would like to print my nodes labels, and my edges labels without printing the tuple {"weight", label}.另外,我想打印我的节点标签和边缘标签而不打印元组 {“weight”,label}。 I honestly didn't found how to make the whole thing clearer...老实说,我没有找到如何使整个事情更清楚...
Do you have any idea?你有什么主意吗?
if __name__ == '__main__':
Data = open('edgelist_bruxelles.csv', "r")
Graphtype = nx.MultiDiGraph()
G = nx.parse_edgelist(Data, delimiter=',', create_using=Graphtype,
nodetype=int, data=(('weight', float),))
pos = nx.spring_layout(G, 10)
nx.draw_networkx_nodes(G, pos, node_size=50)
nx.draw_networkx_edge_labels(G, pos, font_size=5)
nx.draw_networkx_edges(G, pos, edge_color='r', arrows=True)
mp.show()
What I have now我现在拥有的
Here are some things you could consider:以下是您可以考虑的一些事项:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.