<｜begin▁of▁sentence｜>### Instruction:
A researcher has collected data from two different social networks in order to compare their structures. Specifically, the researcher is interested in whether the global connection probabilities, that is, the network densities, are statistically significantly different between the two networks. Using an Erdos-Renyi model assumption, how can the researcher test whether there is a significant difference in the densities of these two networks using python?
### Response:
import numpy as np
from graspologic.inference import density_test

# Generate two random adjacency matrices
np.random.seed(42)
A1 = np.random.binomial(1, 0.5, size=(5, 5))
A2 = np.random.binomial(1, 0.4, size=(5, 5))

# Perform the density test between the two networks
result = density_test(A1, A2, method='fisher')

# Print the results
print(f'Statistic: {result.stat}')
print(f'p-value: {result.pvalue}')
<|EOT|>
