<｜begin▁of▁sentence｜>### Instruction:
Imagine we're advising a company that is attempting to optimize its internal network of communication. To help them visualize their current infrastructure, we've decided to model their network as a simplified graph. The graph consists of departments ('Node1', 'Node2', and 'Node3') and the communication channels between them ('Edge1', 'Edge2', and 'Edge3').

To assist the company in understanding their network, we need to create a digital representation of this graph that can be easily shared and analyzed. Could you outline how we might employ NetworkX's 'nodes' functionality to generate a JSON structure depicting the company's network? This structure should incorporate the departments with their respective identifiers and names, as well as the communication channels with their sources, targets, and descriptive labels. Integrating this data into a clear, actionable format will be pivotal for our strategic recommendations on their network optimization.
### Response:
import networkx as nx

# Create a new graph
G = nx.Graph()

# Add nodes to the graph
G.add_node(1, label='Node1')
G.add_node(2, label='Node2')
G.add_node(3, label='Node3')

# Add edges to the graph
G.add_edge(1, 2, label='Edge1')
G.add_edge(2, 3, label='Edge2')
G.add_edge(3, 1, label='Edge3')

# Using the nodes API to get an iterator of the graph nodes
nodes_iterator = G.nodes(data=True)

# Generate JSON object with graph nodes and edges
graph_json = {'graph nodes': [{'id': n, 'label': d['label']} for n, d in nodes_iterator], 'graph edges': [{'source': u, 'target': v, 'label': d['label']} for u, v, d in G.edges(data=True)]}

print(graph_json)
<|EOT|>
