import matplotlib.pyplot as plt
import networkx as nx
G = nx.grid_2d_graph(5, 5)
pos = nx.spring_layout(G, k=0.3)
node_colors = ['#1f78b4' if v[0] % 2 == 0 else '#33a02c' for v in G.nodes]
nx.draw(G, pos, node_color=node_colors)
plt.show()
Created
May 24, 2020 15:19
-
-
Save mzsima/8ff0467f0b0f3d2e8a31b3d63fce4ee8 to your computer and use it in GitHub Desktop.
[networkX]グリッドeven/odd
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment