# The Graph2Vec Algorithm

Learn the Graph2Vec algorithm to generate embeddings of whole graphs.

## 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:

Get hands-on with 1400+ tech skills courses.