muhanzhang / DGCNN

Code for "M. Zhang, Z. Cui, M. Neumann, and Y. Chen, An End-to-End Deep Learning Architecture for Graph Classification, AAAI-18".
MIT License
174 stars 44 forks source link

How to deal with different size of graph data? #6

Closed Calemsy closed 5 years ago

Calemsy commented 5 years ago

What i want to know is that the Graph Convolution Layer how to accept different size of graph data as input? For Example, In the data set Mutag, the nodes contains in each graph usually different, the nodes in mutag_1.graph and mutag_2.graph are 23 and 26, respectively, right?. How to deal with this?

Calemsy commented 5 years ago

I think maybe cause the lack of knowledge about the data "Mutag", all the graph in the "Mutag" has 28 nodes(but most of them are subset), so the size of Graph Convolution Layer has fixed. right?

muhanzhang commented 5 years ago

No. GNN naturally accept different-size graphs as input. Since graph convolution is local, it is invariant to graph sizes. The graph aggregation step will summarize the local graph convolution results into a graph-level feature vector.

Calemsy commented 5 years ago

This reply drag me back from the wrong path in time. Thank you.

And another question, hope is the last one, i want to ask for you is that in the part of ERRATA of supplementary material, you claimed "we set the k of SortPooling such that 90% graphs have nodes less than k in order to compensate the loss of node features.", I cannot figure out how to deal with the case when $n < k$ which is most more case under this setting. right?

muhanzhang commented 5 years ago

Hi, when $n<k$, we just append $k-n$ all-zero vectors to the $n$ sorted vectors to pad to length $k$.

Calemsy commented 5 years ago

Hi, when n<k, we just append k−n all-zero vectors to the n sorted vectors to pad to length k.

Thank you!

xp561 commented 1 year ago

but the size of output is different when the size of input is different, how do we use the same linear layer the adapt different size of output of GNN? appreciate a lot if u can help me