Мой текущий код:
`< /p>
Код: Выделить всё
import networkx as nx
import matplotlib.pyplot as plt
# Define the graph (nb only need to define the edges; the nodes are to be inferred)
edges=[("$S_{t-2}$", "$S_{t-1}$"),
("$S_{t-1}$", "$S_t$")]
# Construct the graph using networkx
G = nx.DiGraph()
for edge in edges:
G.add_edge(edge[0], edge[1])
# Render the graph with mpl
pos = nx.spring_layout(G)
nx.draw(G, pos, with_labels=True, node_size=3000, node_color="skyblue", font_size=20, font_weight="bold", font_color="black", edge_color="black", linewidths=2, arrowsize=30)
plt.show()
[Мой график]
Но я бы хотел создать интерактивный график (где вы можете перемещать узлы) в увлекательной игровой форме. «пружинная» мода, но с разумными/обычными настройками по умолчанию?
Я пробовал около 0,5 дня — так что буду благодарен за любую помощь!
Подробнее здесь: https://stackoverflow.com/questions/790 ... eractively