def _render(self, mode = "human", close = False):
if close:
return
import matplotlib.pyplot as plt
if self.tick == 0:
plt.ion()
G = self.G
attrs = nx.get_node_attributes(G, "ndd")
values = ["red" if attrs[v] else "blue" for v in G.nodes()]
plt.clf()
nx.draw(G,
pos = nx.circular_layout(G),
node_color = values)
plt.pause(0.01)
return []
评论列表
文章目录