<｜begin▁of▁sentence｜>### Instruction:
Suppose you are analyzing the social interactions within a karate club. You want to visualize the relationships by embedding the graph of interactions into a 2-dimensional space while preserving the graph structure as much as possible. How would you use the AdjacencySpectralEmbed from graspologic to achieve this on a network graph created with networkx?
### Response:
import networkx as nx
from graspologic.embed import AdjacencySpectralEmbed

# Generate a graph using networkx
G = nx.karate_club_graph()

# Create an instance of AdjacencySpectralEmbed
ase = AdjacencySpectralEmbed(n_components=2)

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

# Display the shape of the embedded graph
print(embedded_graph.shape)

# Print latent positions for visualization
for idx, position in enumerate(embedded_graph):
    print(f'Node {idx}: {position}')
<|EOT|>
