# Are there any advantages of encoding an image as a graph to use in Graph Convolutional Networks?

I have seen this encoding of an image as a graph:

• The set of the nodes $$V$$ is the set of pixels. If the image is of size $$10\times10$$, then we have $$10\cdot10=100$$ pixels.
• Each node has a length 3 feature vector $$x_i = (r,g,b)$$ which states the Red, Green and Blue intensity for each pixel.
• All nodes are connected. Furthermore, an adjacency matrix $$A$$ contains at the element $$(i,j)$$ the distance between pixel $$i$$ and $$j$$ encoded as a number between zero and one. For instance, $$A_{2,2}=0$$ and $$A_{firstpixel, lastpixel}=1$$

Is this better for any reason, in any context? Maybe using this in GCN makes sense for some applications?

I honestly don't see the point. GCNs are used for either link prediction or node classification. In this case, the nodes have no classification (they're just pixels) and the link is just the distance between the pixels, and there's of course no interest in predicting links here.

Is my intuition wrong?

• How would you want to use an image in a graph neural network? I don't understand if you're asking if it makes sense to pass images to graph neural networks or why do we encode images as graphs to pass to GNNs. The first question makes more sense to me than the latter.
– nbro
Feb 3 at 11:19
• @nbro This is actually done either by treating the image as a regular grid graph, or by subdividing it into super-pixels and treating this as a graph. However, I've seen this mostly in Graph Benchmarking and not really if predictive performance is required. Feb 3 at 13:35
• @Chillston Yes, right. Sorry, the formulation of my first question in the comment above is not correct. My question was more: how do you think you can pass an image to a GNN otherwise? If GNNs process graphs, then images need to be converted to graphs. Anyway, thanks for the comment. I am also aware of this, although it's been a while since I had to do something with GNNs.
– nbro
Feb 3 at 13:51