graphdeeplearning / graphtransformer

Graph Transformer Architecture. Source code for "A Generalization of Transformer Networks to Graphs", DLG-AAAI'21.
https://arxiv.org/abs/2012.09699
MIT License
872 stars 134 forks source link

pos_enc_dim value #13

Closed aristo-panhu closed 3 years ago

aristo-panhu commented 3 years ago

For graphs with large difference in the number of vertices, how to determine the value of pos_enc_dim? For example, the number of vertices of a graph is 7, and the number of vertices of another graph is 3? Do you take the pos_enc_dim is 8 because the number of vertices in your experimental data set is greater than 8?

vijaydwivedi75 commented 3 years ago

Hi @aristo-panhu, For the pos_enc_dim, since the first few non-trivial eigenvectors are enough to contain the most useful information about the graph structure, a small number of pos_enc_dim (like the ones we use) should be sufficient. However, if you have situations where some number of graphs are smaller even than the pos_enc_dim, you can either zero-pad for those few graphs, or use pos_enc_dim for the smallest graph, or filter out the small graphs if they are quite less in number. In our case, we use pos_enc_dim 8 (eg. for ZINC) as we did not have to filter out any graphs and 8 is a impressively good for the number of eigenvectors to take, even for other larger sized graphs in ZINC. You may also refer to follow-up works like https://arxiv.org/pdf/2010.02863.pdf, https://arxiv.org/pdf/2106.03893.pdf, etc.

aristo-panhu commented 3 years ago

thanks