What are Graph Neural Networks?

Share

A graph neural network (GNN) is a type of neural network used to deal with non-Euclidian data, where the entire representation of data is done in graphs. This helps us work on data where the objects have complex relationships with each other, needing graphs to represent them.

Other neural networks, like convolutional neural networks (CNN), autoencoders, or recurrent neural networks (RNN) that are commonly used for image processing, text recognition, or speech synthesis, work only on Euclidean data. GNNs are needed if the data is too intricate and has several relationships between its objects.

Using graphs

A graph is made up of two basic components:

  • Vertex: It is used to represent the nodes of the graphs.

  • Edge: These are the lines that represent relationships between the nodes.

Graphs (G) are what make GNNs, where every vertex (V) represents an item/object of the data. The relationships between those vertices represented by edges (E) are considered before processing that data where

The graphs that are processed in GNNs can be directed or undirected.

  • Directed graphs: These graphs have vertices that have either incoming or outgoing edges, with arrows that establish their dependencies with other vertices.

  • Undirected graphs: These graphs have vertices with no directional dependencies on each other, having straight-line edges.

Undirected vs directed graphs
Undirected vs directed graphs

In GNN, every node is mapped with embedding where the embedding indicates the node’s location and neighborhood. These nodes use a process called message passing. This feature can be used to predict the nodes and edges of a graph as well. The following is a representation of an image in a GNN that shows the letter “T” in a 3x3 matrix:

Matrix and graph representation of the letter “T” in a GNN
Matrix and graph representation of the letter “T” in a GNN

Message passing in graph neural networks

Message passing is a pivotal concept in GNNs. In message passing, each node in the graph communicates with its neighboring nodes to send and receive messages. The message-passing process in GNNs is typically organized into a series of iterations or layers, with each layer updating the representations of the nodes based on the messages received from their neighbors.

A graph neural network
1 of 3

Overall, this property of GNNs allows nodes to assimilate information from their neighboring nodes, allowing the network to extract relational information and node dependencies in the graph structure.

Comparison with other neural networks

GNN can deal with complex and arbitrary topologies, unlike other neural networks. There might be unordered nodes that other neural networks, like CNNs, will find computationally complicated. Therefore, GNNs can perform on any structure that has any data. Furthermore, GNNs usually use sparse math, where their models typically have two to three layers, whereas other neural networks/models use hundreds of them.

Features of graph neural networks

GNNs have the following features:

  • Classification of nodes: This feature enables the GNNs to classify semi-supervised graphs. It helps in predicting the embeddings of other nodes based on current data.

  • Predicting edges: This feature helps determine the linkages between graph nodes. It also helps in forecasting linkages between two entities.

  • Graph classification: Selective portions of graphs are classified into groups using this feature based on specified variables.

Types of graph neural networks

There are three types of GNNs, as illustrated in the image provided below:

Types of Graph Neural Networks
Types of Graph Neural Networks

Applications of graph neural networks

The following are some applications of GNNs:

  • Graph clustering: GNNs can be used to cluster graphs by vertex or graph clustering. In vertex clustering, the nearby nodes are added to the cluster based on their similarity index, whereas in graph clustering, graphs are treated as objects and put into clusters.

  • Visualization: GNNs can be used to visualize the data present in the graph, which can be used to determine the relationships between the nodes present in the graph and can be used to study their behavior.

  • Prediction: As mentioned earlier, GNNs have the ability to predict their links or nodes using the neighborhood information of the present nodes. This feature can be utilized for forecasts and predictions.

  • Natural language processing: GNNs are widely used today in natural language processing problems like answering questions, extracting relations in data, machine translations, text classification, exploiting semantics, etc.

  • Molecule structures: GNNs are also used in chemistry to determine and analyze compounds’ molecular structures, where each node represents an atom, and every edge represents a chemical bond. This is used in drug discovery.

  • Cybersecurity: GNNs are used to detect security attacks and network traffic anomalies by performing network analysis.

  • Social network analysis: GNNs are used to extract and analyze useful information like predicting user behavior, influence analysis, and community detection.

Copyright ©2024 Educative, Inc. All rights reserved