<｜begin▁of▁sentence｜>### Instruction:
Given 100 nodes with 2 communities, can you create a synthetic network using the Mixed Membership Stochastic Block Model, where the community interconnectivity probabilities are 0.5 within each community and 0.1 between different communities, and each node's community memberships are drawn from a Dirichlet distribution parameterized by alpha = [0.2, 0.2]? After generating the adjacency matrix and community labels, visualize the graph using NetworkX.
### Response:
import numpy as np
from graspologic.simulations import mmsbm

# Specify the number of vertices and communities
n = 100
n_communities = 2

# Define the probability of an edge between each of the communities
p = np.array([[0.5, 0.1], [0.1, 0.5]])

# Define the parameter alpha of the Dirichlet distribution
alpha = np.array([0.2, 0.2])

# Set a random number generator for reproducibility
rng = np.random.default_rng(42)

# Sample a graph from the Mixed Membership Stochastic Block Model
adjacency_matrix, labels = mmsbm(n, p, alpha, rng=rng, return_labels=True)

# Use NetworkX to create the graph
import networkx as nx
G = nx.from_numpy_array(adjacency_matrix)

# Visualize the graph
import matplotlib.pyplot as plt
nx.draw(G)
plt.show()
<|EOT|>
