<｜begin▁of▁sentence｜>### Instruction:
In a study on social networks, researchers have two snapshots of the same social network taken at different times. They are interested in determining whether the underlying social structure (latent positions) of the network has changed over time. The networks are undirected and represented as graphs G1 and G2. How can researchers statistically compare the latent positions of these two graphs?
### Response:
import numpy as np
import networkx as nx
from graspologic.inference import latent_position_test
from graspologic.embed import AdjacencySpectralEmbed

# Generate two random graphs G1 and G2 using NetworkX
G1 = nx.erdos_renyi_graph(n=100, p=0.5)
G2 = nx.erdos_renyi_graph(n=100, p=0.5)

# Convert the graphs to adjacency matrices
A1 = nx.to_numpy_array(G1)
A2 = nx.to_numpy_array(G2)

# Embed the graphs using Adjacency Spectral Embedding
ase = AdjacencySpectralEmbed(n_components=2)
X1 = ase.fit_transform(A1)
X2 = ase.fit_transform(A2)

# Perform the latent position test
result = latent_position_test(A1=A1, A2=A2, embedding='ase', n_components=2, test_case='rotation', n_bootstraps=500, workers=1)

# Print the results
print(f'Statistic: {result.stat}')
print(f'P-value: {result.pvalue}')
if result.pvalue < 0.05:
    print('The latent positions of the two graphs are significantly different.')
else:
    print('The latent positions of the two graphs are not significantly different.')
<|EOT|>
