Covered Forest: Fine-grained generalization analysis of graph neural networks


              Antonis Vasileiou 1 Ben Finkelshtein 2 Floris Geerts 3 Ron Levie 4 Christopher Morris 1


                           Abstract                                     pressivity is analyzed via algorithmic alignment with the
                                                                        1-dimensional Weisfeiler–Leman algorithm (1-WL) (We-
     The expressive power of message-passing graph                      isfeiler & Leman, 1968; Weisfeiler, 1976; Morris et al.,
     neural networks (MPNNs) is reasonably well un-                     2023b), a heuristic for graph isomorphism, or universal
     derstood, primarily through combinatorial tech-                    approximation theorems (Azizian & Lelarge, 2021; Böker
     niques from graph isomorphism testing. How-                        et al., 2023; Chen et al., 2019; Geerts & Reutter, 2022;
     ever, MPNNs’ generalization abilities—making                       Maehara & NT, 2019; Rauchwerger et al., 2024). For in-
     meaningful predictions beyond the training set—                    stance, Morris et al. (2019); Xu et al. (2019) showed that
     remain less explored. Current generalization anal-                 the 1-WL bounds MPNNs’ expressivity in distinguishing
     yses often overlook graph structure, limit the                     non-isomorphic graphs, while recent work (Böker et al.,
     focus to specific aggregation functions, and as-                   2023; Chen et al., 2022; 2023; Rauchwerger et al., 2024)
     sume the impractical, hard-to-optimize 0-1 loss                    refines expressivity using advances in graph similarity, such
     function. Here, we extend recent advances in                       as the Tree distance (Böker, 2021).
     graph similarity theory to assess the influence of
     graph structure, aggregation, and loss functions                   Understanding when MPNNs generalize to unseen graphs
     on MPNNs’ generalization abilities. Our empiri-                    is equally crucial but understudied (Morris et al., 2024).
     cal study supports our theoretical insights, improv-               Recent works (Franks et al., 2023; Liao et al., 2021; Mor-
     ing our understanding of MPNNs’ generalization                     ris et al., 2023a; Scarselli et al., 2018) often use Vapnik–
     properties.                                                        Chervonenkis dimension (VC dimension) (Vapnik, 1995) or
                                                                        related formalisms to derive generalization bounds based
                                                                        on simplistic graph parameters, e.g., maximum degree. For
1. Introduction                                                         example, Morris et al. (2023a, Proposition 1 and 2) linked 1-
                                                                        WL expressivity with VC dimension, assuming the 0-1 loss
Graphs represent interactions across life, natural, and for-            function and specific aggregation functions. Their reliance
mal sciences, such as atomistic systems (Duval et al., 2023;            on 1-WL implies a simplistic notion of graph similarity,
Zhang et al., 2023) or social networks (Easley & Kleinberg,             where graphs are either equivalent or entirely dissimilar,
2010; Lovász, 2012), highlighting the need for machine                  leading to vacuous bounds irrelevant to practice. Moreover,
learning methods for graph data. Message-passing graph                  in general, most analyses overlook architectural variations
neural networks (MPNNs) (Gilmer et al., 2017; Scarselli                 like aggregation functions.
et al., 2009) have recently gained attention, achieving suc-
cess in areas like drug design (Wong et al., 2023), weather
                                                                        Present work Here, we extend modern generalization
forecasting (Lam et al., 2023), and combinatorial optimiza-
                                                                        frameworks based on (data-dependent) covering num-
tion (Cappart et al., 2023; Scavuzzo et al., 2024; Qian et al.,
                                                                        bers (Xu & Mannor, 2012; Kawaguchi et al., 2022) to ad-
2024).
                                                                        dress the above shortcomings. Specifically, we investigate
Despite their success, MPNNs’ theoretical properties are                how refined notions of graph similarity, or pseudo-metrics
underexplored (Morris et al., 2024), with most studies fo-              on graphs, enable smaller graph coverings and tighter anal-
cusing on expressivity, i.e., their ability to separate graphs          yses of MPNNs’ generalization error. See Figure 1 for
or approximate permutation-invariant graph functions. Ex-               an illustration of how pseudo-metrics induce distinct ge-
   1
                                                                        ometries, leading to improved generalization analysis. Our
     RWTH Aachen University, Germany 2 University of Oxford,            analysis also incorporates various architectural choices and
UK 3 University of Antwerp, Belgium 4 Technion – Israel Institute
of Technology, Israel. Correspondence to: Antonis Vasileiou             loss functions.
<antonis.vasileiou@log.rwth-aachen.de>.                                 Concretely, (1) we demonstrate that the choice of pseudo-
                      nd
Proceedings of the 42 International Conference on Machine               metric on n-order graphs significantly affects generaliza-
Learning, Vancouver, Canada. PMLR 267, 2025. Copyright 2025             tion analysis. For instance, the Tree distance (Böker,
by the author(s).                                                       2021) yields a strictly tighter generalization error bound

                                                                    1
                                                          Covered Forests

than Morris et al. (2023a). We provide a general proof tech-            of the covering number, there is a subset {x1 , . . . , xK } ⊂
nique for this improvement, covering loss functions such as             X representing an ε-cover of X . We define a partition
cross-entropy and mean absolute error, unlike Morris et al.             {C1 , . . . , CK } where Ci := {x ∈ X | d(x, xi ) =
(2023a). (2) We link our pseudo-metrics to the Tree Mover’s             minj∈[K] d(x, xj )}, for i ∈ [K]. To break    S ties, we take
distance (TMD) (Chuang & Jegelka, 2022), deepening the                  the smallest i in the above. Note that X = i∈[K] Ci . The
understanding of TMD, originally defined via a recursive                diameter of a set is the maximal distance between any two
transportation formula. (3) We define the 1-MWL, a heuris-              elements in the set. Implied by the definition of an ε-cover
tic for graph isomorphism that characterizes the expressivity           and the triangle inequality, each Ci has a diameter of at most
of MPNNs with mean aggregation and satisfies the Lips-                  2ε.
chitz property required for our generalization analysis. We
also derive a corresponding pseudo-metric on graphs equiva-
                                                                        Supervised learning on graphs We define supervised
lent to 1-MWL in distinguishing non-isomorphic graphs. (4)
                                                                        learning on graphs as follows. Let G be the set of all graphs
Empirically, our theoretical findings translate into practice,
                                                                        and Y a set. Unless specified otherwise, G includes graphs
offering nuanced insights into MPNN generalization.
                                                                        of varying orders with vertex features in arbitrary domains.
In summary, our results highlight how refined graph similar-            Later, we restrict G by bounding graph order or vertex fea-
ity notions improve the understanding of MPNNs’ general-                ture domains. Similarly, Y varies depending on the task,
ization, considering graph structure, architectural choices,            e.g., regression or binary classification. We consider classes
and loss functions.                                                     H ⊆ X G of graph embeddings, i.e., mappings from G
                                                                        to X for some set X . A graph learning algorithm learns
See Appendix A for a detailed discussion of related work.
                                                                        such embeddings from data samples. More formally, let
                                                                        Z := G × Y with a probability distribution µ. A data
1.1. Background                                                         sample S is a collection of elements from Z, drawn i.i.d.
In the following, we provide the necessary background on                according to µ. We denote (G, y) ∼ µ for an element drawn
(pseudo-)metric spaces, covering numbers, and MPNNs. We                 from Z under µ, and S ∼ µk for a sample of size k ∈ N.
use standard notation for graphs and norms; see Appendix B.             A graph learning algorithm for H maps each sample S
                                                                        to a graph embedding hS ∈ H. The “goodness” of hS is
Metric spaces and coverings In the remainder of the                     assessed using a loss function ℓ : X × Y → R+ , assumed
paper, “distances” between graphs play an essential role,               bounded by some M > 0. That is, |ℓ(h(G), y)| ≤ M for all
which we make precise by defining a pseudo-metric (on                   h ∈ H, G ∈ G, and y ∈ Y. We define the      expected and
                                                                                                                                em-
the set of graphs). Let X be a set equipped with a pseudo-              pirical error as: ℓexp (hS ) := E(G,y)∼µ ℓ hS (G), y and
                                                                                         1                                           k
                                                                                            P
metric d : X × X → R+ , i.e., d is a function satisfying                ℓemp (hS ) := |S|      (G,y)∈S ℓ hS (G), y , where S ∼ µ
d(x, x) = 0 and d(x, y) = d(y, x) for x, y ∈ X , and                    for k ∈ N. The generalization error, |ℓexp (hS )−ℓemp (hS )|,
d(x, y) ≤ d(x, z) + d(z, y), for x, y, z ∈ X . The latter               is what we aim to bound in this work.
property is called the triangle inequality. The pair (X , d)
is called a pseudo-metric space. For (X , d) to be a metric
                                                                        Message-passing graph neural networks One particular,
space, d additionally needs to satisfy d(x, y) = 0 ⇒ x = y,
                                                                        well-known class of graph embeddings is MPNNs. Follow-
for x, y ∈ X .1 See Appendix B for the definition of (Lips-
                                                                        ing Gilmer et al. (2017), let G be an attributed graph with
chitz/uniform) continuity of a function between pseudomet-                                      (0)
                                                                        initial vertex-feature hv ∈ Rd0 , d0 ∈ N, for v ∈ V (G).
ric spaces. Let (X , d) be a pseudo-metric space. Given an
                                                                        An MPNN architecture consists of a stack of L neural net-
ε > 0, an ε-cover of X is a subset C ⊆ X such that for
                                                                        work layers for some L > 0. In each layer, t ∈ N, we
all elements x ∈ X there is an element y ∈ C such that                                              (t)
d(x, y) ≤ ε. Given ε > 0 and a pseudo-metric d on the set               compute a vertex feature hv :=
X , we define the covering number of X , N (X , d, ε) :=
                                                                                                                        
                                                                         UPD(t) h(t−1)
                                                                                     v    , AGG(t) {{h(t−1)
                                                                                                        u   | u ∈ N (v)}} ∈ Rdt ,
   min{m | there is an ε-cover of X of cardinality m},
                                                                        dt ∈ N, for v ∈ V (G), where UPD(t) and AGG(t) are
i.e., the smallest number m such that there exists a ε-cover
                                                                        parameterized functions, e.g., neural networks. In the case
of cardinality m of the set X with regard to the pseudo-
                                                                        of graph-level tasks, e.g., graph classification, one uses a
metric d.
                                                                        readout,
The covering number provides a direct way of constructing                                                             
a partition of X . Let K := N (X , d, ε) so that, by definition              hG := READOUT {{h(L)     v  | v ∈ V  (G)}}   ∈ Rd ,

    1
     Observe that computing a metric on the set of graphs G up to       to compute a single vectorial representation based on
isomorphism is at least as hard as solving the graph isomorphism        learned vertex features after iteration L. Again, READOUT
problem on G.                                                           may be a parameterized function.

                                                                    2
                                                                                        Covered Forests
                                                                      MPNN (G2 )

                                                                                                                                                           G
                                                                                                                                                    M PN N( 2 )
                                                        G2γ(ε)                                 ε
                                                                      MPNN (G1 )
        G1             G2                                                                                                             G2          MPNN( G1 )
                                                        G1γ(ε)                                 ε                            G3
                                                                                                                                           γ(ε)                   ε
                                                                                                                                 G1
                                               G3γ(ε)            G4γ(ε)                  ε             ε
                                                                                                                                                         3
                                                                                                                                                             )
                                                                          MPNN ( G4 )                                                         M P N N( G
                                                                                                                                       G4
        G3             G4                                             MPNN ( G3 )                                                                    MPN N( G )
                                                                                                                                                             4

    (a) A set of padded (b) Geometry under the trivial 1-WL discrete pseudo- (c) Geometry under the Tree distance δe∥·∥ . The
    binary trees.       metric. All graphs are equally far apart, not taking similarity of graphs is preserved under MPNNs,
                        into account their similarity, mapping each graph to a leading to a smaller covering and a tighter general-
                        unique ε-ball.                                         ization analysis.

Figure 1. Illustrating how the choice of pseudo-metrics influences the geometry and the size of coverings, leading to a tighter generalization
analysis.


Special cases of MPNN layers In the following, we dis-                                                     MPNN classes Based on the above three types of MPNN
cuss special cases of MPNNs, which we will subsequently                                                    layers, we consider the following classes of MPNNs. Let
use in our analyses of MPNNs’ generalization abilities.                                                    G be a class of graphs, we denote the class of all L-layer
First, for an unlabeled n-order graph G, we assume all                                                     MPNNs following Equation (1) where ψ is represented by
                                              (0)   (0)
initial vertex-features are identical, i.e., hv = hw , for                                                 a feed-forward neural network (FNN) (See Appendix B.1
v, w ∈ V (G). In this case, we define an MPNN layer using                                                  for a formal definition of FNNs) with Lipschitz constant
order-normalized sum aggregation and order-normalized                                                      LFNN and bounded by M ′ ∈ R by MPNNord  L,M ′ ,LFNN (G), i.e.,
readout, where                                                                                             MPNNord    ′
                                                                                                                   L,M ,LFNN (G) :=
                                 X                                                                           n                                                 o
            h(t)
              v := φt /|V (G)|
                         1               h(t−1)
                                           u      ,     (1)                                                     h : G → R h(G) := FNNθ ◦ hG where θ ∈ Θ ,
                                              u∈N (v)
                                              X                                                          where Θ is the parameter set of FNNs. Analogously,
             hG := ψ             1/|V (G)|                h(L)
                                                           u     ,                           (2)           for Equation (3) and Equation (5), we define the classes
                                             u∈V (G)                                                       MPNNsum                           mean
                                                                                                                   L,M ′ ,LFNN (G) and MPNNL,M ′ ,LFNN (G), respectively.
                                                                                                           Finally, we denote the class of all MPNN architectures con-
for v ∈ V (G), where φt : Rdt−1 → Rdt is a Lφt -Lipschitz
                                                                                                           sisting of L layers with a readout layer represented by an
continuous function, with respect to the 2-norm-induced
                                                                                                           FNN at the (L + 1)th-layer by MPNNL (G).
metric, for dt ∈ N and t ∈ [L], and ψ : RdL → Rd is a Lψ -
Lipschitz continuous function.2 Secondly, for an attributed                                                In Appendix C, we provide the formal definition of the
                                     (0)                                                                   1-Weisfeiler–Leman algorithm (1-WL), characterizing the
n-order graph (G, a), i.e., we set hv = a(v), for v ∈
V (G), we define an MPNN layer using sum aggregation                                                       distinguishing power of sum aggregation MPNNs (Morris
and order-normalized readout, where                                                                        et al., 2019). We also introduce 1-MWL, a variant of 1-WL,
                                                                                                         characterizing the distinguishing power of mean aggrega-
                          (1)                   (2)
                                 X
    h(t)
     v   := φt   h(t−1)
                  v     Wt    +        h(t−1)
                                        u     Wt      , (3)                                                tion MPNNs.
                                              u∈N (v)
                                                 
                                                                                                           2. Pseudo-metrics on the set of graphs
                                   X
   hG := ψ 1/|V (G)|                         hu(L) ,                                         (4)
                                 u∈V (G)
                                                                                                           We define and study (pseudo-)metrics on the set of graphs,
where φt and ψ are defined as in Equation (1) and                                                          which we later use for a fine-grained generalization analysis
    (1)   (2)                                                                                              of MPNNs; see Appendix D for an extended discussion.
Wt , Wt are dt−1 × dt matrices over R. Under the
additional assumption of positive homogeneity of φt , i.e.,                                                These pseudo-metrics are designed to align with MPNNs,
φt (λx) = λφt (x), for λ > 0, we define an MPNN layer us-                                                  reflecting their computational properties. Since the expres-
ing mean aggregation and order-normalized readout, where                                                   siveness of MPNNs is bounded by the 1-WL, we aim to
                                                                                                         define pseudo-metrics such that two graphs have a distance
                       (1)                       (2)
                                    X
  h(t)
    v := φt hv
               (t−1)
                     Wt + 1/|N (v)|     h(t−1)
                                         u     Wt      , (5)                                               of 0 if, and only if, they are 1-WL indistinguishable.
                                                   u∈N (v)
                                                                                                         Building on Böker (2021), we define the Tree distance, as
                                                                                                           follows. A matrix S ∈ [0,1]n×n is a doubly-stochastic
                                 X
 hG := ψ         1/|V (G)|              h(L)
                                         u         .                                         (6)
                             u∈V (G)                                                                       matrix if ∥Si,· ∥1 = 1, for i ∈ [n], and ∥S·,j ∥1 = 1, for
    2                                                                                                      j ∈ [n]. Let Dn denote the set of n × n doubly-stochastic
      Implied by Morris et al. (2019), choosing the function φt
appropriately, leads to a 1-WL-equivalent MPNN-layer.                                                      matrices. Given a matrix norm ∥·∥, for two graphs G and

                                                                                                   3
                                                           Covered Forests

H with adjacency matrices A(G) and A(H), respectively,                   forest, by FG,L . We perform the same procedure for the
we define the Tree distance                                              graph (H, ℓH ), resulting in the forest FH,L . Note that the
         T                                                               forests FG,L and FH,L have the same structure but are pos-
        δ∥·∥ (G, H) := min ∥A(G)S − SA(H)∥.                   (7)
                         S∈Dn                                            sibly non-isomorphic due to their vertex labels not matching.
Similarly, we extend the above definition to labeled                     However, we can always find an edge-preserving bijection
             B 3
graphs in Gn,d , resulting in the labeled Tree distance,                 between V (FG,L ) and V (FH,L ). Finally, given a vertex
 T
                                                                         u ∈ V (FG,L ), we denote by l(u) ∈ [L] the level of ver-
δ∥·∥ (G, H)
e           :=
                                                                         tex u in the forest FG,L . Now given a weight function
      min ∥A(G)S − SA(H)∥ + Tr(S ⊺ L(G, H)),                  (8)        ω : N → R+ , we define the Forest distance of depth L and
     S∈Dn                                                                weights ω, between G and H as FDL,ω (G, H) :=
where L(G, H) = [dist(ℓG (i), ℓH (j))]i∈V (G),j∈V (H) for
                                                                                     X
                                                                             min            ω(l(u)) · ∥aG (u) − aH (φ(u))∥2 , (9)
some distance function dist between node features (see Ap-                     φ
                                                                                   u∈V (FG,L )
pendix D). The following result shows that Equations (7)
and (8) are valid pseudo-metrics for many norms.                         where the minimum is taken over all edge-preserving bijec-
Proposition 1. For every entry-wise matrix norm or the cut               tions φ between V (FG,L ) and V (FH,L ).5 When ω(l) = 1,
norm ∥·∥, δeT is a pseudo-metric on G B . Additionally, for              for l ∈ N, we denote the Forest distance by FDL . See Fig-
            ∥·∥                           n,d
                                                T
                                                                         ure 2 for an illustration of the distance. The following result
two vertex-labeled graphs G and H in Gn,d
                                        B
                                            , δe∥·∥ (G, H) =                              (ω)
                                                                         shows that FDL is a valid pseudo-metric.
0 if, and only, if G and H are 1-WL indistinguishable.
                                                                         Lemma 2. For every ω : N → R+ , L ∈ N, the Forest
Although the Tree distance and its extension to labeled                  distance FDL,ω is a well-defined pseudo-metric on Gn,d
                                                                                                                             R
                                                                                                                                . In
graphs match the 1-WL algorithm in expressivity, they do                 addition, for two graphs, G, H, FDL,ω (G, H) = 0 if and
not consider the number of iterations needed to distinguish              only if G, H are 1-WL indistinguishable after L iterations.
two graphs. This limits our ability to provide tighter gen-
eralization error bounds for MPNNs with a fixed number
of layers. To address this, we define the Forest distance                Now the following result shows that the Forest distance is a
on Gn,d
      R
         , which matches the expressivity of 1-WL up to L                simplified version of the TMD defined by Chuang & Jegelka
iterations for fixed L ∈ N.                                              (2022), see Appendix F, providing a streamlined, easy-to-
                                                                         understand definition of the TMD distance while preserving
Forest distance To define the Forest distance, formally, let             all the essential properties required for our analysis.
(G, aG ) and (H, aH ) be attributed graphs of order n, where             Lemma 3. The Forest distance is equivalent to the Tree
aG : V (G) → Rd \ {0Rd } and aH : V (H) → Rd \ {0Rd },                   Mover’s distance. That is, for all n, d, L ∈ N, ω : N → R+ ,
for d ∈ N.4 Given a graph G, a node u ∈ V (G), and a                     and for all graphs G, H ∈ Gn,d
                                                                                                      R
                                                                                                          ,
depth L ∈ N, we define the unrolling tree of u at depth L                                     (ω)
as a rooted tree at u with depth L, where each node has                             TMDL (G, H) = FDL,eω (G, H),
as children its neighbors in the graph G. This tree is also                           Qn
                                                                               e (n) = i=1 ω(i), for i ∈ N.
                                                                         where ω
called the computation tree (see Appendix C for a formal
definition). Now, for a fixed L ∈ N, consider the following              While mathematically equivalent, the Forest distance and
multiset of unrolling trees:                                             TMD have distinct advantages. TMD allows more efficient
                                                                         computation, making it practical for applications, whereas
          TGL := {{τ (unr(G, u, L)) | u ∈ V (G)}}.                       the Forest distance intuitively captures structural differences
To account for unrolling trees of different orders, we per-              between graphs.
form a padding process on all trees in TGL . That is, for
each vertex of each unrolling tree in the multiset TGL , we              Mean Forest distance The Forest distance motivates the
add children with the label 0 until each vertex has exactly              definition of the mean-Forest distance, based on mean
n − 1 children. Hence, after padding, all trees in TGL will              unrolling (computation) trees (see Appendix G). This
have the exact same structure, though the vertices will have             is the first graph pseudo-metric that precisely captures
different labels, and we denote their disjoint union, i.e., a            the distinguishing power of mean aggregation MPNNs
                                                                         (see Lemma 29). These MPNNs also satisfy a Lips-
    3
      Note that this pseudometric can also be defined on the space       chitz property regarding the mean-Forest distance (see
 R
Gn,d , which includes graphs with continuous vertex features. How-
ever, we restrict our proof to Boolean features to establish the              5
                                                                                In the definition of the Forest distance, we use the Euclidean
equivalence with the 1-WL algorithm.                                     norm following Chuang & Jegelka (2022). However, we note that
    4
      Without loss of generality, we use the zero vector 0 for           any other norm could also be used, as all norms are equivalent in
padding purposes.                                                        finite-dimensional spaces.

                                                                     4
                                                            Covered Forests

                                φ                                         have that for all δ ∈ (0,1), with probability at least 1 − δ,
                                                                                                                s
                                                                                                                    2K(S) log(2) + 2 log(1/δ)
                                                                          |ℓexp (hS )−ℓemp (hS )| ≤ ϵ(S)+M                                    ,
                                                                                                                              |S|
                                                                          where hS , as before, denotes a graph embedding from H
   G1                                                      G2             returned by the learning algorithm given the data sample
                                                                          S of Z. We recall that M is the bound on the loss function
                                                                          ℓ.

                                                                          See Appendix I for the refined results of Kawaguchi et al.
                                                                          (2022) and our extension allowing for different radii within
                                                                          each partition set.

                                                                          Connecting robustness, continuity, and expressivity A
                                                                          natural approach to ensure the robustness of the learning
                                                                          algorithm is to impose continuity assumptions on both the
                                                                          loss functions and the graph embeddings. To formalize
                                                                          this, let us consider two pseudo-metric spaces (X , dX ) and
Figure 2. An illustration of the computation of the Forest distance       (Y, dY ), and define the pseudo-metric d∞ : (X ×Y)×(X ×
for depth L = 2 for two labeled graphs G1 and G2 . Grey vertices          Y) → R+ as
indicate the padded vertices in the unrollings, and φ represents an
edge-preserving bijection between the two forests.                            d∞ ((x, y), (x′ , y ′ )) := max{dX (x, x′ ), dY (y, y ′ )}.
                                                                          Let ℓ : X × Y → R+ be a cℓ -Lipschitz continuous loss
Lemma 48). We remark that Chuang & Jegelka (2022) (Ap-                    function concerning the metric d∞ and (G, dG ) be a pseudo-
pendix B.1) introduced the unnormalized tree mover’s dis-                 metric space over a set of graphs. If the covering numbers
tance (TMD∗L ω ) and proved its Lipschitz property for mean               for the spaces (G, dG ) and (Y, dY ) can be bounded above,
aggregation MPNNs. However, TMD∗L      ω is more powerful                 then uniform continuity implies robustness, as shown next.
than the 1-MWL, as it relies on optimal transport between
                                                                          Proposition 5. Let (G, dG ), (X , dX ), and (Y, dY ) be
unrolling trees, capturing 1-WL’s distinguishing power in-
                                                                          pseudo-metric spaces, and let H denote the class of
stead of 1-MWL’s.
                                                                          uniformly continuous graph embeddings from (G, dG ) to
                                                                          (X , dX ). If ℓ : X × Y → R+ is a cℓ -Lipschitz continuous
3. Robustness framework                                                   loss function, regarding d∞ , then for any ε > 0,6 a graph
                                                                          learning algorithm for H on G × Y is
In the following, we introduce the generalization framework
for studying the generalization abilities of MPNNs. We refer                                                              
                                                                                N G, dG , γ(ε, ·)/2 · N (Y, dY , ε/2), cℓ ε -robust.
to Section 1.1 for the formal setup and notation. Slightly
modifying the notation from Xu & Mannor (2012), we say                    Here, γ = γ(ε, hS ) depends on both ε and S is the positive
that a (graph) learning algorithm for the hypothesis class H,             function used in the definition of the uniform continuity of
e.g., a class of graph embeddings, on G := X × Y, is (K, ε)-              hS ∈ H.
robust, for K and ε, mappings from the set of all possible
samples to N and R+ , respectively, if for all samples S, Z               Lipschitzness and equicontinuity of the hypothesis class
                                              K(S)
can be partitioned into K(S) > 0 sets, {Ci }i=1 , such that               By Proposition 5 and Theorem 4, we observe that the gener-
the following holds. If (G, y) ∈ Ci , for some i ∈ [K], then              alization bound depends on the function γ, which, in turn,
for all (G′ , y ′ ) ∈ Ci ,                                                depends on the specific choice of the MPNN hS . Ideally,
            ℓ hS (G), y − ℓ hS (G′ ), y ′ < ε(S),
                                                                        we aim to eliminate this dependency on S by deriving a uni-
                                                                          form bound for all uniformly continuous MPNNs. This can
where hS is the graph embedding the learning algorithm                    be achieved by showing the existence of a “uniform” choice
returns regarding the data sample S. Intuitively, the above               of γ(ε) that satisfies the uniform continuity definition for
definition requires that the difference of the losses of two              all possible MPNNs within a hypothesis class. This prop-
data points in the same part of the partition is small. Xu &              erty is also known as equicontinuity of the hypothesis class.
Mannor (2012) showed that a (K, ϵ)-robust learning algo-                       6
rithm implies a bound on the generalization error.                               Since ε is a function in the definition of robustness, we clarify
                                                                          that here ε refers to a constant function from the set of all possible
Theorem 4 (Theorem 3 in Xu & Mannor (2012)). For any                      samples to a positive real number. For simplicity and with a slight
(K, ϵ)-robust (graph) learning algorithm for H on Z, we                   abuse of notation, we also denote this constant by ε.

                                                                      5
                                                       Covered Forests

For instance, this holds for all the hypothesis classes of all       i.e., the Tree distance. This leads to Proposition 9, The-
c-Lipschitz MPNNs, sharing the same Lipschitz constant c,            orem 10, and Proposition 12 (for a class of binary trees).
in which case we can set γ(ε) = ε/c.                                 Next, we consider labeled graphs and analyze MPNN lay-
                                                                     ers defined in Equation (3), i.e., sum-aggregation MPNNs,
Corollary 6. Let (G, dG ), (X , dX ), and (Y, dY ) be pseudo-
                                                                     using the pseudo-metrics defined in Equation (9), i.e., the
metric spaces, and let H denote the class of cH -Lipschitz
                                                                     Forest distance. This yields Proposition 15 and Proposi-
continuous graph embeddings from (G, dG ) to (X , dX ).
                                                                     tion 16. These results can be extended to mean-aggregation
Assume that the loss function is cℓ -Lipschitz, regard-
                                                                     MPNNs using the mean-Forest distance, as described in Ap-
ing d∞ . Then, graph      learning algorithms     for H are
                                                                   pendix M.
 N G, dG , ε/(2cH ) · N (Y, dY , ε/2), cℓ ε -robust.
                                                                     We first consider unlabeled n-order graphs, i.e., every vertex
As will become clear later, we will use Corollary 6 to de-           has the same label. We analyze the binary classification
rive our generalization bounds in the regression setting,            setting. Following Section 1.1 and Equation (1), here we
assuming a Lipschitz-continuous loss function. However,              investigate the class MPNNord L,M ′ ,LFNN (Gn ). We further con-
for the classification setting, we will specifically use the         sider the binary cross-entropy loss ℓ : R×{0,1} → R, where
cross-entropy loss, which is Lipschitz-continuous, concern-          ℓ(x, y) := y log(σ(x)) + (1 − y) log(1 − σ(x)), where σ is
ing only one argument. In this case, we will need a slightly         the sigmoid function. It is known that ℓ is Lipschitz on the
modified version of Corollary 6 to establish our generaliza-         first argument (since it has a bounded first-order derivative)
tion bounds, resulting in the following proposition, which           for some Lipschitz constant Lℓ .
follows from Xu & Mannor (2012, Theorem 14)
                                                                     In Proposition 1 in Section 1.1, we observed that the Tree
Proposition 7. Let (G, dG ), (X , dX ), and (Y, dY ) be              distance of Equation (7) induces various pseudo-metrics
pseudo-metric spaces, let H be a class of graph embed-               that are equivalent to the 1-WL in terms of expressivity.
dings from (G, dG ) to (X , dX ), and let ℓ : X × Y →                Utilizing the analysis in Böker et al. (2023), we show that
R+ be a loss function. For a graph learning algorithm                the Tree distance using the cut norm satisfies the uniform
for H on G × Y, assume that there exists a positive                  continuity property using the same γ(ε) for all MPNNs in
γ > 0 such that for all samples S and G1 , G2 ∈ G,                   MPNNord L,M ′ ,LFNN (Gn ), i.e., it is equicontinuous. Formally,
y1 , y2 ∈ Y, max{dG (G1 , G2 ), dY (y1 , y2 )} ≤ γ =⇒                we consider the following variant of the Tree distance on
|ℓ(hS (G1 ), y1 ) − ℓ(hS (G2 ), y2 )| < ϵ(S), then, H is             Gn ,
(N (Y, dY , γ/2) · N (G, dG , γ/2), ϵ)-robust.                                T
                                                                             δ□ (G, H) := min ∥A(G)S − SA(H)∥□ ,
                                                                                            S∈Dn
See Appendix J.1 for more details on the relationship be-
tween robustness and continuity.                                     where ∥·∥□ denotes the cut norm, see Equation (11) in Ap-
                                                                     pendix B for details.

4. Fine-grained generalization analysis of                           The following result shows the equicontinuity property of
   MPNNs                                                             MPNNs.
                                                                     Theorem 8. For all ε > 0, L ∈ N there exists γ(ε) > 0
In this section, we derive the main generalization results of        such that for n ∈ N, M ′ ∈ R, G, H ∈ Gn and all MPNN
this work using the robustness framework described in Sec-           architectures in MPNNord
                                                                                           L,M ′ ,LFNN (Gn ), we have
tion 3. First, in Appendix L, we recover the VC-dimension
                                                                         T
bounds from Morris et al. (2023a) within the robustness                 δ□ (G, H) < n2 · γ(ε) =⇒ ∥hG − hH ∥2 ≤ ε.
framework, showing that these bounds can be obtained using
a trivial discrete pseudo-metric between graphs, defined as 1        The proof is a direct implication of Theorems 29 and 31
when the graphs are 1-WL, distinguishable and 0 otherwise,           in Böker et al. (2023) using the uniform continuity of
leading to vacuous generalization bounds. This motivates             MPNNs concerning the Prokhorov metric (Theorem 29)
us to analyze the impact of alternative pseudo-metrics that          and then the ε-δ equivalence between the Prokhorov metric
                                                                                                  T
yield more fine-grained generalization bounds within the             and the Tree distance δ□        (Theorem 31). It is important
robustness framework compared to the trivial 1-WL-based              to note that, in the above result, we proved that all func-
pseudo-metric. Our analysis considers different aggregation          tions in MPNNord   L,M ′ ,LFNN (Gn ), are uniformly continuous
functions, vertex labeling schemes, and loss functions.              sharing the same γ(ε), or equivalently the hypothesis class
                                                                     MPNNord L,M ′ ,LFNN (Gn ) satisfies the equicontinuity property.
We begin by exploring the generalization abilities of MPNN
                                                                     This property is our primary motivation for choosing the
architectures using sum aggregation. Specifically, we con-
                                                                     tree distance as the pseudo-metric.
sider unlabeled graphs and analyze MPNN layers defined
in Equation (1), i.e., order-normalized sum-aggregation              Based on the above result, we define the following non-
MPNNs, using the pseudo-metrics defined in Equation (7),                                 s : R+ ∪ {+∞} → R+ ∪ {+∞}
                                                                     decreasing function γ

                                                                 6
                                                              Covered Forests

where γ(+∞) := +∞, for all G, H ∈ Gn , for all h ∈                      1 − δ, we have
MPNNord
      L,M ′ ,LFNN (Gn ),
                                                                                                                        
                                                                                                                           8k
                                                                                                                   s←
                                                                           |ℓexp (hS ) − ℓemp (hS )| ≤ Lℓ · LFNN · γ
γ                    T
s(ϵ) := sup{δ > 0 | δ□ (G, H) ≤ n2 δ ⇒ ∥hG −hH ∥ ≤ ϵ},                                                                     n2
                                                                                           s
                                                                                                 mn
                                                                                                                                  (10)
                                                                                                     log(2) + 2 log 1δ
                                                                                                                       
                                            s ← : R+ ∪
and define its generalized inverse function γ                                                  4 k+1
           +                    +                                                      +M                                .
{+∞} → R ∪ {+∞}, where R = (0, +∞), as                                                                    |S|
             s← (y) := inf{ϵ > 0 | γ(ϵ) ≥ y}.
             γ
                                                                        for k ∈ N, where M is an upper bound on the loss function
                                                                        ℓ, and mn = |Gn/∼WL |
Note that γs← is also non-decreasing. We further make
the convention that inf{∅} = +∞. We now establish the                   In Appendix I in Proposition 36, we combine the extended
following family of generalization bounds for the class                 robustness definition along with Theorem 35 to extend the
MPNNord L,M ′ ,LFNN (Gn ) based on the results from Proposi-            generalization bounds from Theorem 10 to the class of unla-
tion 7.                                                                 beled graphs with at most n vertices, denoted as G≤n . The
                                                                        proof of Proposition 36 is omitted, as it directly follows from
Proposition 9. For n, L ∈ N, M ′ ∈ R, and ε > 21 d∗ ,
                                                                        the tree construction described in the proof of Theorem 10.
where d∗ is the minimum non-zero δ□   T
                                        distance between two
graphs in Gn , any graph learning algorithm for the class
                                                                        Tighter bounds on the covering number The proof
MPNNordL,M ′ ,LFNN (Gn ) is
                                                                     of Theorem 10 establishes an upper bound on the cover-
                                      ← 2ε                              ing number, decreasing linearly with the radius. We can use
    
                  T
      2N (Gn , δ□ , ε), Lℓ · LFNN · γ           -robust.
                                                                        this bound to determine the optimal radius minimizing the
                                    s
                                          n2
                                                                        generalization bound in Equation (10). However, it remains
Hence, for any sample S and δ ∈ (0,1), with probability at
                                                                        unclear if this upper bound on the covering number is tight
least 1 − δ,
                                                                        or if the linear decay can be improved. Moreover, the bound
                                                                        mn/(k + 1) relies on the number of equivalence classes m ,
                                                                                                                                n
                                             ←       2ε                 which is hard to compute.
  |ℓexp (hS ) − ℓemp (hS )| ≤ Lℓ · LFNN · γ s
                                                     n2                 To address this, we analyze specific graph classes that
                  s
                                T , ε) log(2) + 2 log(1/δ )
                      4N (Gn , δ□                                       yield tighter bounds and simplify the computation of 1-
              +M                                            ,           WL-distinguishable graphs. First, consider the class of un-
                                        |S|
                                                                        ordered, unlabeled, full binary trees on n vertices, denoted
                                                                          (2)
                                                                        Tn , where n = 2j + 1 and j ∈ N. This class includes
where M is an upper bound for the loss function ℓ and Lℓ                rooted trees where each non-root vertex has 0 or 2 children.
is the Lipschitz constant of ℓ(·, y), and y ∈ {0,1}.                    The root need not be explicitly specified here since it is the
                                                                        only vertex with degree 2; all others have degree 1 or 3.
                                                                                         (2)
As can be observed by Proposition 9, the tree distance—a                The graphs in Tn are also called Otter trees, named after
more fine-grained metric compared to the trivial 1-WL met-              Richard Otter’s work on their enumeration (Otter, 1948).
ric (which is 1 for 1-WL-distinguishable graphs and 0 oth-              The total number of Otter trees on n vertices, for n = 2j +1,
erwise)—enables deriving a wider range of generalization                is given by the Wedderburn–Etherington number wj , with
bounds by allowing any real number as the radius for the                j ∈ N. Although no closed-form formula exists for wj , re-
covering number. Choosing the radius ε is critical for tight            cursive methods enable efficient computation. Additionally,
generalization bounds: larger ε reduces the covering number             the following asymptotic result holds.
but increases the first term of the bound, while smaller ε              Lemma 11 ((Finch, 2005, p. 295)). The asymptotic growth
has the opposite effect. Balancing this trade-off is impor-             of wn is given by wn ∼ A·n−3/2 ·bn , for a positive constant
tant, though computing the covering number as a function                A whose precise value is not relevant for our purposes and
of ε is an extremely hard problem. For a given n, the cov-              b ≈ 2.4832.
ering number can instead be bounded in terms of ε and
                                                                        Based on this lemma, we show that for sufficiently large n,
mn = |Gn/∼WL |, yielding covering number bounds depen-
                                                                        we can bound the covering number of the set of Otter trees
dent on ε. For n-order graphs Gn and ε = 4k, a cover of
                                                                        with a function that decreases exponentially regarding the
size mn/(k + 1) can be constructed for all k ∈ N, leading to
                                                                        radius of the cover leading. This results in the following
a family of bounds parametrized by k.
                                                                        (tighter) generalization bounds for MPNNs on the space of
Theorem 10. For n, L ∈ N, and M ′ ∈ R, for any graph                    Otter trees.
learning algorithm for the class MPNNord
                                      L,M ′ ,LFNN (Gn ) and             Proposition 12. For L ∈ N, M ′ ∈ R and sufficiently
for any sample S and δ ∈ (0,1), with probability at least               large n ∈ N, for any graph learning algorithm on

                                                                    7
                                                         Covered Forests

                     (2)
MPNNord L,M ′ ,LFNN (T2n+1 ) and for any sample S, with δ ∈            erty of MPNNs in MPNNsum     L,M ′ ,LFNN (Gn,d,q ) concerning the
(0,1), with probability at least 1 − δ, we have                        Forest distance. While our analysis is restricted to Gn,d,q , we
                                                                     state and prove the following result in the more general set-
                                            ←       16k
 |ℓexp (hS ) − ℓemp (hS )| ≤ Lℓ · LFNN · γs                            ting of graphs in Gn,d
                                                                                          R
                                                                                              , i.e., with real-valued vertex features.
                                                (2n + 1)2
                   s                                                   Lemma 14. For L, n, d ∈ N, M ′ ∈ R and for all MPNNs
                      4wn/b2k log(2) + 2 log(1/δ)                      in MPNNsum           R
             +M                                   ,                           L,M ′ ,LFNN (Gn,d ), we have
                                  |S|
                                                                                                         L
                                                                                               1        Y
where k ∈ N, M is an upper bound on the loss function ℓ,                    ∥hG − hH ∥2 ≤        C(L)Lψ     Lφi FDL (G, H),
                        (2)                                                                    n
b ≈ 2.4832, and wn = |T2n+1 |.                                                                          i=1

                                                                       for G, H ∈ Gn,d
                                                                                    R
                                                                                       , where C(L) is a constant that depends on
Note that using the above bound with a radius mildly depen-            L and the Lipschitz constants of the MPNN layers.
dent on n, say logb (n), we can derive an upper bound on
the covering number that decreases quadratically with n.               We are now ready to present the generalization bound exten-
Additionally, in Appendix N, we derive a graph class (de-              sion for labeled graphs.
noted as Fn ) that leads to non-constant improvement for a             Proposition 15. For ε > 0 and n, L, d, q ∈ N, M ′ ∈ R,
constant ε and lift the above results to the regression setting.       any graph learning algorithm for MPNNsum
                                                                                                             L,M ′ ,LFNN (Gn,d,q )
                                                                       is
Vertex-labeled graphs Finally, in this section, we aim
to extend the previous results to the space of discretely-                (2N (Gn,d,q , FDL , ε), Lℓ · LFNN · CFDL · 2ε)-robust.
labeled n-order graphs, where vertex features are drawn                Hence, we have the following generalization bounds. For
from a finite collection of d elements, i.e., Gn,d
                                               B
                                                   . For ease of       any sample S and δ ∈ (0,1), with probability at least 1 − δ,
notation, we consider one-hot encoding of the labels. Thus,
all vertices are initially labeled with a d-dimensional vector,        |ℓexp (hS ) − ℓemp (hS )| ≤ Cε
                                                                                                   e
having a 1 in one position and 0 elsewhere. Furthermore,                               s
we consider the set of graphs with bounded-degree q, for                                   N (Gn,d,q , FDL , ε)4 log(2) + 2 log(1/δ)
                                                                                   +M                                                ,
q ∈ N. We denote this set as Gn,d,q , and the number of                                                       |S|
equivalence classes induced by the 1-WL after L iterations
on this set by mn,d,q,L , or simply mn,d,q when L = n − 1.             for ε > 0, where C  e = 2/nLℓ LFNN CFD , CFD =
                                                                                                                   L   L
                                                                               QL
To establish our generalization bounds based on the robust-            C(L)Lψ i=1 Lφi is the Lipschitz constant in Lemma 14
ness framework, we use the Forest distance FDL as defined              and M is an upper bound of the loss function ℓ.
in Section 2. We begin with the following simple lemma,
bounding the Forest distance between two graphs differing              Using a similar construction as Theorem 10, below, we up-
by either one edge or one label. Moreover, the following               per bound the covering number in the generalization bound
lemma explains the assumption of bounded degree in our                 by a function of the corresponding radius and mn,d,q,L ,
graph class. Without this assumption, the bound below                  leading to the following generalization bound.
would grow with n, making it impossible to establish uni-              Proposition 16. For n, q, d, L ∈ N, and M ′ ∈
form generalization bounds.                                            R, for any graph learning algorithm for the class
Lemma 13. For d, q ∈ N, there exists a constant b(d, q, L)             MPNNsum L,M ′ ,LFNN (Gn,d,q ) and for any sample S and δ ∈
such that for n ∈ N and G, H ∈ Gn,d,q , if G can be de-                (0,1), with probability at least 1 − δ, we have
rived by either deleting an edge or changing a single ver-
tex feature of H, then FDL (G, H) ≤ b(d, q, L), where                       |ℓexp (hS ) − ℓemp (hS )| ≤ 2Cb(d,
                                                                                                         e     q, L)k
                      L
b(d, q, L) = 2q L 1−q
                                                                                            s
                   1−q .
                                                                                                mn,d,q,L               1
                                                                                                  k+1 4 log(2) + 2 log( /δ )
                                                                                        +M                                   ,
In the following, we analyze the generalization                                                             |S|
power of MPNNsum    L,M ′ ,LFNN (Gn,d,q ). Similar to the
case of unlabeled graphs, we consider the cross-                       for k ∈ N, where C  e = 2/nLℓ LFNN CFD , CFD =
                                                                                                                   L   L
                                                                               QL
entropy function ℓ : R × {0,1} → R, defined by                         C(L)Lψ i=1 Lφi is the Lipschitz constant in Lemma 14
ℓ(x, y) = y log(σ(x)) + (1 − y) log(1 − σ(x)), where                   and M is an upper bound of the loss function ℓ.
σ(x) is the sigmoid function. As with unlabeled graphs,
our generalization analysis requires MPNNs to be Lipschitz             In Appendix M, we lift the results to MPNNs using mean
continuous with respect to the chosen pseudo-metric. The               aggregation. Additionally, in Section 5, we discuss our
following result demonstrates the Lipschitz continuity prop-           analysis’s limitations and future work.

                                                                   8
                                                        Covered Forests

5. Limitations, possible road maps, and future
                                                                      Table 1. The empirical generalization gap computed using the 1-
   work                                                               norm and our generalization bound based on estimates of the
                                                                      Lipschitz constant and the upper bound on the loss function.
While our results are the first to successfully incorporate
                                                                                                                         Dataset
non-trivial graph similarities, architectural choices, and                                      M UTAG          NCI1          MCF-7H        O GBG -M OLHIV
loss functions into the generalization analysis, many open             Train loss              1.890 ±0.078   0.535 ±0.007   0.327 ±0.026     0.144 ±0.006
questions remain regarding MPNN generalization proper-                 Test loss               1.546 ±0.054   0.588 ±0.151   0.325 ±0.010     0.151 ±0.005
                                                                       Generalization gap      0.344 ±0.095   0.053 ±0.151   0.002 ±0.028     0.007 ±0.008
ties. First, our techniques are tailored towards discretely-           Our bound (Optimal ε)      0.705          0.060          0.007            0.015
labeled graphs, e.g., not accounting for real-valued labels.           Our bound (ε = 0)          0.946          0.079          0.008            0.019
While Rauchwerger et al. (2024) did a first step in this direc-
tion, their generalization bounds are implicit or existential,        serve that the covering number increases with larger graph
i.e., they do not derive concrete upper bounds on the size of         orders or smaller radii, aligning with the expected behavior.
the covering, only showing the existence of a finite cover-           Figure 10 in the appendix demonstrates that the covering
ing via the compactness of the investigated pseudo-metric             number bound presented in Theorem 10 is tighter than the
spaces. Secondly, while our analysis can be extended to               number of 1-WL indistinguishable graphs, mn , when com-
other aggregation functions, e.g., weighted mean, it does             pared to the optimal cover, N (·, δ1T , ε), highlighting the
not account for other commonly used architectural choices,            usefulness of our upper bound. This observation holds even
such as normalization layers or skip connections. Thirdly,            though the optimal cover is based on the 1-norm while our
although the experimental results in Section 6 indicate that          bound is derived using the cut norm, further solidifying the
our generalization analysis holds in practice to some extent,         improved bound introduced in Theorem 10.
it does not explain why gradient descent-based algorithms
converge to generalizing solutions. Hence, future work
should extend our results to graphs with real-valued features         Q2 See Figure 11 in the appendix. We observe a strong
and study whether gradient descent-based algorithms can               correlation between the Forest distance and the MPNN out-
converge to parameter assignments inducing the desired                put variations, indicated by a high Pearson correlation co-
coverings.                                                            efficient across varying datasets and MPNN layers. This
                                                                      finding supports the validity of defining the Forest distance’s
                                                                      Lipschitz constant in Lemma 14, showing that it captures
6. Experimental study                                                 the computation of MPNNs.
In the following, we investigate to what extent our theoreti-
cal results translate into practice. Specifically, we answer
                                                                      Q3 See Table 1. The results demonstrate that the cover-
the following questions.
                                                                      ing number bound presented in Proposition 15 is tight in
Q1 To what extent do the empirical covering numbers for               real-world settings, in the sense that the empirical general-
   different graph families match the theoretical upper               ization gap and the computed bound are of the same order of
   bounds derived in Section 4?                                       magnitude, closely reflecting the real-world generalization
                                                                      behavior. Furthermore, incorporating the upper bound pre-
Q3 How are the Forest distance and MPNN outputs corre-                sented in Proposition 16 yields an even tighter bound over
   lated?                                                             simply equating the covering number to the total number of
Q3 How does the covering number influence the general-                1-WL indistinguishable graphs.
   ization performance of MPNNs?
                                                                      7. Conclusion
See https://github.com/benfinkelshtein/
CoveredForests for source code and instructions to                    Here, we focused on understanding how choosing different
reproduce all results.                                                pseudo-metrics on the set of graphs and capturing the com-
                                                                      putation of different MPNN architectures allow for a tighter
See Appendix P for an overview of employed data sets,
                                                                      analysis of the generalization error of MPNNs. Unlike pre-
neural architectures, experimental protocols, and model con-
                                                                      vious works, our refined analysis allows us to account for
figurations.
                                                                      non-trivial graph similarities, the impact of different ag-
                                                                      gregation functions, and various practically relevant loss
Results and discussion In the following, we answer Q1-                functions. Our empirical study confirmed the validity of
Q3.                                                                   our theoretical findings. Overall, our theoretical framework
                                                                      constitutes an essential initial step in unraveling how graph
Q1 See Figures 8 and 9 in the appendix. Across the graph              structure and architectural choices influence the MPNNs’
               (2)
classes Gn , Tn , Fn , and all real-world datasets, we ob-            generalization properties.

                                                                  9
                                                      Covered Forests

Acknowledgements                                                     Bartlett, P. L., Foster, D. J., and Telgarsky, M. Spectrally-
                                                                       normalized margin bounds for neural networks. In Ad-
Antonis Vasileiou is funded by the German Research Foun-               vances in Neural Information Processing Systems, 2017.
dation (DFG) within Research Training Group 2236/2 (Un-                15
RAVeL). Ben Finkelshtein is supported by the Clarendon
Scholarship. Christopher Morris is partially funded by a             Baskin, I. I., Palyulin, V. A., and Zefirov, N. S. A neural
DFG Emmy Noether grant (468502433) and RWTH Junior                     device for searching direct correlations between struc-
Principal Investigator Fellowship under Germany’s Excel-               tures and properties of chemical compounds. Journal
lence Strategy. Ron Levie is supported by a grant from the             of Chemical Information and Computer Sciences, 37(4):
United States-Israel Binational Science Foundation (BSF),              715–721, 1997. 15
Jerusalem, Israel, and the United States National Science
Foundation (NSF), (NSF-BSF, grant No. 2024660), and by               Bento, J. and Ioannidis, S. A family of tractable graph
the Israel Science Foundation (ISF grant No. 1937/23). We              metrics. Applied Network Science, 4(1):107, 2019. 22
thank Erik Müller for crafting the figures.
                                                                     Böker, J. Graph similarity and homomorphism densities.
                                                                       In Bansal, N., Merelli, E., and Worrell, J. (eds.), Inter-
Impact statement
                                                                       national Colloquium on Automata, Languages, and Pro-
This paper aims to advance the field of machine learning               gramming, 2021. 1, 3, 16, 35
by providing tight bounds that enhance the theoretical un-
derstanding of MPNNs. While our findings hold significant            Borgwardt, K. M., Ghisu, M. E., Llinares-López, F., O’Bray,
potential for societal impact, this discussion is beyond the           L., and Rieck, B. Graph kernels: State-of-the-art and
immediate scope of this work.                                          future challenges. Foundations and Trends in Machine
                                                                       Learning, 13(5–6), 2020. 16
References                                                           Bruna, J., Zaremba, W., Szlam, A., and LeCun, Y. Spectral
Alon, N. and Naor, A. Approximating the cut-norm via                   networks and deep locally connected networks on graphs.
  grothendieck’s inequality. In Conference Proceedings of              In International Conference on Learning Representation,
  the Annual ACM Symposium on Theory of Computing,                     2014. 15
  2004. 32
                                                                     Böker, J., Levie, R., Huang, N., Villar, S., and Morris, C.
Alon, N., Vega, W. F. D. L., Kannan, R., and Karpinski,                Fine-grained expressivity of graph neural networks. In Ad-
  M. Random sampling and approximation of max-csp                      vances in Neural Information Processing Systems, 2023.
  problems. In Conference Proceedings of the Annual ACM               1, 6, 16, 32, 34, 35, 40
  Symposium on Theory of Computing, 2002. 32
                                                                     Cai, J., Fürer, M., and Immerman, N. An optimal lower
Andrews, G. E. and Eriksson, K. Integer Partitions. Cam-               bound on the number of variables for graph identifications.
  bridge University Press, 2004. 39                                    Combinatorica, 12(4):389–410, 1992. 18

Arvind, V., Köbler, J., Rattan, G., and Verbitsky, O. On the         Cappart, Q., Chételat, D., Khalil, E., Lodi, A., Morris, C.,
  power of color refinement. In International Symposium                and Veličković, P. Combinatorial optimization and rea-
  on Fundamentals of Computation Theory, 2015. 18                      soning with graph neural networks. Journal of Machine
                                                                       Learning Research, 24:130:1–130:61, 2023. 1
Azizian, W. and Lelarge, M. Characterizing the expressive
  power of invariant and equivariant graph neural networks.          Chen, S., Lim, S., Mémoli, F., Wan, Z., and Wang, Y.
  In International Conference on Learning Representations,             Weisfeiler-Lehman meets Gromov-Wasserstein. In Inter-
  2021. 1                                                              national Conference on Machine Learning, 2022. 1

Babai, L. and Kucera, L. Canonical labelling of graphs in            Chen, S., Lim, S., Mémoli, F., Wan, Z., and Wang, Y. The
  linear average time. In Symposium on Foundations of                  Weisfeiler-Lehman distance: Reinterpretation and con-
  Computer Science, 1979. 18                                           nection with GNNs. In Topological, Algebraic and Geo-
                                                                       metric Learning Workshop, 2023. 1
Baranwal, A., Fountoulakis, K., and Jagannath, A. Graph
  convolution for semi-supervised classification: Improved           Chen, Z., Villar, S., Chen, L., and Bruna, J. On the equiv-
  linear separability and out-of-distribution generalization.          alence between graph isomorphism testing and function
  In International Conference on Machine Learning, 2021.               approximation with GNNs. In Advances in Neural Infor-
  15                                                                   mation Processing Systems, 2019. 1

                                                                10
                                                      Covered Forests

Chuang, C. and Jegelka, S. Tree mover’s distance: Bridg-            Feng, J., Chen, Y., Li, F., Sarkar, A., and Zhang, M. How
  ing graph metrics and stability of graph neural networks.           powerful are k-hop message passing graph neural net-
  In Advances in Neural Information Processing Systems,               works. In Advances in Neural Information Processing
  2022. 2, 4, 5, 16, 27, 28, 31                                       Systems, 2022. 48

Chuang, C.-Y., Mroueh, Y., Greenewald, K., Torralba, A.,            Fey, M. and Lenssen, J. E. Fast graph representation learning
  and Jegelka, S. Measuring generalization with optimal               with PyTorch Geometric. In International Conference on
  transport. In Advances in Neural Information Processing             Learning Representations, Workshop on Representation
  Systems, 2021. 16                                                   Learning on Graphs and Manifolds, 2019. 48

Daniëls, N. and Geerts, F. A note on the VC dimension of            Finch, S. R. Mathematical constants, volume 94 of Ency-
 1-dimensional GNNs. arXiv preprint, 2024. 15                         clopedia of mathematics and its applications. Cambridge
                                                                      University Press, 2005. 7
Defferrard, M., Bresson, X., and Vandergheynst, P. Con-
  volutional neural networks on graphs with fast localized          Franks, B. J., Anders, M., Kloft, M., and Schweitzer, P. A
  spectral filtering. In Advances in Neural Information               systematic approach to universal random features in graph
  Processing Systems, 2016. 15                                        neural networks. Transactions on Machine Learning
                                                                      Research, 2023. 1
Dell, H., Grohe, M., and Rattan, G. Lovász meets Weisfeiler
                                                                    Franks, B. J., Morris, C., Velingker, A., and Geerts, F.
  and Leman. In International Colloquium on Automata,
                                                                      Weisfeiler-leman at the margin: When more expressivity
  Languages, and Programming, 2018. 16
                                                                      matters. In International Conference on Machine Learn-
D’Inverno, G. A., Bianchini, M., and Scarselli, F. Vc di-             ing, 2024. 15
  mension of graph neural networks with pfaffian activation         Frieze, A. M. and Kannan, R. Quick approximation to
  functions. arXiv preprint, 2024. 15                                 matrices and applications. Comb., 1999. 32, 34
Duval, A., Mathis, S. V., Joshi, C. K., Schmidt, V., Miret,         Gama, F., Marques, A. G., Leus, G., and Ribeiro, A. Con-
  S., Malliaros, F. D., Cohen, T., Lio, P., Bengio, Y., and           volutional neural network architectures for signals sup-
  Bronstein, M. M. A hitchhiker’s guide to geometric                  ported on graphs. IEEE Transactions on Signal Process-
  GNNs for 3d atomic systems. arXiv preprint, 2023. 1                 ing, 67(4):1034–1049, 2019. 15
Duvenaud, D., Maclaurin, D., Aguilera-Iparraguirre, J.,             Garg, V. K., Jegelka, S., and Jaakkola, T. S. Generalization
  Gómez-Bombarelli, R., Hirzel, T., Aspuru-Guzik, A.,                 and representational limits of graph neural networks. In
  and Adams, R. P. Convolutional networks on graphs for               International Conference on Machine Learning, 2020. 15
  learning molecular fingerprints. In Advances in Neural
 Information Processing Systems, 2015. 15                           Geerts, F. and Reutter, J. L. Expressiveness and approxima-
                                                                      tion properties of graph neural networks. In International
Dvorák, Z. On recognizing graphs by numbers of homomor-               Conference on Learning Representations, 2022. 1
  phisms. Journal of Graph Theory, 64(4):330–342, 2010.
                                                                    Gilmer, J., Schoenholz, S. S., Riley, P. F., Vinyals, O., and
 16
                                                                      Dahl, G. E. Neural message passing for quantum chem-
Easley, D. and Kleinberg, J. Networks, Crowds, and Mar-               istry. In International Conference on Machine Learning,
  kets: Reasoning About a Highly Connected World. Cam-                2017. 1, 2, 15
  bridge University Press, 2010. 1                                  Goldreich, O. Introduction to testing graph properties. In
Eisner, T., Farkas, B., Haase, M., and Nagel, R. Operator            Property Testing. Springer, 2010. 16
  Theoretic Aspects of Ergodic Theory. Published: Gradu-            Goller, C. and Küchler, A. Learning task-dependent
  ate Text in Mathematics, 2015. 35                                   distributed representations by backpropagation through
                                                                      structure. In International Conference on Neural Net-
El-Yaniv, R. and Pechyony, D. Transductive rademacher
                                                                      works, 1996. 15
  complexity and its applications. In Annual Conference
  on Learning Theory, 2007. 15                                      Grohe, M. Descriptive Complexity, Canonisation, and De-
                                                                      finable Graph Structure Theory. Cambridge University
Esser, P. M., Vankadara, L. C., and Ghoshdastidar, D. Learn-          Press, 2017. 18, 26
  ing theory can (sometimes) explain generalisation in
  graph neural networks. In Advances in Neural Infor-               Grohe, M. The logic of graph neural networks. In Sympo-
  mation Processing Systems, 2021. 15                                 sium on Logic in Computer Science, 2021. 18

                                                               11
                                                      Covered Forests

Hamilton, W. L., Ying, Z., and Leskovec, J. Inductive                  weather forecasting. Science, 382(6677):1416–1421,
  representation learning on large graphs. In Advances in              2023. 1
  Neural Information Processing Systems, 2017. 15
                                                                     Lee, J., Hwang, M., and Whang, J. J. PAC-Bayesian gen-
Hammer, B. Generalization ability of folding networks.                 eralization bounds for knowledge graph representation
  IEEE Transactions on Knowledge and Data Engineering,                 learning. In International Conference on Machine Learn-
 13(2):196–206, 2001. 15                                               ing, 2024. 15

Hu, W., Fey, M., Zitnik, M., Dong, Y., Ren, H., Liu, B.,             Levie, R. A graphon-signal analysis of graph neural net-
  Catasta, M., and Leskovec, J. Open graph benchmark:                  works. In Advances in Neural Information Processing
  Datasets for machine learning on graphs. In Advances in              Systems, 2023. 15, 16
 Neural Information Processing Systems, 2020. 48
                                                                     Levie, R., Monti, F., Bresson, X., and Bronstein, M. M.
Ju, H., Li, D., Sharma, A., and Zhang, H. R. Generaliza-               Cayleynets: Graph convolutional neural networks with
  tion in graph neural networks: Improved PAC-Bayesian                 complex rational spectral filters. IEEE Transactions on
  bounds on graph diffusion. arXiv preprint, 2023. 15                  Signal Processing, 67(1):97–109, 2019. 15

Karczewski, R., Souza, A., and Garg, V. On the general-              Li, S., Geerts, F., Kim, D., and Wang, Q. Towards bridging
  ization of equivariant graph neural networks. In Interna-            generalization and expressivity of graph neural networks.
  tional Conference on Machine Learning, 2024. 15                      arXiv preprint, 2024. 16

Karpinski, M. and Macintyre, A. Polynomial bounds for                Liao, R., Urtasun, R., and Zemel, R. S. A PAC-Bayesian
  VC dimension of sigmoidal and general Pfaffian neural                approach to generalization bounds for graph neural net-
  networks. Journal of Computer and System Sciences, 54                works. In International Conference on Learning Repre-
  (1):169–176, 1997. 15                                                sentations, 2021. 1, 15

Kawaguchi, K., Deng, Z., Luh, K., and Huang, J. Robust-              Lovász, L. Large Networks and Graph Limits. American
  ness implies generalization via data-dependent general-              Mathematical Society, 2012. 1, 34
  ization bounds. In International Conference on Machine             Maehara, T. and NT, H. A simple proof of the universality
  Learning, 2022. 1, 5, 15, 32                                        of invariant/equivariant graph neural networks. arXiv
Kingma, D. P. and Ba, J. Adam: A method for stochastic                preprint, 2019. 1
  optimization. In International Conference on Learning              Mao, A., Mohri, M., and Zhong, Y. Cross-entropy loss
  Representations, 2015. 48                                           functions: Theoretical analysis and applications. In Inter-
                                                                      national Conference on Machine Learning, 2023. 48
Kipf, T. N. and Welling, M. Semi-supervised classifica-
  tion with graph convolutional networks. In International           Maskey, S., Lee, Y., Levie, R., and Kutyniok, G. General-
  Conference on Learning Representations, 2017. 15                    ization analysis of message passing neural networks on
                                                                      large random graphs. In Advances in Neural Information
Kireev, D. B. Chemnet: A novel neural network based
                                                                      Processing Systems, 2022. 15
  method for graph/property mapping. Journal of Chemi-
  cal Information and Computer Sciences, 35(2):175–180,              Maskey, S., Kutyniok, G., and Levie, R. Generalization
  1995. 15                                                            bounds for message passing networks on mixture of
                                                                      graphons. arXiv preprint, 2024. 15
Kriege, N. M., Morris, C., Rey, A., and Sohler, C. A prop-
  erty testing framework for the theoretical expressivity            Merkwirth, C. and Lengauer, T. Automatic generation of
  of graph kernels. In International Joint Conference on              complementary descriptors with molecular graph net-
  Artificial Intelligence, 2018. 16                                   works. Journal of Chemical Information and Modeling,
                                                                      45(5):1159–1168, 2005. 15
Kriege, N. M., Johansson, F. D., and Morris, C. A survey
  on graph kernels. Applied Network Science, 5(1):6, 2020.           Micheli, A. Neural network for graphs: A contextual con-
  16                                                                  structive approach. IEEE Transactions on Neural Net-
                                                                      works, 20(3):498–511, 2009. 15
Lam, R., Sanchez-Gonzalez, A., Willson, M., Wirnsberger,
  P., Fortunato, M., Alet, F., Ravuri, S., Ewalds, T., Eaton-        Micheli, A. and Sestito, A. S. A new neural network model
  Rosen, Z., Hu, W., Merose, A., Hoyer, S., Holland, G.,              for contextual processing of graphs. In Italian Workshop
  Vinyals, O., Stott, J., Pritzel, A., Mohamed, S., and               on Neural Nets Neural Nets and International Workshop
  Battaglia, P. Learning skillful medium-range global                 on Natural and Artificial Immune Systems, 2005. 15

                                                                12
                                                        Covered Forests

Mohri, M., Rostamizadeh, A., and Talwalkar, A. Founda-                 Rauchwerger, L., Jegelka, S., and Levie, R. Generalization,
 tions of Machine Learning. MIT Press, 2018. 15                          expressivity, and universality of graph neural networks
                                                                         on attributed graphs. arXiv preprint, 2024. 1, 9, 15, 16
Monti, F., Boscaini, D., Masci, J., Rodolà, E., Svoboda,
 J., and Bronstein, M. M. Geometric deep learning on                   Satorras, V. G., Hoogeboom, E., and Welling, M. E(n) equiv-
 graphs and manifolds using mixture model cnns. In IEEE                  ariant graph neural networks. In International Conference
 Conference on Computer Vision and Pattern Recognition,                  on Machine Learning, 2023. 15
 2017. 15
                                                                       Scarselli, F., Gori, M., Tsoi, A. C., Hagenbuchner, M., and
Morris, C., Ritzert, M., Fey, M., Hamilton, W. L., Lenssen,              Monfardini, G. The graph neural network model. IEEE
 J. E., Rattan, G., and Grohe, M. Weisfeiler and Leman                   Transactions on Neural Networks, 20(1):61–80, 2009. 1,
 go neural: Higher-order graph neural networks. In AAAI                  15
 Conference on Artificial Intelligence, 2019. 1, 3, 18, 19,
 21, 34, 37                                                            Scarselli, F., Tsoi, A. C., and Hagenbuchner, M. The Vapnik-
                                                                         Chervonenkis dimension of graph and recursive neural
Morris, C., Kriege, N. M., Bause, F., Kersting, K., Mutzel, P.,
                                                                         networks. Neural Networks, pp. 248–259, 2018. 1, 15
 and Neumann, M. TUDataset: A collection of benchmark
 datasets for learning with graphs. arXiv preprint, 2020a.             Scavuzzo, L., Aardal, K. I., Lodi, A., and Yorke-Smith, N.
 18, 48                                                                  Machine learning augmented branch and bound for mixed
                                                                         integer linear programming. arXiv preprint, 2024. 1
Morris, C., Rattan, G., and Mutzel, P. Weisfeiler and Le-
 man go sparse: Towards higher-order graph embeddings.                 Sokolic, J., Giryes, R., Sapiro, G., and Rodrigues, M. R. D.
 In Advances in Neural Information Processing Systems,                   Generalization error of invariant classifiers. In Interna-
 2020b. 18                                                               tional Conference on Artificial Intelligence and Statistics,
Morris, C., Geerts, F., Tönshoff, J., and Grohe, M. WL meet              2017. 15
 VC. In International Conference on Machine Learning,
                                                                       Sperduti, A. and Starita, A. Supervised neural networks
 2023a. 1, 2, 6, 15, 22, 36, 37
                                                                         for the classification of structures. IEEE Transactions on
Morris, C., L., Y., Maron, H., Rieck, B., Kriege, N. M.,                 Neural Networks, 8(3):714–35, 1997. 15
 Grohe, M., Fey, M., and Borgwardt, K. Weisfeiler and
 Leman go machine learning: The story so far. Journal of               Sverdlov, Y., Davidson, Y., Dym, N., and Amir, T. FSW-
 Machine Learning Research, 24:333:1–333:59, 2023b. 1,                   GNN: A bi-lipschitz wl-equivalent graph neural network.
 18                                                                      arXiv preprint, 2024. 16

Morris, C., Frasca, F., Dym, N., Maron, H., Ceylan, İ. İ.,           Tang, H. and Liu, Y. Towards understanding generalization
 Levie, R., Lim, D., Bronstein, M. M., Grohe, M., and                    of graph neural networks. In International Conference
 Jegelka, S. Future directions in the theory of graph ma-                on Machine Learning, 2023. 15
 chine learning. In International Conference on Machine
 Learning, 2024. 1                                                     Tinhofer, G. Graph isomorphism and theorems of Birkhoff
                                                                         type. Computing, pp. 285–300, 1986. 25
Nesterov, Y. and Nemirovskii, A. Interior-Point Polyno-
  mial Algorithms in Convex Programming. Interior-Point                Tinhofer, G. A note on compact graphs. Discrete Applied
  Polynomial Algorithms in Convex Programming, 1994.                     Mathematics, pp. 253–264, 1991. 16, 22
  32
                                                                       Tolstikhin, I. O. and Lopez-Paz, D. Minimax lower bounds
Otter, R. The number of trees. The Annals of Mathematics,                for realizable transductive classification. arXiv preprint,
  49, 1948. 7                                                            2016. 15

Pellizzoni, P., Schulz, T., Chen, D., and Borgwardt, K. M.             van der Vaart, A. W., a JA Wellner, J., der Vaart, A. V.,
  On the expressivity and sample complexity of node-                     and a JA Wellner, J. Weak Convergence and Empirical
  individualized graph neural networks. In Advances in                   Processes: With Applications to Statistics. 1996. Springer,
  Neural Information Processing Systems, 2024. 15                        1996. 33
Qian, C., Manolache, A., Ahmed, K., Zeng, Z., den Broeck,              Vapnik, V. Statistical learning theory. Wiley, 1998. 15, 36
  G. V., Niepert, M., and Morris, C. Probabilistically
  rewired message-passing neural networks. In Interna-                 Vapnik, V. N. The Nature of Statistical Learning Theory.
  tional Conference on Learning Representation, 2024. 1                  Springer, 1995. 1, 15

                                                                  13
                                                       Covered Forests

Vapnik, V. N. and Chervonenkis, A. A note on one class of             M. M., Zitnik, M., Anandkumar, A., Ermon, S., Liò, P.,
  perceptrons. Avtomatika i Telemekhanika, 24(6):937–945,             Yu, R., Günnemann, S., Leskovec, J., Ji, H., Sun, J.,
  1964. 15, 36                                                        Barzilay, R., Jaakkola, T. S., Coley, C. W., Qian, X., Qian,
                                                                      X., Smidt, T. E., and Ji, S. Artificial intelligence for
Vapnik, V. N. and Chervonenkis, A. Y. On the uniform                  science in quantum, atomistic, and continuum systems.
  convergence of relative frequencies of events to their              arXiv preprint, 2023. 1
  probabilities. Theory of Probability & Its Applications,
  16(2):264–280, 1971. 15
Veličković, P., Cucurull, G., Casanova, A., Romero, A.,
  Liò, P., and Bengio, Y. Graph attention networks. In
  International Conference on Learning Representations,
  2018. 15
Verma, S. and Zhang, Z. Stability and generalization of
  graph convolutional neural networks. In International
  Conference on Knowledge Discovery & Data Mining,
  2019. 15
Weisfeiler, B. On Construction and Identification of Graphs.
 Springer, 1976. 1
Weisfeiler, B. and Leman, A. The reduction of a
 graph to canonical form and the algebra which ap-
 pears therein. Nauchno-Technicheskaya Informatsia, 2
 (9):12–16, 1968. English translation by G. Ryabov is
 available at https://www.iti.zcu.cz/wl2018/
 pdf/wl_paper_translation.pdf. 1, 18
Wong, F., Zheng, E. J., Valeri, J. A., Donghia, N. M.,
 Anahtar, M. N., Omori, S., Li, A., Cubillos-Ruiz, A.,
 Krishnan, A., Jin, W., Manson, A. L., Friedrichs, J., Hel-
 big, R., Hajian, B., Fiejtek, D. K., Wagner, F. F., Soutter,
 H. H., Earl, A. M., Stokes, J. M., Renner, L. D., and
 Collins, J. J. Discovery of a structural class of antibiotics
 with explainable deep learning. Nature, 2023. 1
Xu, H. and Mannor, S. Robustness and generalization.
 Machine Learning, 86(3):391–423, 2012. 1, 5, 6, 15, 32
Xu, K., Hu, W., Leskovec, J., and Jegelka, S. How powerful
  are graph neural networks? In International Conference
  on Learning Representations, 2019. 1, 18
Yehudai, G., Fetaya, E., Meirom, E. A., Chechik, G., and
  Maron, H. From local structures to size generalization in
  graph neural networks. In International Conference on
  Machine Learning, 2021. 16
Zhang, X., Wang, L., Helwig, J., Luo, Y., Fu, C., Xie, Y.,
  Liu, M., Lin, Y., Xu, Z., Yan, K., Adams, K., Weiler, M.,
  Li, X., Fu, T., Wang, Y., Yu, H., Xie, Y., Fu, X., Strasser,
  A., Xu, S., Liu, Y., Du, Y., Saxton, A., Ling, H., Lawrence,
  H., Stärk, H., Gui, S., Edwards, C., Gao, N., Ladera,
  A., Wu, T., Hofgard, E. F., Tehrani, A. M., Wang, R.,
  Daigavane, A., Bohde, M., Kurtin, J., Huang, Q., Phung,
  T., Xu, M., Joshi, C. K., Mathis, S. V., Azizzadenesheli,
  K., Fang, A., Aspuru-Guzik, A., Bekkers, E. J., Bronstein,

                                                                 14
                                                        Covered Forests

A. Related work
In the following, we discuss relevant related work.

MPNNs Recently, MPNNs (Gilmer et al., 2017; Scarselli et al., 2009) emerged as the most prominent graph machine
learning architecture. Notable instances of this architecture include, e.g., Duvenaud et al. (2015); Hamilton et al. (2017); Kipf
& Welling (2017), and Veličković et al. (2018), which can be subsumed under the message-passing framework introduced
in Gilmer et al. (2017). In parallel, approaches based on spectral information were introduced in, e.g., Bruna et al. (2014);
Defferrard et al. (2016); Gama et al. (2019); Kipf & Welling (2017); Levie et al. (2019), and Monti et al. (2017)—all of
which descend from early work in Baskin et al. (1997); Goller & Küchler (1996); Kireev (1995); Merkwirth & Lengauer
(2005); Micheli & Sestito (2005); Micheli (2009); Scarselli et al. (2009), and Sperduti & Starita (1997).

Generalization frameworks Vapnik & Chervonenkis (1964; 1971); Vapnik (1998) laid out the theory of statistical
learning, introducing the VC dimension and its strong connection to uniform convergence; see also Mohri et al. (2018).
Xu & Mannor (2012) introduced an alternative approach based on a notion of “robustness.”. Here, if a testing sample is
“close” to a training sample, then the expected error is close to the training error, implying a bound on the generalization
error; see Section 3. They also showed that so-called weak robustness is sufficient and necessary for generalization.
Recently, Kawaguchi et al. (2022) proposed data-driven variations of the framework of Xu & Mannor (2012), allowing for a
tighter analysis in practice. Sokolic et al. (2017) used Xu & Mannor (2012) to showcase how invariant machine learning
architectures, regarding some group action, exhibit a smaller generalization error than their non-invariant counterparts.

Generalization abilities of MPNNs and GNNs Scarselli et al. (2018) used classical techniques from learning the-
ory (Karpinski & Macintyre, 1997) to show that MPNNs’ VC dimension (Vapnik, 1995) with piece-wise polynomial
activation functions on a fixed graph, under various assumptions, is in O(P 2 n log n), where P is the number of parameters
and n is the order of the input graph; see also Hammer (2001). We note here that Scarselli et al. (2018) analyzed a different
type of MPNN not aligned with modern MPNN architectures (Gilmer et al., 2017); see also D’Inverno et al. (2024). Garg
et al. (2020) showed that the empirical Rademacher complexity (see, e.g., Mohri et al. (2018)) of a specific, simple MPNN
architecture, using sum aggregation and specific margin loss, is bounded in the maximum degree, the number of layers,
Lipschitz constants of activation functions, and parameter matrices’ norms. We note here that their analysis assumes
weight sharing across layers. Recently, Karczewski et al. (2024) lifted this approach to E(n)-equivariant MPNNs (Satorras
et al., 2023). Liao et al. (2021) refined the results of Garg et al. (2020) via a PAC-Bayesian approach, further refined
in Ju et al. (2023). See Lee et al. (2024) for (transductive) PAC-Bayesian generalization bounds for knowledge graphs.
Maskey et al. (2022; 2024) assumed that data is generated by random graph models, leading to MPNNs’ generalization
analysis depending on the (average) number of vertices of the graphs. In addition, Levie (2023) and Rauchwerger et al.
(2024) defined metrics on attributed graphs, resulting in a generalization bound for MPNNs depending on the covering
number of these metrics. Verma & Zhang (2019) studied the generalization abilities of 1-layer MPNNs in a transductive
setting based on algorithmic stability. Similarly, Esser et al. (2021) used stochastic block models to study the transductive
Rademacher complexity (El-Yaniv & Pechyony, 2007; Tolstikhin & Lopez-Paz, 2016) of standard MPNNs. See also Tang &
Liu (2023) for refined results. For semi-supervised vertex classification, Baranwal et al. (2021) studied the classification of a
mixture of Gaussians, where the data corresponds to the vertex features of a stochastic block model, deriving conditions
under which the mixture model is linearly separable using the GCN layer (Kipf & Welling, 2017). Recently, Morris et al.
(2023a) made progress connecting MPNNs’ expressive power and generalization ability via the Weisfeiler–Leman hierarchy.
They studied the influence of graph structure and the parameters’ encoding lengths on MPNNs’ generalization by tightly
connecting 1-WL’s expressivity and MPNNs’ VC dimension. They derived that MPNNs’ VC dimension depends tightly on
the number of equivalence classes computed by the 1-WL over a given set of graphs. Moreover, they showed that MPNNs’
VC dimension depends logarithmically on the number of colors computed by the 1-WL and polynomially on the number of
parameters. Since relying on the 1-WL, their analysis implicitly assumes a discrete pseudo-metric space, where two graphs
are either exactly equal or far apart. One VC lower bound reported in Morris et al. (2023a) was tightened in Daniëls &
Geerts (2024) to MPNNs restricted to using a single layer and a width of one. In addition, Pellizzoni et al. (2024) extended
the analysis of Morris et al. (2023a) to node-individualized MPNNs and devised a Rademacher-complexity-based approach
using a covering number argument (Bartlett et al., 2017). Similar to us, they also assume MPNNs that are (Lipschitz)
continuous regarding a given pseudo-metric. However, unlike the present work, they do not derive such pseudo-metric and
do not provide an explicit bound on the covering number. Franks et al. (2024) studied MPNNs’ VC dimension assuming
linearly separable data and showed a tight relationship to the data’s margin, also partially explaining when more expressive

                                                               15
                                                         Covered Forests

architectures lead to better generalization. Li et al. (2024) build on the margin-based generalization framework proposed by
Chuang et al. (2021), which is based on k-Variance and the Wasserstein distance. They provide a method to analyze how
expressiveness affects graph embeddings’ inter- and intra-class concentration. Kriege et al. (2018) leveraged results from
graph property testing (Goldreich, 2010) to study the sample complexity of learning to distinguish various graph properties,
e.g., planarity or triangle freeness, using graph kernels (Borgwardt et al., 2020; Kriege et al., 2020). Finally, Yehudai et al.
(2021) showed negative results for MPNNs’ generalization ability to larger graphs.

Graph (pseudo-)distances Based on older ideas in Dell et al. (2018); Dvorák (2010); Tinhofer (1991), Böker (2021)
defined the Tree distance, a pseudo-metric on the set of graphs, and showed a tight correspondence between the former and
homomorphism densities regarding trees, which also implies equivalence to the 1-WL. Böker et al. (2023) later lifted the
result to specific MPNNs using sum aggregation, deriving uniform continuity. Based on this, Sverdlov et al. (2024) defined
an extension of the Tree distance to account for labeled graphs and derived a specific MPNN architecture that exhibits a
bi-Lipschitz property. Chuang & Jegelka (2022) defined the TMD distance between the computation graphs of specific
MPNNs via a hierarchical optimal transport problem, showed equivalence to the 1-WL, and derived Lipschitz constants. In
addition, they studied MPNNs’ generalization abilities under distribution shifts. Levie (2023) defined the graphon-signal cut
distance, showed that MPNNs are Lipschitz continuous concerning this metric, and derived a bound on the covering number
of the space of attributed graphs under this metric. As a result of the Lipschitz continuity and finite covering, he derived a
generalization bound for MPNNs. However, the graphon-signal cut distance topology does not give the coarsest topology
under which MPNNs are continuous. At the same time, in the present work, we find such a maximally coarse topology,
which, in principle, reduces the covering number (asymptotically in the radius). Most recently, Rauchwerger et al. (2024)
extended Böker et al. (2023) to attributed graphs, i.e., the vertex features are in R1×d , deriving a universal approximation
theorem for MPNNs over such graphs and generalization bounds for MPNN using a covering number argument based on
the technique from Levie (2023). Unlike the present work, they do not derive explicit bounds on the covering number and
only study specific MPNN layers.

B. Detailed notation
Here, we outlined our notation in more detail.

Basic notations Let N := {1, 2, . . .} and N0 := N ∪ {0}. The set R+ denotes the set of non-negative real numbers. For
n ∈ N, let [n] := {1, . . . , n} ⊂ N. We use {{. . .}} to denote multisets, i.e., the generalization of sets allowing for multiple,
finitely many instances for each of its elements. For two non-empty sets X and Y , let Y X denote the set of functions
from X to Y . Given a set X and a subset A ⊂ X, we define the indicator function 1A : X → {0,1} such that 1A (x) = 1
if x ∈ A, and 1A (x) = 0 otherwise. Let M be an n × m matrix, n > 0 and m > 0, over R, then Mi,· , M·,j , i ∈ [n],
j ∈ [m], arePthe ith row and jth column, respectively, of the matrix M . Let N be an n × n matrix, n > 0, then the trace
Tr(N ) := i∈[n] Nii . In what follows, 0 denotes an all-zero vector with an appropriate number of components.

Norms Given a vector space V , a norm is a function ∥ · ∥ : V → R+ which satisfies the following properties. For
all vectors u, v ∈ V and scalar s ∈ R, we have (i) non-negativity, ∥v∥ ≥ 0 with ∥v∥ = 0 if, and only, if v = 0;
(ii) scalar multiplication, ∥sv∥ = |s| ∥v∥; and the (iii) triangle inequality holds, ∥u + v∥ ≤ ∥u∥ + ∥v∥. When V is
some real vector space, say R1×d , for d > 0, here,
                                                p and in the remainder of the paper, ∥ · ∥1 and ∥ · ∥2 refer to the 1-norm
∥x∥1 := |x1 | + · · · + |xd | and 2-norm ∥x∥2 := x21 + · · · + x2d , respectively, for x ∈ R1×d .
When considering the vector space Rn×n of square n × n matrices, a matrix norm ∥ · ∥ is a norm as described above, with
the additional property that ∥M N ∥ ≤ ∥M ∥∥N ∥ for all matrices M and N ∈ Rn×n . A matrix norm is called induced, or
operator norm, if ∥M ∥ := supx∈Rn ,∥x∥=1 ∥M x∥, for some vector norm ∥ · ∥ on Rn . A matrix norm is called element-wise
                                                                                      2
if it is defined in terms of a vector norm ∥ · ∥ by interpreting M as a vector in Rn . However, not every vector norm results
                                                                                                                  2
in an element-wise matrix norm. For instance, the norm ∥M ∥∞ := maxi,j∈[n] |mij | is a valid norm on Rn but does not
                                                n×n                                                 n×n
satisfy the conditions of a matrix norm on R         . Later in the paper, we use the cut norm on R     , defined by
                                                                          X
                                              ∥M ∥□ :=         max             mij .                                     (11)
                                                         S⊂[n],T ⊂[n]
                                                                        i∈S,j∈T

                   1×d
Finally, for p ∈ R , d > 0, and ε > 0, the ball B∥·∥ (p, ε, d) := {s ∈ R1×d | ∥p − s∥ ≤ ε}; when the norm is clear from
the context, we omit the subscript.

                                                               16
                                                         Covered Forests

Graphs An (undirected) graph G is a pair (V (G), E(G)) with finite sets of vertices V (G) and edges E(G) ⊆ {{u, v} ⊆
V (G) | u ̸= v}. vertices or nodes V (G) and edges E(G) ⊆ {{u, v} ⊆ V (G) | u ̸= v}. The order of a graph G is
its number |V (G)| of vertices. If not stated otherwise, we set n := |V (G)| and call G an n-order graph. We denote
the set of all n-order (undirected) graphs by Gn and the set of all (undirected) graphs up to n vertices by G≤n . In a
directed graph, we define E(G) ⊆ V (G)2 , where each edge (u, v) has a direction from u to v. Given a directed graph
G and vertices u, v ∈ V (G), we say that v is a child of u if (u, v) ∈ E(G). A (directed) graph G is called connected
if, for any u, v ∈ V (G), there exist r ∈ N and {u1 , . . . , ur } ⊆ V (G), such that (u, u1 ), (u1 , u2 ), . . . , (ur , v) ∈ E(G),
and analogously for undirected graphs by replacing directed edges with undirected ones. We say that a graph G is
disconnected if it is not connected. For a graph G and an edge e ∈ E(G), we denote by G \ e the graph induced by
removing the edge e from G. For an n-order graph G ∈ Gn , assuming V (G) = [n], we denote its adjacency matrix by
A(G) ∈ {0,1}n×n , where A(G)vw = 1 if, and only, if {v, w} ∈ E(G). The neighborhood of a vertex v ∈ V (G) is
denoted by NG (v) := {u ∈ V (G) | {v, u} ∈ E(G)}, where we usually omit the subscript for ease of notation, and the
degree of a vertex v is |NG (v)|. A graph G is a tree if it is connected, but G \ e is disconnected for any e ∈ E(G). A tree or
a disjoint collection of trees is known as a forest.
A rooted tree (G, r) is a tree where a specific vertex r is marked as the root. For a rooted (undirected) tree, we can define an
implicit direction on all edges as pointing away from the root; thus, when we refer to the children of a vertex u in a rooted
tree, we implicitly consider this directed structure. For S ⊆ V (G), the graph G[S] := (S, ES ) is the subgraph induced by
S, where ES := {(u, v) ∈ E(G) | u, v ∈ S}. A (vertex-)labeled graph is a pair (G, ℓG ) with a graph G = (V (G), E(G))
and a (vertex-)label function ℓG : V (G) → Σ, where Σ is an arbitrary countable label set. For a vertex v ∈ V (G), ℓG (v)
denotes its label. A Boolean (vertex-)d-labeled graph is a pair (G, ℓG ) with a graph G = (V (G), E(G)) and a label
function ℓG : V (G) → {0,1}d . We denote the set of all n-order Boolean d-labeled graphs as Gn,d   B
                                                                                                      . An attributed graph is a
pair (G, aG ) with a graph G = (V (G), E(G)) and an (vertex-)attribute function aG : V (G) → R1×d , for d > 0. That is,
contrary to labeled graphs, vertex annotations may be from an uncountable set. The attribute or feature of v ∈ V (G) is
aG (v). We denote the class of all n-order graphs with d-dimensional, real-valued vertex features by Gn,d   R
                                                                                                               .
Two graphs G and H are isomorphic if there exists a bijection φ : V (G) → V (H) that preserves adjacency, i.e., (u, v) ∈
E(G) if, and only, if (φ(u), φ(v)) ∈ E(H). In the case of labeled graphs, we additionally require that ℓG (v) = ℓH (φ(v))
for v ∈ V (G). Moreover, we call the equivalence classes induced by ≃ isomorphism types and denote the isomorphism type
of G by τ (G). A graph class is a set of graphs that is closed under isomorphism. Given two graphs G and H with disjoint
vertex sets, we denote their disjoint union by G ∪˙ H.

B.1. Continuity on metric spaces
Let (X , dX ) and (Y, dY ) be two pseudo-metric spaces. A function f : X → Y is called cf -Lipschitz continuous if, for
x, x′ ∈ X ,
                                               dY (f (x), f (x′ )) ≤ cf · dX (x, x′ ).


We also define a weaker notion of continuity, known as uniform continuity. Specifically, we say that f is uniformly
continuous if, for every ε > 0, there exists a γ(ε, f ) > 0, possibly dependent on ε and f , such that, for x, x′ ∈ X ,

                                        dX (x, x′ ) ≤ γ(ε, f ) ⇒ dY f (x), f (x′ ) ≤ ε.
                                                                                  


It is easy to check that cf -Lipschitz continuity implies uniform continuity with γ(ε, f ) = ε/cf .


Feed-forward neural networks An L-layer feed-forward neural network (FNN), for L ∈ N, is a parametric function
    (L)
FNNθ : R1×d → R, d > 0, where θ := (W (1) , . . . , W (d) ) ⊆ Θ and W (i) ∈ Rd×d , for i ∈ [L − 1], and W (L) ∈ Rd×1 ,
where
                                                                       
                             x 7→ σ · · · σ σ xW (1) W (2) · · · W (L) ∈ R,

for x ∈ R1×d . Here, the function σ : R → R is an activation function, applied component-wisely, e.g., a rectified linear unit
(ReLU), where σ(x) := max(0, x). For an FNN where we do not need to specify the number of layers, we write FNNθ .

                                                                17
                                                            Covered Forests

C. The 1-dimensional Weisfeiler–Leman algorithm
The 1-dimensional Weisfeiler–Leman algorithm (1-WL) or color refinement is a well-studied heuristic for the graph
isomorphism problem, originally proposed by Weisfeiler & Leman (1968).7 Intuitively, the algorithm determines if two
graphs are non-isomorphic by iteratively coloring or labeling vertices. Given an initial coloring or labeling of the vertices
of both graphs, e.g., their degree or application-specific information, in each iteration, two vertices with the same label
get different labels if the number of identically labeled neighbors is unequal. These labels induce a vertex partition, and
the algorithm terminates when, after some iteration, the algorithm does not refine the current partition, i.e., when a stable
coloring or stable partition is obtained. Then, if the number of vertices annotated with a specific label is different in both
graphs, we can conclude that the two graphs are not isomorphic. It is easy to see that the algorithm cannot distinguish all
non-isomorphic graphs (Cai et al., 1992). However, it is a powerful heuristic that can successfully decide isomorphism for a
broad class of graphs (Arvind et al., 2015; Babai & Kucera, 1979).
Formally, let (G, ℓG ) be a labeled graph. In each iteration, t > 0, the 1-WL computes a vertex coloring Ct1 : V (G) → N,
depending on the coloring of the neighbors. That is, in iteration t > 0, we set
                                                                                         
                                Ct1 (v) := RELABEL Ct−1   1           1
                                                             (v), {{Ct−1 (u) | u ∈ N (v)}} ,

for vertex v ∈ V (G), where RELABEL injectively maps the above pair to a unique natural number, which has not been
used in previous iterations. In iteration 0, the coloring C01 := ℓG is used.8 To test whether two graphs G and H are
non-isomorphic, we run the above algorithm in “parallel” on both graphs. If the two graphs have a different number of
vertices colored c ∈ N at some iteration, the 1-WL distinguishes the graphs as non-isomorphic. Moreover, if the number of
                                                                                                                 1
colors between two iterations, t and (t + 1), does not change, i.e., the cardinalities of the images of Ct1 and Ci+t are equal,
or, equivalently,
                                        Ct1 (v) = Ct1 (w) ⇐⇒ Ct+1 1            1
                                                                       (v) = Ct+1  (w),
                                                                                                            1
                             ˙
for all vertices v, w ∈ V (G ∪H), then the algorithm terminates. For such t, we define the stable coloring C∞ (v) = Ct1 (v),
                ˙
for v ∈ V (G ∪H). The stable coloring is reached after at most max{|V (G)|, |V (H)|} iterations (Grohe, 2017). Finally,
when considering graphs of a fixed order n, we define the equivalence class of a graph G ∈ Gn induced by 1-WL as
[G] = {G′ ∈ Gn | G, G′ are 1-WL indistinguishable} and the quotient space consisting of the equivalence classes as
Gn/∼WL := {[G] | G ∈ G }. We similarly, use Gn/∼WL for the quotient space of equivalences classes after L iterations, for
                          n                           L
L ∈ N.

Connection between the 1-WL and MPNNs Morris et al. (2019) and Xu et al. (2019) showed that any possible MPNN
architecture is limited by the 1-WL in terms of distinguishing non-isomorphic graphs. Furthermore, for the MPNNs defined
in Equation (3), Morris et al. (2019) showed that, under appropriate parameter selections, they can achieve expressivity
equivalent to that of the 1-WL; see Grohe (2021) and Morris et al. (2023b) for details. Similarly, building on Morris
et al. (2019), it is straightforward to show that the MPNNs defined in Equation (1) can distinguish the same pairs of
non-isomorphic n-order graphs as the 1-WL.

Unrollings characterization for 1-dimensional Weisfeiler–Leman algorithm Following Morris et al. (2020b), given an
n-order labeled graph (G, ℓG ), we define the unrolling tree of depth L ∈ N0 for a vertex u ∈ V (G), denoted as unr(G, u, L),
inductively as follows.

  1. For L = 0, we consider the trivial tree as an isolated vertex labeled ℓG (u).
  2. For L > 0, we consider the root vertex with label ℓG (u) and, for v ∈ N (u), we attach the subtree unr(G, v, L − 1)
     under the root.

The above unrolling tree construction characterizes the 1-WL algorithm through the following lemma.
Lemma 17 (Folklore, see, e.g., Morris et al. (2020a)). For L ∈ N0 , given a labeled graph (G, ℓG ) and vertices u, v ∈ V (G),
the following are equivalent.
    7
      Strictly speaking, the 1-WL and color refinement are two different algorithms. That is, the 1-WL considers neighbors and non-
neighbors to update the coloring, resulting in a slightly higher expressive power when distinguishing vertices in a given graph; see (Grohe,
2021) for details. Following customs in the machine learning literature, we consider both algorithms to be equivalent.
    8
      Here, we implicitly assume an injective function from Σ to N.

                                                                    18
                                                       Covered Forests

  1. The vertices u and v have the same color after L iterations of the 1-WL.
  2. The unrolling trees unr(G, u, L) and unr(G, v, L) are isomorphic.

C.1. The mean 1-dimensional Weisfeiler–Leman algorithm
Similarly to 1-WL, we can define the mean-aggregation 1-WL (1-MWL) on a labeled graph (G, ℓG ) and give a similar
characterization based on unrolling trees denoted as m-unr(G, u, L). We will later use the 1-MWL to characterize the
expressive power of MPNN layers using mean aggregation. Before we describe the 1-MWL algorithm and the unrolling
construction, we introduce some notation. For a given multiset X, we denote by set(X) the set consisting of all distinct
elements of X. Additionally, for each x ∈ set(X), we denote by mulX (x) the multiplicity of the element x ∈ X in the
multiset. We define                                                        
                                                       mulX (x)
                                    freq(X) :=      x,             x ∈ set(X) ,
                                                         |X|
mapping each multiset to a set of pairs, encoding the frequency of each element in the multiset. Also, given a directed tree
T , for each vertex u ∈ V (T ), we denote by chT (u) the set of children of the vertex u ∈ V (T ), i.e., vertices that are one
level below u and are connected to u. Moreover, for a vertex u ∈ V (T ), we denote by subT (u) the rooted directed subtree
under vertex u with root u. Finally, for vertex u ∈ V (T ), we define desT (u) = {{τ (subT (v)) | v ∈ chT (u)}}.
Given a labeled graph (G, ℓG ), the 1-MWL computes a vertex coloring Ct1,m : V (G) → N. That is, in iteration t > 0, we set
                                                           1,m
                                      Ct1,m (v) = RELABEL(Ct−1 (v), freq(Mt−1 (v))),

for v ∈ V (G), where RELABEL injectively maps the above pair to a unique natural number, which has not been used in
previous iterations, and Mt (v) = {{Ct1,m (u) | u ∈ N (v)}}. In iteration 0, we set C01,m := ℓG .

Unrolling characterization for the 1-MWL. Given a labeled graph (G, ℓ) and a vertex u ∈ V (G), we define the mean
unrolling tree of depth L m-unr(G, u, L), characterizing the 1-MWL up to L iterations. For a vertex u ∈ V (G), starting
from the original unrolling tree T = unr(G, u, L) of depth L, considering the root as level 0, we prune the tree as follows.

  1. Starting from level l = L − 1.
  2. For all vertices u at level l, we consider the multiset desT (u). Let c be the greatest common factor of the elements in
     {muldecT (u) (a) | a ∈ set(desT (u))}, then for each a ∈ set(decT (u)), we drop c−1    c muldesT (u) (a) copies of a from
     decT (u), and we also prune the corresponding subtrees from T , leading to an updated tree.
  3. If l = 0, the pruning is done; otherwise, we set l = l − 1 and repeat step 2 with the updated tree T .

We call the above-described algorithm the mean-pruning of the tree T . See Figure 3 for an illustration of the mean-pruning
process and the mean-unrolling tree. The above mean unrolling tree construction characterizes the 1-MWL through the
following result.
Proposition 18. For L ∈ N0 , given a labeled graph (G, ℓG ) and vertices u, v ∈ V (G), the following are equivalent.

  1. The vertices u, v have the same color after L iterations of the 1-MWL.
  2. The trees m-unr(G, u, L) and m-unr(G, v, L) are isomorphic.

Connection between the 1-MWL and MPNNs Similarly to the results by Morris et al. (2019), we show in Proposition 21
in Appendix C.2 that any possible MPNN architecture described by Equation (5) is limited by 1-MWL in terms of
distinguishing non-isomorphic graphs. Furthermore, again, for the MPNNs considered in Equation (5), we show that, under
appropriate parameter selection, they can achieve expressivity equivalent to 1-MWL.

C.2. Mean 1-WL unrollings characterization
Here, we show the correspondence between mean unrollings, the 1-MWL, and mean-aggregation MPNNs. We begin by
showing a characterization of the 1-MWL through the mean unrollings defined in Appendix C.1
We first show the following auxiliary lemma, which shows that the computation of m-unr(·) at depth L + 1 induces a finer
partition of the set of vertices compared to the partition induced by m-unr(·) at depth L.

                                                             19
                                                             Covered Forests

                                          unr(G, u3 , 3)                   m-unr(G, u3 , 3)




                                                             mean-pruning
                           u3
                  G   u1

                           u4             unr(G, u4 , 3)                                              m-unr(G, u4 , 3)
                      u2

                           u5




                                                                              mean-pruning


Figure 3. An illustration of the unrolling trees and the process of obtaining the mean unrolling trees from the unrolling trees through mean
pruning.


Lemma 19. For L ∈ N, given a labeled graph (G, ℓG ) and vertices u, v ∈ V (G), the following holds,

                      m-unr(G, u, L + 1) ≃ m-unr(G, v, L + 1) =⇒ m-unr(G, u, L) ≃ m-unr(G, v, L).

Proof. As described in Appendix C.1, m-unr(G, v, L + 1) is derived by applying the mean-pruning process to unr(G, v, L +
1). Consider the labeled tree (T1 , ℓT1 ) := unr(G, v, L + 1). We define the L-depth labeled tree (T1′ , ℓT1′ ) induced by
(T1 , ℓT1 ) by relabeling all vertices at level L of T1 and then remove all leaves, i.e., vertices at level L + 1. We relabel vertices
at level L as follows.
For a vertex x at level L of T1 with label ℓT1 (x), let MT1 ,x denote the multiset of labels of its children, i.e.,

                                                 MT1 ,x = {{ℓT1 (y) | y ∈ chT1 (x)}}.

We compute the new label
                                            ℓT1′ (x) = RELABEL(ℓT1 (x), freq(MT1 ,x )).                                                (12)
Similarly, let (T2 , ℓT2 ) = unr(G, u, L + 1), and define (T2′ , ℓT2′ ) analogously. By definition, m-unr(G, u, L + 1) ≃
m-unr(G, v, L + 1) if, and only if, the trees T1′′ and T2′′ , obtained by applying the mean-pruning process to T1′ and T2′ ,
respectively, are isomorphic. Now, if T1′′ ≃ T2′′ , it directly follows that m-unr(G, u, L) ≃ m-unr(G, v, L). The reasoning
is as follows: the trees T1′ and T2′ up to level L − 1 are structurally identical to unr(G, u, L + 1) and unr(G, v, L + 1),
respectively. Furthermore, if two vertices in layer L of T1′ have the same label, then these vertices must have also had
the same label before the relabeling step (i.e., in unr(G, u, L + 1)). This follows directly from Equation (12). Therefore,
if applying the mean-pruning process to T1′ and T2′ results in isomorphic graphs, applying the mean-pruning process to
unr(G, u, L) and unr(G, v, L) must also yield isomorphic graphs.

We next show the correspondence between mean unrollings and the 1-MWL.
Proposition 20 (Proposition 18 in the main paper). For L ∈ N0 , given a labeled graph (G, ℓG ) and vertices u, v ∈ V (G),
the following are equivalent.

  1. Vertices u and v have the same color after L iterations of the 1-MWL.
  2. The trees m-unr(G, u, L) and m-unr(G, v, L) are isomorphic.

Proof. For the proof of both directions of the proposition, we will need the following observation.
Observation 1 (Recursive formulation of mean unrolling). For each L ∈ N, u ∈ V (G), the mean unrolling m-unr(G, u, L +
1) can be constructed by considering a root vertex with label ℓG (u) and attaching to this root vertex all m-unr(G, w, L), for
w ∈ N (u), and finally performing the process described in step 2 of the m-unrolling construction on level l = 1.

                                                                    20
                                                            Covered Forests

We now prove the two directions.
1 ⇒ 2: By induction on L. For L = 0, the result is clear. For the induction hypothesis, we assume that for some L ∈ N,
and for all vertices u, v ∈ V (G), if CL1,m (u) = CL1,m (v), then m-unr(G, u, L) ≃ m-unr(G, v, L). Now, for vertices
                     1,m           1,m
u, v ∈ V (G), if CL+1    (u) = CL+1    (v), then by definition, freq(ML (u)) = freq(ML (v)), where ML (v) = {{CL1,m (w) |
w ∈ N (v)}}. We consider the tree Tu with root u and attach all m-unr(G, w, L), for w ∈ N (u). Analogously, we consider
the tree Tv with root v. By the observation above, we drop (if necessary) all the subtrees rooted at level 1 of Tu as described
in step 2 of the m-unr operation, leading to a new tree Tu′ which is isomorphic to m-unr(G, u, L + 1). We do the same on
Tv , leading to Tv′ ≃ m-unr(G, v, L + 1). Now, using the induction hypothesis, since freq(ML (u)) = freq(ML (v)), there
exists a bijection σ between the subtrees t rooted at level 1 of Tu′ and the subtrees rooted at level 1 of Tv′ , such that t ≃ σ(t),
                                       1,m          1,m
for all subtrees t. Finally, because CL+1  (u) = CL+1   (v) implies C01,m (u) = C01,m (v), the roots of Tu′ and Tv′ have the same
color, implying that m-unr(G, u, L + 1) ≃ m-unr(G, v, L + 1).
2 ⇒ 1: For the reverse direction, we again proceed by induction. If m-unr(G, u, L + 1) ≃ m-unr(G, v, L + 1), the
observation above and the inductive hypothesis directly imply that freq(ML (u)) = freq(ML (v)). Furthermore, by
Lemma 19, m-unr(G, u, L + 1) ≃ m-unr(G, v, L + 1) implies m-unr(G, u, L) ≃ m-unr(G, v, L), which concludes the
proof.


Next, we show that mean-aggregation MPNNs as defined in Equation (5) are limited by 1-MWL in distinguishing non-
isomorphic graphs. In addition, we prove that under an appropriate parameter selection, both algorithms can achieve exactly
the expressivity of the 1-MWL. Formally,
Proposition 21. Let (G, ℓG ) ∈ Gn,d
                                  B
                                      be a labeled graph and Ct1,m be the coloring function of 1-MWL on iteration t > 0.
Then for all t ≥ 0, u, v ∈ V (G) and for all MPNNs described by Equation (5), we have that,

                                            Ct1,m (u) = Ct1,m (v) =⇒ h(t)  (t)
                                                                      u = hv .

                                                                             (1)        (2)                                      (t)
Additionally, for L > 0, there exists a choice of parameters W ′t                  , W ′t     , φ′t , t ∈ [L], such that if h′         is the MPNN
                (1)   (2)
induced by W ′t , W ′t , φ′t , we have that:

                                              (t)       (t)
                                           h′u      = h′v      =⇒ Ct1,m (u) = Ct1,m (v).


Proof. We recall that for a multiset X, freq(X) is defined as
                                                                                           
                                                                 mulX (x)
                                        freq(X) :=            x,                    x ∈ set(X) .
                                                                   |X|

We now define the following class of MPNN architectures:
                                                                                     
                                       (t)
                             h(t)
                              v := UPD       h(t−1)
                                              v     , AGG(t) freq {{hw
                                                                     (t−1)
                                                                           | w ∈ N (v)}}    ,                                                 (13)

where UPD(t) and AGG(t) are two parameterized functions. It suffices to show that the MPNNs described by Equation (5)
are a special case of the MPNNs in Equation (13). The proof then proceeds by induction exactly as in Morris et al. (2019,
Theorem 1). To verify this, we set

                                                                                                 (2)
                                                                    X
                                         AGG(t) (X) =                             a1 · a2 · Wt−1 ,
                                                              (a1 ,a2 )∈freq(X)
                                                                             
                                                                       (1)
                                         UPD(t) (x1 , x2 ) = φt x1 · Wt−1 + x2 .


The other direction follows by straightforward adaption of the proof of Morris et al. (2019, Theorem 2) by adapting Lemma
11 and 14.



                                                                     21
                                                        Covered Forests

D. Pseudo-metrics on graph
First, let us consider (pseudo-)metrics on the set of n-order unlabeled graphs Gn , for n ∈ N. The straightforward way to
define a metric on Gn is through the adjacency matrices of the graphs. To that, for n ∈ N, a matrix P ∈ {0,1}n×n is a
permutation matrix if ∥Pi,· ∥1 = 1, for i ∈ [n], and ∥P·,j ∥1 = 1, for j ∈ [n]. More generally, a matrix S ∈ [0,1]n×n is a
doubly-stochastic matrix if ∥Si,· ∥1 = 1, for i ∈ [n], and ∥S·,j ∥1 = 1, for j ∈ [n]. Let Pn and Dn denote the sets of n × n
permutation and doubly-stochastic matrices, respectively. Now observe that graphs G and H ∈ Gn are isomorphic if, and
only, if there exists a permutation matrix P ∈ Pn such that A(G)P = P A(H). Similarly, from Tinhofer (1991), it follows
that the graphs G and H are not distinguished by 1-WL if, and only, if there exist of a doubly-stochastic matrix S such that
A(G)S = SA(H).
Based on the above, for n ∈ N, let G, H ∈ Gn and ∥·∥ is a norm in Rn×n , we define the following pseudo-metric on Gn ,

                                         δ∥·∥ (G, H) := min ∥A(G)P − P A(H)∥.
                                                         P ∈Pn

By definition, it holds that δ∥·∥ (G, H) = 0 if, and only, if G and H are isomorphic.
Secondly, we extend the above definition to the set of labeled n-order graphs. For simplicity and to be aligned with Morris
et al. (2023a), we consider d-dimensional Boolean features, though the following distance can also be defined in the set of real-
valued features. Given two labeled n-order graphs (G, ℓG ), (H, ℓH ) ∈ Gn,d
                                                                         B
                                                                            and a distance function dist : {0,1}d ×{0,1}d →
  +
R , assuming V (G) = V (H) = [n], we define the distance matrix L(G, H) = [dist(ℓG (i), ℓH (j))]i∈V (G),j∈V (H) .
Following Bento & Ioannidis (2019), we define the following metric on Gn,d  B
                                                                               , for any entry-wise or operator norm ∥·∥,

                              δe∥·∥ (G, H) := min ∥A(G)P − P A(H)∥ + Tr(P ⊺ L(G, H)).
                                              P ∈Pn

To see the effect of the second term, suppose that dist is the discrete distance function. Then, minP ∈Pn Tr(P ⊺ L(G, H))
finds a label-preserving vertex permutation. Again, we can easily verify that δe∥·∥ (G, H) = 0 if, and only, if (G, ℓG ) and
(H, ℓH ) are isomorphic.

E. Proof of the pseudo-metric property and 1-WL equivalence
In this section, we prove that the family of distances defined in Gn,d
                                                                   B
                                                                       by Equation (8) constitutes a well-defined pseudo-metric
on the set of graphs. We then show that this family of pseudo-metrics is equivalent in expressivity to the 1-WL algorithm,
i.e., we show Proposition 1.
To establish the pseudo-metric property, we use the result by Bento & Ioannidis (2019) showing that for every entry-wise
norm, the following distance defines a pseudo-metric on Gn,d
                                                           B
                                                              ,
                                 T
                               δs∥·∥ (G, H) := min ∥A(G)S − SA(H)∥ + Tr(S ⊺ L(G, H)),
                                               S∈Dn

where
                                                  Li,j = dist(ℓG (i), ℓH (j)),
for some distance function dist (e.g., dist(ℓG (i), ℓH (j) = 1 if ℓG (i) ̸= ℓH (j) and 0 otherwise.)
However, the cut norm is not an entry-wise norm, and thus, we need to prove the pseudo-metric property separately.
Nevertheless, we follow the argumentation used for entry-wise norms. To achieve this, we first establish the following
auxiliary lemma.
Lemma 22. Let A be the adjacency matrix of an n-order graph, then for all doubly-stochastic matrices S ∈ Dn , the
following inequalities hold,

                                                      ∥AS∥□ ≤ ∥A∥□ ,
                                                      ∥SA∥□ ≤ ∥A∥□ .

Proof. By the Birkhoff-von-Neumann theorem, each doubly-stochastic matrix can be written as a convex combination of
permutation matrices. That is, if S ∈ Dn , there exist a k ∈ N, λ1 , . . . λk ∈ [0,1], and permutation matrices P1 , . . . , Pk ,

                                                                 22
                                                          Covered Forests
                 Pk
such that S =       i=1 λi Pi . Therefore, if A is the adjacency matrix of an n-order graph, then

                                           k
                                           X                  k
                                                              X                      k
                                                                                     X
                            ∥AS∥□ = ∥A           λi Pi ∥□ ≤         λi ∥APi ∥□ =           λi ∥A∥□ = ∥A∥□ ,
                                           i=1                i=1                    i=1

where the first inequality is derived from the sub-additivity and the absolute homogenicity property of the cut norm. In
addition, because the cut norm is invariant under permutations, it holds that ∥Pi A∥□ = ∥A∥□ . We similarly can prove the
second inequality.

                                                         T
We are now ready to show the pseudo-metric property of δs□ on Gn,d
                                                               B
                                                                   .
                                                                                       T
                                                                                       □ defines a pseudo-metric on Gn,d ,
                                                                                                                     B
Proposition 23 (First part of Proposition 1 in the main paper). The distance function δĎ
for d ∈ N

Proof. Let the graphs (GA , ℓGA ), (GB , ℓGB ), (GC , ℓGC ) ∈ Gn,d
                                                               B
                                                                   .
                                                  T
Symmetry. To prove the symmetry property, i.e., δ (G , G ) = δĎ
                                                  Ď                  T (G , G ), we use the following properties:
                                                      □    A        B        □   B    A

  1. For all adjacency matrices A, ∥A∥□ = ∥A⊺ ∥□ .
  2. For all S ∈ Dn , S ⊺ ∈ Dn .
  3. Tr(A⊺ B) = Tr(AB ⊺ ).

We then have,
                         T                                             ⊺
                         □ (GA , GB ) = min ∥A(GA )S − SA(GB )∥□ + Tr(S L(GA , GB ))
                        δĎ
                                         S∈Dn

                                      = min ∥SA(GB ) − A(GA )S∥□ + Tr(S ⊺ L(GA , GB ))
                                         S∈Dn

                                      = min ∥A(GB )S ⊺ − S ⊺ A(GA )∥□ + Tr(SL(GA , GB )⊺ )
                                         S∈Dn

                                      = min
                                        ⊺
                                            ∥A(GB )S ⊺ − S ⊺ A(GA )∥□ + Tr((S ⊺ )⊺ L(GA , GB )⊺ )
                                         S ∈Dn

                                      = min
                                        ⊺
                                            ∥A(GB )S ⊺ − S ⊺ A(GA )∥□ + Tr((S ⊺ )⊺ L(GB , GA ))
                                         S ∈Dn

                                      = min ∥A(GB )S − SA(GA )∥□ + Tr(S ⊺ L(GB , GA ))
                                         S∈Dn
                                         T
                                      = δĎ
                                         □ (GB , GA ),

as desired.
Triangle inequality. We define S ′ := arg minS∈Dn ∥A(GA )S − SA(GB )∥□ + Tr(S ⊺ L(GA , GB )) and S ′′ =
arg minS∈Dn ∥A(GB )S − SA(GC )∥□ + Tr(S ⊺ L(GB , GC )). It is easy to verify that the product of two doubly-stochastic
matrices is a doubly-stochastic matrix and, therefore,
                         T                      ′ ′′  ′ ′′               ′ ′′ ⊺
                         □ (GA , GC ) ≤ ∥A(GA )S S − S S A(GC )∥□ + Tr((S S ) L(GA , GC )).
                        δĎ

Therefore, it suffices to show that

               ∥A(GA )S ′ S ′′ − S ′ S ′′ A(GC )∥□ ≤ ∥A(GA )S ′ − S ′ A(GB )∥□ + ∥A(GA )S ′′ − S ′′ A(GC )∥□

and,
                        Tr((S ′ S ′′ )⊺ L(GB , GC )) ≤ Tr((S ′ )⊺ L(GA , GB )) + Tr((S ′′ )⊺ L(GB , GC )).
For the first inequality, we use Lemma 22 and the triangle inequality for the cut norm,

              ∥A(GA )S ′ S ′′ − S ′ S ′′ A(GC )∥□ ≤ ∥A(GA )S ′ S ′′ − S ′ A(GB )S ′′ ∥□
                                                                                     + ∥S ′ A(GB )S ′′ − S ′ S ′′ A(GC )∥□
                                                                    ′    ′
                                                  ≤ ∥A(GA )S − S A(GB )∥□ + ∥A(GB )S ′′ − S ′′ A(GC )∥□ .

                                                                    23
                                                            Covered Forests

For the second inequality, we use the notation dist(ℓG (i), ℓH (j)) for the distance between the label of vertex i ∈ V (G) and
the label of vertex j ∈ V (H) (e.g., dist(ℓG (i), ℓH (j)) = 1ℓG (i)̸=ℓH (j) , where 1 is the indicator function.)
                                           X X
            Tr((S ′ S ′′ )⊺ L(GA , GC )) =             s′i,k s′′k,j dist(ℓGA (i), ℓGC (j))
                                           i,j∈[n] k∈[n]
                                            X X
                                       ≤                   s′i,k s′′k,j (dist(ℓGA (i), ℓGB (k)) + dist(ℓGB (k), ℓGC (j)))
                                           i,j∈[n] k∈[n]
                                            X                                           X
                                       =             s′i,k dist(ℓGA (i), ℓGB (k))               s′′k,j
                                           i,k∈[n]                                      j∈[n]
                                                                                  X                                        X
                                                                             +             s′′k,j dist(ℓGB (k), ℓGC (j))           s′i,k
                                                                                 k,j∈[n]                                   i∈[n]
                                                     ′ ⊺                             ′′ ⊺
                                       ≤ Tr((S ) L(GA , GB )) + Tr((S ) L(GB , GC )),

where the first inequality follows from the triangle inequality of metric dist, and the last inequality from ∥S ′′ ∥1 ≤ 1 and
∥S ′ ∥1 ≤ 1.

                                                     T
We now show the equivalence of the pseudo-metric δs□   and the 1-WL in distinguishing non-isomorphic graphs.
                                                                                                            T
Lemma 24 (Second part of Proposition 1 in the main paper). For all n, d ∈ N and G, H ∈ Gn,d
                                                                                         B
                                                                                             we have that δs□ (G, H) = 0
if, and only, if G and H are 1-WL indistinguishable.

Proof. For all n, d ∈ N and G, H ∈ Gn,d
                                      B
                                          , we simplify the notation as follows. Once an adjacency matrix A(G) is fixed
for an n-order graph G, we refer to the i-th vertex of G as the vertex corresponding to the i-th row of A(G), for i ∈ [n].
We define an injection θ : Bd → {n + 2, n + 3, . . .}. Then, we introduce a transformation Tθ : Gn,d
                                                                                                 B
                                                                                                     → G≤m′ , which maps
                                         ′                     ′
graphs G ∈ Gn,d to unlabeled graphs G ∈ G≤m , where m is sufficiently large. The transformation Tθ is defined as
               B                                    ′

follows.
Given (G, ℓG ) ∈ Gn,d
                  B
                      , for each u ∈ V (G), we add θ(ℓG (u)) new vertices, denoted u1 ,. . ., uθ(ℓG (u)) , to the graph G. These
new vertices form a clique and one of them (without loss of generality, u1 ) is connected to u. Formally, we define:

                                                           Tθ ((G, ℓG )) = G′ ,

where                                                                                           
                                                                             θ(ℓG (u))
                                                                     [            [
                                       V (G′ ) = V (G) ∪                                 {ui },
                                                                   u∈V (G)        i=1

and                                                                                                        
                                                                   
                                                                                            θ(ℓG (u))
                                                     [                   [  [
                             E(G′ ) = E(G) ∪ 
                                                                                          
                                                            {u, u1 } ∪ 
                                                                        
                                                                            
                                                                               {ui , uj }
                                                                                          .
                                                                                           
                                                  u∈V (G)                    u∈V (G)            i,j=1
                                                                                                 i̸=j


Let m denote the number of added vertices, i.e., m = u∈V (G) θ(ℓG (u)). The adjacency matrix A(G′ ) of the transformed
                                                     P

graph G′ can then be represented in the following block structure:
                                                                    
                                                     ′      A(G) B
                                                 A(G ) =               ,
                                                             B⊺    D

where B ∈ Rn×m and D ∈ Rm×m are symmetric.
Now, let G, H ∈ Gn,d
                   B
                      and their transformed graphs be G′ = Tθ (G) and H ′ = Tθ (H). We aim to prove the equivalence of
the following statements, completing the proof.
      T
  1. δ∥·∥ (G′ , H ′ ) = 0.
  2. G′ and H ′ are 1-WL-indistinguishable.

                                                                    24
                                                                     Covered Forests

                                                                                                u5

                                                                                     u4                  u3

                                                                                       u1            u2

                                     u
                              G                                                   Tθ (G)         u
                                                                 Tθ
                                                         (θ( ) = 5, θ( ) = 6)
                                     v       w                                              v        w

                                                                              v1            v2           w1   w2

                                                                             v6                 v3   w6        w3

                                                                              v5            v4           w5   w4


Figure 4. An illustration of the Tθ transformation of a labeled graph G into an unlabeled graph Tθ (G). For illustration reasons the colors
red and blue have chosen as the initial node features in RBd .


  3. G and H are 1-WL-indistinguishable.
       T
  4. δe∥·∥ (G, H) = 0.

The equivalences follow as outlined below:

   • 1. ⇔ 2.: This is a direct result of Tinhofer (1986).
                       ′(1)           (1)
   • 2. ⇒ 3. Let Ct and Ct represent the coloring functions of the 1-WL algorithm applied to the graphs G′ and (G, ℓG ),
                                                                  ′(1)       ′(1)                       (1)     (1)
     respectively. We aim to show that for all u, v ∈ V (G), if C∞ (u) = C∞ (v), then it follows that C∞ (u) = C∞ (v).
                                                                 ′(1)       ′(1)           (1)      (1)
     To do this, we will prove by induction that for each t, if Ct+2 (u) = Ct+2 (v), then Ct (u) = Ct (v).
                         ′(1)               ′(1)
     For t = 0, if C2 (u) = C2 (v), we conclude that ℓG (u) = ℓG (v). Otherwise, the vertices u and v would have
     different cliques attached to them, resulting in distinct colors in the second iteration. Now, assume the induction
                         ′(1)        ′(1)            (1)         (1)                                     ′(1)       ′(1)
     hypothesis, i.e., Ct+2 (u) = Ct+2 (v) =⇒ Ct (u) = Ct (v), for t ∈ N. Next, suppose that Ct+3 (u) = Ct+3 (v).
     We further note that the added vertices in G′ , even from the first iteration, have different colors from those of the
     original vertices since their degrees are strictly larger than n + 1, while the original vertices have degrees strictly
     smaller than n + 1. That is, |NG′ (ui )| > n − 1 and |NG′ (u)| < n + 1 for all u ∈ V (G), i ∈ [θ(ℓG (u))]. By the
     definition of the 1-WL algorithm and applying the induction hypothesis, we obtain the following,
                                                                       (1)           (1)
                                                                     Ct (u) = Ct (v),
                                                   (1)                                (1)
                                              {{Ct (w) | w ∈ NG′ (u)}} = {{Ct (w) | w ∈ NG′ (v)}}.

     By the second equality and the fact that the added vertices, namely {ui }i∈θ(ℓG (u)) for u ∈ V (G), will always have
     distinct stable colors from the original vertices (i.e., vertices in V (G)), we deduce that
                                                   (1)                                (1)
                                               {{Ct (w) | w ∈ NG (u)}} = {{Ct (w) | w ∈ NG (v)}}.

     This completes the induction.
                                                   (1)         (1)
   • 3. ⇒ 2. It suffices to show that Ct (u) = Ct (v) implies the following three equalities.
             ′(1)             ′(1)
      (a) Ct        (u) = Ct         (v), for all u, v ∈ V (G),
             ′(1)        ′(1)
      (b)   Ct (u1 ) = Ct (v1 ),
             ′(1)       ′(1)
      (c)   Ct (ui ) = Ct (vj ), for all i, j ∈ [θ(ℓG (u))].

                                                                             25
                                                        Covered Forests

                                                                                                        ′(1)        ′(1)
  We can prove (a) =⇒ (b) and (b) =⇒ (c) by induction. First, we show that if Ct (u1 ) = Ct (v1 ), then
    ′(1)         ′(1)
  Ct+1 (ui ) = Ct+1 (vj ) for all u, v ∈ V (G) and i, j ∈ [θ(ℓG (u))] (implying (b) =⇒ (c)). Similarly, we can show by
                   ′(1)         ′(1)             ′(1)          ′(1)
  induction that Ct (u) = Ct (v) implies Ct+1 (u1 ) = Ct+1 (v1 ) for all u, v ∈ V (G) (implying (a) =⇒ (b)).
                                                  (1)            (1)                           (1)        (1)
  Next, we use again induction to prove Ct (u) = Ct (v) =⇒ (a). If Ct+1 (u) = Ct+1 (v), by the induction
  hypothesis and the definition of the 1-WL algorithm, we obtain.
                                                         ′(1)           ′(1)
                                                        Ct      (u) = Ct       (v),
                                    ′(1)                      ′(1)
                                 {{Ct (w) | w ∈ NG (u)}} = {{Ct (w) | w ∈ NG (v)}}.
                                           ′(1)                                       ′(1)
  By (b) and (c), we conclude that {{Ct (w) | w ∈ NG′ (u)}} = {{Ct                           (w) | w ∈ NG′ (v)}}. Hence, we have
   ′(1)        ′(1)
  Ct+1 (u) = Ct+1 (v), completing the proof.
                      T
• 1. ⇒ 4.: Assume δ∥·∥   (G′ , H ′ ) = ∥A(G′ )S ′ − S ′ A(H ′ )∥ = 0 for some doubly stochastic matrix S ′ . By Theorem
  3.5.11 in Grohe (2017), if C∞ denotes the stable coloring under the 1-WL algorithm on G′ , H ′ , then S ′ can be
  explicitly expressed as
                                    (
                                      1/|V (G) ∩ C −1 (c)|, if C (i) = C (j) = c for some color c,
                           ′                      ∞             ∞       ∞
                          Si,j =
                                      0,                    otherwise.

  The newly added vertices in G′ and H ′ always have stable colors distinct from those of the original vertices since their
  degrees are strictly larger than n + 1, while the original vertices have degrees strictly smaller than n + 1. Consequently,
  S ′ has a block diagonal structure                                  
                                                          ′     S 0
                                                        S =          e ,
                                                                0 S
                   e ∈ Dm . Substituting into the equation ∥A(G′ )S ′ − S ′ A(H ′ )∥ = 0, we deduce that
  where S ∈ Dn and S

                                                    ∥A(G)S − SA(H)∥ = 0.

  The term Tr(S ⊺ L(G, H)) can be written as
                                                                       X
                                    Tr(S ⊤ L(G, H)) =                             Si,j L(G, H)i,j .
                                                                i∈V (G),j∈V (H)
     P
  If i∈V (G),j∈V (H) Si,j L(G, H)i,j ̸= 0, then, there exists i ∈ V (G) and j ∈ V (H) for which Si,j > 0 and
  ℓG (i) ̸= ℓH (j) which is a contradiction since Si,j = S ′ i,j > 0 and if ℓG (i) ̸= ℓH (j), there would have been attached
                                                                                                           T
  different vertices to vertices i and j, implying that they would have different stable colors. Hence, δ□   (G, H) = 0.
                     T
• 4. ⇒ 1.: Suppose δe∥·∥ (G, H) = 0. We construct a block diagonal doubly stochastic matrix S ′ ∈ Dn+m , consisting of
  two blocks in Dn and Dm respectively, such that ∥A(G′ )S ′ − S ′ A(H ′ )∥ = 0.
           T
  Assume δe□ (G, H) = 0. This implies that there exists S ∈ Dn , s.t. ∥A(G)S − SA(H)∥ = 0 and Tr(S ⊺ L(G, H)) =
  0.
  We choose to order the vertices being ordered by their colors vertices in G and H. That is, a vertex u ∈ V (G) comes
  before vertex v ∈ V (G) if the stable coloring satisfies C∞ (u) < C∞ (v). Following the described ordering, and
  Theorem 3.5.11 in Grohe (2017), then S is symmetric, satisfying Si,j > 0 if, and only, if vertices i, j have the same
  color when the 1-WL algorithm acts on G and H, without considering initial labels. Moreover, Tr(S ⊺ L(G, H)) = 0
  implies that Si,j > 0 =⇒ ℓG (i) = ℓG (j). Therefore, if two vertices have the same stable color after 1-WL without
  considering initial labels, then these two vertices also have the same initial labels. This implies that the adjacency
  matrices of G′ , H ′ can be written as follows,
                                                                      
                                                      ′      A(G) B
                                                  A(G ) =                 ,
                                                              B⊺     D
                                                                       
                                                             A(H) B
                                                  A(H ′ ) =               ,
                                                              B⊺     D

                                                                 26
                                                             Covered Forests

     where B ∈ Rn×m , such that
                                               (                                        Pi−1
                                                   1, i ∈ {2, . . . n} and j = 1 +             k=1 θ(ℓG (k)),
                                      Bi,j =
                                                   0, otherwise,

     and D ∈ Rm×m is a block diagonal symmetric matrix of the attached cliques. We now define S ′ to be
                                                                
                                                    ′     S 0
                                                  S =          e ,
                                                          0 S

     where S
           e is defined as follows,
                                                                                          
                                                        K1,1        K1,1      ···     K1,n
                                                       K2,1        K2,2      ···     K2,n 
                                                    e=
                                                    S                                  ..  ,
                                                                                           
                                                       ..           ..       ..
                                                       .             .          .      . 
                                                             Kn,1   Kn,2      ···     Kn,n

     where Ki,j ∈ Rθ(ℓG (i)×θ(ℓG (j)) is
                                                                                        
                                                               Si,j      0     ···    0
                                                               0        0     ···    0
                                                       Ki,j =  .                     ..  .
                                                                                        
                                                                         ..    ..
                                                               ..        .       .    .
                                                                    0    0     ···    0

     It is then easy to verify that, S                                                        e ⊺ = B ⊺ S which by symmetry
                                     e is a doubly stochastic and symmetric matrix satisfying SB
     implies B S  e = SB. Finally, it is easy to verify that D S   e = SD,
                                                                       e     by showing that D S e is symmetric and using the
     symmetry of D and S.    e All together, this implies
                                                "                 #                  
                                        ′   ′    A(G)S B S            SA(H) SB
                                                                                         = S ′ A(H ′ ),
                                                                e
                                  A(G )S =                          =   e ⊺
                                                   B⊺S       DS e      SB        SD
                                                                                  e

     as desired.

This concludes the proof.

F. The Tree Mover’s distance
The following introduces the Tree Mover’s Distance (TMD), defined through the optimal transport problem. Following the
notation from the original paper by Chuang & Jegelka (2022), we introduce the optimal transport problem and the Wasserstein
distance. We then define an optimal transport problem between the sets of unrolled computation trees corresponding to the
vertices of two labeled graphs. Next, we define a distance between labeled rooted trees and extend this definition to the
space of labeled graphs, using the optimal transport problem and the unrolling trees of graphs’ vertices.

The Optimal Transport We begin with a brief introduction to Optimal Transport (OT) and the Wasserstein distance. Let
X = {xi }m                       m
             i=1 and Y = {yj }j=1 be two multisets of m elements each. Let C ∈ R
                                                                                     m×m
                                                                                           be the transportation cost for each
pair, i.e., Cij = d(xi , yj ), where d is a distance function between X and Y . The Wasserstein distance is defined through the
following minimization problem,

                                                  ⟨C, γ⟩
                   OT∗d (X, Y ) :=     min               ,    Γ (X, Y ) = {γ ∈ Rm×m
                                                                                +   | γ1m = γ ⊤ 1m = 1m },
                                     γ∈Γ (X,Y )     m

where ⟨·, ·⟩ is defined as the sum of the elements resulting from the entry-wise multiplication of two matrices with equal
dimensions, and 1m denotes the all ones m-dimensional column vector. In the following, we use the unnormalized version
of the Wasserstein distance,
                                    OTd (X, Y ) := min ⟨C, γ⟩ = m · OT∗d (X, Y ).
                                                         γ∈Γ (X,Y )


                                                                    27
                                                        Covered Forests

Distance between rooted trees via hierarchical OT Let (T, r) denote a rooted tree. We further let Tv be the multiset of
subtrees of T consisting of subtrees rooted at the children of v. Determining whether two trees are similar requires iteratively
examining whether the subtrees in each level are similar. By recursively computing the optimal transportation cost between
their subtrees, we define the distance between two rooted trees (Ta , ra ), (Tb , rb ). However, the number of subtrees could be
                                       ̸ |Trb |. To compute the OT between sets with different sizes, we augment the smaller set
different for ra and rb , i.e., |Tra | =
with blank trees.
Definition 25. A blank tree T0 is a tree (graph) that contains a single vertex and no edge, where the vertex feature is the
zero vector 0p ∈ Rp , and T0n denotes a multiset of n blank trees.
Definition 26. Given two multisets of trees Tu , Tv , define ρ to be a function that augments a pair of trees with blank trees as
follows,                                                                                            
                                                       max(|Tu |−|Tv |,0)         max(|Tv |−|Tu |,0)
                          ρ : (Tv , Tu ) → Tv ∪ T0                        , Tu ∪ T0                    .

We now recursively define a distance between rooted trees using the optimal transport problem.
Definition 27. The distance between two trees rooted (Ta , ra ), (Tb , rb ) is defined recursively as:
                                        (
                                          ∥xra − xrb ∥ + ω(L) · OTTDw (ρ(Tra , Trb )) if L > 1,
                      TDω (Ta , Tb ) :=
                                          ∥xra − xrb ∥                                       otherwise,

where ∥·∥ is a norm on the feature space, L = max(Depth(Ta ), Depth(Tb )) and ω : N → R+ is a depth-dependent weighting
function.

Extension to labeled graphs Below, we extend the above distance between rooted trees to the TMD on labeled graphs by
calculating the optimal transportation cost between the graphs’ unrolling trees.
Definition 28. Given two graphs G, H and L > 0, the tree mover’s distance between G and H is defined as

                                            TMDL                    L    L
                                               ω (G, H) = OTTDω (ρ(TG , TH )),

where TGL and THL are multisets of the depth-L unrolling trees of graphs G and H, respectively.

G. Mean-Forest distance
Normalized Tree Mover’s distance We can scale the vertex features of the forests to extend the definition of the Forest
distance to the normalized TMD; see Chuang & Jegelka (2022). This distance satisfies the Lipschitz property of mean
aggregation MPNNs, as shown in Chuang & Jegelka (2022, Appendix B.). However, this distance is strictly more expressive
than the mean-1-WL algorithm, meaning that there are graphs that are not distinguished by the 1-MWL but have a positive
normalized TMD. To see this, consider the distance between two star graphs, one with a root labeled 1 and two neighbors
labeled 1 and 2, and the other with a root labeled 1 and four neighbors, two of which are labeled 1 and the other two with 2.
It is clear that the 1-MWL cannot distinguish these two simple graphs. However, the normalized TMD between these graphs
is positive because the number of vertices at the first level differs. This motivates us to define the mean-Forest distance
through the mean unrollings defined in Section 1.1.

Mean-Forest distance Here, we define the mean-Forest distance, providing a pseudo-metric aligned with the mean-
aggregation MPNN models and preserving the expressivity of the 1-MWL. That is, for a given attributed n-order graph
(G, ℓG ) with labels in R1×d and a fixed L ∈ N, consider the following multiset of mean-unrolling trees,

                                         TsGL = {{τ (m-unr(G, u, L)) | u ∈ V (G)}}.

In analogy to the use of the normalized Wasserstein distance to define the normalized TMD in Chuang & Jegelka (2022),
here we scale all vertex features to align our distance with the mean aggregation scheme described by Equation (5), thereby
ensuring the Lipschitz property. For each vertex u in each tree, we divide its vertex feature by s(u), where s(u) is defined
inductively as follows. For the root r, s(r) = 1. For any other vertex u, with parent v, we define s(u) as the product of the
number of children of v and s(v). Next, we perform a padding process on all trees in TsGL as follows. For each vertex of each
tree, we add children with the vertex feature 0 until each vertex has exactly n − 1 children. We then construct the forest
                                                      m
consisting of all n trees and denote this forest by FG,L .

                                                               28
                                                               Covered Forests

The mean-Forest distance between two labeled graphs G and H is defined as
                                                    X
                             FDmL (G, H) = min                m (u) − ℓF m (φ(u))∥2 ,
                                                          ∥ℓFG,L          H,L
                                                    φ
                                                                 m )
                                                           u∈V (FG,L

                                                                              m             m
where the minimum is taken over all edge-preserving bijections between V (FG,L  ) and V (FH,L   ). Now, the following result
shows that the mean-Forest distance is a valid pseudo-metric.
Lemma 29. The mean-Forest distance FDm       L is a well-defined pseudo-metric on Gn,d , for L ∈ N. Additionally, for two
                                                                                     R

graphs G, H, FDm L (G, H) =  0 if, and only, if G, H are 1-MWL   indistinguishable after L iterations.

H. Properties of the Forest distance and the mean-Forest distance
Here, we prove the main results regarding the Forest distance and mean-Forest distance as defined in Section 2. We start
by showing the equivalence between the Forest distance and the Tree Mover’s distance, as stated in Lemma 3. Next, we
establish that the mean-Forest distance is a well-defined pseudo-metric on the set of graphs and has equivalent expressivity to
1-MWL; see Lemma 29. We then show the Lipschitz-continuity property of sum and mean aggregation MPNNs concerning
the Forest distance and mean-Forest distance, respectively, i.e., Lemma 14 and Lemma 48. Finally, we derive an upper
bound for the covering number of graph class Gn,d,q regarding the Forest distance, as stated in Proposition 16.
We begin by showing the equivalence between the Forest distance and the TMD. Specifically, we prove Lemma 3 using a
recursive formula for the Forest distance for the simple case where the weight ω ≡ 1. The proof for general weight function
ω remains the same. To proceed, we will introduce some further notations. Recall the definition of the Forest distance, for
L ∈ N and graphs G, H ∈ Gn,d R
                                 , the Forest distance
                                                            X
                                    FDL (G, H) = min              ∥ℓG (u) − ℓH (φ(u))∥2 ,
                                                           φ
                                                                u∈V (FG,L )

where FG,L denotes the forest consisting of all padded trees in TGL , and the minimum is taken over all edge-preserving
bijections φ between V (FG,L ) and V (FH,L ). We denote the set of forests consisting of depth-L complete trees (i.e.,
non-leaf vertex has exactly n − 1 children), with vertex labels from Rd , by FL . For two forests F1 , F2 ∈ FL , we define
iso(F
 Ď 1 , F2 ) as the set of edge-preserving bijections between V (F1 ) and V (F2 ). If F1 and F2 contain a different number
of trees, we pad the smaller forest with depth-L complete trees with 0 vertex labels. The forest transport function FTL
between two forests in FL is then defined as
                                                                                           
                                                                                  (F   )
                                                                X
                               FTL (F1 , F2 ) :=    min              ∥x(F
                                                                         u
                                                                           1)
                                                                              − xφ(u)2
                                                                                         ∥2 ,
                                                    φ∈iso(F
                                                       Ď 1 ,F2 )
                                                                         u∈V (F1 )

        (F )
where xu j ∈ R1×d represents the label of vertex u in Fj for j ∈ {1,2}. Observing this, we immediately find that
                                               FDL (G, H) = FTL (FG,L , FH,L ).
Now, for a rooted tree T with root r, let Tr denote the multiset containing all subtrees rooted at the children of r in T , and
let Fr represent the forest of padded (with 0 labeled vertices) subtrees rooted at r’s children. Additionally, given a forest F
composed of rooted trees, denote by roots(F ) the set of roots of the trees in F . The following lemma provides a recursive
formula for the Forest distance.
Lemma 30. For forests F1 , F2 ∈ FL ,
                                                                                                              
                                                          X                   (F   )
                                                                                                              
              FTL (F1 , F2 ) =          min                       ∥x(F
                                                                      r
                                                                        1)
                                                                           − xσ(r)2
                                                                                      ∥2 + FTL−1 (Fr , Fσ(r) ) .
                               σ : roots(F1 )→roots(F2 )
                                         bijection             r∈roots(F1 )


Proof. We prove the lemma by substituting the definition of FTL−1 (Fr , Fσ(r) ) into the recursive formula. By definition of
the forest transport function, we have,
                                                                                                
                                                                                       (F   )
                                                                  X
                            FTL−1 (Fr , Fσ(r) ) =     min               ∥x(F
                                                                            u
                                                                               1)
                                                                                  − xφ(u) 2
                                                                                              ∥2 .
                                                      φ∈iso(F
                                                         Ď r ,Fσ(r) )
                                                                              u∈V (Fr )


                                                                       29
                                                                    Covered Forests

Substituting this into the recursive formula yields that
                                                                                                   
                                                  X                (F2 )
                                                                                                  
                                min                     ∥x(F
                                                           r
                                                              1)
                                                                 − xσ(r)  ∥2 + FTL−1 (Fr , Fσ(r) ) 
                           σ : roots(F1 )→roots(F2 )
                                     bijection          r∈roots(F1 )


is equal to

                                                             (F )
                                  X
              min                             ∥x(F
                                                r
                                                   1)      2
                                                      − xσ(r) ∥2
   σ : roots(F1 )→roots(F2 )
             bijection         r∈roots(F1 )
                                                                                                                                               
                                                                                                              X                      (Fσ(r) )
                                                                                 +        min                            ∥x(F
                                                                                                                            u
                                                                                                                               r)
                                                                                                                                  − xφ(u)     ∥2 
                                                                                     φ∈iso(F
                                                                                        Ď r ,Fσ(r) )
                                                                                                           u∈V (Fr,F1 )

which is equal to
                                                                                                                                      
                                          X                                        (F )
                                                                                                         X                    (Fσ(r) )
                    min                                  min          ∥x(F
                                                                          r
                                                                             1)
                                                                                − x 2 ∥2 +                         ∥x(F
                                                                                                                     u
                                                                                                                        r)
                                                                                                                           − xφ(u)     ∥2 ,
                                                                                          σ(r)
          σ : roots(F1 )→roots(F2 )                  φ∈iso(F
                                                        Ď r ,Fσ(r) )
                    bijection         r∈roots(F1 )                                                     u∈V (Fr )


which in turn is equal to FTL (F1 , F2 ). Here, the last equality follows from the fact that computing a bijection between
the roots of the trees in two forests and then computing edge-preserving bijections between the subtrees of these roots is
equivalent to directly computing edge-preserving bijections between the two forests.

Next, using Lemma 30, we show the equivalence of Forest distance and TMD.
Lemma 31 (Lemma 3 (for ω ≡ 1) in the main paper). The Forest distance is equivalent to the TMD when ω ≡ 1. That is,
for graphs G, H ∈ Gn,d
                   R
                       ,
                                        TMDL (G, H) = FDL (G, H).

Proof. We prove by induction on L that if T1 and T2 are multisets of n depth-L trees, and F1 and F2 are the padded forests
induced by T1 and T2 , respectively, then

                                                       OTTD (ρ(T1 , T2 )) = FTL (F1 , F2 ),

where OT, TD, and ρ denote the optimal transport problem, Tree distance, and padding function, respectively, as defined
in Appendix F. Setting T1 = TGL and T2 = THL implies the equivalency between the two distances. For L = 0, consider
multisets T1 , T2 of trivial “trees,” i.e., isolated vertices. By the optimal transport problem definition, if we assume
T1 = T2 = [n], we have                                                                   
                                                                X
                               OTTD (ρ(T1 , T2 )) = min              Su,v ∥x(G)    (H) 
                                                                             u − xv ∥2 ,
                                                              S∈Dn
                                                                           u∈T1 ,v∈T2

which is a minimization problem with a convex feasible set and linear objective function. Therefore, the minimum is attained
on an extreme point. The Birkhoff-von Neumann theorem shows that the extreme points for doubly stochastic matrices are
                                      Ď G,L , F H,L ) is equivalent to choosing a permutation matrix, we conclude that,
the permutation matrices. Since φ ∈ iso(F
                                                                                  
                                                     X
                     OTTD (ρ(T1 , T2 )) = min               Pu,v ∥x(G)      (H) 
                                                                     u − xv ∥2        = FT0 (F1 , F2 ).
                                                     P ∈Pn
                                                              u∈T1 ,v∈T2

For the inductive hypothesis, we assume that

                                                     OTTD (ρ(T1 , T2 )) = FTL−1 (F1 , F2 ),

for multisets T1 , T2 of (L − 1)-depth trees and their corresponding forests F1 , F2 . Now, let us consider two multisets of
L-depth trees, T1 and T2 , with associated forests F1 and F2 . With slight abuse of notation, we introduce a canonical ordering

                                                                            30
                                                            Covered Forests

for the elements in the multisets T1 and T2 such that each t ∈ T1 can be used interchangeably as a tree or as an index for
the entries of the permutation matrix. Additionally, for each rooted tree t ∈ T1 , we denote the root by rt . We compute the
optimal transport OTTD (ρ(T1 , T2 )) using the definition from Appendix F as follows,
                                                                          
                                                   X
                   OTTD (ρ(T1 , T2 )) = min               Pt,t′ TD(t, t′ )
                                         P ∈Pn
                                                    t∈T1 ,t′ ∈T2
                                                                                                                 
                                                       X                          ′
                                                                                                                
                                       = min                      Pt,t′ ∥x(t)   (t )
                                                                           rt − xrt′ ∥2 + OTTD (ρ(Trt , Trt′ ))
                                                                                                                  
                                         P ∈Pn
                                                    t∈T1 ,t′ ∈T2
                                                                                                              
                                                       X                             ′
                                                                                                             
                                       = min                      Pt,t′ ∥x(t)   (t )
                                                                           rt − xrt′ ∥2 + FTL−1 (Frt , Frt′ )
                                                                                                               
                                         P ∈Pn
                                                    t∈T1 ,t′ ∈T2

                                       = FDL (F1 , F2 ),

where the last two equalities follow from the inductive hypothesis and from Lemma 30, respectively.

The following results relate the mean Forest distances to the 1-MWL in distinguishing non-isomorphic graphs.
                                                                                              (m)
Lemma 32 (Lemma 29 in Appendix G). For L ∈ N, the mean-Forest distance FDL is a well-defined pseudo-metric on
                       (m)
Gn,d
 R
     . Additionally, FDL (G, H) = 0 if, and only, if G, H are 1-MWL indistinguishable after L iterations.

Proof. We recall the definition of the mean-Forest distance between two graphs G, H ∈ Gn,d
                                                                                       R
                                                                                           , which can be written as
                                       (m)
                                   FDL (G, H) =                     min            (Tr(P ⊺ L(G, H))),
                                                                   P ∈PnF
                                                             (m)             (m)
                                                        A(FG,L )P =P A(FH,L )

         (G,H)       (G)         (H)
where Lu,v   = ∥xu − xv ∥2 , and nF is the total number of vertices in the forest after the padding process i.e.,
nF = (n − 1)L+1 − 1.
                            (m)                          (m)                  (m)
It is easy to verify that FDL (G, G) = 0 and FDL (G, H) = FDL (H, G) for all G, H ∈ Gn,w      R
                                                                                                 . Now, for the triangle
                                              ′   ′′
inequality, consider GA , GB , GC ∈ Gn,w and P , P as the permutation matrices arising from the minimization formula of
                                     R
   (m)                     (m)
FDL (GA , GB ) and FDL (GB , GC ), respectively. Note that P ′ P ′′ is a permutation matrix satisfying
                                        (m)                           (m)                      (m)
                                  A(FGA ,L )P ′ P ′′ = P ′ A(FGB ,L )P ′′ = P ′ P ′′ A(FGC ,L ),

implying that
                                              (m)
                                        FDL (GA , GC ) ≤ Tr((P ′ P ′′ )⊺ L(GA , GC )).
Following the same derivations as in Proposition 23, we show that

                     Tr((P ′ P ′′ )⊺ L(GA , GC )) ≤ Tr((P ′ )⊺ L(GA , GB )) + Tr((P ′′ )⊺ L(GB , GC )),

which proves the triangle inequality.
                            (m)
The additional property: FDL (G, H) = 0 if, and only if, G and H are 1-MWL indistinguishable after L iterations, follows
directly from the unrolling characterization of 1-MWL as described in Proposition 18.



Computational complexity Throughout the paper, we discuss two main distances: the tree distance (with either the cut
norm or the L2 -norm) and the forest distance. As shown in Lemma 3, the forest distance is equivalent to the Tree Mover’s
Distance (TMD) introduced by Chuang & Jegelka (2022). This equivalence allows for efficient computation via dynamic
programming (as described in the original paper), with a time complexity of O(t(n) + Lnt(q)), where q is the maximum
degree of a node (in both graphs), n is the number of nodes, and t(m) = O(m3 log(m)).

                                                                      31
                                                         Covered Forests

The tree distance with the L2 -norm can be computed in polynomial time (specifically, an ϵ-approximation), as detailed
in (Nesterov & Nemirovskii, 1994, Section 6.3.3). In contrast, computing the tree distance with the cut norm involves a
significantly harder combinatorial optimization problem. One of the most well-known approximation techniques for this
case is described in (Alon & Naor, 2004). Additional relevant works include Alon et al. (2002); Frieze & Kannan (1999). It
is worth mentioning that for the theoretical results in our paper, either the tree distance with the cut norm or with the 2-norm
can be used interchangeably, as they define the same topology as discussed in (Böker et al., 2023).

I. Extended robustness framework
                                 √ generalization bound in Theorem 4 by establishing a data-dependent bound that
Kawaguchi et al. (2022) improved the
reduces the dependency on K from K to log (K), as shown in the following theorem.
Theorem 33 (Theorem 3 in Kawaguchi et al. (2022)). For any (K, ϵ)-robust (graph) learning algorithm for H on Z, with
                 K(S)
partition {Ck }k=1 , we have that for all δ ∈ (0,1), with probability at least 1 − δ, for a sample S drawn from Z according
to µ, it holds that
                                                                     s                                    !
                                                          √        |T | log(2K/δ) 2|T | log(2K/δ)
                                                                           S                   S
                 ℓexp (hS ) ≤ ℓemp (hS ) + ϵ(S) + ζ(hS )     2+1                         +                   ,
                                                                               |S|                |S|

where IkS = {i ∈ [|S|] | (xi , yi ) ∈ Ci }, ζ(hS ) = max(x,y)∈Z {ℓ(hS (x), y))}, and TS = {k ∈ [K] | |IkS | ≥ 1}.

Here, we introduce an extended definition of robustness that allows us to choose different radii for the various partition sets.
This modification makes the first term of the generalization bounds in Theorem 4 data-dependent.
Definition 34. A (graph) learning algorithm for H is (K, ε)-robust, with K, ε = (ε1 , . . . εK ) mapping from the set of all
                                                                                                       K(S)
possible samples to N and (0, ∞)K(S) , respectively, if Z can be partitioned into K(S) sets, {Ci }i=1 , such that for all
samples S, and for any (G, y) ∈ S, the following holds. If (G, y) ∈ Ci for some i ∈ {1, . . . , K}, then for all (G′ , y ′ ) ∈ Ci ,
we have
                                         ℓ hS (G), y − ℓ hS (G′ ), y ′ < εi (S),
                                                                     

where hS is the graph embedding the learning algorithm returns concerning the data sample S.

Building on our refined definition of robustness, we derive the following generalization bound. The proof is nearly identical
to that of Theorem 3 in Xu & Mannor (2012); however, for completeness, we provide the proof in Appendix J.
Theorem 35. For any (K, ε)-robust (graph) learning algorithm for H on Z, we have that for all δ ∈ (0,1), with probability
at least 1 − δ,
                                                                               s
                                             K
                                            X   |{s ∈ S | s ∈ Ci }|              2K log(2) + 2 log(1/δ)
                |ℓexp (hS ) − ℓemp (hS )| ≤                         ϵi (S) + M                          .
                                            i=1
                                                       |S|                                |S|

where hS , as before, denotes a graph embedding from H returned by the learning algorithm given the data sample S of Z.
We recall that M is the bound on the loss function ℓ.

Based on Theorem 35 and the proof technique outlined in Theorem 10, we present the following generalization bound for
the class of unlabeled graphs consisting of at most n vertices (i.e., G≤n )
Proposition 36. For n, L ∈ N, M ′ ∈ R, for any graph learning algorithm for the class MPNNord
                                                                                            L,M ′ ,LFNN (G≤n ) and for any
sample S and δ ∈ (0,1), with probability at least 1 − δ, we have
                                                                                    s
                                           n                           
                                          X   |{s ∈ S | s ∈ Gi × Y}| ← 8k              4m≤n/k + 1 log(2) + 2 log(1/δ)
  |ℓexp (hS ) − ℓemp (hS )| ≤ Lℓ · LFNN ·                           γ
                                                                    s     2
                                                                              +M                                       ,
                                          i=1
                                                        |S|              i                           |S|

for k ∈ N, where M is an upper bound on the loss function ℓ, and m≤n := |G≤n/∼WL |.

J. Missing proofs from Section 3
The following results extends the robustness based generalization bounds utilizing the generalized robustness property.

                                                                32
                                                                Covered Forests

Theorem 37 (Theorem 35 in Appendix I). If we have a (K, ε)-robust (graph) learning algorithm for H on Z, then for all
δ ∈ (0,1), with probability at least 1 − δ, for a sample S drawn from Z according to µ, it holds that
                                           K(S)
                                                                              s
                                            X |{s ∈ S | s ∈ Ci }|               2K(S) log(2) + 2 log(1/δ)
               |ℓexp (hS ) − ℓemp (hS )| ≤                         ϵi (S) + M                             .
                                            i=1
                                                        |S|                                 |S|

where hS , as before, denotes a graph embedding from H returned by the learning algorithm given the data sample S of Z.
We recall that M is the bound on the loss function ℓ.

Proof. Let Ni = {s ∈ S | s ∈ Ci }. Note that (|N1 |, . . . , |NK |) is an i.i.d multinomial random variable with parameters |S|
and (µ(C1 ), . . . , µ(CK )), where µ is the unknown distribution on Z from which our sample is drawn. The following holds
by the Bretagnolle-Huber-Carol inequality (see Proposition A.6 of van der Vaart et al. (1996)),
                                           K 
                                                                     !
                                                                                       nλ2
                                                                                          
                                          X    |Ni |
                                    Pr               − µ(Ci ) ≥ λ ≤ 2K exp −                  .
                                          i=1
                                                |S|                                     2

Thus, with probability at least 1 − δ, we have:
                                                                         s
                                            K
                                            X |Ni |                           2K log 2 + 2 ln(1/δ)
                                                          − µ(Ci ) ≤                               .
                                            i=1
                                                    |S|                               |S|

The discrepancy between the expected and empirical losses can be bounded as follows:

                    |ℓexp (hS ) − ℓemp (hS )|
                         K
                         X                                          1 X
                     =         E(ℓ(hS , z)|z ∈ Ci )µ(Ci ) −             ℓ(hS , s)
                         i=1
                                                                   |S|
                                                                         s∈S
                         K
                         X                                |Ni |   1 X
                     ≤         E(ℓ(hS , z)|z ∈ Ci )             −             ℓ(hS , s)
                         i=1
                                                           |S|    |S|
                                                                        s∈S
                         K                                        K
                         X                                        X                            |Ni |
                     +         E(ℓ(hS , z)|z ∈ Ci )µ(Ci ) −             E(ℓ(hS , z)|z ∈ Ci )
                         i=1                                      i=1
                                                                                                |S|
                            K                                                                      K
                          1 XX                                                                     X |Ni |
                     ≤                     max |ℓ(hS , s) − ℓ(hS , z2 )| + max|ℓ(hS , z)|                      − µ(Ci )
                          |S| i=1          z2 ∈Ci                                   z∈Z
                                                                                                   i=1
                                                                                                         |S|
                                    s∈Ni
                                                                   s
                         K
                         X |{s ∈ S | s ∈ Ci }|                          2K log(2) + 2 log(1/δ)
                     ≤                                ϵi (S) + M                               ,
                         i=1
                                      |S|                                        |S|

where the first inequality is due to triangle inequality, the second by definition of Ni , the third by definition of the generalized
robustness property and the bound M .

The following result links continuity and robustness.
Proposition 38 (Proposition 5 in the main paper). Let (G, dG ), (X , dX ), and (Y, dY ) be pseudo-metric spaces, and let H
denote the class of uniformly continuous graph embeddings from (G, dG ) to (X , dX ). If ℓ : X × Y → R+ is a cℓ -Lipschitz
continuous loss function, regarding d∞ , then for any ε > 0, a graph learning algorithm for H on G × Y is
                                                                           
                                      N G, dG , γ/2 · N (Y, dY , ε/2), cℓ ε -robust.

Where γ(·, h) be the positive function γ used in definition of the uniform continuity of h ∈ H

Proof. Let {Ci }K
                i=1 be a partition corresponding to a γ(ε, hS )/2-cover
                  1
                                                                        of G, and let {Yj }K
                                                                                           j=1 be a partition of Y correspond-
                                                                                             2
                                                                      
ing to an ε/2-cover of Y. Then we have K1 = N G, dG , γ(ε, hS )/2 and K2 = N (Y, dY , ε/2). Letting K = K1 K2 , we

                                                                         33
                                                      Covered Forests

define the partition Di,j := Ci × Yj , for i ∈ [K1 ] and j ∈ [K2 ] of G × Y. We now verify that this partition satisfies the
robustness conditions.
To this end, consider a sample (G, y) ∈ S from G ×Y and assume (G, y) ∈ Di,j , along with another element (G′ , y ′ ) ∈ Di,j .
We need to show that
                                            ℓ hS (G), y − ℓ hS (G′ ), y ′ ≤ cℓ ε.
                                                                        

Since G and G′ both belong to Ci , we have dG (G, G′ ) ≤ γ(ε, hS ) and this implies that dX hS (G), hS (G′ ) ≤ ε. Similarly,
                                                                                                            

since y and y ′ both belong to Yj , we have dY (y, y ′ ) ≤ ε. Thus, using the fact that the loss function ℓ is cℓ -Lipschitz
continuous, we obtain
                          ℓ hS (G), y − ℓ hS (G′ ), y ′ ≤ cℓ max dX hS (G), hS (G′ ) , dY (y, y ′ )
                                                                                      

                                                        ≤ cℓ max{ε, ε} = cℓ ε,
as desired.

J.1. Robustness and expressiveness
To apply Theorem 4 in our analysis, we must choose our pseudo-metric dG , the class of graph embeddings H, and the loss
function so that the Lipschitzness of the graph embeddings and the loss function guarantee robustness; see Corollary 6.
Since we are primarily interested in the generalization abilities of MPNN architectures, the chosen pseudo-metric should be
aligned with the MPNN outputs to satisfy a Lipschitz property. A minimal requirement is that whenever the distance between
two graphs through the chosen pseudo-metric is zero, the MPNN outputs should be identical. We derive the following result
by combining this observation with the results from Morris et al. (2019) regarding the equivalence of MPNNs and the 1-WL
algorithm.
Observation 2. Let (G, dG ) be a set of graph G paired with a pseudo-metric dG and H be the hypothesis class of all possible
MPNNs. Then, if h is Ch -Lipschitz for all h ∈ H, we have that the pseudo-metric dG is at least as expressive as the 1-WL,
i.e., for all G1 , G2 ∈ G with dG (G1 , G2 ) = 0, we have that G1 , G2 are 1-WL indistinguishable.

The observation shows some minimal expressivity requirements for the pseudo-metric must be met to satisfy the Lipschitz
property on MPNNs. Thus, for the rest of this work, we focus on pseudo-metrics that are at least as expressive as the 1-WL
or its variants such that the 1-MWL.

K. Graphon analysis
In the following section, we define graphons, the extension of graphs to graphs with infinitely many (and uncountable)
vertices. Formally, the space of graphons is the completion of the space of graphs to a compact space concerning the
cut-distance; see Frieze & Kannan (1999) and Lovász (2012, Theorem 9.23). Next, we extend the tree distance to the space
of graphons such that the graphon tree distance between two induced graphons is precisely the tree distance between the
original graphs. We further introduce the Prokhorov pseudo-metric δP on the space of graphons as defined in (Böker et al.,
2023). We proceed by describing a message-passing mechanism on the space of graphons such that applying this mechanism
to a graphon induced by a graph is equivalent to using the MPNN defined in Equation (1) to the original graph. Finally, we
present Theorems 29 and 31 from Böker et al. (2023), showing the equicontinuity of MPNNs on graphons concerning the
Prokhorov pseudo-metric and the uniform continuity of the Prokhorov pseudo-metric concerning the graphon tree distance,
respectively. Combining these two results, we establish the equicontinuity of MPNNs concerning the tree distance, as stated
in Theorem 8 of the main paper.

Graphons We begin with the definition of a graphon, which is just a symmetric measurable function W : [0,1]2 → [0,1].
We denote the set of all graphons by W. Graphons generalize graphs in the following sense. Every n-order graph G can
be viewed as a graphon WG by partitioning [0,1] into n intervals (Iv )v∈V (G) , each of mass 1/n, and letting WG (x, y) for
x ∈ Iu , y ∈ Iv be one if {u, v} ∈ E(G) and zero otherwise. We call WG the induced graphon by graph G.

Graphon tree distance A graphon W defines an operator TW : L2 ([0,1]) → L2 ([0,1]) on the space L2 ([0,1]) of square-
integrable functions modulo equality almost everywhere as
                                        Z
                         (TW f )(x) :=        W (x, y)f (y) dλ(y), x ∈ [0,1], f ∈ L2 ([0,1]).
                                           [0,1]


                                                             34
                                                           Covered Forests

Following Böker (2021) we define the graphon tree distance of two graphons U and W as
                                       T
                                      δ□ (U, W ) := inf sup |⟨f, (TU ◦ S − S ◦ TW )g⟩| ,
                                                       S   f,g

where the supremum is taken over all measurable functions f, g : [0,1] → [0,1] and the infimum is taken over all Markov
operators S, i.e., operators S : L2 ([0,1]) → L2 ([0,1]) such that S(f ) ≥ 0 for every f ≥ 0, S(1[0,1] ) = 1[0,1] , and
S ∗ (1[0,1] ) = 1[0,1] also for the Hilbert adjoint S ∗ . Markov operators are the infinite-dimensional analog to doubly stochastic
matrices (Eisner et al., 2015).
The following result by Böker (2021) shows that the graphon tree distance specializes to the tree distance defined on graphs
when applied to the corresponding induced graphons.
Lemma 39 ((Böker, 2021, Lemma 15)). Let G, H ∈ Gn for some n ∈ N. Then,

                                                  T                T
                                                 δ□ (G, H) = n2 · δ□ (WG , WH ).

Prokhorov pseudo-metric on graphons Without delving into technical details, we denote the Prokhorov pseudo-metric
on W as δP . The formal definition can be found in Böker et al. (2023). Intuitively, the Prokhorov pseudo-metric is a
pseudo-metric on the space of graphons and is based on the Prokhorov distance between the color histograms produced by a
continuous counterpart of the 1-WL algorithm applied to graphons.

Message passing graph neural networks on graphons For a graphon W ∈ W, an L-layer MPNN initializes a feature
 (0)                                                         (t)
hx := φ0 ∈ Rd0 for x ∈ [0,1]. Then, for t ∈ [L], we compute hx : [0,1] → Rdt and the single graphon-level feature
       1×d
hW ∈ R     after L layers by
                             Z                        !                    Z                !
                    h(t)
                     x := φt               W (x, y)h(t−1)
                                                    y     dλ(y) ,     and hW := ψ                 hx(L) dλ(x) .               (14)
                                   [0,1]                                                  [0,1]


Where, (φ)Lt=1 , ψ are the functions of Equation (1). This definition generalizes Equation (1) on graphons. More precisely,
we have the following result.
Lemma 40 ((Böker et al., 2023, Theorem 9)). Let G ∈ Gn , for some n ∈ N, let (φL
                                                                               t=1 ) be an L-layer MPNN model, and ψ
be Lipschitz. Then,
                                                   hG = hWG .

We are now ready to present Theorems 29 and 31 from (Böker et al., 2023), presenting the uniform continuity of MPNNs on
graphons for the Prokhorov pseudo-metric and the uniform continuity of the Prokhorov pseudo-metric for the graphon tree
distance, respectively.
Theorem 41 ((Böker et al., 2023, Theorem 29)). For all L ∈ N, ε > 0, there exists a δ1 > 0 such that, for all graphons U
and W , if δP (U, W ) ≤ δ1 , then ∥hU −hW ∥2 ≤ ε for every L′ -layer MPNN model given by Equation (14) with L ≤ L′ .
Theorem 42 ((Böker et al., 2023, Theorem 31)). For every ε > 0, there exists a δ2 > 0 such that, for all graphons U and
        T
W , if δ□ (U, W ) ≤ δ2 , then δP (U, W ) ≤ ε.

We now combine the above two results to show the equicontinuity of MPNNord
                                                                       L,M ′ ,LFNN (Gn ), as stated in Theorem 8 in the
main paper.
Theorem 43 (Theorem 8 in the main paper). For all ε > 0 and L ∈ N, there exists γ(ε) > 0 such that for n ∈ N, M ′ ∈ R,
G, H ∈ Gn , and all MPNN architectures in MPNNord
                                                L,M ′ ,LFNN (Gn ), the following implication holds,

                                            T
                                           δ□ (G, H) < n2 · γ(ε) =⇒ ∥hG − hH ∥2 ≤ ε.

Proof. Given ε > 0, let δ1 (ε) be as described in Theorem 41. Set this δ1 (ε) as the ε in Theorem 42 and compute
                                                                                                    T
δ2 (δ1 (ε)) = δ2 (ε). Now, by setting γ(ε) = δ2 (ε), we have that for all n ∈ N and G, H ∈ Gn , if δ□ (WG , WH ) ≤ γ(ε), or
equivalently, by Lemma 39 if,
                                                     T
                                                   δ□  (G, H) ≤ n2 · γ(ε),

                                                                 35
                                                           Covered Forests

then δP (WG , WH ) ≤ δ1 (ε). Hence, by Theorem 41, ∥hWG − hWH ∥2 ≤ ε, for all L-layer MPNN models given by
Equation (14). Finally, by Lemma 40, the last inequality can equivalently be written as
                                                         ∥hG − hH ∥2 ≤ ε,
completing the proof.

L. Robustness and VC dimension bounds
Here, we show how we can recover previously obtained bounds on the generalization abilities of MPNNs of Morris et al.
(2023a) through the generalization framework of Section 3. That is, we show how the robustness framework of Section 3
allows us to recover the results in Morris et al. (2023a, Proposition 1 and 2) by fixing a particular pseudo-metric on the set
of n-order graphs. Unlike Morris et al. (2023a), our results not only hold for the binary classification setting using the 0-1
loss but, under mild assumptions, for arbitrary loss functions, such as the cross entropy loss and also standard loss functions
for the regression case.

Analysis of generalization abilities of MPNNs of Morris et al. (2023a) To state the results of Morris et al. (2023a), we
first introduce the VC dimension of MPNNs. That is, for a class of MPNNs MPNN(X ) operating on a set of graphs X , e.g.,
MPNNL (X ), the VC dimension VC-dim(MPNN(G)) is the maximal number m of graphs G1 , . . . , Gm in X that can be
shattered by MPNN(X ). Here, G1 , . . . , Gm are shattered if for any τ in {0,1}m there exists a MPNN mpnn ∈ MPNN(X )
such that for all i in [m],
                                                      mpnn(Gi ) = τi .
By standard learning-theoretic results, bounding the VC dimension of a class of functions directly implies a bound on the
generalization error.9
Theorem 44 (Vapnik & Chervonenkis (1964); Vapnik (1998, adapted to MPNNs)). Let X be a set of graphs and let
MPNN(X ) be a class of MPNNs operating on X , with VC-dim(MPNN(X )) = d < ∞. Then, for all δ ∈ (0,1), with
probability at least 1 − δ, the following holds for all mpnn ∈ MPNN(X ),
                                                              r                 r
                                                                2d log (eN/d)     log (1/δ)
                                ℓexp (mpnn) ≤ ℓemp (mpnn) +                   +             .
                                                                     N              2N

To bound the VC dimension of MPNNs, Morris et al. (2023a) consider X = Gn,d         B
                                                                                       , the set of n-order graphs with d-
dimensional Boolean vertex features and Y = {0,1}. Like Morris et al. (2023a), for d > 0, by mn,d,L we denote the number
of unique graphs in Gn,d
                     B
                         distinguishable by 1-WL after L iterations. Now, Morris et al. (2023a) proved the following upper
and lower bounds for the VC dimension of L-layer MPNNs on the set Gn,d   B
                                                                            of graphs, showing that the VC dimension is
bounded by the ability of the 1-WL to distinguish n-order graphs.
Proposition 45 (Morris et al. (2023a, Proposition 1)). For all n, d and L ∈ N, it holds that
                                                                  
                                                                B
                                          VC-dim MPNNL Gn,d           ≤ mn,d,L .

This upper bound holds regardless of the choice of aggregation, update, and readout functions used in the MPNN architecture.
They also show a matching lower bound.
Proposition 46 (Morris et al. (2023a, Proposition 2)). For all n, d, and L ∈ N, all mn,d,L 1-WL-distinguishable n-order
graphs with d-dimensional boolean features can be shattered by sufficiently wide L-layer MPNNs. Hence,
                                                                  
                                                                 B
                                           VC-dim MPNNL Gn,d           = mn,d,L .

Hence, combining the above result with Theorem 44 implies that for all samples S, with probability at least 1 − δ,
                                                  s                              s
                                                    2mn,d,L log (e|S|/mn,d,L )     log (1/δ)
                        ℓexp (hS ) ≤ ℓemp (hS ) +                              +             .
                                                               |S|                    2|S|
    9
      For ease of exposition, compared to Morris et al. (2023a), we use a slightly different definition of MPNNs’ VC dimension. However,
the proofs of Propositions 1 and 2 also work in the case of the above definition.

                                                                  36
                                                          Covered Forests

Note that the logarithm must be positive for the above bound to be meaningful. This requires the assumption that the sample
size is significantly larger than the total number of 1-WL-distinguishable graphs, which is generally not feasible, especially
for large graphs. We now largely recover the above generalization bound without any assumptions on the sample size
through the theory outlined in Section 3 and extend it to the case of regression.

Recovering Morris et al. (2023a) via the robustness framework Let us consider the binary classification setting with
Y = {0,1} and the 0-1 loss function ℓ : Y × Y → {0,1}, where ℓ(y1 , y2 ) = 0 if, and only if, y1 = y2 . Given that the
expressive power of any MPNN with L layers is bounded by 1-WL after L iterations (Morris et al., 2019), it is straightforward
to verify that any graph learning algorithm for MPNNL (Gn,d  B
                                                                ) on Z := Gn,d
                                                                            B
                                                                               × Y is (2mn,d,L , 0)-robust, leading to the
following generalization bound. For δ ∈ (0,1) and for all samples S, with probability at least 1 − δ, we have
                                                            s
                                                               4mn,d,L log(2) + 2 log(1/δ)
                                |ℓexp (hS ) − ℓemp (hS )| ≤                                .
                                                                          |S|

To see this, observe that we can construct a partition of Z using the sets C = G × {j}, for G ∈ Gn/∼WLL , j ∈ {0,1}.

Regression setting In contrast to Morris et al. (2023a), the robustness framework is flexible enough to accommodate
different loss functions straightforwardly. For example, consider the set of graphs Gn,d
                                                                                     B
                                                                                         , we now extend to the regression
setting where Y = (0,1), with the loss function ℓ : Y × Y → (0,1), defined by ℓ(y1 , y2 ) = |y1 − y2 |. We then define the
pseudo-metric WL1,L on Gn,d B
                                as follows,
                                           (
                                            1, if 1-WL distinguishes G and H after L iterations,
                        WL1,L (G, H) :=                                                           .
                                            0, otherwise.

We further consider the metric | · | on (0,1) as the absolute difference metric. Observing that: (1) the covering number
N ((0,1), | · |, ε) < 2/ε, for ε < 1, (2) the covering number N (Gn,d,L
                                                                    B
                                                                          , WL1,L , ε) = mn,d,L , for ε < 1, (3) the loss function
ℓ(x, y) = |x − y| is 2-Lipschitz, and (4) L-layer MPNNs are 1-Lipschitz with respect to the WL1,L pseudo-metric, we can
apply Corollary 6 to obtain the following bound. For δ ∈ (0,1), for all samples S, with probability at least 1 − δ and for
ϵ < 1, we have                                                  s
                                                                  2/ϵ · m                      1
                                                                          n,d,L log(2) + 2 log( /δ )
                               |ℓexp (hS ) − ℓemp (hS )| ≤ 4ϵ +                                      .
                                                                                  |S|

M. Fine-grained analysis of MPNNs with other aggregation functions
In this section, we extend the previous results analyzing MPNN layers using mean aggregation according to Equation (5).
Let ms n,d,q,L denote the number of equivalence classes induced by the 1-MWL after L iterations on Gn,d,q . For the case
when L = n − 1, we simply write m    s n,d,q . To establish generalization bounds, we rely on the mean-Forest distance FDmL
defined in Section 2. Similar to the Forest distance, we can bound the mean-Forest distance between two graphs that differ
by either a single edge or vertex label change, as shown in the following lemma, the proof proceeds identically to the proof
of Lemma 13.
Lemma 47. For d, q, L ∈ N, there exists a constant b(m) (d, q, L) such that for n ∈ N and G, H ∈ Gn,d,q , if G can be
obtained from H by either deleting an edge or by replacing a vertex feature with a new one, then
                                                    (m)
                                                FDL (G, H) ≤ b(m) (d, q, L).

We next analyze the generalization power of the MPNN class MPNNmeanL,M ′ ,LFNN (Gn,w,q ). Again, we consider the loss function
ℓ : R × {0,1} → R, defined by ℓ(x, y) = y log(σ(x)) + (1 − y) log(1 − σ(x)), where σ(x) is the sigmoid function. The
following result shows the Lipschitz continuity property of MPNNs in MPNNmean L,M ′ ,LFNN (Gn,w,q ) concerning the mean-Forest
distance. Similarly to sum aggregation MPNNs, we state and prove the Lipschitz property below for the more general setting
with graphs in Gn,d
                 R
                    .
Lemma 48. For every L, n, d ∈ N, M ′ ∈ R and for all MPNNs in MPNNmean          R
                                                                  L,M ′ ,LFNN (Gn,d ), we have

                                                     L
                                          1 (m)     Y
                        ∥hG − hH ∥2 ≤       C (L)Lψ     Lφi FDm
                                                              L (G, H),
                                                                                                   R
                                                                                   for all G, H ∈ Gn,d ,
                                          n         i=1

                                                                37
                                                        Covered Forests

where C (m) (L) is a constant depending on L.

We now state the generalization bound for mean aggregation MPNNs.
Proposition 49. For ε > 0 and n, q, d, L ∈ N, M ′ ∈ R and any graph learning algorithm for MPNNmean
                                                                                               L,M ′ ,LFNN (Gn,d,q ) is
                                                                            
                                               (m)
                               2N (Gn,d,q , FDL , ε), Lℓ · LFNN · CFD(m) · 2ε -robust.
                                                                               L


Hence, for any sample S and δ ∈ (0,1), with probability at least 1 − δ,
                                                    s
                                                                        (m)               1
                                         e (m) ε + M 2N (Gn,w,q , FDL , ε)2 log 2 + 2 log( /δ) , for ε > 0,
             |ℓexp (hS ) − ℓemp (hS )| ≤ C
                                                                            |S|

where Ce (m) = 2/nLℓ LFNN C (m) , C (m) = C (m) (L)Lψ QL Lmlp the Lipschitz constant by Lemma 48, and M , is an
                             FDL       FDL                   i=1      i

upper bound of the loss function ℓ.

We similarly bound the covering number concerning the mean-Forest distance, deriving the following bound.
Proposition 50. For n, q, d, L ∈ N, and M ′ ∈ R, for any graph learning algorithm for the class MPNNsum L,M ′ ,LFNN (Gn,d,q )
and for any sample S and δ ∈ (0,1), with probability at least 1 − δ, we have
                                                                s
                                                                    m
                                                                    Ďn,d,q,L               1
                                          (m) (m)                     k+1 4 log(2) + 2 log( /δ )
           |ℓexp (hS ) − ℓemp (hS )| ≤ 2C b (d, q, L)k + M
                                        e                                                        , for k ∈ N,
                                                                               |S|

N. Covering number dependency on graphs’-order
In previous sections, we showed that for different choices of ε, the covering number can be bounded by a function that
always increases scales on n as mn , i.e., the number of 1-WL-indistinguishable classes. Specifically, when estimating the
limit
                                                                     T
                                                            N (Gn , δ□ , ε)
                                                       lim                  ,
                                                      n→∞        mn
the result will always be a constant that depends on ε. While one could use Equation (10) with radius 4n to obtain a bound
that scales as mn /(n + 1) in n, such an increase in radius would impact the first term in the generalization bound. Hence,
the question arises of whether it is possible to derive a bound that grows more slowly with n than mn for some sufficiently
interesting graph class, using either a constant radius or a radius that depends only mildly on n.
More formally, a natural question is whether we can establish tighter bounds for the covering number for a given constant ε
that does not depend, or mildly depends, on n. For instance, is there a choice of ε > 0 and a graph class Fn such that

                                                           T          |Fn/∼WL |
                                                  N (Fn , δ□ , ε) ≤             ,                                            (15)
                                                                         bn
where bn → ∞ as n grows? If such a graph class exists, then MPNNs could effectively handle the growth in graph size
without significantly impacting their generalization performance. Below, we present a class of graphs Fn that satisfies
Equation (15) for radius ε = 4.
We define the class Fn as follows, let Pn denote a path on n vertices, with vertex set V (Pn ) = {v1 , . . . , vn } and edge set
E(pn ) = {{v1 , v2 }, . . . , {vn−1 , vn }}. We denote by P(n) the set consisting of disjoint unions of paths on n vertices. Then,
we define the graph class
                                                                               ˙
                   Fn := {(V, E) | V := V (Pn ) ∪˙ V (P ), E := E(P ) ∪˙ E(Pn )∪{u, v}, for P ∈ P(n),
                                     u ∈ V (P ), and v ∈ V (Pn )}.

We will now show that for the graph class Fn and ε = 4, Equation (15) holds.
Proposition 51. For the the graph class Fn ⊂ Gn constructed above, we have

                                                          T           2|Fn/∼WL |
                                                 N (Fn , δ□ , 4) ≤               .
                                                                          n
                                                               38
                                                              Covered Forests

Note that in the above proposition, we established that the covering number is bounded by |P(n)|, which has an interesting
combinatorial interpretation. Specifically, |P(n)| represents the integer partition of n, i.e., the number of distinct ways to
express n as a sum of positive integers. While there is no known closed formula for the integer partition, it can be accurately
approximated through asymptotic expansions and computed precisely via recurrence relations, making the bound efficiently
computable (Andrews & Eriksson, 2004).

Regression setting Here, we lift the results from the previous section to the regression setting. Specifically, we use
consider the loss function ℓ(x, y) = |x − y|, resulting in the following results.
Proposition 52. For every L, n ∈ N, M ′ ∈ R and for all MPNNs in MPNNord          L,M ′ ,LFNN (Gn ), we have the following
generalization bound. For any sample S, and any δ ∈ (0,1), with probability at least 1 − δ, for ε < 2M ′ ,
                                                                   s
                                                                            T , ε) 4M ′ log(2) + 2 log(1/δ )
                                                                     N (Gn , δ□
                                                       ←  2ε     ′                        ε
              |ℓexp (hS ) − ℓemp (hS )| ≤ 2 · LFNN · γ
                                                     s       +M                                                .
                                                          n2                           |S|

O. Missing proofs from section Section 4
The following result links robustness with the generalization error of order-normalized MPNNs.
                                                                                        T
Proposition 53 (Proposition 9 in the main paper). For ε > 21 ·              inf        δ□ (G, H), n, L ∈ N, and M ′ ∈ R, any graph
                                                                          T
                                                                         δ□ (G,H)>0
learning algorithm for the class MPNNord
                                     L,M ′ ,LFNN (Gn ) is
                                                                                      
                                         
                                                       T                            2ε 
                                             2N (Gn , δ□                   s←
                                                         , ε), Lℓ · LFNN · γ             -robust.
                                                                                    n2
Hence, for any sample S and δ ∈ (0,1), with probability at least 1 − δ,
                                                                     s
                                                                                  T , ε) log(2) + 2 log 1
                                                                                                        
                                                         ←  2ε          4N (Gn , δ□                     δ
               |ℓexp (hS ) − ℓemp (hS )| ≤ Lℓ · LFNN · γ
                                                       s        +M                                          ,
                                                            n2                           |S|

where, M is an upper bound for the loss function ℓ and Lℓ , the Lipschitz constant of ℓ(·, y), y ∈ {0,1}.

Proof. We first note that since FNN is bounded by M ′ , we know that the loss function is also bounded from some M ∈ R.
                                                                                                  T
Now, let Z = Gn × {0,1}. For a given ε > 0, graphs G1 , G2 ∈ Gn , and y1 , y2 ∈ {0,1}, if max{δ□    (G1 , G2 ), δ(y1 , y2 )} <
      2
s(ε)n , where δ is the Kronecker-delta metric on {0,1}, i.e.,
γ
                                                        (
                                                          ∞, if y1 ̸= y2 , and
                                          δ(y1 , y2 ) =
                                                          0   if y1 = y2 ,

                           s(ε)n2 , implies y1 = y2 , and therefore, for any sample S,
we have that δ(y1 , y2 ) < γ

                             |ℓ(hS (G1 ), y1 ) − ℓ(hS (G2 ), y2 )| = |ℓ(hS (G1 ), y1 ) − ℓ(hS (G2 ), y1 )|
                                                                    ≤ Lℓ |hS (G1 ) − hS (G2 )|
                                                                    ≤ Lℓ · LFNN · ε.

Therefore, by Proposition 7, any learning algorithm for MPNNord
                                                            L,M ′ ,LFNN (Gn ) is

                                          
                                                        T     s(ε)n2
                                                              γ                        
                                              2N (Gn , δ□ ,           ), Lℓ · LFNN · ε -robust.
                                                                 2
                                   ← 2ε
                                                                   s← , if γ s← n2ε2 ̸= 0, we have γ        s← n2ε2           2ε
                                                                                                                  
Now, we replace ε with γ          s n2 . By definition of γ                                               s γ             ≥   n2 .   Thus,
                   ← 2ε       2
         T   γ (γ    ( n2
                          ))n                T
N (Gn , δ□                      ) ≤ N (Gn , δ□
             s   s
           ,          2                        , ε), leading to the following generalization bound:
                                                                                s
                                                                                              T , ε) log(2) + 2 log 1
                                                                                                                    
                                                                 ←   2ε             4N (Gn , δ□                     δ
                   |ℓexp (hS ) − ℓemp (hS )| ≤ Lℓ · LFNN · γ   s           +M                                           .
                                                                     n2                              |S|

                                                                    39
                                                          Covered Forests

                                    s← n2ε2 = 0.
                                            
It remains to check the case where γ
   s← n2ε2 = 0, then γ                                                                T
                      s(x) ≥ n2ε2 for all x > 0. Thus, for all graphs G1 , G2 , with δ□ (G1 , G2 ) < n2ε2 · n2 , we have:
          
If γ

                             ∥hG1 − hG2 ∥2 ≤ x,       for all x > 0, h ∈ MPNNord
                                                                             L,M ′ ,LFNN (Gn ) ⇔

                             ∥hG1 − hG2 ∥2 = 0,       for all h ∈ MPNNord
                                                                      L,M ′ ,LFNN (Gn ),

                                                    T
which, following Böker et al. (2023), implies that δ□ (G1 , G2 ) = 0.
                                                   T                           T
Now, observe that since for all G1 , G2 ∈ Gn with δ□ (G1 , G2 ) < 2ε, we have δ□ (G1 , G2 ) = 0, implying

                                                      1                 T
                                                 ε≤          inf       δ□ (G, H),
                                                      2    G,H∈Gn
                                                           T
                                                          δ□ (G,H)>0

                                                                         T
which leads to a contradiction, since we have assumed ε > 12 inf G,H∈Gn δ□ (G, H).
                                                                        T
                                                                       δ□ (G,H)>0


The following results provide a generalization bound using the number of graphs distinguished by 1-WL to derive an upper
bound on the covering number.
Theorem 54 (Theorem 10 in the main paper). For n, L ∈ N, M ′ ∈ R, for any graph learning algorithm for
MPNNord
      L,M ′ ,LFNN (Gn ) and for any sample S and δ ∈ (0,1), with probability at least 1 − δ, we have
                                                                                     s
                                                                                           mn
                                                                                         4 k+1 log(2) + 2 log(1/δ)
                                                                           
                                                                       8k
                                                            s←
                    |ℓexp (hS ) − ℓemp (hS )| ≤ Lℓ · LFNN · γ                   +M                                   ,
                                                                       n2                          |S|

for k ∈ N, where M is an upper bound on the loss function ℓ.

                         T
Proof. First, note that δ□ (G, H) = 0 if, and only, if the graphs G, H ∈ Gn are 1-WL-equivalent. By the triangle inequality,
we also have that if G, H ∈ Gn , and G′ ∈ [G], H ′ ∈ [H] are two arbitrarily chosen graphs from their respective equivalence
classes, then
                                                  T              T
                                                 δ□  (G, H) = δ□   (G′ , H ′ ).
Thus, we can define the Tree distance between two equivalence classes as the Tree distance between two randomly chosen
representatives. Moreover, computing the covering number on Gn is equivalent to computing the covering number on the
                               T
pseudo-metric space (Gn/∼WL , δ□ ).
We now construct a labeled directed tree with labels from Gn/∼WL level-wise, starting from the root r (level 0), as follows.

  1. The root corresponds to the complete graph on n vertices denoted as Kn , which is unique in its equivalence class.
  2. The first level consists of a single vertex corresponding to the graph derived by deleting an edge from the complete
     graph on n vertices. Denote this graph as Kn− , which is also unique in its equivalence class.
  3. In the next level, we compute all graphs obtained by deleting an edge from Kn− . Denote these graphs as G1 , . . . , Gr ,
     for r ∈ N. We then de-duplicate the set {G1 , . . . , Gr } for the 1-WL, keeping one representative for each equivalence
     class. This reduces the set to [G1 ], . . . , [Gr′ ], where r′ ≤ r. These equivalence classes form the children of the vertex
     at level 1.
  4. For each vertex corresponding to a graph class [Gi ] in level 2, we compute its children as follows. We first compute all
     graphs in the set.
                               [Gi ]c = {G′ | ∃ G ∈ [Gi ], e ∈ E(G) such that G \ {e} ≃ G′ }.

     We connect these graphs to the vertex [Gi ]. We then prune the tree by arbitrarily dropping all 1-WL-equivalent graphs,
     keeping only one as the representative.
  5. We continue this process until we reach the vertex corresponding to the empty graph.

                                                                40
                                                         Covered Forests
                                                                                                      h            i
                                                                                                          n(n−1)
Observe that in the resulting tree, the total number of vertices is exactly mn , since for each l ∈          2         , level l contains all
1-WL-equivalence classes for graphs with n vertices and n(n−1)
                                                           2   − l edges. Additionally, the tree satisfies the following two
properties:

  1. Each parent is at most at a distance 2 from its children.
  2. All siblings are at most at a distance of 4 from each other.

To verify this, consider the following. If [G1 ] is a child of [G], then there exists G1 ∈ [G1 ], G ∈ [G], and an edge e ∈ E(G)
such that G \ {e} ≃ G1 . By the triangle inequality and the fact that
                                                          T
                                                         δ□ (G, G′ ) = 0,

since G and G′ are 1-WL-indistinguishable, we have
                                                T                 T
                                               δ□ ([G], [G1 ]) = δ□ (G, G1 ) = 2.

Similarly, if [G1 ] and [G2 ] are siblings, the triangle inequality gives
                                     T                   T                 T
                                    δ□ ([G1 ], [G2 ]) ≤ δ□ ([G], [G1 ]) + δ□ ([G], [G2 ]) ≤ 4.

This follows from the fact that if the adjacency matrices of two graphs differ in exactly two entries, then their Tree distance
is bounded above by 2. Now, we construct a cover of Gn/∼WL as follows.

  1. We start from the leaves of the tree and merge each leaf with its parent. We repeat this step k times. The resulting
     graph is still a tree.
  2. In this induced tree, we create as many disjoint sets of 1-WL-equivalence classes as there are leaves in the induced tree
     by considering all classes corresponding to a leaf as a set. Each group contains at least k + 1 elements.
  3. We then remove all leaves, creating a new tree T ′ . For each leaf in T ′ , we repeat the merging process as many times as
     necessary until each leaf contains at least k + 1 equivalence classes (requiring at most k merges).

At the end of this process, each group will have at least k + 1 elements, and the Tree distance between any two elements in
the same group will be at most 4k. To see this, note that for any two graph classes [G] and [H] in the same partition set, if
we consider the tree to be undirected, there exists a path of length at most 2k in the initial tree connecting [G] and [H]. Thus,
we can find graphs G ∈ [G] and H ∈ [H], differing by at most 2k edge additions or deletions, implying that G and H are at
Tree distance at most 4k. This implies that the covering number
                                                             T            mn
                                                    N (Gn , δ□ , 4k) ≤       .
                                                                         k+1

The following result derives tighter bounds for Otter trees.
Proposition 55 (Proposition 12 in the main paper). For L ∈ N, M ′ ∈ R and sufficiently large n ∈ N, for any graph learning
                                    (2)
algorithm on MPNNord L,M ′ ,LFNN (T2n+1 ) and for any sample S, with δ ∈ (0,1), with probability at least 1 − δ, we have

                                                                            s
                                                         ←      16k              4wn/b2k log(2) + 2 log(1/δ)
              |ℓexp (hS ) − ℓemp (hS )| ≤ Lℓ · LFNN · γs              2
                                                                          +M                                  ,
                                                             (2n + 1)                        |S|

                                                                                          (2)
where k ∈ N, M is an upper bound on the loss function ℓ, b ≈ 2 4832, and wn = |T2n+1 |.

Proof. As in the proof of Theorem 10, we begin by constructing a rooted, labeled, directed tree. However, the labels are
                   n
                  S     (2)
now graphs from      T2j+1 , and we do not need to use 1-WL equivalence classes, as 1-WL can distinguish any pair of
                   j=1
non-isomorphic trees.

  1. The root (level 0) corresponds to the isolated vertex graph.

                                                                41
                                                            Covered Forests




(a) An illustration of tree construction as described in the proof (b) An illustration of the grouping process applied to the chosen
of Theorem 10. On the left, we show all possible trees that can be tree, which leads to the desired upper bound for the covering number.
computed according to the description in the proof, represented in a All vertices belong to a group with at least two elements (possibly
directed acyclic graph (DAG) format. On the right, we display an excluding from the root).
arbitrarily chosen tree from this set.

                              Figure 5. Illustrations related to tree construction and the grouping process.


  2. The first level consists of a single vertex corresponding to the 3-path graph.
  3. At level l + 1, we compute the children of vertices at level l as the graphs obtained by connecting a leaf vertex of the
     graphs in level l with two additional vertices. We then prune the tree by removing isomorphic graphs.
  4. We continue this process until all binary trees at the current level have 2n + 1 vertices.

The above construction shows that level l consists of all Otter trees with 2l + 1 vertices. Additionally, each child is at most
                                                                                              (2)          (2)
at Tree distance 4 from its parent and at most 8 from its siblings. Therefore, we can cover T2n+1 using T2n−1 balls of radius
                                     (2)                           (2)
8. Recursively, we can show that T2n+1 can be covered using T2(n−2k)+1 balls of radius 8k. Using the asymptotic formula
from Lemma 11, we obtain
                                              (2)                       wn−2k      wn
                                         N (T2n+1 , 8k) ≤ wn−2k = wn            = 2k .
                                                                          wn       b

The following result derives tighter bounds for a specialized graph class constructed from paths.
Proposition 56 (Proposition 51 in the main paper). For the the graph class Fn ⊂ Gn constructed above, we have

                                                             T          2|Fn/∼WL |
                                                    N (Fn , δ□ , 4) ≤              .
                                                                            n

Proof. First note that since 1-WL is complete in the space of forests, |Fn/∼WL | is exactly the number of non-isomorphic
graphs in Fn . We prove that Fn can be partitioned into |P(n)| subsets, each containing at least n/2 non-isomorphic graphs.
Furthermore, within each partition set, all graphs are pairwise at Tree distance of at most 4. This result implies that while
the total number of non-isomorphic graphs in Fn is greater than |P(n)| · n/2, we can cover them using only |P(n)| sets.
Now, for each P ∈ P(n), we define a set SP containing n/2 non-isomorphic graphs from Fn such that for all P, P ′ ∈ P(n),
we have SP ∩ SP ′ = ∅. We construct SP as follows. For each P ∈ P(n), let Pmax denote the largest connected component
of P . Choose, without loss of generality, a vertex u ∈ V (Pmax ) with degree 1, i.e., a non-interior vertex) and define
                 n                                                                                                o
          SP := (V, E) V := V (pn ) ∪˙ V (P ), E := E(P ) ∪˙ E(pn ) ∪ {u, v}, where v = vj for j ∈ ⌈n/2⌉ .

                                                                   42
                                                                Covered Forests

                                        (3)                                                                     (3)
                                      τ2                                                                       τ2


                                        (5)                                                                     (5)
                                      τ2                                                                       τ2




                                               (7)                                                                     (7)
                                              τ2                                                                      τ2




                                                     (9)                                                                     (9)
                                                   τ2                                                                      τ2




                                                            (11)                                                                      (11)
                                                           τ2                                                                        τ2




Figure 6. An illustration related to tree construction (left) and the grouping process for Otter trees (right) asymptotically leading to an
exponential decrease of the covering number with the radius.


Clearly, |SP | = n/2. We now verify the following claims.

  1. For all G1 , G2 ∈ SP , G1 and G2 are non-isomorphic.
  2. For all P, P ′ ∈ P(n), SP ∩ SP ′ = ∅.

Proof of (1). Let G1 , G2 ∈ SP with edge sets E(G1 ) = E(P ) ∪ {u, vj1 } and E(G2 ) = E(P ) ∪ {u, vj2 }, where j1 ̸= j2
and j1 , j2 ∈ n2 . Assume further that j1 , j2 ̸= 1. If j1 < j2 , then in G2 , starting from vertex v1 , we can trace a path of
length j2 + |E(Pmax )|. In G1 , however, such a path does not exist. If j1 = 1 ̸= j2 , it is evident that G1 has a connected
component consisting of a path of length n + |V (Pmax )|, which is absent in G2 .
Proof of (2). If P and P ′ have different numbers of disconnected components, then for all G1 ∈ SP and G2 ∈ SP ′ , G1 and
G2 will differ in edge count. Furthermore, if P and P ′ have the same number of connected components but |Pmax | =    ′
                                                                                                                 ̸ |Pmax |,
                                                                                                           ′
then the size of the largest connected component in G1 will differ from that in G2 . Finally, if P and P have identical
                                                     ′
numbers of connected components and |Pmax | = |Pmax     |, then the connected component size histograms of G1 and G2 must
                            ′
differ; otherwise, P and P would be isomorphic.

The following result establishes that MPNNs using sum aggregation are Lipschitz continuous regarding the Forest distance.
Lemma 57 (Lemma 14 in the main paper). For L, n, d ∈ N, M ′ ∈ R and for all MPNNs in MPNNsum             R
                                                                                           L,M ′ ,LFNN (Gn,d ), we
have
                                               L
                                    1          Y
                                                                                     R
                   ∥hG − hH ∥2 ≤ C(L)Lψ            Lφi · FDL (G, H), for all G, H ∈ Gn,d ,
                                   n          i=1

where C(L) is a constant depending on L

Proof. Let θ be an edge-preserving bijection between the padded forests FG,L and FH,L . This bijection θ induces another
bijection, θ(l) , between vertices at layer l of trees in FG,L and vertices at layer l of trees in FH,L , for each l ∈ {0, . . . , L}. We

                                                                      43
                                                          Covered Forests




                                   Figure 7. An example of graphs within the class Fn for n=7.

                                                                                                                                 (1)   (2)
further define θs(l) (u, v) = 1 iff θ(l) (u) = v and 0 elsewhere. We present the proof for the case L = 2 and let Wt , Wt
                                                                       (1)   (2)
be identical matrices; for L > 2 and any choice of matrices Wt , Wt , the proof is analogous, though the notation
                                                                            (1)         (2)
becomes more complex. Specifically, one may generalize by replacing Wt and Wt with Lipschitz continuous functions,
and the proof would still hold. We show the Lipschitz property by recursively bounding the following difference:
                                                                                            
                                                        1   X                  1   X
                                 ∥hG − hH ∥ = ψ                  h(2)
                                                                   u
                                                                        − ψ             h(2)
                                                                                            v
                                                                                               
                                                        n                      n
                                                          u∈V (G)                       v∈V (H)
                                              1               X
                                             ≤ Lψ                         θs(0) (u, v) h(2)  (2)
                                                                                        u − hv   ,
                                              n
                                                        u∈V (G),v∈V (H)

where in the last step, we applied the triangle inequality, as implied by the bijection θ(0) between the roots.
Thus, we have that ∥hG − hH ∥ is less than
                                                                           
           1         X                            X  (1)
                                                                       X  (1)
             Lψ           θs(0) (u, v) φ2 h(1)
                                            u +     hu′  − φ2 h(1)
                                                                 v +     hv′ 
           n                                    ′                    ′
                 u∈V (G),v∈V (H)                         u ∈N (u)                              v ∈N (v)

                1             X                                        X          (1)
                                                                                            X          (1)
            ≤     Lψ Lφ2               θs(0) (u, v) h(1)  (1)
                                                     u − hv +                    hu′ −                hv′
                n
                        u∈V (G),v∈V (H)                              u′ ∈N (u)           v ′ ∈N (v)
                1             X
            ≤     Lψ Lφ2             θs(0) (u, v) h(1)  (1)
                                                   u − hv
                n
                       u∈V (G),v∈V (H)
                |                   {z                      }
                                       A
                                    1           X                           X                                (1)   (1)
                                   + Lψ Lφ2             θs(0) (u, v)                      θs(1) (u′ , v ′ ) hu′ − hv′ ,
                                    n
                                          u∈V (G),v∈V (H)            u′ ∈N (u),v ′ ∈N (v)
                                    |                                    {z                                            }
                                                                                 B

where, in the last step, we again applied the triangle inequality, this time induced by the bijection θ(1) between the vertices
at the first layer. Note that it is possible that |N (u)| > |N (v)|, meaning some neighbors of u are mapped by θ(1) to padded
                                                                                   (1)
vertices. In this case, we can trivially apply the triangle inequality by setting hv′ = 0 in the expression above.
Next, we bound term A:

                       1                   X                                              X           (0)
                                                                                                               X           (0)
                 A≤      Lψ Lφ2 Lφ1                     θs(0) (u, v) h(0)  (0)
                                                                      u − hv +                      hu′ −                 hv′
                       n
                                      u∈V (G),v∈V (H)                                   u′ ∈N (u)            v ′ ∈N (v)
                       1                   X
                   ≤     Lψ Lφ2 Lφ1                     θs(0) (u, v) h(0)  (0)
                                                                      u − hv
                       n
                                      u∈V (G),v∈V (H)


                                                                44
                                                              Covered Forests

                         1                    X                                    X                                 (0)   (0)
                     +     Lψ Lφ2 Lφ1                     θs(0) (u, v)                            θs(1) (u′ , v ′ ) hu′ − hv′ .
                         n
                                        u∈V (G),v∈V (H)                   u′ ∈N (u),v ′ ∈N (v)


Similarly, the term B is bounded by

                 1                 X                    X                        (0)   (0)
                                                                                                           X           (0)
                                                                                                                                   X             (0)
           ≤       Lψ Lφ2 Lφ1            θs(0) (u, v)         θs(1) (u′ , v ′ ) hu′ − hv′ +                           hu′′ −                    hv′′
                 n
                             u∈V (G),v∈V (H) u′ ∈N (u),v ′ ∈N (v)                                      u′′ ∈N (u′ )            v ′′ ∈N (v ′ )
            1                      X                     X                         (0)   (0)
           ≤ Lψ Lφ2 Lφ1                  θs(0) (u, v)           θs(1) (u′ , v ′ ) hu′ − hv′
            n
                             u∈V (G),v∈V (H)      u′ ∈N (u),v ′ ∈N (v)
                   1                     X                     X                                X                              (0)    (0)
                  + Lψ Lφ2 Lφ1                 θs(0) (u, v)              θs(1) (u′ , v ′ )                θs(2) (u′′ , v ′′ ) hu′′ − hv′′ .
                   n
                                  u∈V (G),v∈V (H)       u′ ∈N (u),v ′ ∈N (v)          u′′ ∈N (u′ ),v ′′ ∈N (v ′ )


Therefore, choosing as θ the edge-preserving bijection minimizes Equation (9) we get,
                                                          1
                                            ∥hG − hH ∥ ≤ 2 Lψ Lφ2 Lφ1 FDL (G, H).
                                                          n

The following result derives a bound on the generalization error for MPNNs using sum aggregation.
Proposition 58 (Proposition 52 in the main paper). For every L, n ∈ N, M ′ ∈ R and for all MPNNs in MPNNsum        L,M ′ ,LFNN (Gn ),
we have the following generalization bound: For any sample S, and any δ ∈ (0,1), with probability at least 1 − δ,
                                                                       s
                                                                                  T , ε) 4M ′ log(2) + 2 log 1
                                                                                                               
                                                                         N (Gn , δ□
                                                          
                                                       ←  2ε         ′                        ε              δ
              |ℓexp (hS ) − ℓemp (hS )| ≤ 2 · LFNN · γ
                                                     s          +M                                               ,
                                                          n2                               |S|
for ε < 2M ′ .

Proof. Similarly to the classification setting we apply Proposition 7. First note that ℓ is 2-Lipschitz since,
                                     |ℓ(x1 , y1 ) − ℓ(x2 , y2 )| = ||x1 − y1 | − |x2 − y2 ||
                                                                  ≤ |x1 − x2 | + |y1 − y2 |
                                                                  ≤ 2 max{|x1 − x2 |, |y1 − y2 |}.
                                                                                                       T
Now, let Z = Gn × [−M ′ , M ′ ]. For a given ε > 0, graphs G1 , G2 ∈ Gn , and y1 , y2 ∈ [0,1], if max{δ□ (G1 , G2 ), |y1 , y2 | <
     2
s(ε)n , we have that for any sample S,
γ
                           |ℓ(hS (G1 ), y1 ) − ℓ(hS (G2 ), y2 )| ≤ 2 max{|hS (G1 ) − hS (G2 )|, |y1 , y2 |}
                                                                    ≤ 2 · LFNN · ε.

Therefore, by Proposition 7, any learning algorithm for MPNNordL,M ′ ,LFNN (Gn ) is

                                          s(ε)n2                  s(ε)n2
                                                                                      
                                          γ                   T γ
                          N (0,1), | · |,           · N Gn , δ□ ,            , 2 · LFNN · ε -robust.
                                             2                        2

                                                               T γ  s (γs← ( n 2 ))n
                                                                              2ε     2
                              s← n2ε2 and we get N (Gn , δ□                                             T
                                      
Similarly we replace ε with γ                                     ,          2         ) ≤ N (Gn , δ□     , ε), leading to the following
generalization bound: For any sample S, and any δ ∈ (0,1), with probability at least 1 − δ, |ℓexp (hS ) − ℓemp (hS )| is less
than                                           s
                                                                                         T , ε)2 log(2) + 2 log 1
                                                                                                                       
                                                 N ([−M ′ , M ′ ], | · |, ε) · N (Gn , δ□
                                
                             ←    2ε         ′                                                                       δ
                2 · LFNN · γ
                           s           +M                                                                                ,
                                  n2                                               |S|
or,                                                                          s
                                                                                          T , ε) 4M ′ log(2) + 2 log 1
                                                                                                                           
                                                                               N (Gn , δ□
                                                          
                                                       ←    2ε             ′                          ε                 δ
              |ℓexp (hS ) − ℓemp (hS )| ≤ 2 · LFNN · γ
                                                     s             +M                                                        ,
                                                            n2                                     |S|
for ε < 2M ′ .

                                                                     45
                                                        Covered Forests

The following results upper bounds the covering number regarding the Forest distance using the number of 1-WL-
distinguishable graphs after L iterations.
Proposition 59 (Proposition 16 in the main paper). For n, q, d, L ∈ N, and M ′ ∈ R, for any graph learning algorithm for
the class MPNNsum L,M ′ ,LFNN (Gn,d,q ) and for any sample S and δ ∈ (0,1), with probability at least 1 − δ, we have
                                                                 s
                                                                   mn,d,q,L                  1
                                                                     k+1 4 log(2) + 2 log( /δ )
                |ℓexp (hS ) − ℓemp (hS )| ≤ 2Cb(d,
                                                e     q, L)k + M                                  , for k ∈ N,
                                                                                 |S|

where C e = 2/nLℓ LFNN CFD , CFD = C(L)Lψ QL Lφ is the Lipschitz constant in Lemma 14 and M is an upper bound
                               L        L                i=1  i
of the loss function ℓ.

Proof. It suffices to show that for all n, L, d, q ∈ N, we have the following bound for the covering number.
                                                                            mn,d,q,L
                                          N (Gn,d,q , FDL , 2b(d, q, L)k) ≤          .
                                                                             k+1
Let Gn,d,q/∼WLL be the quotient space defined by 1-WL after L iterations on Gn,d,q , i.e., mn,d,q,L = |Gn,d,q/∼WLL |. We denote
the equivalence classes in this space by [G]L . Following the proof in Theorem 10, it suffices to construct a rooted tree with
labels from Gn,d,q/∼WLL satisfying the following properties,

   • The total number of vertices is mn,d,q,L , and each vertex has a unique label.
   • The graph corresponding to each parent vertex is at most at Forest distance (depth L) of b(d, q, L) from the graphs
     corresponding to its children.
   • Graphs corresponding to sibling vertices are at most at Forest distance (depth L) of 2b(d, q, L).

We construct such a tree as follows:

  1. The root (at level l = 0) corresponds to the empty graph on n vertices, where each vertex has the same feature. Without
     loss of generality, we assume this feature to be (1,0, . . . ,0) ∈ R1×d .
  2. At the next level (l + 1), for a vertex at level l with label, say, [Gi ]L , we compute its children as follows. We first
     calculate all graphs in the set
                                                                    (e)        (f )
                                                   [Gi ]L,c := [Gi ]L,c ∪ [Gi ]L,c ,
     where
                              (e)
                          [Gi ]L,c = {G′ ∈ Gn,d,q | ∃ G ∈ [Gi ]L , e ∈ E(G′ ) such that G′ \ {e} ≃ G},
     and
                                      n
                                 (f )
                            [Gi ]L,c = G′ ∈ Gn,d,q | ∃ G ∈ [Gi ]L , u ∈ V (G), u′ ∈ V (G′ ) such that
                                                                                  o
                                       changing ℓG (u) to ℓG′ (u′ ) implies G ≃ G′ .

     We connect all graphs in [Gi ]L,c to the vertex [Gi ]L . Then, we prune the tree by arbitrarily removing all 1-WL-equivalent
     (after L iterations) graphs, retaining only one as the representative.
  3. We continue this process until all graph classes in Gn,d,q/∼WLL have been used as labels.



The following result shows the Lipschitz continuity property of MPNNs using mean aggregation regarding the mean-Forest
distance.
Lemma 60 (Lemma 48 in the main paper). For L, n, d ∈ N, M ′ ∈ R and for all MPNNs in MPNNmean                    R
                                                                                                   L,M ′ ,LFNN (Gn,d ), we
have
                                                        L
                                        1 (m)          Y
                       ∥hG − hH ∥2 ≤ C (L)Lψ               Lφi FDm
                                                                 L (G, H),
                                                                                            R
                                                                            for all G, H ∈ Gn,d ,
                                        n              i=1

where C (m) (L) is a constant depending on L.

                                                               46
                                                                  Covered Forests

                                                                                              (m)            (m)
Proof. Let θ be an edge-preserving bijection between the padded forests FG,L and FH,L . This bijection θ induces another
                                                           (m)                                      (m)
bijection, θ(l) , between vertices at layer l of trees in FG,L and vertices at layer l of trees in FH,L , for l ∈ {0, . . . , L}.
                       s(l)                 (l)
Similarly, we define θ (u, v) = 1 iff θ (u) = v and 0 elsewhere. We present the proof for the case L = 2 with
   (1)    (2)                                                              (1)    (2)
Wt , Wt as identical matrices; for L > 2 and any choice of matrices Wt , Wt , the proof is analogous, though the
                                                                                (1)       (2)
notation becomes more complex. Specifically, one may generalize by replacing Wt and Wt with Lipschitz continuous
and positive homogeneous functions, and the proof would still hold. For each u ∈ V (G), we denote by Nu the number of
neighbors of u (i.e., Nu = |N (u)|). Then,

                                                                                                                
                                                   1                  X
                                                                                  − ψ 1
                                                                                                    X
                                  ∥hG − hH ∥ = ψ                           h(2)
                                                                             u                               h(2)
                                                                                                              v
                                                                                                                  
                                                   n                                          n
                                                                  u∈V (G)                         v∈V (H)
                                                      1               X
                                                     ≤ Lψ                         θs(0) (u, v) h(2)  (2)
                                                                                                u − hv   ,
                                                      n
                                                                u∈V (G),v∈V (H)


where we have just applied the triangle inequality, as implied by the bijection θ(0) between the roots. Thus, we have that
∥hG − hH ∥ is bounded by
                                                                                                          
          1          X                                    1    X       (1)                  1    X       (1)
            Lψ                  θs(0) (u, v) φ2 h(1)
                                                  u +                hu′  − φ2 h(1) v +               hv′ 
          n                                              Nu ′                              Nv ′
                   u∈V (G),v∈V (H)                                        u ∈N (u)                                       v ∈N (v)

                  1                X                                                  X       1 (1)     X                1 (1)
              ≤     Lψ Lφ2                       θs(0) (u, v) h(1)  (1)
                                                               u − hv +                         hu′ −                      h ′
                  n                                                                          Nu                          Nv v
                             u∈V (G),v∈V (H)                                    u′ ∈N (u)             ′       v ∈N (v)
               1                   X
              ≤ Lψ Lφ2                 θs(0) (u, v) h(1)  (1)
                                                     u − hv
               n
                       u∈V (G),v∈V (H)
               |                     {z                       }
                                               A
                                                                                                                (1)  (1)
                                  1              X                             X                               h ′  h ′
                              +     Lψ Lφ2                 θs(0) (u, v)                      θs(1) (u′ , v ′ ) u − v ,
                                  n                                                                            Nu   Nv
                                           u∈V (G),v∈V (H)              u′ ∈N (u),v ′ ∈N (v)
                                  |                                         {z                                           }
                                                                                  B

where, in the last step, we again applied the triangle inequality induced by the bijection θ(1) between the vertices at the first
layer. Note that it is possible that Nu > Nv , meaning some neighbors of u are mapped by θ(1) to padded vertices. In this
                                                                  (1)
case, we can trivially apply the triangle inequality by setting hv′ = 0 in the expression above.
Next, we bound term A, i.e.,

                  1                     X                                      1                  X          (0)   1       X           (0)
          A≤        Lψ Lφ2 Lφ1                         θs(0) (u, v) h(0)  (0)
                                                                     u − hv +                             hu′ −                       hv′
                  n                                                           Nu                                   Nv
                                  u∈V (G),v∈V (H)                                             u′ ∈N (u)                  v ′ ∈N (v)
                  1                     X
              ≤     Lψ Lφ2 Lφ1                         θs(0) (u, v) h(0)  (0)
                                                                     u − hv
                  n
                                  u∈V (G),v∈V (H)
                                                                                                                               (0)           (0)
                                  1                         X                                 X                                h ′ h ′
                              +     Lψ Lφ2 Lφ1                         θs(0) (u, v)                          θs(1) (u′ , v ′ ) u − v .
                                  n                                                                                            Nu  Nv
                                                    u∈V (G),v∈V (H)                   u′ ∈N (u),v ′ ∈N (v)


Similarly, we can bound the term B by

   1                X                                 X
     Lψ Lφ2                     θs(0) (u, v)
   n
              u∈V (G),v∈V (H)                  u′ ∈N (u),v ′ ∈N (v)


                                                                          47
                                                                 Covered Forests
                                                                                                                                                            
                                                       (0)                                                      (0)
                                                     hu′          1                       (0)                hv′             1                         (0)
                                                                               X                                                           X
                           θs(1) (u′ , v ′ ) · φ1            +                           hu′′  − φ1                     +                              hv′′  ,
                                                        Nu       Nu Nu′                                          Nv          Nv Nv ′
                                                                          u′′ ∈N (u′ )                                                 v ′′ ∈N (v ′ )


where we have used the positive homogeneity property of φ1 . Therefore,

                                                                                                     (0)         (0)
        1                   X                                    X                               h ′ h ′
  B≤      Lψ Lφ2 Lφ1                     θs(0) (u, v)                          θs(1) (u′ , v ′ ) u − v
        n                                                                                        Nu  Nv
                       u∈V (G),v∈V (H)                  u′ ∈N (u),v ′ ∈N (v)
                               1                         X                                    X
                           +     Lψ Lφ2 Lφ1                           θs(0) (u, v)                             θs(1) (u′ , v ′ )
                               n
                                                u∈V (G),v∈V (H)                      u′ ∈N (u),v ′ ∈N (v)
                                                                                                                                       (0)                (0)
                                                                                         X                                            hu′′     hv′′
                                                                                                             θs(2) (u′′ , v ′′ ) ·          −         .
                                                                                                                                     Nu Nu′   Nv Nv ′
                                                                               u′′ ∈N (u′ ),v ′′ ∈N (v ′ )


Hence, choosing as θ the edge preserving bijection minimizes Appendix G we get,

                                                         1
                                           ∥hG − hH ∥ ≤ 2 Lψ Lφ2 Lφ1 FDL (G, H),
                                                         n

as desired.

P. Experimental results
In the following section, we describe the experiments in detail and report the results.

                                                                                                                 (2)
Datasets To investigate Q1, we conducted experiments using the graph classes Gn , Tn , and Fn (defined in Appendix N).
Additionally, we experimented with the binary classification real-world datasets M UTAG, NCI1, MCF-7H (Morris et al.,
2020a), and O GBG -M OLHIV (Hu et al., 2020), to match our theoretical setup and address Q1, Q2, and Q3. For real-world
datasets analyzed under Q1, we computed the covering number across all graphs up to a specified order, with smaller graphs
being padded with isolated vertices, aligning their order. Similarly, for Q3, graphs were padded to match the order of the
largest graph in the dataset; see Table 2 for dataset statistics and properties.

Neural architectures To address Q2, we used randomly initialized GIN architectures (Feng et al., 2022) with varying
numbers of layers and matching parameters for the Forest distance. Conversely, for Q3, we trained GIN architecture with
three layers across five random seeds to estimate variance. Both architectures incorporated ReLU activation functions and
sum pooling, disregarding potential edge labels. We tuned the feature dimension across the set 32, 64, 128, 256 based on
validation set performance, training M UTAG and NCI1 for 100 epochs and MCF-7H and O GBG -M OLHIV for 20 epochs
using the Adam optimizer (Kingma & Ba, 2015). The training setup included a learning rate of 0.001, a batch size of 128,
and no learning rate decay or dropout across all datasets. All models were implemented with PyTorch Geometric (Fey &
Lenssen, 2019) and executed on a system with 128GB of RAM and an Nvidia Tesla A100 GPU with 48GB of memory.

Experimental protocol and model configuration For Q1, we calculated the covering number N (·, FD3 , ε) for various
datasets, graph orders, and radii by solving the corresponding set cover problem. We also compare the bound on the covering
number presented in Theorem 10 against the covering number N (·, δ1T , ε) using the 1-norm instance of the cut norm as
computing the cut norm is MaxSNP-hard. For Q2, we measure whether the Forest distance input perturbations lead to
perturbations in the MPNN outputs as expected in Lemma 14. We used a random 80/10/10 split for training/validation/testing.
Each plot included 1 000 data points generated by selecting a random graph size. The Forest distance for two graphs of
the chosen size, randomly sampled from the dataset, can be compared with the Euclidean distance between their MPNN
outputs. For Q3, we evaluated the generalization gap by estimating the train and test losses and compared it against our
generalization bound derived for the Forest distance in Proposition 15. We utilized an upper estimate of the Lipschitz
constant obtained from Q2 and an Lℓ = 1 (Mao et al., 2023) to compute the bound. We selected the radii that yielded the
tightest bound. See Table 3 for the values of C,e CFD , and mn,d,3 used in the computation of our bound.
                                                       3



                                                                       48
                                                        Covered Forests




Figure 8. The covering number N (·, FD3 , ε) and the number of 1-WL indistinguishable graphs mn (upper row, black) for the graph
               (2)
families Gn , Tn , and Fn across different graph sizes n and radii ε.




Figure 9. The covering number N (·, FD3 , ε) and the number of 1-WL indistinguishable graphs mn (upper row, black) for real-world
datasets across varying graph sizes n and radii ε.


Q. Dataset statistics
The statistics of the real-world datasets can be found in Table 2, and estimates of the coefficients in Theorem 10 can be
found in Table 3.




                                                               49
                                                             Covered Forests




Figure 10. The covering number N (·, FD3 , 0 7) bound, the 1-norm set cover and the number of 1-WL indistinguishable graphs mn for
real-world datasets with varying graph orders.




Figure 11. Correlation between MPNN outputs and the Forest distance FD across real-world datasets using a varying number of MPNN
layers. The Pearson correlation coefficient r between ∥h(G1 ) − h(G2 )∥2 and the Forest distance FD3 are shown on the top left of the
figures

                         Table 2. Statistics for the M UTAG, NCI1, MCF-7H, and O GBG -M OLHIV datasets.
                                                                           Dataset
                                                          M UTAG   NCI1    MCF-7H    O GBG -M OLHIV
                                        # Graphs           188     4 110    27 770       41 127
                                        # Classes           2        2        2             2
                                        Avg. # vertices    17.9    29.9      26.4         25.5
                                        Avg. # edges       39.6    32.3      28.5         27.5



                                                                    50
                                                            Covered Forests




Table 3. Estimates of the coefficients in Proposition 15 for real-world datasets. We compute mn,d,3 in a data-dependent fashion for each
dataset, i.e., not for the whole graph class.
                                                                      Dataset
                                                   M UTAG    NCI1     MCF-7H       O GBG -M OLHIV
                                          S         150      3 288        22 216       32 902
                                          mn,d,3    139      3 808        25 448       34 433
                                          M        5.890     2.389        0.497        1.704
                                          CFD3     0.377     0.202        0.101        0.107
                                          n          28       111          244          222




                                                                     51
