<｜begin▁of▁sentence｜>### Instruction:
How can you generate a pair of correlated Erdős-Rényi (ER) graphs using the graspologic library and then convert them into NetworkX graph objects? Assume we want the graphs to have 5 vertices each, with an edge probability of 0.5, and a correlation of 0.3 between the graphs. The graphs should not have self-loops or directed edges.
### Response:
import numpy as np
from graspologic.simulations import er_corr
import networkx as nx

# Set seed for reproducibility
np.random.seed(2)

# Define parameters for the ER graph
def generate_correlated_graphs():
    n = 5  # Number of vertices
    p = 0.5  # Probability of edge existence
    r = 0.3  # Correlation between graphs
    
    # Generate correlated graphs
    G1_adj, G2_adj = er_corr(n, p, r, directed=False, loops=False)
    
    # Convert to NetworkX graphs
    G1 = nx.from_numpy_array(G1_adj)
    G2 = nx.from_numpy_array(G2_adj)
    return G1, G2

G1, G2 = generate_correlated_graphs()

# Print adjacency matrices of the generated graphs
print('Adjacency matrix of G1:\n', nx.adjacency_matrix(G1).todense())
print('\nAdjacency matrix of G2:\n', nx.adjacency_matrix(G2).todense())
<|EOT|>
