<｜begin▁of▁sentence｜>### Instruction:
Ladies and gentlemen, imagine we're setting up a fantasy sports league, consisting of 4 unique teams with each team drafting 3 players. Now, we're trying to establish some riveting rivalries and alliances within our league. To capture the spirit of competition, we've got some statistics in play: there's a 50% chance that players within the same team have played together before (we'll call these 'IN' connections), while there is a 10% chance that players from different teams have crossed paths on the field (and these are the 'OUT' connections).

What I've got here is a request to bring this scenario to life in a digital format. We want to create a visual playbook, essentially a JSON playbook let's call it, highlighting our teams and players, and showing who's likely to have played with whom. This means each player in the playbook needs a label showing which team they belong to, and each match-up, or "play," needs a tag indicating whether it's an 'IN' play within the same team or an 'OUT' play between different teams.

So, we're looking to take this concept from the drawing board to our viewers at home, giving them a clear picture of the team dynamics and potential player interactions in our fantasy league. Can you draft this digital playbook for us to review on our next broadcast?
### 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|>
