# Is there a graph neural network algorithm that can deal with a different number of input and output nodes?

I am new to graph neural networks and their applications. I have an input graph $$G = \{V, E\}$$ and an output graph $$G' = \{V', E'\}$$ where the number of nodes $$V$$ and $$V'$$ are different. I am trying to learn the function where $$f(G) = G'$$ and $$V > V'$$, thus, the function is mapping many-to-one ($$n$$ number of nodes map to one). The Graph Convolution Network (GCN) seems to have the same number of nodes in input and output with the function being learnt. Could I utilize the GCN for my task?

I suggest you look into link prediction. I have had good luck with the StellarGraph library. They have several algorithms implemented, including GCN.

Link prediction is a binary classification problem. Given two nodes, $$v_i$$ and $$v_j$$, does there exist a link between them? Using a library like StellarGraph will also produce node embeddings while performing link prediction.

For you scenario I'm picturing a three step process:

1. Link prediction and node embeddings on $$G$$.
2. Link prediction and node embeddings on $$G'$$.
3. Link prediction reusing existing embeddings where each link is between the two graphs. So each link is a tuple of the form: $$(v_i, v_j')$$ where $$v_i \in V$$ and $$v_j' \in V'$$. If there were no links predicted from $$v_i$$ to $$v_j'$$ then that might suggest to remove $$v_j'$$.

In the link prediction tasks that I've outlined, you can use GCN with StellarGraph. So there should be no problems in terms of the number of nodes.

• Thanks. So in case, where none of the edges exist, the node is removed? Also wouldnt that lead to lot of computation if the V' is much smaller than V. – shunyo Feb 12 at 15:42