In a knowledge graph, embedding vectors can be learned for nodes (node embedding) and edges (edge embeddings). Is there a method to learn one single embedding vector for the entire knowledge graph?

  • $\begingroup$ Do you mean the entire graph, or rather the entire relationship between two nodes through an edge? $\endgroup$ Dec 19, 2022 at 8:15
  • $\begingroup$ @JaumeOliverLafont The entire graph $\endgroup$
    – skumaravel
    Dec 19, 2022 at 12:24
  • $\begingroup$ Im not too familiar with knowledge graphs. But seeing as you talk about embedding vectors for nodes, are the knowledge graphs you talk about embedded using graph neural networks? Because in that case you could learn a graph classification/regression network for embedding the complete graph. $\endgroup$ Dec 19, 2022 at 13:35
  • $\begingroup$ @RobinvanHoorn Yes the nodes are embedded using GNNs. How will learning a graph classification/regression network result in embedding for the entire graph? $\endgroup$
    – skumaravel
    Dec 19, 2022 at 20:32
  • $\begingroup$ Well in a GNN you can have node embeddings which are then stacked/aggregated together. On that combined vector you can add a multi-layer perceptron to learn a new embedding on top. I think graph2vec is worth looking into for you. $\endgroup$ Dec 20, 2022 at 9:14

1 Answer 1


The answer is Graph Readout operation can get a graph level representation out of the node/edge representations. Read the following: https://lifesci.dgl.ai/api/model.readout.html

  • 1
    $\begingroup$ You might be on to something. However, it is helpful to add to your answer why you think this is a solution and to provide external links with additional explanations. Providing APIs is generally not the best approach for explaining new concepts. $\endgroup$ Dec 20, 2022 at 9:19
  • $\begingroup$ @RobinvanHoorn I will go through the documentation fully and understand it and give an update to my answer with proper explanations. I am not sure who gave a -1 to my answer. What do you mean by 'you might be on to something'? $\endgroup$
    – skumaravel
    Dec 26, 2022 at 6:33
  • $\begingroup$ What i meant with 'you might be on to something' is that the API does look like something that can be used. I was thinking along the lines of graph regression/graph classification, and reading a few sentences in the link i feel like its somewhat similar. $\endgroup$ Dec 26, 2022 at 10:09
  • $\begingroup$ @RobinvanHoorn Oh, my bad! I misunderstood it. $\endgroup$
    – skumaravel
    Dec 27, 2022 at 4:54

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .