# How can I learn a graph given nodes with features in a supervised fashion?

I have a dataset and want to be able to construct a graph from it in a supervised fashion.

Let's assume I have a dataset with N nodes, each node has e.g. 10 features. Out of these N nodes, I want to learn a graph, i.e. an $$N \times N$$ adjacency matrix. So, I start with $$N$$ nodes and all I know is a 10-dimensional feature vector for each node. I have no knowledge about the relation between these nodes and want to figure it out.

Here is an example for $$N=6$$, but in practice $$N$$ is not fixed.

So the output I would like to get here is a $$6\times6$$ adjacency matrix, representing the relations between the nodes (undirected).

Note: N is arbitrary and not fixed. So an algorithm should be able to perform on any given N.

My dataset is labeled. For the training dataset, I have the desired adjacency matrix for each collection of input nodes, which is filled with $$0$$s and $$1$$s.

However, the output of the algorithm could also be an adjacency matrix filled with non-integer numbers in $$[0,1]$$, giving some kind of probability of the nodes being connected (preferably close to $$0$$ or $$1$$ of course). So I could easily give a number as the label for each node. In the above example, the labels for the three connected nodes could be class $$1$$, and so on.

Is there any kind of supervised learning algorithm (e.g. some sort of graph neural network) that can perform these tasks?

• Now, I cannot answer your question, but I can provide you some information about the application of deep learning to graphs. This is often called "geometric deep learning". And, yes, there are "graph neural networks". You may search for them on the web. There should already exist models for your use case. If you find a solution, feel free to provide an answer below to your own question for future readers ;) – nbro Mar 21 at 16:50
• Thanks a lot! I have already tried to search the web for this of course but I could not find any useful information, probably also partly due to the fact that I do not know the right terminology in this field. That's why I posted my question here. – basti123 Mar 21 at 16:54
• See if this paper Junction Tree Variational Autoencoder for Molecular Graph Generation can be useful. I had read it several months ago and I even gave a presentation, but I forgot the details, but I remember that it was about generating graphs. – nbro Mar 21 at 20:53