Skip to main content

Fast implementation of node2vec

Project description

PyPI version

fastnode2vec

Really fast implementation of node2vec based on numba and gensim.

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)

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
  --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')

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

fastnode2vec-0.0.2.tar.gz (4.5 kB view details)

Uploaded Source

Built Distribution

fastnode2vec-0.0.2-py3-none-any.whl (5.6 kB view details)

Uploaded Python 3

File details

Details for the file fastnode2vec-0.0.2.tar.gz.

File metadata

  • Download URL: fastnode2vec-0.0.2.tar.gz
  • Upload date:
  • Size: 4.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.8.2

File hashes

Hashes for fastnode2vec-0.0.2.tar.gz
Algorithm Hash digest
SHA256 309947a355b7c5ca7aa024e70d820a2a785b6462339bb32e9b1895db61255c8e
MD5 e1b05e4f95d8c0e6903fb26fc3cc1b13
BLAKE2b-256 4ab3a746a2684d20ab2ed9f10d962e404c39466454bb538c2e92916cc643677a

See more details on using hashes here.

File details

Details for the file fastnode2vec-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: fastnode2vec-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 5.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.8.2

File hashes

Hashes for fastnode2vec-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 db3c3fc2f5229c826c776c2125127a680840992a41cbc2e3c774d3324dd36c6d
MD5 837a9f366687a2fdf1ac021833b947da
BLAKE2b-256 56af495566e20d2eb348a891b6fbeb8b8dc7f61a9cff1e72dfef8ff02837623d

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page