<｜begin▁of▁sentence｜>### Instruction:
Given a random graph with 15 nodes and 30 edges, plot the distribution of edge weights. If the nodes belong to two different groups ('Group1' and 'Group2'), plot the edge weight distribution for each node category, using the edgeplot function from graspologic. How would you accomplish this, and what would be the resulting visualization?
### Response:
import matplotlib.pyplot as plt
import numpy as np
import networkx as nx
from graspologic.plot import edgeplot

# Generate a random graph
G = nx.gnm_random_graph(n=15, m=30, seed=123)

# Create numpy array from NetworkX graph
X = nx.to_numpy_array(G)

# Optional: Generate node labels to distinguish groups
labels = np.array(['Group1' if i < 7 else 'Group2' for i in range(15)])

# Plot the edge weight distribution
fig, ax = plt.subplots()
edgeplot(X, labels=labels, nonzero=True, title='Edge Weight Distribution', context='talk', font_scale=1.2, figsize=(10, 6), palette='Set1')
plt.show()
<|EOT|>
