<｜begin▁of▁sentence｜>### Instruction:
Researchers are exploring the structure of social networks within a school. The school has two main social groups: Group A and Group B, each consisting of 50 students. The researchers hypothesize that students within the same group interact more frequently than students from different groups. To test this, they aim to model the social interactions as a stochastic block model (SBM) with 100 nodes representing students and different probabilities of interaction within and between the two groups. Can you use `graspologic.simulations.sbm` to simulate such a network and visualize it with networkx?
### Response:
import numpy as np
from graspologic.simulations import sbm
import networkx as nx

# Parameters for SBM
n_communities = [50, 50] # number of nodes in two communities
p_matrix = [[0.1, 0.01], [0.01, 0.1]] # block model probabilities

# Generate a stochastic block model graph
adj_matrix, labels = sbm(n_communities, p_matrix, return_labels=True)

# Convert to a networkx graph
G = nx.from_numpy_array(adj_matrix)

# Plot the networkx graph using spring layout
import matplotlib.pyplot as plt
pos = nx.spring_layout(G)
nx.draw(G, pos, node_color=labels, with_labels=True)
plt.show()
<|EOT|>
