Authors: Luca Gallo ([email protected]), Vito Latora, Alfredo Pulvirenti
This directory contains code for the MultiplexSAGE algorithm, a generalization of the GraphSAGE algorithm that allows embedding multiplex networks. For more details on the algorithm, check out our preprint.
The Graphs directory contains some examples analyzed in the paper. We provide three example graphs, one in each subdirectory:
- arxiv: it is a collaboration network where each layer represents a different category of the pre-print archive. Source
- drosophila: it is the protein-genetic interaction network of the common fruit fly Drosophila melanogaster Each layer corresponds to a different type of interaction. Source
- fftwyt: it is a multiplex network obtained from Friendfeed (ff), a social media aggregator, which allows the users to register their accounts on other online social networks. Source
If you make use of this code or the MultiplexSAGE algorithm in your work, please cite the following paper:
@article{gallo2022multiplexsage,
title={MultiplexSAGE: a multiplex embedding algorithm for inter-layer link prediction},
author={Gallo, Luca and Latora, Vito and Pulvirenti, Alfredo},
journal={arXiv preprint arXiv:2206.13223},
year={2022}}
You can run MultiplexSage inside a docker image:
$ docker build -t multiplexsage .
$ docker run -it multiplexsage bash
The example_multiplexsage.sh contains example usages of the model. In this example, the algorithm task is intra-layer and inter-layer link prediction, which is an unsupervised task.
The user must specify a --model flag. Currently, only the mean aggregator is provided, but we plan to extend the code to other aggregating functions.
Two input files have to be provided to the model:
- multi-G.json -- A networkx-specified json file describing the input graph. Edges have an attribute to categorize them as intra-layer and inter-layer, as well as an attribute to define whether they are in the training or in the test set.
- multi-id_map.json -- A dictionary mapping the multiplex ids of the nodes to consecutive integers. Note that same nodes in different layers have different ids.
The flags --n_layers specifies the number of layers in the multiplex network, while --n_try flag can be used to select a specific graph if multiple train-test splits of the same network are considered.
This code is based on a fork of the GraphSAGE code, which is described in this paper.