Answers.Body: <blockquote>
  <p>My question is if GraphSAGE is suitable for this kind of data?</p>
  </blockquote>
  <p>To my knowledge, GraphSAGE is designed for very large graphs with highly connected nodes (like social networks). The neighborhood sampling mitigates oversmoothing problems that occur when aggregating large neighborhoods. I guess that other architectures are better suited, but it's always worth trying it out with your dataset.</p>
  <blockquote>
  <p>Can it be used to learn node representation and be used for downstream tasks like node/graph/link classification?</p>
  </blockquote>
  <p>Yes, GraphSAGE produces node embeddings for every node that can be used for a classification or a regression task.</p>
  <blockquote>
  <p>However, this sampler intakes only one Graph as input (big Cora graph). I am confused about how to use a dataset with multiple graphs here.</p>
  </blockquote>
  <p>Most graph libraries work like that. The models/functions only accept a single graph, if you want to input multiple graphs at once, you can take a look at graph batching. How it works is that you combine your <span class="math-container">$n$</span> separate graphs into a single large graph (with disjoint subgraphs) because GNNs work on neighborhoods the individual graphs will not affect each other. <a href="https://colab.research.google.com/drive/1I8a0DfQ3fI7Njc62__mVXUlcAleUclnb?usp=sharing#scrollTo=2owRWKcuoALo" rel="nofollow noreferrer">Here</a> this principle is described.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-06-24T12:31:06.197Z
Answers.LastActivityDate: 2022-06-24T12:31:06.197Z
Answers.UserDisplayName: Chillston
Body: <p>I checked out applications of GraphSAGE and it seems like its primarily used for single graph datasets. For example - Cora dataset - Its one big graph with 2708 nodes and 5429 edges. The model can learn the node representation of this big graph and it can be later used for downstream tasks like node classification, link prediction.</p>
  <p>I have a dataset with hundreds of graphs that are relatively small (about 15 nodes and 20 edges on avg per graph). Each graph represents a separate datapoint i.e, there is no relation between these graphs. It is similar to datasets like MUTAG, PROTEIN datasets . My question is if GraphSAGE is suitable for this kind of data ? Can it be used to learn node representation and be used for downstream tasks like node/graph/link classification?</p>
  <p>I am following this stellargraph example - <a href="https://stellargraph.readthedocs.io/en/stable/demos/embeddings/graphsage-unsupervised-sampler-embeddings.html" rel="nofollow noreferrer">stellargraph_graphsage</a>
  It uses a sampler to perform random walks and solve a classification task. However, this sampler intakes only one Graph as input (big Cora graph). I am confused about how to use a dataset with multiple graphs here.</p>
  <pre><code>unsupervised_samples = UnsupervisedSampler(
      G, nodes=nodes, length=length, number_of_walks=number_of_walks
  )
  </code></pre>
  
Tags: <machine-learning><deep-learning><convolutional-neural-networks><graph-neural-networks>
Title: Using GraphSAGE model for multigraph datasets
UserDisplayName: Prince Bhatti
ThreadText: # Using GraphSAGE model for multigraph datasets
  
  (Asked by: username_0 on 2022-06-24)
  
  I checked out applications of GraphSAGE and it seems like its primarily used for single graph datasets. For example - Cora dataset - Its one big graph with 2708 nodes and 5429 edges. The model can learn the node representation of this big graph and it can be later used for downstream tasks like node classification, link prediction.
  
  I have a dataset with hundreds of graphs that are relatively small (about 15 nodes and 20 edges on avg per graph). Each graph represents a separate datapoint i.e, there is no relation between these graphs. It is similar to datasets like MUTAG, PROTEIN datasets . My question is if GraphSAGE is suitable for this kind of data ? Can it be used to learn node representation and be used for downstream tasks like node/graph/link classification?
  
  I am following this stellargraph example - [stellargraph\_graphsage](https://stellargraph.readthedocs.io/en/stable/demos/embeddings/graphsage-unsupervised-sampler-embeddings.html)
  It uses a sampler to perform random walks and solve a classification task. However, this sampler intakes only one Graph as input (big Cora graph). I am confused about how to use a dataset with multiple graphs here.
  
  ```
  unsupervised_samples = UnsupervisedSampler(
      G, nodes=nodes, length=length, number_of_walks=number_of_walks
  )
  
  ```
  
  **Tags:** machine-learning, deep-learning, convolutional-neural-networks, graph-neural-networks
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2022-06-24. Score: 3 | Accepted answer
  
  > My question is if GraphSAGE is suitable for this kind of data?
  
  To my knowledge, GraphSAGE is designed for very large graphs with highly connected nodes (like social networks). The neighborhood sampling mitigates oversmoothing problems that occur when aggregating large neighborhoods. I guess that other architectures are better suited, but it's always worth trying it out with your dataset.
  
  > Can it be used to learn node representation and be used for downstream tasks like node/graph/link classification?
  
  Yes, GraphSAGE produces node embeddings for every node that can be used for a classification or a regression task.
  
  > However, this sampler intakes only one Graph as input (big Cora graph). I am confused about how to use a dataset with multiple graphs here.
  
  Most graph libraries work like that. The models/functions only accept a single graph, if you want to input multiple graphs at once, you can take a look at graph batching. How it works is that you combine your $n$ separate graphs into a single large graph (with disjoint subgraphs) because GNNs work on neighborhoods the individual graphs will not affect each other. [Here](https://colab.research.google.com/drive/1I8a0DfQ3fI7Njc62__mVXUlcAleUclnb?usp=sharing#scrollTo=2owRWKcuoALo) this principle is described.
  
  
  ---
  
  