This repository builds further on the reference implementation of node2vec as described in the paper:
node2vec: Scalable Feature Learning for Networks.
Aditya Grover and Jure Leskovec.
Knowledge Discovery and Data Mining, 2016.
Name | Github ID |
---|---|
A Sudarshan | ASudu |
Rahul Balike | RahulBalike |
Manpreet Singh Ahluwalia | Manpreet-2002 |
The node2vec algorithm learns continuous representations for nodes in any (un)directed, (un)weighted graph. Please check the project page for more details.
We run on two datasets:
To run node2vec on Zachary's karate club network, execute the following command from the project home directory:
python src/karate_club.py --input graph/karate.edgelist --output emb/karate.emd
To run node2vec on Victor Hugo's novel 'Les Misérables' network (without edge weights), execute the following command from the project home directory:
python src/les_miserables.py --input moreno_lesmis/out.moreno_lesmis_lesmis --output moreno_lesmis/lesmis.emb
To run node2vec on Victor Hugo's novel 'Les Misérables' network (with edge weights), execute the following command from the project home directory:
python src/les_miserables.py --input moreno_lesmis/out1.moreno_lesmis_lesmis --output moreno_lesmis/lesmis1.emb --weighted
You can check out the other options available to use with node2vec using:
python src/main.py --help
The supported input format is an edgelist:
node1_id_int node2_id_int <weight_float, optional>
The graph is assumed to be undirected and unweighted by default. These options can be changed by setting the appropriate flags.
The output file has n+1 lines for a graph with n vertices. The first line has the following format:
num_of_nodes dim_of_representation
The next n lines are as follows:
node_id dim1 dim2 ... dimd
where dim1, ... , dimd is the d-dimensional representation learned by node2vec.
For each network, we first display the input network and then output the final embeddings given by node2vec after applying tSNE.