<｜begin▁of▁sentence｜>### Instruction:
Given the requirement to generate 2 random forests, each with 10 nodes and no more than 3 nodes per tree, how can you use NetworkX to create these forests and identify their roots?
### Response:
import networkx as nx

# Use the random_unlabeled_rooted_forest function
# Specify number of nodes (n), maximum nodes per tree (q), number of forests (optional), and seed (optional)
n = 10
q = 3
number_of_forests = 2
seed = 42

# Generate random forests
forests = nx.random_unlabeled_rooted_forest(n, q, number_of_forests, seed)

# Print the generated forests and their roots
for idx, forest in enumerate(forests):
    roots = forest.graph['roots']
    print(f'Forest {idx} has roots: {roots}')
    print(forest.edges())
<|EOT|>
