Method to create representations for nodes in a graph, using Neighbor Based Node Embeddings (NBNE) method.
Project description
# NBNE
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 https://github.com/tiagopms/nbne.git
cd nbne
pip install .
```
#### Dependencies
NBNE has the following requirements:
* [NetworkX](https://networkx.github.io/)
* [Gensim](https://radimrehurek.com/gensim/)
### Usage
#### Basic Usage
The libraries gensim and networkx should be installed. Then run:
```bash
$ 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:
```python
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:
```python
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`.
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 https://github.com/tiagopms/nbne.git
cd nbne
pip install .
```
#### Dependencies
NBNE has the following requirements:
* [NetworkX](https://networkx.github.io/)
* [Gensim](https://radimrehurek.com/gensim/)
### Usage
#### Basic Usage
The libraries gensim and networkx should be installed. Then run:
```bash
$ 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:
```python
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:
```python
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 | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
nbne-0.81.tar.gz
(3.7 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file nbne-0.81.tar.gz.
File metadata
- Download URL: nbne-0.81.tar.gz
- Upload date:
- Size: 3.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
30ee752c814f783b83c25c9dc6a5ebce54dc1d71fcadd37eb7fc7bceca156518
|
|
| MD5 |
c51649372712be56860680e0d4903fe6
|
|
| BLAKE2b-256 |
52bf9065a169c35c8f43635ad593f3e4350fc72fc1699e83dd5c0edef1e59dee
|
File details
Details for the file nbne-0.81-py2.py3-none-any.whl.
File metadata
- Download URL: nbne-0.81-py2.py3-none-any.whl
- Upload date:
- Size: 4.4 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
334a4567a094fc324631ad2a3115291cc0d431076f3106a4df3fcd271aecda2a
|
|
| MD5 |
7e01eba3e7f9a324be22a388bc8fe07c
|
|
| BLAKE2b-256 |
369b7642fd69a39d074157adb47749aac30178c718fb72209e2d15081c394509
|