Skip to content

pedugnat/dynnode2vec

Repository files navigation

dynnode2vec

Python Version Dependencies Status

Code style: black License Coverage Report

dynnode2vec is a package to embed dynamic graphs.

It is the python implementation of S. Mahdavi, S. Khoshraftar, A. An: dynnode2vec: Scalable Dynamic Network Embedding. IEEE BigData 2018

Installation

pip install -U dynnode2vec

Usage

import pickle

from dynnode2vec.dynnode2vec import DynNode2Vec
from dynnode2vec.utils import create_dynamic_graph

# Create random graphs
graphs = create_dynamic_graph(
  n_base_nodes=100, n_steps=50, base_density=0.05
)

# Instantiate dynnode2vec object
dynnode2vec = DynNode2Vec(
    p=1., 
    q=1., 
    walk_length=10, 
    n_walks_per_node=20, 
    embedding_size=64
)

# Embed the dynamic graphs
embeddings = dynnode2vec.compute_embeddings(graphs)

# Save embeddings to disk
with open('example_embeddings.pkl', 'wb') as f:
    pickle.dump(embeddings, f)

Parameters

  • DynNode2Vec class:

    • p: Return hyper parameter (default: 1)
    • q: Inout parameter (default: 1)
    • walk_length: Number of nodes in each walk (default: 80)
    • n_walks_per_node: Number of walks per node (default: 10)
    • embedding_size: Embedding dimensions (default: 128)
    • seed: Number of workers for parallel execution (default: 1)
    • parallel_processes: Number of workers for parallel execution (default: 1)
    • use_delta_nodes: Number of workers for parallel execution (default: 1)
  • DynNode2Vec.fit method:

    • graphs: list of nx.Graph (ordered by time)

TO DO

  • remove pandas use in embeddings formatting
  • code examples of synthetic and real-life uses
  • get rid of Stellar Graph dependency

Releases

You can see the list of available releases on the GitHub Releases page.

License

This project is licensed under the terms of the MIT license. See LICENSE for more details.

Citation

@misc{dynnode2vec,
  author = {Paul-Emile Dugnat},
  title = {dynnode2vec, a package to embed dynamic graphs},
  year = {2022},
  publisher = {GitHub},
  journal = {GitHub repository},
  howpublished = {\url{https://github.com/pedugnat/dynnode2vec}}
}

This project was generated with python-package-template