Graph Neural Networks: An Introduction

Dhaval Taunk
3 min readMay 29, 2024

--

Credits: https://bdtechtalks.com/2021/10/11/what-is-graph-neural-network/

In this series of blog posts on graph neural networks, we will discuss the basics of graph neural networks, their use cases, why they are required, and their advantages over conventional fully connected neural networks.

So let’s get started…..

Why Graph Neural Networks?

Many data sources are in a graph-based format where they can be represented as nodes (vertices) connected by edges, capturing relationships and dependencies between entities. Due to their complex structure, traditional fully connected networks are not effective at interpreting these kinds of datasets.

Such datasets have a rich relational structure that can be better represented as a relational graph. Therefore, graph neural networks offer a promising avenue for modeling these types of datasets.

Use Cases of Graph Neural Networks (GNN’s)

GNNs offer solutions to a wide range of use cases involving graph-structured data. One of the most popular examples is social media analysis. With the vast user bases of platforms like Facebook and Instagram, each user can be treated as an individual node in a graph, with their profile features serving as attributes. By leveraging their friends lists, we can construct a large graph. This is a classical example where graph neural networks outperform fully connected neural networks.

Other use cases include communication networks, citation networks, economic networks, knowledge graphs, scene graphs, and more. Graph neural networks can effectively tackle various problems across these domains.

Graph Neural Network Applications

GNNs can be used to solve a variety of problems. Below, I am listing the applications. We will discuss them in detail in the upcoming blogs.

1. Graph Level Prediction:
- Graph classification (Drug Discovery, Molecule Generation etc.)

2. Sub-Graph Level:
- Traffic Prediction (Google Maps etc.)

3. Node Level:
- Node Classification (Categorize online users/items etc.)

4. Edge Level:
- Link Prediction (Recommender Systems, Drug Side effects etc.)

Popular Tools

There are a variety of tools available for graph-based data analysis and modeling. Below, I am listing some of them. In the next set of blogs, I will discuss them in detail, providing hands-on examples as well.

1. NetworkX: 
- It is a Python library for the graph creation, manipulation, and study of
complex networks.

2. Pytorch Geometric:
- It is a library for deep learning on irregularly structured data such as
graphs and it is built on top of PyTorch.

3. DeepSnap:
- It is a Python library that facilitates deep learning on graphs by
providing easy-to-use data structures and tools for graph manipulation and
model training.

4. GraphGym:
- It is a research platform built on PyTorch Geometric that offers modular
and flexible tools for designing, training, and evaluating graph neural
networks.

Machine Learning for Graph

Before the advent of graph neural networks, people used to follow traditional ML pipelines, where they extracted features from the input graph and fed them into classical ML models to perform various tasks. These features can also be divided based on the graph structure in the following manner:

1. Node Level Features:
a. Node Degree
b. Node Centrality
c. Clustering Coefficient
d. Graphlets

2. Edge Level Features:
a. Distance Based Features:
i. Shortest-path distance between two nodes
b. Local Neighborhood Overlap:
i. Common Neighbors
ii. Jaccard's Coefficient
iii. Adamic-Adar Index
c. Global Neighborhood Overlap:
i. Katz Index

3. Graph Level Features:
a. Graph Kernels
i. Graphlet Kernel
ii. Weisfeiler-Lehman Kernel

I will be discussing them in detail in the upcoming blogs. Stay tuned for that!

Types of Graph Neural Network

There are numerous graph neural networks available. Discussing them in detail will require another set of blogs, which I will cover in the next series. However, for the sake of discussion and to provide an overview, I am listing some of the popularly used networks.

1. Vanilla GNN
2. Graph Convolutional Networks (GCN)
3. Graph Attention Networks (GAT)
4. GraphSage
5. Relational Graph Convolutional Networks (R-GCNs)
6. Graph Recurrent Neural Networks (GRNNs)

The above list is not exhaustive, but it includes the most prominent networks in use. Details will follow in the next set of blogs.

For now, that’s all from my side. In summary, in this blog, I briefly discussed the utility of graph neural networks, their applications, types, etc. In the next blog, we will discuss classical ML for graphs and continue to delve into graph neural networks in subsequent blogs.

So stay tuned and happy reading……..

--

--

Dhaval Taunk

MS by Research @IIITH, Ex Data Scientist @ Yes Bank | Former Intern @ Haptik, IIT Guwahati | Machine Learning | Deep Learning | NLP