Dimensionality reduction transforms high-dimensional data into fewer numerical dimensions while preserving selected information or structure. It makes graph embeddings easier to visualize and can expose clusters or patterns useful for clustering and classification. section 2.1 section 5.1.2
A practical graph-embedding workflow is:
- Generate node embeddings with Node2Vec, using random walks to summarize local neighborhoods as vectors. section 2.1
- Collect the embedding vectors into a NumPy array suitable for transformation. section 2.1.3
- Use UMAP with two components to project the vectors into a two-dimensional visualization. section 2.1.3
- Compare the result with embeddings generated directly at two dimensions when the task permits a less expressive representation. section 2.1.3
Dimensionality reduction also appears inside generative models. Autoencoders compress high-dimensional data into a low-dimensional latent space and decode it again; variational autoencoders add a regularizing term that produces a more structured, continuous space. Graph autoencoders and variational graph autoencoders apply the same pattern to graphs and support edge prediction. section 5.6
Political Books graph
Node2Vec embeddings of the Political Books dataset are projected with UMAP and colored by political alignment. The two-dimensional plot reveals clusters corresponding to liberal, conservative, and neutral books. Direct two-dimensional Node2Vec produces similar separation but bunches the books more tightly, showing that the useful representation depends on the task. section 2.1 section 2.1.3
Listing 2.2 Visualizing the embeddings using UMAP
node_embeddings = [embeddings[str(node)] \ for node in gml_graph.nodes()] #1 node_embeddings_array = np.array(node_embeddings) umap_model = umap.UMAP(n_neighbors=15, min_dist=0.1, n_components=2, \ random_state=42) umap_features = umap_model.fit_transform\ (node_embeddings_array) #2 plt.scatter(umap_features[:, 0], \ umap_features[:, 1], color=node_colors, alpha=0.7) #3
Run the UMAP projection and scatterplot workflow for converting Node2Vec vectors into a two-dimensional graph visualization. section 2.1.3










