The Graph2Vec Algorithm
Explore the Graph2Vec algorithm to generate vector embeddings representing entire graphs. Understand how ego graphs and skip-gram models work together to allow graph comparison in a metric space. This lesson teaches you how to implement Graph2Vec in Python using the KarateClub library on multiple graph types.
We'll cover the following...
What is Graph2Vec?
Graph2Vec is another embedding algorithm, however, it focuses on creating a vector representation for entire graphs, not only nodes. This way it allows for comparison between different graph structures in a metric space.
How the Graph2Vec algorithm works
The idea behind Graph2Vec is that we can treat the entire graph as a collection of subgraphs, which are subsets of nodes and edges from the original graph. Therefore, for each graph, we’ll generate a set of subgraphs based on each node of the graph.
The way of generating those subgraphs is by looking at ego graphs from nodes. A node ego graph is a graph rooted in the node and all its neighbors and neighbors of neighbors considering
For example, let’s consider the following graph:
The ego graph for node