You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

ReadMe.md 3.8KB

2 years ago
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. MGCN: Semi-supervised Classification in Multi-layer Graphs with Graph Convolutional Networks
  2. ====
  3. Here is the code for node embedding in multi-layer networks with attributes written in Pytorch.
  4. Ghorbani et.al. "MGCN: Semi-supervised Classification in Multi-layer Graphs with Graph Convolutional Networks" [1]
  5. Usage
  6. ------------
  7. The main file is "train.py". It contains the running code for infra dataset with default parameters.
  8. ```python train.py```
  9. Input Data
  10. ------------
  11. You should create a folder in "data" folder, named "dataset_str" in the code. For example if your dataset_str is "infra", you should place files in the path "data/infra/". The folder contains the following information:
  12. 1) The adjacency list of within layer edges for every layer. Node numbering should be started from 0. The name of the files containing the within layer adjacency list should follow the pattern "dataset_name.adj#NumberOfLayer".
  13. For example if your dataset name is "infra" with three layers, you should have "infra.adj0", "infra.adj1" and "infra.adj2" files that every one of them contains adjacency list like follow:
  14. ```
  15. 0 1
  16. 0 2
  17. 0 3
  18. 0 4
  19. ```
  20. 2) The adjacency list of between layer edges for every pair of layers (if available). The name of the files containing the between layer adjacency list should follow the pattern "dataset_name.bet#NumberOfLayer1_#NumberOfLayer2".
  21. For example if your dataset name is "infra" with three layers, you should have "infra.bet0_1", "infra.bet0_2" and "infra.bet1_2" (One file for every pair of layers is enough)
  22. 3) Features and labels of every node in every layer. If features aren't available identity matrix should be used. The name of the files containing the features and labels should follow the pattern "dataset_name.feat#NumberOfLayer"
  23. For example if your dataset name is "infra" with three layers, you should have "infra.feat0", "infra.feat1", "infra.feat2". Every line of file includes the node number, node features, node label. For example for "infra" dataset, if the first layer have 5 node belongs to 2 classes, it should be like follow:
  24. ```
  25. NodeNumber Features Label
  26. 0 1 0 0 0 0 1
  27. 1 0 1 0 0 0 1
  28. 2 0 0 1 0 0 2
  29. 3 0 0 0 1 0 2
  30. 4 0 0 0 0 1 2
  31. ```
  32. Parameters
  33. ------------
  34. Parameters of the code are all in the list format for testing different combination of configs.
  35. Parameters are as follow:
  36. - dataset_str: Dataset name
  37. - adj_weights: It is a list for assigning different weights to input layers. If you leave it empty, all layers will have equal weihts. [[1,1,1]] includes one config with equal weights.
  38. - wlambdas: It is the weight of reconstruction loss.
  39. - hidden_structures: A list contains different structures for hidden spaces in every layer. For example [[[32],[32],[32]]] contains one config for hidden spaces of every layer which in all of them, the dimension of embedding for all layers are 32.
  40. - lrs: A list contains learning rate(s).
  41. - test_sizes: A list contains the test size(s).
  42. Note
  43. ------------
  44. Thanks to Thomas Kipf. The code is written based on the "Graph Convolutional Networks in PyTorch" [2].
  45. Bug Report
  46. ------------
  47. If you find a bug, please send a bug report to [email protected] including if necessary the input file and the parameters that caused the bug.
  48. You can also send me any comment or suggestion about the program.
  49. References
  50. ------------
  51. [1] [Ghorbani et.al., MGCN: Semi-supervised Classification in Multi-layer Graphs with Graph Convolutional Networks, 2019](https://arxiv.org/pdf/1811.08800)
  52. [2] [Kipf & Welling, Semi-Supervised Classification with Graph Convolutional Networks, 2016](https://arxiv.org/abs/1609.02907)
  53. Cite
  54. ------------
  55. Please cite our paper if you use this code in your own work:
  56. ```
  57. @article{ghorbani2018multi,
  58. title={Multi-layered Graph Embedding with Graph Convolution Networks},
  59. author={Ghorbani, Mahsa and Baghshah, Mahdieh Soleymani and Rabiee, Hamid R},
  60. journal={arXiv preprint arXiv:1811.08800},
  61. year={2018}
  62. }
  63. ```