fastnode2vec
Really fast implementation of node2vec based on numba and gensim. Memory usage is linear and scales with your data unlike most other implementations. The algorithm is described in this blog post.
API
Node2Vec inherits from gensim's Word2Vec, all its APi is valid.
from fastnode2vec import Graph, Node2Vec
graph = Graph([("a", "b"), ("b", "c"), ("c", "a"), ("a", "d")],
directed=False, weighted=False)
# or
graph = Graph([("a", "b", 1), ("b", "c", 2), ("c", "a", 3), ("a", "d", 4)],
directed=False, weighted=True)
n2v = Node2Vec(graph, dim=10, walk_length=100, context=10, p=2.0, q=0.5, workers=2)
n2v.train(epochs=100)
print(n2v.wv["a"])
CLI
Usage: fastnode2vec [OPTIONS] FILENAME
Options:
--directed
--weighted
--dim INTEGER [required]
--p FLOAT
--q FLOAT
--walk-length INTEGER [required]
--context INTEGER
--epochs INTEGER [required]
--workers INTEGER
--batch-walks INTEGER
--debug PATH
--output PATH
--help Show this message and exit.
Compute embeddings of the Gnutella peer-to-peer network:
wget https://snap.stanford.edu/data/p2p-Gnutella08.txt.gz
fastnode2vec p2p-Gnutella08.txt.gz --dim 16 --walk-length 100 --epochs 10 --workers 2
Load embeddings produced by the CLI
Just use the Word2Vec API.
from gensim.models import KeyedVectors
wv = KeyedVectors.load("p2p-Gnutella08.txt.gz.wv", mmap='r')
Citing
If you have used this software in a scientific publication, please cite it using the following BibLaTeX code:
@software{fastnode2vec,
author = {Louis Abraham},
title = {fastnode2vec},
year = 2020,
publisher = {Zenodo},
doi = {10.5281/zenodo.3902632},
url = {https://github.com/louisabraham/fastnode2vec}
}
Metadata
Release files for fastnode2vec 0.0.7
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| fastnode2vec-0.0.7.tar.gz | 8.9 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| fastnode2vec-0.0.7-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 18.3 kB
Release files / fastnode2vec-0.0.7.tar.gz
| Download URL | fastnode2vec-0.0.7.tar.gz |
|---|---|
| Size | 8.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d34deb7a54cd7e654f04f318826b84fad6f982be2965d2adb19cd3230aa9e2b0
|
|
BLAKE2b-256 checksum How to use checksums |
f4e8c508246e1982355366d2d321627ad3b4b8861cb249c99fd1b4b4f48f9d2b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.8.8
|
Release files / fastnode2vec-0.0.7-py3-none-any.whl
| Download URL | fastnode2vec-0.0.7-py3-none-any.whl |
|---|---|
| Size | 9.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
01a53d87b2515c89459f783cbb949ac9f7a58d85f065d6825556d2b4e1127439
|
|
BLAKE2b-256 checksum How to use checksums |
059734e0970b7279064cfc18c38cc1ebfac05767699e2f5e8b1e62f65d29d990
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.8.8
|
Security for fastnode2vec 0.0.7
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.