<s>
A	O
graph	B-Algorithm
neural	I-Algorithm
network	I-Algorithm
(	O
GNN	O
)	O
is	O
a	O
class	O
of	O
artificial	B-Architecture
neural	I-Architecture
networks	I-Architecture
for	O
processing	O
data	O
that	O
can	O
be	O
represented	O
as	O
graphs	B-Application
.	O
</s>
<s>
In	O
the	O
more	O
general	O
subject	O
of	O
"	O
geometric	O
deep	B-Algorithm
learning	I-Algorithm
"	O
,	O
certain	O
existing	O
neural	B-Architecture
network	I-Architecture
architectures	O
can	O
be	O
interpreted	O
as	O
GNNs	O
operating	O
on	O
suitably	O
defined	O
graphs	B-Application
.	O
</s>
<s>
Convolutional	B-Architecture
neural	I-Architecture
networks	I-Architecture
,	O
in	O
the	O
context	O
of	O
computer	B-Application
vision	I-Application
,	O
can	O
be	O
seen	O
as	O
a	O
GNN	O
applied	O
to	O
graphs	B-Application
structured	O
as	O
grids	O
of	O
pixels	B-Algorithm
.	O
</s>
<s>
Transformers	B-Algorithm
,	O
in	O
the	O
context	O
of	O
natural	B-Language
language	I-Language
processing	I-Language
,	O
can	O
be	O
seen	O
as	O
GNNs	O
applied	O
to	O
complete	O
graphs	B-Application
whose	O
nodes	O
are	O
words	O
in	O
a	O
sentence	O
.	O
</s>
<s>
,	O
whether	O
it	O
is	O
possible	O
to	O
define	O
GNN	O
architectures	O
"	O
going	O
beyond	O
"	O
message	O
passing	O
,	O
or	O
if	O
every	O
GNN	O
can	O
be	O
built	O
on	O
message	O
passing	O
over	O
suitably	O
defined	O
graphs	B-Application
,	O
is	O
an	O
open	O
research	O
question	O
.	O
</s>
<s>
Several	O
open	B-License
source	I-License
libraries	B-Library
implementing	O
graph	B-Algorithm
neural	I-Algorithm
networks	I-Algorithm
are	O
available	O
,	O
such	O
as	O
PyTorch	B-Algorithm
Geometric	O
(	O
PyTorch	B-Algorithm
)	O
,	O
TensorFlow	B-Language
GNN	O
(	O
TensorFlow	B-Language
)	O
,	O
and	O
jraph	O
(	O
Google	B-Application
JAX	I-Application
)	O
.	O
</s>
<s>
The	O
architecture	O
of	O
a	O
generic	O
GNN	O
implements	O
the	O
following	O
fundamental	O
layers	B-Algorithm
:	O
</s>
<s>
Permutation	B-Algorithm
equivariant	O
:	O
a	O
permutation	B-Algorithm
equivariant	O
layer	B-Algorithm
maps	B-Algorithm
a	O
representation	O
of	O
a	O
graph	O
into	O
an	O
updated	O
representation	O
of	O
the	O
same	O
graph	O
.	O
</s>
<s>
In	O
the	O
literature	O
,	O
permutation	B-Algorithm
equivariant	O
layers	B-Algorithm
are	O
implemented	O
via	O
pairwise	O
message	O
passing	O
between	O
graph	O
nodes	O
.	O
</s>
<s>
Intuitively	O
,	O
in	O
a	O
message	O
passing	O
layer	B-Algorithm
,	O
nodes	O
update	O
their	O
representations	O
by	O
aggregating	O
the	O
messages	O
received	O
from	O
their	O
immediate	O
neighbours	O
.	O
</s>
<s>
As	O
such	O
,	O
each	O
message	O
passing	O
layer	B-Algorithm
increases	O
the	O
receptive	O
field	O
of	O
the	O
GNN	O
by	O
one	O
hop	O
.	O
</s>
<s>
Local	O
pooling	O
:	O
a	O
local	O
pooling	O
layer	B-Algorithm
coarsens	O
the	O
graph	O
via	O
downsampling	B-Algorithm
.	O
</s>
<s>
Local	O
pooling	O
is	O
used	O
to	O
increase	O
the	O
receptive	O
field	O
of	O
a	O
GNN	O
,	O
in	O
a	O
similar	O
fashion	O
to	O
pooling	O
layers	B-Algorithm
in	O
convolutional	B-Architecture
neural	I-Architecture
networks	I-Architecture
.	O
</s>
<s>
Examples	O
include	O
k-nearest	O
neighbours	O
pooling	O
,	O
top-k	O
pooling	O
,	O
and	O
self-attention	O
pooling	O
.	O
</s>
<s>
Global	O
pooling	O
:	O
a	O
global	O
pooling	O
layer	B-Algorithm
,	O
also	O
known	O
as	O
readout	O
layer	B-Algorithm
,	O
provides	O
fixed-size	O
representation	O
of	O
the	O
whole	O
graph	O
.	O
</s>
<s>
The	O
global	O
pooling	O
layer	B-Algorithm
must	O
be	O
permutation	B-Algorithm
invariant	O
,	O
such	O
that	O
permutations	B-Algorithm
in	O
the	O
ordering	O
of	O
graph	O
nodes	O
and	O
edges	O
do	O
not	O
alter	O
the	O
final	O
output	O
.	O
</s>
<s>
Message	O
passing	O
layers	B-Algorithm
are	O
permutation-equivariant	O
layers	B-Algorithm
mapping	O
a	O
graph	O
into	O
an	O
updated	O
representation	O
of	O
the	O
same	O
graph	O
.	O
</s>
<s>
Formally	O
,	O
they	O
can	O
be	O
expressed	O
as	O
message	O
passing	O
neural	B-Architecture
networks	I-Architecture
(	O
MPNNs	O
)	O
.	O
</s>
<s>
Additionally	O
,	O
let	O
be	O
the	O
features	B-Algorithm
of	O
node	O
,	O
and	O
be	O
the	O
features	B-Algorithm
of	O
edge	O
.	O
</s>
<s>
An	O
MPNN	O
layer	B-Algorithm
can	O
be	O
expressed	O
as	O
follows	O
:	O
</s>
<s>
where	O
and	O
are	O
differentiable	O
functions	O
(	O
e.g.	O
,	O
artificial	B-Architecture
neural	I-Architecture
networks	I-Architecture
)	O
,	O
and	O
is	O
a	O
permutation	B-Algorithm
invariant	O
aggregation	O
operator	O
that	O
can	O
accept	O
an	O
arbitrary	O
number	O
of	O
inputs	O
(	O
e.g.	O
,	O
element-wise	O
sum	O
,	O
mean	O
,	O
or	O
max	O
)	O
.	O
</s>
<s>
The	O
outputs	O
of	O
one	O
or	O
more	O
MPNN	O
layers	B-Algorithm
are	O
node	O
representations	O
for	O
each	O
node	O
in	O
the	O
graph	O
.	O
</s>
<s>
Node	O
representations	O
can	O
be	O
employed	O
for	O
any	O
downstream	O
task	O
,	O
such	O
as	O
node/graph	O
classification	B-General_Concept
or	O
edge	O
prediction	O
.	O
</s>
<s>
As	O
such	O
,	O
stacking	O
MPNN	O
layers	B-Algorithm
means	O
that	O
one	O
node	O
will	O
be	O
able	O
to	O
communicate	O
with	O
nodes	O
that	O
are	O
at	O
most	O
"	O
hops	O
"	O
away	O
.	O
</s>
<s>
In	O
principle	O
,	O
to	O
ensure	O
that	O
every	O
node	O
receives	O
information	O
from	O
every	O
other	O
node	O
,	O
one	O
would	O
need	O
to	O
stack	O
a	O
number	O
of	O
MPNN	O
layers	B-Algorithm
equal	O
to	O
the	O
graph	O
diameter	O
.	O
</s>
<s>
However	O
,	O
stacking	O
many	O
MPNN	O
layers	B-Algorithm
may	O
cause	O
issues	O
such	O
as	O
oversmoothing	O
and	O
oversquashing	O
.	O
</s>
<s>
Countermeasures	O
such	O
as	O
skip	B-Algorithm
connections	I-Algorithm
(	O
as	O
in	O
residual	B-Algorithm
neural	I-Algorithm
networks	I-Algorithm
)	O
,	O
gated	O
update	O
rules	O
and	O
jumping	O
knowledge	O
can	O
mitigate	O
oversmoothing	O
.	O
</s>
<s>
Modifying	O
the	O
final	O
layer	B-Algorithm
to	O
be	O
a	O
fully-adjacent	O
layer	B-Algorithm
,	O
i.e.	O
,	O
by	O
considering	O
the	O
graph	O
as	O
a	O
complete	O
graph	O
,	O
can	O
mitigate	O
oversquashing	O
in	O
problems	O
where	O
long-range	O
dependencies	O
are	O
required	O
.	O
</s>
<s>
Other	O
"	O
flavours	O
"	O
of	O
MPNN	O
have	O
been	O
developed	O
in	O
the	O
literature	O
,	O
such	O
as	O
graph	O
convolutional	O
networks	O
and	O
graph	O
attention	B-General_Concept
networks	O
,	O
whose	O
definitions	O
can	O
be	O
expressed	O
in	O
terms	O
of	O
the	O
MPNN	O
formalism	O
.	O
</s>
<s>
A	O
GCN	O
layer	B-Algorithm
defines	O
a	O
first-order	B-Algorithm
approximation	I-Algorithm
of	O
a	O
localized	O
spectral	O
filter	O
on	O
graphs	B-Application
.	O
</s>
<s>
GCNs	O
can	O
be	O
understood	O
as	O
a	O
generalization	O
of	O
convolutional	B-Architecture
neural	I-Architecture
networks	I-Architecture
to	O
graph-structured	O
data	O
.	O
</s>
<s>
The	O
formal	O
expression	O
of	O
a	O
GCN	O
layer	B-Algorithm
reads	O
as	O
follows	O
:	O
</s>
<s>
where	O
is	O
the	O
matrix	O
of	O
node	O
representations	O
,	O
is	O
the	O
matrix	O
of	O
node	O
features	B-Algorithm
,	O
is	O
an	O
activation	B-Algorithm
function	I-Algorithm
(	O
e.g.	O
,	O
ReLU	B-Algorithm
)	O
,	O
is	O
the	O
graph	O
adjacency	B-Algorithm
matrix	I-Algorithm
with	O
the	O
addition	O
of	O
self-loops	O
,	O
is	O
the	O
graph	O
degree	B-Algorithm
matrix	I-Algorithm
with	O
the	O
addition	O
of	O
self-loops	O
,	O
and	O
is	O
a	O
matrix	O
of	O
trainable	O
parameters	O
.	O
</s>
<s>
In	O
particular	O
,	O
let	O
be	O
the	O
graph	O
adjacency	B-Algorithm
matrix	I-Algorithm
:	O
then	O
,	O
one	O
can	O
define	O
and	O
,	O
where	O
denotes	O
the	O
identity	B-Algorithm
matrix	I-Algorithm
.	O
</s>
<s>
This	O
normalization	O
ensures	O
that	O
the	O
eigenvalues	O
of	O
are	O
bounded	O
in	O
the	O
range	O
,	O
avoiding	O
numerical	B-Algorithm
instabilities	I-Algorithm
and	O
exploding/vanishing	B-Algorithm
gradients	I-Algorithm
.	O
</s>
<s>
A	O
limitation	O
of	O
GCNs	O
is	O
that	O
they	O
do	O
not	O
allow	O
multidimensional	O
edge	O
features	B-Algorithm
.	O
</s>
<s>
It	O
is	O
however	O
possible	O
to	O
associate	O
scalar	O
weights	O
to	O
each	O
edge	O
by	O
imposing	O
,	O
i.e.	O
,	O
by	O
setting	O
each	O
nonzero	O
entry	O
in	O
the	O
adjacency	B-Algorithm
matrix	I-Algorithm
equal	O
to	O
the	O
weight	O
of	O
the	O
corresponding	O
edge	O
.	O
</s>
<s>
The	O
graph	O
attention	B-General_Concept
network	O
(	O
GAT	O
)	O
was	O
introduced	O
by	O
Petar	O
Veličković	O
et	O
al	O
.	O
</s>
<s>
Graph	O
attention	B-General_Concept
network	O
is	O
a	O
combination	O
of	O
a	O
graph	B-Algorithm
neural	I-Algorithm
network	I-Algorithm
and	O
an	O
attention	B-General_Concept
layer	B-Algorithm
.	O
</s>
<s>
The	O
implementation	O
of	O
attention	B-General_Concept
layer	B-Algorithm
in	O
graphical	O
neural	B-Architecture
networks	I-Architecture
helps	O
provide	O
attention	B-General_Concept
or	O
focus	O
to	O
the	O
important	O
information	O
from	O
the	O
data	O
instead	O
of	O
focusing	O
on	O
the	O
whole	O
data	O
.	O
</s>
<s>
A	O
multi-head	O
GAT	O
layer	B-Algorithm
can	O
be	O
expressed	O
as	O
follows	O
:	O
</s>
<s>
where	O
is	O
the	O
number	O
of	O
attention	B-General_Concept
heads	O
,	O
denotes	O
vector	O
concatenation	O
,	O
is	O
an	O
activation	B-Algorithm
function	I-Algorithm
(	O
e.g.	O
,	O
ReLU	B-Algorithm
)	O
,	O
are	O
attention	B-General_Concept
coefficients	O
,	O
and	O
is	O
a	O
matrix	O
of	O
trainable	O
parameters	O
for	O
the	O
-th	O
attention	B-General_Concept
head	O
.	O
</s>
<s>
For	O
the	O
final	O
GAT	O
layer	B-Algorithm
,	O
the	O
outputs	O
from	O
each	O
attention	B-General_Concept
head	O
are	O
averaged	O
before	O
the	O
application	O
of	O
the	O
activation	B-Algorithm
function	I-Algorithm
.	O
</s>
<s>
Formally	O
,	O
the	O
final	O
GAT	O
layer	B-Algorithm
can	O
be	O
written	O
as	O
:	O
</s>
<s>
Attention	B-General_Concept
in	O
Machine	O
Learning	O
is	O
a	O
technique	O
that	O
mimics	O
cognitive	O
attention	B-General_Concept
.	O
</s>
<s>
In	O
the	O
context	O
of	O
learning	O
on	O
graphs	B-Application
,	O
the	O
attention	B-General_Concept
coefficient	O
measures	O
how	O
important	O
is	O
node	O
to	O
node	O
.	O
</s>
<s>
Normalized	O
attention	B-General_Concept
coefficients	O
are	O
computed	O
as	O
follows	O
:	O
</s>
<s>
where	O
is	O
a	O
vector	O
of	O
learnable	O
weights	O
,	O
indicates	O
transposition	O
,	O
and	O
is	O
a	O
modified	B-Algorithm
ReLU	I-Algorithm
activation	B-Algorithm
function	I-Algorithm
.	O
</s>
<s>
Attention	B-General_Concept
coefficients	O
are	O
normalized	O
to	O
make	O
them	O
easily	O
comparable	O
across	O
different	O
nodes	O
.	O
</s>
<s>
A	O
GCN	O
can	O
be	O
seen	O
as	O
a	O
special	O
case	O
of	O
a	O
GAT	O
where	O
attention	B-General_Concept
coefficients	O
are	O
not	O
learnable	O
,	O
but	O
fixed	O
and	O
equal	O
to	O
the	O
edge	O
weights	O
.	O
</s>
<s>
The	O
gated	O
graph	O
sequence	O
neural	B-Architecture
network	I-Architecture
(	O
GGS-NN	O
)	O
was	O
introduced	O
by	O
Yujia	O
Li	O
et	O
al	O
.	O
</s>
<s>
The	O
message	O
passing	O
framework	O
is	O
implemented	O
as	O
an	O
update	O
rule	O
to	O
a	O
gated	B-Algorithm
recurrent	I-Algorithm
unit	I-Algorithm
(	O
GRU	O
)	O
cell	O
.	O
</s>
<s>
The	O
initial	O
node	O
features	B-Algorithm
are	O
zero-padded	B-Application
up	O
to	O
the	O
hidden	O
state	O
dimension	O
of	O
the	O
GRU	O
cell	O
.	O
</s>
<s>
Local	O
pooling	O
layers	B-Algorithm
coarsen	O
the	O
graph	O
via	O
downsampling	B-Algorithm
.	O
</s>
<s>
For	O
each	O
cases	O
,	O
the	O
input	O
is	O
the	O
initial	O
graph	O
is	O
represented	O
by	O
a	O
matrix	O
of	O
node	O
features	B-Algorithm
,	O
and	O
the	O
graph	O
adjacency	B-Algorithm
matrix	I-Algorithm
.	O
</s>
<s>
The	O
output	O
is	O
the	O
new	O
matrix	O
of	O
node	O
features	B-Algorithm
,	O
and	O
the	O
new	O
graph	O
adjacency	B-Algorithm
matrix	I-Algorithm
.	O
</s>
<s>
The	O
top-k	O
pooling	O
layer	B-Algorithm
can	O
then	O
be	O
formalised	O
as	O
follows	O
:	O
</s>
<s>
where	O
is	O
the	O
subset	O
of	O
nodes	O
with	O
the	O
top-k	O
highest	O
projection	O
scores	O
,	O
denotes	O
element-wise	O
matrix	O
multiplication	O
,	O
and	O
is	O
the	O
sigmoid	B-Algorithm
function	I-Algorithm
.	O
</s>
<s>
In	O
other	O
words	O
,	O
the	O
nodes	O
with	O
the	O
top-k	O
highest	O
projection	O
scores	O
are	O
retained	O
in	O
the	O
new	O
adjacency	B-Algorithm
matrix	I-Algorithm
.	O
</s>
<s>
The	O
operation	O
makes	O
the	O
projection	O
vector	O
trainable	O
by	O
backpropagation	B-Algorithm
,	O
which	O
otherwise	O
would	O
produce	O
discrete	O
outputs	O
.	O
</s>
<s>
where	O
is	O
a	O
generic	O
permutation	B-Algorithm
equivariant	O
GNN	O
layer	B-Algorithm
(	O
e.g.	O
,	O
GCN	O
,	O
GAT	O
,	O
MPNN	O
)	O
.	O
</s>
<s>
The	O
Self-attention	O
pooling	O
layer	B-Algorithm
can	O
then	O
be	O
formalised	O
as	O
follows	O
:	O
</s>
<s>
The	O
self-attention	O
pooling	O
layer	B-Algorithm
can	O
be	O
seen	O
as	O
an	O
extension	O
of	O
the	O
top-k	O
pooling	O
layer	B-Algorithm
.	O
</s>
<s>
Differently	O
from	O
top-k	O
pooling	O
,	O
the	O
self-attention	O
scores	O
computed	O
in	O
self-attention	O
pooling	O
account	O
both	O
for	O
the	O
graph	O
features	B-Algorithm
and	O
the	O
graph	O
topology	O
.	O
</s>
<s>
Graph	B-Algorithm
neural	I-Algorithm
networks	I-Algorithm
are	O
one	O
of	O
the	O
main	O
building	O
blocks	O
of	O
AlphaFold	B-Application
,	O
an	O
artificial	O
intelligence	O
program	O
developed	O
by	O
Google	B-Application
's	I-Application
DeepMind	B-Application
for	O
solving	O
the	O
protein	O
folding	O
problem	O
in	O
biology	O
.	O
</s>
<s>
AlphaFold	B-Application
achieved	O
first	O
place	O
in	O
several	O
CASP	O
competitions	O
.	O
</s>
<s>
Social	O
networks	O
are	O
a	O
major	O
application	O
domain	O
for	O
GNNs	O
due	O
to	O
their	O
natural	O
representation	O
as	O
social	O
graphs	B-Application
.	O
</s>
<s>
Examples	O
include	O
computing	O
shortest	O
paths	O
or	O
Eulerian	O
circuits	O
for	O
a	O
given	O
graph	O
,	O
deriving	O
chip	O
placements	O
superior	O
or	O
competitive	O
to	O
handcrafted	O
human	O
solutions	O
,	O
and	O
improving	O
expert-designed	O
branching	O
rules	O
in	O
branch	B-Algorithm
and	I-Algorithm
bound	I-Algorithm
.	O
</s>
<s>
Anomalies	O
within	O
provenance	O
graphs	B-Application
often	O
correlate	O
to	O
malicious	O
activity	O
within	O
the	O
network	O
.	O
</s>
<s>
GNNs	O
have	O
been	O
used	O
to	O
identify	O
these	O
anomalies	O
on	O
individual	O
nodes	O
and	O
within	O
paths	O
to	O
detect	O
malicious	O
processes	O
,	O
or	O
on	O
the	O
edge	O
level	O
to	O
detect	O
lateral	B-General_Concept
movement	I-General_Concept
.	O
</s>
