ArticleslgStudy

computer science

Graph neural network

Graph neural network is a computer science topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand Graph neural network rather than just read about it. In short: Graph neural networks (GNNs) are artificial neural networks designed for tasks whose inputs are graphs. Because graphs usually do not have a canonical ordering of their nodes, GNN architectures are commonly designed to be permutation equivariant: reordering the nodes in the input reorders the corresponding node representations in the same way.

Graph neural network — main illustration
Graph neural network — illustration

Key takeaways

  • Graph neural network belongs to computer science; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect Graph neural network to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of Graph neural network from memory before moving on to harder problems.

Reference excerpt

Graph neural networks (GNNs) are artificial neural networks designed for tasks whose inputs are graphs. Because graphs usually do not have a canonical ordering of their nodes, GNN architectures are commonly designed to be permutation equivariant: reordering the nodes in the input reorders the corresponding node representations in the same way. For graph-level prediction tasks, GNNs typically use a permutation-invariant readout function, whose output is unchanged by the ordering of the nodes. A prominent example is molecular drug design. Molecules can be represented as graphs, with nodes for atoms and edges for atomic bonds, often including known chemical properties as features. Inputs may thus differ in size, due to varying number of atoms and bonds. A graph-level task may be to predict the efficacy of a given molecule for a specific medical application, such as eliminating E. coli bacteria. The key design element of GNNs is the use of pairwise message passing, such that graph nodes iteratively update their representations by exchanging information with their neighbors. Several GNN architectures have been proposed, which implement different flavors of message passing, started by recursive or convolutional constructive approaches. A 2022 position paper argued that many architectures described as going "beyond" message passing can instead be interpreted as message passing over suitably modified graphs, and proposed the term "augmented message passing" for such approaches.

In the more general subject of "geometric deep learning", certain existing neural network architectures can be interpreted as GNNs operating on suitably defined graphs. A convolutional neural network layer, in the context of computer vision, can be considered a GNN applied to graphs whose nodes are pixels, and only adjacent pixels are connected by edges in the graph. A transformer layer, in natural language processing, can be considered a GNN applied to complete graphs whose nodes are words or tokens in a passage of natural language text. Relevant application domains for GNNs include natural language processing, social networks, citation networks, molecular biology, chemistry, physics and NP-hard combinatorial optimization problems. Open source libraries implementing GNNs include PyTorch Geometric (PyTorch), TensorFlow GNN (TensorFlow), Deep Graph Library (framework agnostic), jraph (Google JAX), and GraphNeuralNetworks.jl/GeometricFlux.jl (Julia, Flux).

Architecture The architecture of a generic GNN implements the following fundamental layers:

Permutation-equivariant layers: a permutation equivariant layer maps a representation of a graph into an updated representation of the same graph. In the literature, permutation equivariant layers are implemented via pairwise message passing between graph nodes. Intuitively, in a message passing layer, nodes update their representations by aggregating the messages received from their immediate neighbours. As such, each message passing layer increases the receptive field of the GNN by one hop. Local pooling: a local pooling layer coarsens the graph via downsampling. Local pooling is used to increase the receptive field of a GNN, in a similar fashion to pooling layers in convolutional neural networks. Examples include k-nearest neighbours pooling, top-k pooling, and self-attention pooling. Global pooling: a global pooling layer, also known as readout layer, provides fixed-size representation of the whole graph. The global pooling layer must be permutation invariant, such that permutations in the ordering of graph nodes and edges do not alter the final output. Examples include element-wise sum, mean or maximum. Standard message-passing GNNs are at most as expressive as the Weisfeiler Leman graph isomorphism test. In practice, this means that there exist different graph structures that cannot be distinguished by GNNs. More powerful GNNs operating on higher-dimension geometries such as simplicial complexes can be designed. As of 2022, whether or not future architectures will overcome the message passing primitive is an open research question.

Message passing layers

Message passing layers are permutation-equivariant layers mapping a graph into an updated representation of the same graph. Formally, they can be expressed as message passing neural networks (MPNNs). Let G = ( V , E ) {\displaystyle G=(V,E)} be a graph, where V {\displaystyle V} is the node set and E {\displaystyle E} is the edge set. Let N u {\displaystyle N_{u}} be the neighbourhood of some node u ∈ V {\displaystyle u\in V} . Additionally, let x u {\displaystyle \mathbf {x} _{u}} be the features of node u ∈ V {\displaystyle u\in V} , and e u v {\displaystyle \mathbf {e} _{uv}} be the features of edge ( u , v ) ∈ E {\displaystyle (u,v)\in E} . An MPNN layer can be expressed as follows:

… excerpt ends here. Continue reading the full article.

Illustrations

Graph neural network: Non-isomorphic graphs that cannot be distinguished by a GNN due to the limitations of the Weisfeiler-Lehman Graph Isomorphism Test. Colors indicate node features.
Non-isomorphic graphs that cannot be distinguished by a GNN due to the limitations of the Weisfeiler-Lehman Graph Isomorphism Test. Colors indicate node features.
Graph neural network: Node representation update in a Message Passing Neural Network (MPNN) layer. Node 
  
    
      
        
          
            x
          
          
            0
          
        
      
    
    {\displaystyle \mathbf {x} _{0}}
  
 receives messages sent by all of its immediate neighbours 
  
    
      
        
          
            x
          
          
            1
          
        
      
    
    {\displaystyle \mathbf {x} _{1}}
  
 to 
  
    
      
        
          
            x
          
          
            4
          
        
      
    
    {\displaystyle \mathbf {x} _{4}}
  
. Messages are computed by the message function 
  
    
      
        ψ
      
    
    {\displaystyle \psi }
  
, which accounts for the features of both the sender and the receiver.
Node representation update in a Message Passing Neural Network (MPNN) layer. Node x 0 {\displaystyle \mathbf {x} _{0}} receives messages sent by all of its immediate neighbours x 1 {\displaystyle \mathbf {x} _{1}} to x 4 {\displaystyle \mathbf {x} _{4}} . Messages are computed by the message function ψ {\displaystyle \psi } , which accounts for the features of both the sender and the receiver.

Worked examples

Example 1 — a first encounter with Graph neural network

Start with the simplest possible case. Write down what Graph neural network claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In computer science, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to Graph neural network before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about Graph neural network ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of Graph neural network

In research
Graph neural network appears in computer science research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses Graph neural network in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
Graph neural network is common in secondary-school and first-year university syllabi. It links to neighbouring topics 2009 in artificial intelligence, Artificial neural networks, Graph algorithms, so understanding it makes those chapters shorter.
In everyday life
Look for Graph neural network outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.
Ask Teacher Smith questions about this articleOpens your AI tutor with a question about “Graph neural network” →

Affiliate

Preply — study more efficiently by working with a personal tutor. 50% off.

How to study Graph neural network in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what Graph neural network means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain Graph neural network out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is Graph neural network in simple terms?

Graph neural networks (GNNs) are artificial neural networks designed for tasks whose inputs are graphs. Because graphs usually do not have a canonical ordering of their nodes, GNN architectures are commonly designed to be permutation equivariant: reordering the nodes in the input reorders the corre…

Why does Graph neural network matter?

Because it connects several computer science ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study Graph neural network?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on Graph neural network.

Tags

  • 2009 in artificial intelligence
  • Artificial neural networks
  • Graph algorithms
  • Neural network architectures
  • Semisupervised learning
  • Supervised learning
  • Unsupervised learning

Keep exploring