Skip to main content

Method to create representations for nodes in a graph, using Neighbor Based Node Embeddings (NBNE) method.

Project description


Code to use Neighbor Based Node Embeddings (NBNE) method to create representations to nodes in a graph.

### Installation

You can install NBNE directly from PyPI:

`pip install nbne`

Or from source:

git clone
cd nbne
pip install .
#### Dependencies

NBNE has the following requirements:

* [NetworkX](
* [Gensim](

### Usage

#### Basic Usage

The libraries gensim and networkx should be installed. Then run:

$ nbne --input examples/data/watts_strogatz.graph --output examples/data/watts_strogatz.emb

#### Using in other Applications

Import nbne module in your application and train model with:

from nbne import train_model
train_model(graph, num_permutations)

Where graph should be a networkx graph. To save the model in an output file:
Import nbne module in your application and train model with:

from nbne import train_model
import networkx as nx
graph = nx.watts_strogatz_graph(1000, 50, 0.2)
train_model(graph, num_permutations, output_name)

### Input

Input should be a edgelist with format:

node1_id node2_id
node1_id node3_id
node2_id node3_id

### Output

The output is a document with `n+1` lines. The first has format:

num_nodes embeddings_size

And the other:

node_id embedding

Where `embedding` is a space separated vector with dimension `d`, i.e. `d1 d2 d3 ... dn`.

Project details

Release history Release notifications

This version
History Node


Download files

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

Filename, size & hash SHA256 hash help File type Python version Upload date
nbne-0.81-py2.py3-none-any.whl (4.4 kB) Copy SHA256 hash SHA256 Wheel py2.py3
nbne-0.81.tar.gz (3.7 kB) Copy SHA256 hash SHA256 Source None

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page