<｜begin▁of▁sentence｜>### Instruction:
As an animator, imagine you're working on a futuristic cyber-themed animation, where a visual representation of a network is a crucial element. The network is creatively designed with nodes symbolizing data points, each adorned with a unique 'label' indicative of its identity within the virtual universe. The pulsating connections between these nodes are the edges, also uniquely distinguished by their own 'labels', representing the data streams or pathways.

Now, your task is to bring this digital network to life by translating it into an interactive format that can be seamlessly integrated with your animation software. For this purpose, you're looking to convert this intricate network architecture, which currently exists as an abstract graph structure, into a more tangible JSON object.

This JSON object requires a meticulous composition—a list each for nodes and edges—meticulously preserving the 'label' attribute innate to both the nodes and the edges from the graph. Could you transform your stylized network, ensuring the essence and attributes are captured authentically in this new JSON structure? Suppose the network's raw form resides within a 'cyberspace_network.gml' file, from which you need to extract and encapsulate the data, setting the stage for a grand visual symphony.
### Response:
import networkx as nx

# Create a graph
G = nx.Graph()

# Add nodes with attributes
G.add_node(1, label='Node A')
G.add_node(2, label='Node B')

# Add an edge with attributes
G.add_edge(1, 2, label='Edge A-B')

# Use the to_edgelist function to get a list of edges
edgelist = nx.to_edgelist(G)

# Convert the edgelist to a JSON-compatible format
edges_json = [
    {'source': src, 'target': tgt, 'label': data['label']}
    for src, tgt, data in edgelist
]

# Convert the graph nodes to a JSON-compatible format
nodes_json = [
    {'id': node, 'label': G.nodes[node]['label']}
    for node in G.nodes()
]

# Combine nodes and edges into a single JSON object
graph_json = {
    'graph nodes': nodes_json,
    'graph edges': edges_json
}

print(graph_json)
<|EOT|>
