Title: NEURAL EXECUTION OF GRAPH ALGORITHMS

Abstract: Graph Neural Networks (GNNs) are a powerful representational tool for solving problems on graph-structured inputs. In almost all cases so far, however, they have been applied to directly recovering a final solution from raw inputs, without explicit guidance on how to structure their problem-solving. Here, instead, we focus on learning in the space of algorithms: we train several state-of-the-art GNN architectures to imitate individual steps of classical graph algorithms, parallel (breadth-first search, Bellman-Ford) as well as sequential (Prim's algorithm). As graph algorithms usually rely on making discrete decisions within neighbourhoods, we hypothesise that maximisation-based message passing neural networks are bestsuited for such objectives, and validate this claim empirically. We also demonstrate how learning in the space of algorithms can yield new opportunities for positive transfer between tasks-showing how learning a shortest-path algorithm can be substantially improved when simultaneously learning a reachability algorithm. * Work performed while the author was at DeepMind. 1 We note that there exist good reasons for choosing this approach, e.g. ease of optimisation.

1. INTRODUCTION:

A multitude of important real-world tasks can be formulated as tasks over graph-structured inputs, such as navigation, web search, protein folding, and game-playing. Theoretical computer science has successfully discovered effective and highly influential algorithms for many of these tasks. But many problems are still considered intractable from this perspective.

Machine learning approaches have been applied to many of these classic tasks, from tasks with known polynomial time algorithms such as shortest paths (Graves et al., 2016; Xu et al., 2019) and sorting (Reed & De Freitas, 2015) , to intractable tasks such as travelling salesman (Vinyals et al., 2015; Bello et al., 2016; Kool et al., 2018) , boolean satisfiability (Selsam et al., 2018; Selsam & Bjørner, 2019) , and even probabilistic inference (Yoon et al., 2018) . Recently, this work often relies on advancements in graph representation learning (Bronstein et al., 2017; Hamilton et al., 2017; Battaglia et al., 2018) with graph neural networks (GNNs) (Li et al., 2015; Kipf & Welling, 2016; Gilmer et al., 2017; Veličković et al., 2018) . In almost all cases so far, ground-truth solutions are used to drive learning, giving the model complete freedom to find a mapping from raw inputs to such solution 1 . Many classical algorithms share related subroutines: for example, shortest path computation (via the Bellman-Ford (Bellman, 1958) algorithm) and breadth-first search both must enumerate sets of edges adjacent to a particular node. Inspired by previous work on the more general tasks of program synthesis and learning to execute (Zaremba & Sutskever, 2014; Kaiser & Sutskever, 2015; Kurach et al., 2015; Reed & De Freitas, 2015; Santoro et al., 2018) , we show that by learning several algorithms simultaneously and providing a supervision signal, our neural network is able to demonstrate positive knowledge transfer between learning different algorithms. The supervision signal is driven by how a known classical algorithm would process such inputs (including any relevant intermediate outputs), providing explicit (and reusable) guidance on how to tackle graph-structured problems. We call this approach neural graph algorithm execution.

Given that the majority of popular algorithms requires making discrete decisions over neighbourhoods (e.g. "which edge should be taken?"), we suggest that a highly suitable architecture for this task is a message-passing neural network (Gilmer et al., 2017) with a maximisation aggregator-a claim we verify, demonstrating clear performance benefits for simultaneously learning breadth-first search for reachability with the Bellman-Ford algorithm for shortest paths. We also verify its applicability to sequential reasoning, through learning Prim's algorithm (Prim, 1957) for minimum spanning trees.

Note that our approach complements Reed & De Freitas (2015) : we show that a relatively simple graph neural network architecture is able to learn and algorithmically transfer among different tasks, do not require explicitly denoting subroutines, and tackle tasks with superlinear time complexity.

2. PROBLEM SETUP:



2.1. GRAPH ALGORITHMS:

We consider graphs G = (V, E) where V is the set of nodes (or vertices) and E is the set of edges (pairs of nodes). We will consider graphs for two purposes: 1) as part of the task to be solved (e.g., the graph provided as input to breadth first search), 2) as the input to a graph neural network.

A graph neural network receives a sequence of T ∈ N graph-structured inputs. For each element of the sequence, we will use a fixed G and vary meta-data associated with the nodes and edges of the graph in the input. In particular, to provide a graph G = (V, E) as input to a graph neural network, each node i ∈ V has associated node features x (t) i ∈ R Nx where t ∈ {1, . . . , T } denotes the index in the input sequence and N x is the dimensionality of the node features. Similarly, each edge (i, j) ∈ E has associated edge features e (t) ij ∈ R Ne where N e is the dimensionality of the edge features. At each step, the algorithm produces node-level outputs y (t) i ∈ R Ny . Some of these outputs may then be reused as inputs on the next step; i.e., x (t+1) i may contain some elements of y (t) i .

2.2. LEARNING TO EXECUTE GRAPH ALGORITHMS:

We are interested in learning a graph neural network that can execute one or more of several potential algorithms. The specific algorithm to be executed, denoted A, is provided as an input to the network. The structure of the graph neural network follows the encode-process-decode paradigm (Hamrick et al., 2018) . First we will describe the encode-process-decode architecture and then describe the specific parameterisations that are used for each sub-network. The relation between the variables used by the graph algorithm and our neural algorithm executor setup is further illustrated in Figure 1 .

For each algorithm A we define an encoder network f A . It is applied to the current input features and previous latent features h

(t-1) i (with h (0) i = 0) to produce encoded inputs, z (t) i , as such: z (t) i = f A ( x (t) i , h (t-1) i ) (1)

The encoded inputs are then processed using the processor network P . The processor network shares its parameters among all algorithms being learnt. The processor network takes as input the encoded inputs

Z (t) = { z t i } i∈V and edge features E (t) = { e (t)

ij } e∈E and produces as output latent node features,

EQUATION

The node and algorithm specific outputs are then calculated by the decoder-network, g A :

EQUATION

Note that the processor network also needs to make a decision on whether to terminate the algorithm. This is performed by an algorithm-specific termination network, T A , which provides the probability of termination τ (t) -after applying the logistic sigmoid activation σ-as follows:

EQUATION

where

H (t) = 1 |V | i∈V h (t)

i is the average node embedding. If the algorithm hasn't terminated (e.g. τ (t) > 0.5) the computation of Eqns. 1-4 is repeated-with parts of y In our experiments, all algorithm-dependent networks, f A , g A and T A , are all linear projections, placing the majority of the representational power of our method in the processor network P . As we would like the processor network to be mindful of the structural properties of the input, we employ a graph neural network (GNN) layer capable of exploiting edge features as P . Specifically, we compare graph attention networks (GATs) (Veličković et al., 2018) . (Equation 5, left) against message-passing neural networks (MPNNs) (Gilmer et al., 2017) (Equation 5, right):

EQUATION

(5) where W is a learnable projection matrix, a is an attention mechanism producing scalar coefficients, while M and U are neural networks producing vector messages.

is an elementwise aggregation operator, such as maximisation, summation or averaging. We use linear projections for M and U .

Note that the processor network P is algorithm-agnostic, and can hence be used to execute several algorithms simultaneously. Lastly, we note that the setup also easily allows for including edge-level outputs, and graph-level inputs and outputs-however, these were not required in our experiments.

3. EXPERIMENTAL SETUP:

Graph generation To provide our learner with a wide variety of input graph structure types, we follow prior work (You et al., 2018; 2019) and generate undirected graphs from seven categories:

• Ladder graphs;

• 2D grid graphs;

• Trees, uniformly randomly generated from the Prüfer sequence;

• Erdős-Rényi (Erdős & Rényi, 1960) graphs, with edge probability min log 2 |V | |V | , 0.5 ; • Barabási-Albert (Albert & Barabási, 2002) graphs, attaching either four or five edges to every incoming node;

• 4-Community graphs-first generating four disjoint Erdős-Rényi graphs with edge probability 0.7, followed by interconnecting their nodes with edge probability 0.01;

• 4-Caveman (Watts, 1999) graphs, having each of their intra-clique edges removed with probability 0.7, followed by inserting 0.025|V | additional shortcut edges between cliques.

We additionally insert a self-edge to every node in the graphs, in order to support easier retention of self-information through message passing. Finally, we attach a real-valued weight to every edge, drawn uniformly from the range [0.2, 1]. These weight values serve as the sole edge features, e

ij , for

EQUATION

v , e

EQUATION

i , e

EQUATION

k , e all steps t. Note that sampling edge weights in this manner essentially guarantees the uniqueness of the recovered solution, simplifying downstream evaluation. We also ignore corner-case inputs (such as negative weight cycles), leaving their handling to future work.

We aim to study the algorithm execution task from a "programmer" perspective: human experts may manually inspect only relatively small graphs, and any algorithms derived from this should apply to arbitrarily large graphs. For each category, we generate 100 training and 5 validation graphs of only 20 nodes. For testing, 5 additional graphs of 20, 50 and 100 nodes are generated per category.

Parallel algorithms We consider two classical algorithms: breadth-first search for reachability, and the Bellman-Ford algorithm (Bellman, 1958) for shortest paths. The former maintains a single-bit value in each node, determining whether said node is reachable from a source node, and the latter maintains a scalar value in each node, representing its distance from the source node.

In both cases, the algorithm is initialised by randomly selecting the source node, s. As the initial input to the algorithms, x

i , we have:

BFS : x (1) i = 1 i = s 0 i = s Bellman-Ford : x (1) i = 0 i = s +∞ i = s (6)

This information is then propagated according to the chosen algorithm: a node becomes reachable from s if any of its neighbours are reachable from s, and we may update the distance to a given node as the minimal way to reach any of its neighbours, then taking the connecting edge:

BFS : x (t+1) i =      1 x (t) i = 1 1 ∃j.(j, i) ∈ E ∧ x (t) j = 1 0 otherwise B-F : x (t+1) i = min x (t) i , min (j,i)∈E x (t) j + e (t) ji (7)

For breadth-first search, no additional information is being computed, hence y

(t) i = x (t+1) i

. Additionally, at each step the Bellman-Ford algorithm may compute, for each node, the "predecessor" node, p (t) i in the shortest path (indicating which edge should be taken to reach this node). This information is ultimately used to reconstruct shortest paths, and hence represents the crucial output:

Bellman-Ford : p (t) i =    i i = s argmin j;(j,i)∈E x (t) j + e (t) ji i = s (8)

Hence, for Bellman-Ford, y

(t) i = p (t) i x (t+1) i

, where is concatenation. To provide a numerically stable value for +∞, we set all such entries to the length of the longest shortest path in the graph + 1.

We learn to execute these two algorithms simultaneously-at each step, concatenating the relevant x (t) i and y

(t):

i values for them. As both of the algorithms considered here (and most others) rely on discrete decisions over neighbourhoods, learning to execute them should be naturally suited for the MPNN with the max-aggregator-a claim which we directly verify in the remainder of this section.

Sequential algorithms Unlike the previous two algorithms, single iterations of many classical graph algorithms will specifically focus on one node at a time-very often the case with constructive tasks. We seek to demonstrate that our neural graph algorithm execution paradigm aligns well with this setting too, and in this context we study Prim's algorithm (Prim, 1957) for minimum spanning trees.

Prim's algorithm maintains a partially constructed minimum spanning tree (MST)-initially, it is a singleton tree consisting of only a source node, s. At each step, Prim's algorithm searches for a new node to connect to the MST-chosen so that the edge attaching it to the tree is the lightest possible:

Prim : x (1) i = 1 i = s 0 i = s Prim : x (t+1) i =            1 x (t) i = 1 1 i = argmin j s.t. x (t) j =0 min k s.t. x (t) k =1 e (t) jk 0 otherwise (9)

Once the new node is selected, the algorithm attaches it to the MST via this edge-similarly to Bellman-Ford, we can keep track of predecessor nodes, p (t) i :

EQUATION

In Equations 9-10, the boxed updates are the only modifications to the state of the algorithm at step tcentering only on the selected node to attach to the MST. Once again, the algorithm requires discrete decisions based on neighbourhood edge weights, hence we expect outperformance of MPNN-max.

For a visualisation of the expected alignment between a graph algorithm and our neural graph executors, refer to Figure 2 . We provide an overview of all of the inputs and supervision signals used here for the executor in Appendix A.

Neural network architectures To assess the comparative benefits of different architectures for the neural algorithm execution task, we consider many candidate networks executing the computation of Equations 1-5, especially the processor network P : For the MPNN update rule, we consider maximisation, mean and summation aggregators. For the GAT update rule, we consider the originally proposed attention mechanism of Veličković et al. (2018) , as well as Transformer attention (Vaswani et al., 2017) ; Additionally for GAT, we consider also attending over the full graph-adding a second attention head, only acting on the non-edges of the graph (and hence not accepting any edge features). The two heads' features are then concatenated and passed through another linear layer.

Analogously to our expectation that the best-performing MPNN rule will perform maximisation, we attempt to force the attentional coefficients of GAT to be as sharp as possible-applying either an entropy penalty to them (as in Ying et al. ( 2018)) or the Gumbel softmax trick (Jang et al., 2016) .

We perform an additional sanity check to ensure that a GNN-like architecture is necessary in this case. Prior work (Xu et al., 2019) has already demonstrated the unsuitability of MLPs for reasoning tasks like these, and they will not support variable amounts of nodes. Here, instead, we consider an LSTM (Hochreiter & Schmidhuber, 1997) architecture into which serialised graphs are fed (we use an edge list, in a setup similar to (Graves et al., 2016) ).

In all cases, the neural networks compute a latent dimension of K = 32 features, and are optimised using the Adam SGD optimiser (Kingma & Ba, 2014) on the binary cross-entropy for the reachability predictions, mean squared error for the distance predictions, categorical cross-entropy for the predecessor node predictions, and binary cross-entropy for predicting termination (all applied simultaneously). We use an initial learning rate of 0.0005, and perform early stopping on the validation accuracy for the predecessor node (with a patience of 10 epochs). If the termination network T A does not terminate the neural network computation within |V | steps, it is assumed terminated at that point. For Prim's algorithm, as only one node at a time is updated, we optimise the categorical cross-entropy of predicting the next node, masked across all the nodes not added to the MST yet.

It should be noted that, when learning to execute Bellman-Ford and Prim's algorithms, the prediction of p

i is performed by scoring each node-pair using an edge-wise scoring network (a neural network predicting a scalar score from h

(t) i h (t) j e (t)

ij ), followed by a softmax over all neighbours of i.

4. RESULTS AND DISCUSSION:

Parallel algorithm execution In order to evaluate how faithfully the neural algorithm executor replicates the two parallel algorithms, we propose reporting the accuracy of predicting the reachability2 (for breadth-first search; Table 1 ), as well as predicting the predecessor node (for Bellman-Ford; Table 2 ). We report this metric averaged across all steps t (to give a sense of how well the algorithm is imitated across time), as well as the last-step performance (which corresponds to the final solution). While it is not necessary for recovering the final answer, we also provide the mean squared error of the models on the Bellman-Ford distance information, as well as the termination accuracy (computed at each step separately)-averaged across all timesteps-in Table 3 .

The results confirm our hypotheses: the MPNN-max model exhibits superior generalisation performance on both reachability and shortest-path predecessor node prediction. Even when allowing for hardening the attention of GAT-like models (using entropy or Gumbel softmax), the more flexible computational model of MPNN is capable of outperforming them. The performance gap on predicting the predecessor also widens significantly as the test graph size increases.

Our findings are compounded by observing the mean squared error metric on the intermediate result:

with the MPNN-max being the only model providing a reasonable level of regression error at the 100node generalisation level. It further accentuates that, even though models like the MPNN-sum model may also learn various thresholding functions-as demonstrated by (Xu et al., 2018) -aggregating messages in this way can lead to outputs of exploding magnitude, rendering the network hard to numerically control for larger graphs.

We perform two additional studies, executing the shortest-path prediction on MPNN-max without predicting reachability, and without supervising on any intermediate algorithm computations-that is, learning to predict predecessors (and termination behaviour) directly from the inputs, x

i . Note that this is the primary way such tasks have been tackled by graph neural networks in prior work. We report these results as no-reach and no-algo in Table 2 , respectively.

Looking at the no-reach ablation, we observe clear signs of positive knowledge transfer occurring between the reachability and shortest-path tasks: when the shortest path algorithm is learned in isolation, the predictive power of MPNN-max drops significantly (while still outperforming many other approaches). In Appendix B, we provide a brief theoretical insight to justify this. Similarly, considering the no-algo experiment, we conclude that there is a clear benefit to supervising on the distance information-giving an additional performance improvement compared to the standard approach of only supervising on the final downstream outputs. Taken in conjunction, these two results provide encouragement for studying this particular learning setup.

Lastly, we report the performance of a curriculum learning (Bengio et al., 2009) strategy (as curriculum): here, BFS is learnt first in isolation (to perfect validation accuracy), followed by finetuning on Bellman-Ford. We find that this approach performs worse than learning both algorithms simultaneously, and as such we do not consider it in further experiments.

Desirable properties of the MPNN-max as an algorithm executor persist when generalising to even larger graphs, as we demonstrate in Table 4 -demonstrating favourable generalisation on graphs up to 75× as large as the graphs originally trained on. We note that our observations also still hold (computed against the algorithm's "ground-truth" ordering), as well as the accuracy of reconstructing the final MST (via the predecessors).

As anticipated, our results once again show strong generalisation outperformance of MPNN-max. We additionally compared against a non-sequential version (no-algo), where the MPNN-max model was trained to directly predict predecessors (without requiring sequentially chosing nodes). This resulted in poor generalisation to larger graphs, weaker than even the LSTM sequential baseline.

The insights from our setup verify that our neural graph execution paradigm is applicable to sequential algorithm execution as well-substantially expanding its range of possible applications.

5. CONCLUSIONS:

In this manuscript, we have presented the neural graph algorithm execution task, where-unlike prior approaches-we optimise neural networks to imitate individual steps and all intermediate outputs of classical graph algorithms, parallel as well as sequential. Through extensive evaluation-especially on the tasks of reachability, shortest paths and minimum spanning trees-we have determined a highly suitable architecture in maximisation-based message passing neural networks, and identified clear benefits for multi-task learning and positive transfer, as many classical algorithms share related subroutines. We believe that the results presented here should serve as strong motivation for further work in the area, attempting to learn more algorithms simultaneously and exploiting the similarities between their respective subroutines whenever appropriate. 

B THEORETICAL INSIGHTS:

We provide a brief theoretical insight into why learning to imitate multiple algorithms simultaneously may provide benefits to downstream predictive power.

Our insight comes from an information-theoretic perspective. Consider two algorithms, A and B, that both operate on the same input, x, and produce outputs y A and y B , respectively. We consider the task of learning to execute A (that is, predicting y A from x), with and without y B provided3 . We operate on the further assumption that A and B share subroutines-implying that, knowing x, there is information content preserved between y A and y B . Formally, we say that the conditional mutual information of the corresponding random variables, I(Y A ; Y B |X), is positive. 

Expanding out the expression for I(Y:



C LARGER-SCALE STUDIES:

To investigate the models' behaviour when generalising to larger graphs, we conduct experiments for executing the two parallel algorithms (BFS and Bellman-Ford) when training on graphs with 100 nodes, and testing on graphs with 1000 nodes, as reported in Table 8 . These results further solidify the outperformance of MPNN-based models, even outside of the studied "programmer" regime.

D PERFORMANCE PER GRAPH TYPE:

As our training and testing graphs come from a specific set of seven categories, it is natural to study the predictive power of the model conditioned on the testing category. Firstly, in Table 9 , we provide We then perform the same explanation procedure on the ground-truth predecessor of u in the BFS algorithm, and continue the process until we reach the source node, s of the BFS algorithm. If all explanations are correct, we will observe a path that connects the node u to the starting node of the BFS algorithm. Any disconnection indicates an incorrect explanation that deviates from the groundtruth, which could either be due to the incorrect prediction of the model, or an incorrect explanation.

Using the standard training dataset in our experiments, we observe that 82.16% of the instances have a path explanation with no error in the explanation compared to the ground-truth predecessors. Two of these examples are visualised in Figure 4 . Additionally, 93.85% of the predecessor explanation correspond to the ground-truth, providing further qualitative insight into the algorithm execution capacity of MPNN-max.

:

Note that the BFS update rule is, in isolation, fully learnable by all considered GNN architectures. Results here demonstrate performance when learning to execute BFS simultaneously with Bellman-Ford. Specifically, in this regime, MPNN-sum's messages explode when generalising to larger sizes, while MPNN-mean dedicates most of its capacity to predicting the shortest path (cf. Tables2-3).

Note that here we're implicitly assuming that yB is trivial enough to be fully learnt on its own-and thus can be provided to the model. This is a more strict way of assuming that B is a "simpler" algorithm than A.

Note that this is also the case with ladder graphs, but these trajectories cannot get very complicated in this case, as the ladder graph is a product of two path graphs.

Figures and Tables:

Figure 2: Illustrating the alignment of one step of the Bellman-Ford algorithm (left) with one step of a message passing neural network (right), and the supervision signal used for the algorithm learner.

A ; Y B |X), denoting Shannon entropy by H, we obtain:I(Y A ; Y B |X) = H(Y A |X) + H(Y B |X) -H(Y A , Y B |X) = H(Y A |X) + H(Y B |X) -(H(Y A |Y B , X) + H(Y B |X)) = H(Y A |X) -H(Y A |Y B , X)(11)AsI(Y A ; Y B |X) > 0, we conclude H(Y A |X) > H(Y A |Y B , X); therefore, providing y B upfront strictly reduces the information-theoretic uncertainty in y A , thus making it potentially more suitable for being learned by optimisation techniques.

Figure 4: Identified reachability paths for a noisy Caveman graph and tree graph, using GNNExplainer. The purple edges indicate the predecessor relationships identified by the explainer, while the yellow edges are the remainder of the graph's edges.

Accuracy of predicting reachability at different test-set sizes, trained on graphs of 20 nodes. GAT* correspond to the best GAT setup as per Section 3 (GAT-full using the full graph).

Table content: <table><tr><td>Reachability (mean step accuracy / last-step accuracy)</td></tr></table>

Accuracy of predicting the shortest-path predecessor node at different test-set sizes. (curriculum) corresponds to a curriculum wherein reachability is learnt first. (no-reach) corresponds to training without the reachability task. (no-algo) corresponds to the classical setup of directly training on the predecessor, without predicting any intermediate outputs or distances.

Table content: <table><tr><td>Predecessor (mean step accuracy / last-step accuracy)</td></tr></table>

Mean squared error for predicting the intermediate distance information from Bellman-Ford, and accuracy of the termination network compared to the ground-truth algorithm, averaged across all timesteps. (curriculum) corresponds to a curriculum wherein reachability is learnt first. (no-reach) corresponds to training without the reachability task.

Table content: <table><tr><td/><td colspan="3">B-F mean squared error / mean termination accuracy</td></tr><tr><td>Model</td><td>20 nodes</td><td>50 nodes</td><td>100 nodes</td></tr><tr><td colspan="2">LSTM (Hochreiter &amp; Schmidhuber, 1997) 3.857 / 83.43%</td><td colspan="2">11.92 / 86.74% 74.36 / 83.55%</td></tr><tr><td>GAT* (Veličković et al., 2018)</td><td>43.49 / 85.33%</td><td colspan="2">123.1 / 84.88% 183.6 / 82.16%</td></tr><tr><td>GAT-full* (Vaswani et al., 2017)</td><td>7.189 / 77.14%</td><td colspan="2">28.89 / 75.51% 58.08 / 77.30%</td></tr><tr><td>MPNN-mean (Gilmer et al., 2017)</td><td>0.021 / 98.57%</td><td colspan="2">23.73 / 89.29% 91.58 / 86.81%</td></tr><tr><td>MPNN-sum (Gilmer et al., 2017)</td><td>0.156 / 98.09%</td><td colspan="2">4.745 / 88.11% +∞ / 87.71%</td></tr><tr><td>MPNN-max (Gilmer et al., 2017)</td><td>0.005 / 98.89%</td><td colspan="2">0.013 / 98.58% 0.238 / 97.82%</td></tr><tr><td>MPNN-max (curriculum)</td><td colspan="3">0.021 / 98.99% 0.351 / 96.34% 3.650 / 92.34%</td></tr><tr><td>MPNN-max (no-reach)</td><td>0.452 / 80.18%</td><td colspan="2">2.512 / 91.77% 2.628 / 85.22%</td></tr></table>

Shortest-path predecessor accuracy of the MPNN-max model trained jointly with the reachability objective on 20-node graphs, at different test graph sizes (up to 75× larger).

Table content: <table><tr><td/><td/><td/><td colspan="3">MPNN-max predecessor prediction</td><td/></tr><tr><td>Metric</td><td colspan="6">20 nodes 50 nodes 100 nodes 500 nodes 1000 nodes 1500 nodes</td></tr><tr><td colspan="2">Mean step accuracy 97.13%</td><td>94.71%</td><td>90.91%</td><td>83.08%</td><td>77.53%</td><td>74.90%</td></tr><tr><td>Last-step accuracy</td><td>96.84%</td><td>93.88%</td><td>88.79%</td><td>76.46%</td><td>72.74%</td><td>67.66%</td></tr></table>

Accuracy of selecting the next node to add to the minimum spanning tree, and predicting the minimum spanning tree predecessor node-at different test-set sizes. (no-algo) corresponds to the classical setup of directly training on the predecessor, without adding nodes sequentially.

Table content: <table><tr><td>Accuracy (next MST node / MST predecessor)</td></tr></table>

Summary of inputs and supervision signals of the three algorithms considered. : predecessor of i in the partial MSTA SUMMARY OF ALGORITHM INPUTS AND SUPERVISION SIGNALSTo aid clarity, within Table7, we provide an overview of all the inputs and outputs (supervision signals) for the three algorithms considered here (breadth-first search, Bellman-Ford and Prim).

Table content: <table><tr><td>Algorithm</td><td colspan="2">Inputs</td><td colspan="2">Supervision signals</td></tr><tr><td colspan="2">Breadth-first search x</td><td>(t)</td><td colspan="2">x τ (t) : has the algorithm terminated? (t+1) , i</td></tr><tr><td>Bellman-Ford</td><td colspan="2">x (using ≤ t hops) (t) i : shortest distance from s to i</td><td colspan="2">x τ (t) , (t+1) i p (t) i : predecessor of i in the ,</td></tr><tr><td/><td/><td/><td colspan="2">shortest path tree (in ≤ t hops)</td></tr><tr><td>Prim's algorithm</td><td colspan="2">x (built from s after t steps)? (t) i : is node i in the (partial) MST</td><td>x τ (t) , (t+1) i p (t)</td><td>,</td></tr></table>

Peer review (iclr2020):
This paper investigates using GNNs to learn graph algorithms. It proposes a model which consists of algorithm-dependent encoder and decoder, and algorithm-independent processor. Authors try to learn BFS, Bellman-Ford and Prim algorithms on various types of random graphs. Experimental results suggest that MPNN with max aggregator outperforms other variants significantly in terms of generalization. Overall, this paper presents a solid contribution on learning graph algorithms using GNNs, despite the caveat for some clarifications on the model and experiments. Given these clarifications in an author response, I would be willing to increase the score. Pros: 1, Although it is less satisfying to learn to solve graph problems where polynomial-time algorithms exist, I still appreciate the contribution of the paper, especially the algorithm-independent processor. It is one step forward to models which could learn meta-level representation of algorithms. The findings of this paper may suggest that different types of operators used in the GNN may have different inductive bias in learning different types of algorithms. 2, Experimental comparisons are adequate and convincing. The detailed analysis of empirical results also provide good explanation. Cons & Suggestions: 1, Given the dynamic programming nature of the most of tasks, it is not that surprising that MPNN with max aggregation could solve them pretty well. What surprises me is that MPNN-mean / MPNN-sum could not generalize well (i.e., performance drops significantly on 50 and 100 nodes settings) on the reachability task. In my opinion, the reachability task could be easily handled by any diffusion/propagation based models including, e.g., MPNN, GCN, GAT, as long as the information is spread over the input graph. Could you explain why does this happen? 2, Training details are sparse. If I understood correctly, the training of various GNNs is done by teacher forcing such that each step some supervised information collected from the underlying graph algorithms is provided to GNNs. However, it is not clear that what supervised information is exactly provided under each graph algorithm. It would be great to have a table to summarize what the input and supervised output information is for each graph algorithm. 3, The processor is trained to learn multiple graph algorithms simultaneously. A natural question to ask is how does the performance change when you train the processor with different combinations of algorithms? What is the impact of correlations between different graph algorithms? Did you explore learning with graph algorithms following some sequential schedule, e.g., curriculum learning? 4, It would be great to provide more results on larger size graphs, e.g., trained on 20 nodes but test on 1000 or more nodes. I saw one set of experiments trained on 100 and test 1000 nodes in the appendix. More results along this line would make the paper more convincing on the generalization. 5, It would be great to discuss [1] as it also studies how to use GNNs to learn a special class of graph algorithms, i.e., probabilistic inference algorithms on graphs. It is shown in [1] that belief propagation algorithm could be seen as a specially constructed GNN. Interestingly, some well-known graph algorithms could be re-formulated as probabilistic inference algorithms, e.g., graph-cut could be reformulated as max-product [2]. [1] Yoon, K., Liao, R., Xiong, Y., Zhang, L., Fetaya, E., Urtasun, R., Zemel, R. and Pitkow, X., 2018. Inference in probabilistic graphical models by graph neural networks. arXiv preprint arXiv:1803.07710. [2] Tarlow, D., Givoni, I.E., Zemel, R.S. and Frey, B.J., 2011, July. Graph Cuts is a Max-Product Algorithm. In UAI (pp. 671-680). ====================================================================================================== Thanks for the thorough response! It resolves my concerns. I improved my score.