<｜begin▁of▁sentence｜>### Instruction:
Given a parameter set l=4 (number of groups), k=3 (number of vertices in each group), p_in=0.5 (probability of linking vertices within the same group), and p_out=0.1 (probability of linking vertices from different groups), can you generate a JSON object that contains the nodes and edges of the planted l-partition bipartite graph created with these parameters? Each node should be labeled with its group id, and each edge should be labeled as 'IN' if it connects nodes from the same group, or 'OUT' if it connects nodes from different groups.
### Response:
import networkx as nx

# Parameters for the planted l-partition graph
l = 4  # number of groups
k = 3  # number of vertices in each group
p_in = 0.5  # probability of linking two vertices within the same group
p_out = 0.1  # probability of linking two vertices from different groups
seed = 42  # seed for random number generator

# Create the planted l-partition graph
G = nx.planted_partition_graph(l, k, p_in, p_out, seed=seed, directed=False)

# Iterate over the nodes and edges to build the JSON object
data = {'graph_nodes': [], 'graph_edges': []}

for node in G.nodes(data=True):
    node_id = node[0]
    node_label = 'Group ' + str(node[1]['block'])
    data['graph_nodes'].append({'id': node_id, 'label': node_label})

for edge in G.edges(data=True):
    source, target = edge[0], edge[1]
    edge_label = 'IN' if node[1]['block'] == node[0]['block'] else 'OUT'
    data['graph_edges'].append({'source': source, 'target': target, 'label': edge_label})

print(data)
<|EOT|>
