<｜begin▁of▁sentence｜>### Instruction:
Imagine you are charting the complex landscape of interactions within a bustling community of 100 individuals, akin to tracking the intricate communication networks of the human auditory and respiratory systems you so expertly navigate. This network of relationships has spontaneously formed, mirroring the unpredictable nature of the Erdős–Rényi model, with each individual having a 5% probability of forming an acquaintance with another.

In this scenario, we are particularly interested in visualizing the social dynamics of two distinct groups. The community is bifurcated into two subsets; the first 50 individuals represent 'group1', analogous to the way the ear functions as a distinct but interconnected part of the ENT system, while the remaining 50 make up 'group2', perhaps reminiscent of the throat's role.

To glean insights into the social vitality of these sets, we turn to an analogous tool in our field—the 'degreeplot' function from the 'graspologic.plot' API. Just as we might visualize audiograms to understand hearing thresholds across frequencies, 'degreeplot' will serve to illuminate the degree distributions for these two groups within our social network. How would you proceed to deploy this 'degreeplot' function to reveal and compare the pattern of connections that each individual within 'group1' and 'group2' maintains in this elegantly complex web of social bonds?
### Response:
import networkx as nx
from graspologic.plot import degreeplot
import numpy as np
import matplotlib.pyplot as plt

# Create a synthetic graph
G = nx.erdos_renyi_graph(n=100, p=0.05)

# Calculate the degrees of each node
degrees = np.array([d for n, d in G.degree()])

# Optionally, label half the nodes as 'group1' and the other half as 'group2'
labels = np.array(['group1' if i < 50 else 'group2' for i in range(100)])

# Plot the degree distribution of the graph
fig, ax = degreeplot(degrees, labels=labels, direction='out', title='Degree Distribution', context='talk', font_scale=1, figsize=(12, 8), palette='husl')

plt.show()
<|EOT|>
