<｜begin▁of▁sentence｜>### Instruction:
Given a graph whose edge set is [('A', 'B', {'weight': 3, 'color': 'blue'}), ('B', 'C', {'weight': 2, 'color': 'red'})], how can you use NetworkX to write this graph's edgelist to a text file with only the 'color' attribute, and also write the edgelist to a gzipped file without edge data?
### Response:
import networkx as nx

# Create a graph
G = nx.Graph()

# Add weighted edges with attributes
G.add_edge('A', 'B', weight=3, color='blue')
G.add_edge('B', 'C', weight=2, color='red')

# Write the edgelist to a text file with only the 'color' attribute
nx.write_edgelist(G, 'edges.edgelist', data=['color'])

# Write the edgelist to a gzipped file without edge data
nx.write_edgelist(G, 'edges.edgelist.gz', data=False)
<|EOT|>
