我不确定这是否就是你所说的动态,但也许是这样的?
import networkx as nx
import numpy as np
import matplotlib.pylab as plt
import hvplot.networkx as hvnx
import holoviews as hv
from bokeh.models import HoverTool
hv.extension('bokeh')
A = np.matrix([[0,1,1,0,0],[1,0,1,0,0],[1,1,0,1,1],[0,0,1,0,1],[0,0,1,1,0]])
G = nx.from_numpy_matrix(A)
pos = nx.spring_layout(G)
nx.draw_networkx(G, pos, node_color='lightgray')
plt.show()
hvnx.draw(G, pos, node_color='lightgray').opts(tools=[HoverTool(tooltips=[('index', '@index_hover')])])
Normal static graph
Dynamic graph you can interact with