To change the color of a node in a NetworkX graph, you can use the nx.draw() function and set the node_color parameter to the color you want. For example:
G = nx.Graph()
G.add_node(1, color='red')
nx.draw(G, node_color=G.nodes[1]['color'])
plt.show()
This code creates a graph with a single node and sets its color to red.
When the graph is drawn using nx.draw(), the node_color parameter is set to the value of the 'color' attribute of the node, which causes the node to be drawn in red.
Alternatively, you can use the `node_color` parameter to set the color of all nodes in the graph to the same color. For example:
nx.draw(G, node_color='blue')
This code will draw all nodes in the graph in blue, regardless of their individual 'color' attributes.