Our implementation of Signed Whole Graph Embeddings methods.
This set of scripts implements the signed whole graph embedding methods presented in our paper. It can be used to:
- Learn the representations of whole signed graphs.
- Perform classification tasks based on the embeddings extracted from signed methods.
We include a few graphs for each dataset in the data
folder. The full datasets can be downloaded from [anonymity - available later] Place the downloaded graphs directly into the corresponding folder in data
.
This repository is composed of the following elements:
-
Folder
data
: input signed networks. -
Folder
out
: contains the files produced by our scripts. -
requirements.py
: List of Python packages used in SWGE. -
There are 3 main scripts:
SG2V.py
: Performs the representation learning step related to the Signed Graph2Vec methods.run_sgcn.py
: Performs the representation learning step related to the Signed Graph Convolutional Networks methods.evaluation.py
: Performs the classification task.
- Install Python (tested with Python 3.6.9)
- Install dependencies using the following command:
pip install -r requirements.txt
- The SGCN method is based on the code of SGCN.
- Retrieve the data from Zenodo and place them into the
data
folder.
- In order to learn representations with Signed Graph2Vec, run the file
SG2V.py
. You can configure themodel_type
between the 3 versions proposed in our paper:g2v
,sg2vn
orsg2vsb
. - In order to learn representations with SGCN, run the file
run_sgcn.py
.
These scripts will export the learned representations into the out
folder.
-
After running the previous scripts, you can perform the classification by running
evaluation.py
. You can configure thepath_emb
andpath_label
variables to change the dataset used. -
The
main.py
file can be used to run all the experiment with a single script.
- A. Narayanan, M. Chandramohan, R. Venkatesan, L. Chen, Y. Liu, and S. Jaiswal: graph2vec: Learning distributed representations of graphs, MLG, 2017. URL: [http://www.mlgworkshop.org/2017/paper/MLG2017_paper_21.pdf]
- T. Derr, Y. Ma, and J. Tang: Signed graph convolutional network, 18th ICDM, 2018, DOI: 10.1109/ICDM.2018.00113.