Welcome to Graph-Embeddings’s documentation!
This project aims to bring graph embeddings methods for downstream tasks.
Installation:
It’s advised to install graph-embeddings using a virtual env, inside the env use:
pip install graph-embeddings
Get Started Example:
Find the Node2Vec presentation for each node in a set of graphs
import networkx as nx
from graph_embeddings.algorithms import StackedNode2Vec
g1 = nx.DiGraph()
g2 = nx.DiGraph()
g1.add_edges_from([("A", "B"), ("B", "C"), ("C", "B"), ("B", "E")])
g2.add_edges_from([("A", "B"), ("B", "D"), ("D", "C"), ("C", "D")])
graphs = [g1, g2]
embedding_model = StackedNode2Vec()
embedding_model.fit(graphs)
embedding_model.get_embeddings() # ndarray with shape (2, 5, 128) - graphs, nodes, embedding_size
embedding_model.get_dense_embeddings() # ndarray with shape (2, 640) - graphs, nodes*embedding_size