Skip to content

ryandewolfe33/COVE

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Co-Occurance Vetex Embedding (COVE)

This package is provides an implementation of co-occurance vectorization using random walks on graphs, similar to node2vec. In combination with dimension reduction tools (like UMAP) it may give slightly improved results, especially for visualization in 2/3 dimensions.

Getting Started

Currently this package can be installed by cloning the repository and the using pip locally.

git clone https://github.com/ryandewolfe33/COVE.git
cd COVE
pip install .

How it works

from cove import COVE, UMAPLE
import sknetwork as sn
import matplotlib.pyplot as plt

# Get the adjacency matrix of a graph
block_sizes = [100 for _ in range(10)]
adjacency = sn.data.models.block_model(block_sizes, 0.15, 0.025, seed=42)

# Instantiate a COVE vectorizer and fit an embedding.
vectorizer = COVE(window_length=6, walks_per_node =20, walk_length=20)
embedding = vectorizer.fit_transform(adjacency)

# Reduce dimension to 2d for visualization with UMAPLE (UMAP with laplacian eigenvector initialization).
mapper =  UMAPLE(dimension=2, metric="hellinger")
data_map = mapper.fit_transform(embedding, adjacency)

# Plot the clusters (colored by block)
labels = [i for i,block_size in enumerate(block_sizes) for _ in range(block_size)]
plt.scatter(data_map[:, 0], data_map[:, 1], c=labels)

Pre-print

Ryan DeWolfe. Leveraging Non-linear Dimension Reduction and Random Walk Co-occurrence for Node Embedding. arXiv Preprint (2026). https://arxiv.org/abs/2602.24069

About

Co-Occurance Vertex Embedding

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages