Answers.Body: <p>I suggest you look into <a href="https://en.wikipedia.org/wiki/Link_prediction" rel="nofollow noreferrer">link prediction</a>. I have had good luck with the <a href="https://www.stellargraph.io/" rel="nofollow noreferrer">StellarGraph</a> library. They have <a href="https://stellargraph.readthedocs.io/en/stable/demos/" rel="nofollow noreferrer">several algorithms implemented</a>, including <a href="https://stellargraph.readthedocs.io/en/stable/demos/link-prediction/gcn-link-prediction.html" rel="nofollow noreferrer">GCN</a>.</p>
  <p>Link prediction is a binary classification problem. Given two nodes, <span class="math-container">$v_i$</span> and <span class="math-container">$v_j$</span>, does there exist a link between them? Using a library like StellarGraph will also produce node embeddings while performing link prediction.</p>
  <p>For you scenario I'm picturing a three step process:</p>
  <ol>
  <li>Link prediction and node embeddings on <span class="math-container">$G$</span>.</li>
  <li>Link prediction and node embeddings on <span class="math-container">$G'$</span>.</li>
  <li>Link prediction reusing existing embeddings where each link is between the two graphs. So each link is a tuple of the form: <span class="math-container">$(v_i, v_j')$</span> where <span class="math-container">$v_i \in V$</span> and <span class="math-container">$v_j' \in V'$</span>. If there were no links predicted from <span class="math-container">$v_i$</span> to <span class="math-container">$v_j'$</span> then that might suggest to remove <span class="math-container">$v_j'$</span>.</li>
  </ol>
  <p>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.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-02-12T15:42:12.490Z
Answers.Text: 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`.
Answers.UserDisplayName: shunyo
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-02-12T02:24:17.057Z
Answers.LastActivityDate: 2021-02-12T22:14:37.040Z
Answers.LastEditDate: 2021-02-12T22:14:37.040Z
Answers.UserDisplayName: CorruptedHeapScapeGoat
Body: <p>I am new to graph neural networks and their applications. I have an input graph <span class="math-container">$G = \{V, E\}$</span> and an output graph <span class="math-container">$G' = \{V', E'\}$</span> where the number of nodes <span class="math-container">$V$</span> and <span class="math-container">$V'$</span> are different. I am trying to learn the function where <span class="math-container">$f(G) = G'$</span> and <span class="math-container">$V &gt; V'$</span>, thus, the function is mapping many-to-one (<span class="math-container">$n$</span> 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?</p>
  
Tags: <neural-networks><reference-request><graph-neural-networks><model-request><algorithm-request>
Title: Is there a graph neural network algorithm that can deal with a different number of input and output nodes?
UserDisplayName: shunyo
ThreadText: # Is there a graph neural network algorithm that can deal with a different number of input and output nodes?
  
  (Asked by: username_0 on 2021-02-11)
  
  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?
  
  **Tags:** neural-networks, reference-request, graph-neural-networks, model-request, algorithm-request
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2021-02-12. Score: 1 | Accepted answer
  
  I suggest you look into [link prediction](https://en.wikipedia.org/wiki/Link_prediction). I have had good luck with the [StellarGraph](https://www.stellargraph.io/) library. They have [several algorithms implemented](https://stellargraph.readthedocs.io/en/stable/demos/), including [GCN](https://stellargraph.readthedocs.io/en/stable/demos/link-prediction/gcn-link-prediction.html).
  
  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.
  
  > **Comments:**
  > **username_0**: 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`.  
  
  ---
  
  