<｜begin▁of▁sentence｜>### Instruction:
Given a directed graph with nodes 'A', 'B', and 'C', edges from 'A' to 'B' with weight 7, 'A' to 'C' with weight 3, and 'B' to 'C' with weight 1, how can you create a read-only view that combines the attributes of the successors and predecessors of node 'A'?
### Response:
import networkx as nx

# Create a DiGraph
dg = nx.DiGraph()
# Add edges with attributes
dg.add_edge('A', 'B', weight=7)
dg.add_edge('A', 'C', weight=3)
dg.add_edge('B', 'C', weight=1)

# Access UnionAtlas view of node 'A' for successors and predecessors
successors = dg.succ['A']  # Outgoing attribute dictionary
dg.add_node('A', attr_dict={'color': 'red'})  # Adding an attribute to 'A'
predecessors = dg.pred['A']  # Incoming attribute dictionary

# UnionAtlas gives a read-only view of the union of successors and predecessors
union_atlas = nx.classes.coreviews.UnionAtlas(successors, predecessors)

# Usage example: Iterate through the UnionAtlas
for node, attr in union_atlas.items():
    print(node, attr)
<|EOT|>
