<｜begin▁of▁sentence｜>### Instruction:
A network scientist needs to embed an undirected social network graph (for example, the famous Zachary's karate club graph) into a 2-dimensional space to analyze its structure and visualize the clusters within the network. How can they use the Adjacency Spectral Embedding from graspologic to achieve this lower-dimensional representation while preserving the graph's properties?
### Response:
import networkx as nx
from graspologic.embed import AdjacencySpectralEmbed

# Create a graph
G = nx.karate_club_graph()

# Instantiate the embedding object
ase = AdjacencySpectralEmbed(n_components=2)

# Fit the model and transform the graph into a lower-dimensional space
embedding = ase.fit_transform(G)

print('Embedding shape (n_vertices, n_components):', embedding.shape)
print('First few embeddings:\n', embedding[:5])
<|EOT|>
