最佳答案
只需交换你们位置的坐标即可。
import networkx as nx
import matplotlib.pyplot as plt
G = fast_gnp_random_graph(20,0.1)
pos = nx.sprint_layout(G)
nx.draw_networkx(G, pos=pos)
flipped_pos = {node: (x,-y) for (node, (x,y)) in pos.items())
plt.clf()
nx.draw_networkx(G, pos = flipped_pos)
关于python - 网络X : Flip graph,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42322301/