  We propose an end-to-end framework based on a Graph Neural Network (GNN) to
balance the power flows in energy grids. The balancing is framed as a
supervised vertex regression task, where the GNN is trained to predict the
current and power injections at each grid branch that yield a power flow
balance. By representing the power grid as a line graph with branches as
vertices, we can train a GNN that is accurate and robust to changes in
topology. In addition, by using specialized GNN layers, we are able to build a
very deep architecture that accounts for large neighborhoods on the graph,
while implementing only localized operations. We perform three different
experiments to evaluate: i) the benefits of using localized rather than global
operations and the tendency of deep GNN models to oversmooth the quantities on
the nodes; ii) the resilience to perturbations in the graph topology; and iii)
the capability to train the model simultaneously on multiple grid topologies
and the consequential improvement in generalization to new, unseen grids. The
proposed framework is efficient and, compared to other solvers based on deep
learning, is robust to perturbations not only to the physical quantities on the
grid components, but also to the topology.
