## Abstract

The *network reconfiguration* problem seeks to find a rooted tree *T* such that the energy of the (unique) feasible electrical flow over *T* is minimized. The tree requirement on the support of the flow is motivated by operational constraints in electricity distribution networks. The bulk of existing results on convex optimization over vertices of polytopes and on the structure of electrical flows do not easily give guarantees for this problem, while many heuristic methods have been developed in the power systems community as early as 1989. Our main contribution is to give the first provable approximation guarantees for the network reconfiguration problem. We provide novel lower bounds and corresponding approximation factors for various settings ranging from \(\min \{{\mathcal {O}}(m-n), {\mathcal {O}}(n)\}\) for general graphs, to \({\mathcal {O}}(\sqrt{n})\) over grids with uniform resistances on edges, and \({\mathcal {O}}(1)\) for grids with uniform edge resistances and demands. To obtain the result for general graphs, we propose a new method for (approximate) spectral graph sparsification, which may be of independent interest. Using insights from our theoretical results, we propose a general heuristic for the network reconfiguration problem that is orders of magnitude faster than existing methods in the literature, while obtaining comparable performance.

This is a preview of subscription content, access via your institution.

## Notes

- 1.
Throughout the paper we use energy and loss interchangeably.

- 2.
Edges are referred to as

*lines*, root is the location of the*substation*, and demands are often referred to as*loads*in the power systems community. - 3.
Here we use a simplified linear flow model, similar to [10]. In reality, power flow equations are nonlinear and result in non-convex optimization problems [44, 46, 50, 52]. We refer the reader to a recent survey on relaxations and approximations of power flow equations [49]. In contrast, here we aim to relax the non-linearity of the power flow model, and instead focus on the combinatorial aspect of the optimization problem in (P0).

- 4.
Contract the support of the flow and add edges with 0 flow to construct a spanning tree.

- 5.
We assume that the demands are real numbers, while in energy systems, demands are usually complex numbers \(d=p+{\mathbf {i}}q\), capturing the active (

*p*) and reactive (*q*) parts of the demand. In this case, the objective function can be decomposed into two additive parts, in which one is only a function of real demands (*p*), and the other is only a function of the reactive part (*q*). All our approximation guarantees hold for this more realistic objective as well, because the proposed solutions would guarantee the same approximation factor for both parts of the objective. - 6.
The support of the vertices of the general flow polytope is a tree.

- 7.
We will improve upon this factor in Sect. 5.2.

- 8.
The stretch of a tree is a metric used to analyze how well a tree preserves distances between the endpoints of edges in the original graph.

- 9.
For any matrix \(A \in {\mathbb {R}}^{m \times n}\), we have \(\mathrm {im}(A) = \mathrm {im}(A A^T)\) (see e.g., Thm A.25 (iv) in [53]).

- 10.
See the problem

*SymT*in [26] for example. - 11.
An

*r*-arborescence is a directed spanning tree such that for any vertex*v*, there is exactly one directed path from*r*to*v*(see [56] for more details). - 12.
The code written for the simulations in this paper can be found here: https://github.com/hassanmortagy/Electrical-Flows-over-Spanning-Trees.

- 13.
We implemented all algorithms in Python 3.7, utilizing numpy and networkx for some of our functions. We used these packages from the Anaconda 4.7.12 distribution, with Gurobi 9 [27] as a solver for the MIP.

- 14.
For these solutions, the provable gaps using MIPs were around 15–30%.

- 15.
We follow the definition of Elkin et al. [18], but this definition slightly differs in the denominator from others given in the literature. Abraham and Neiman [2] and Abraham et al. [1] define the stretch as \( \frac{d_T (u,v)}{d_G(u,v)}\), where \(d_G\) is the shortest-path metric on

*G*with respect to the edge weights. Note that these definitions are equivalent if the edge weights are uniform. - 16.
Ohm’s Law says that the electrical flow on any edge is equal to the potential difference divided by the resistance of the edge (or equivalently multiplied by the conductance).

## References

- 1.
Abraham, I., Bartal, Y., Neiman, O.: Nearly tight low stretch spanning trees. In: Proceedings of the 49th Annual IEEE Symposium on Foundations of Computer Science, pp. 781–790 (2008)

- 2.
Abraham, I., Neiman, O.: Using petal-decompositions to build a low stretch spanning tree. In: Proceedings of the 44th Annual ACM Symposium on Theory of Computing, pp. 395–406 (2012)

- 3.
Alon, N., Karp, R.M., Peleg, D., West, D.: A graph-theoretic game and its application to the \(k\)-server problem. SIAM J. Comput.

**24**(1), 78–100 (1995) - 4.
Anari, N., Oveis Gharan, S.: Effective-resistance-reducing flows, spectrally thin trees, and asymmetric TSP. In: Proceedings of the 56th IEEE Annual Symposium on Foundations of Computer Science, pp. 20–39 (2015)

- 5.
Andrews, M., Chuzhoy, J., Guruswami, V., Khanna, S., Talwar, K., Zhang, L.: Inapproximability of edge-disjoint paths and low congestion routing on undirected graphs. Combinatorica

**30**(5), 485–520 (2010) - 6.
Asadpour, A., Goemans, M.X., Madry, A., Gharan, S.O., Saberi, A.: An \({\cal{O}}(\log n/ \log \log n)\)-approximation algorithm for the asymmetric traveling salesman problem. In: Proceedings of the 21st Annual ACM-SIAM Symposium on Discrete Algorithms, pp. 379–389 (2010)

- 7.
Baes, M., Del Pia, A., Nesterov, Y., Onn, S., Weismantel, R.: Minimizing Lipschitz-continuous strongly convex functions over integer points in polytopes. Math. Program.

**134**(1), 305–322 (2012) - 8.
Baran, M.E., Wu, F.: Network reconfiguration in distribution systems for loss reduction and load balancing. IEEE Trans. Power Deliv.

**4**(2), 1401–1407 (1989) - 9.
Bertsimas, D., Tsitsiklis, J.: Introduction to Linear Optimization, 1st edn. Athena Scientific, Athens (1997)

- 10.
Christiano, P., Kelner, J.A., Madry, A., Spielman, D.A., Teng, S.H.: Electrical flows, Laplacian systems, and faster approximation of maximum flow in undirected graphs. In: Proceedings of the 43rd Annual ACM Symposium on Theory of Computing, pp. 273–282 (2011)

- 11.
Chu, T., Gao, Y., Peng, R., Sachdeva, S., Sawlani, S., Wang, J.: Graph sparsification, spectral sketches, and faster resistance computation via short cycle decompositions. SIAM J. Comput. 18–85 (2020)

- 12.
Civanlar, S., Grainger, J., Yin, H., Lee, S.: Distribution feeder reconfiguration for loss reduction. IEEE Trans. Power Deliv.

**3**(3), 1217–1223 (1988) - 13.
Coffrin, C., Hijazi, H.L., Van Hentenryck, P.: The QC relaxation: a theoretical and computational study on optimal power flow. IEEE Trans. Power Syst.

**31**(4), 3008–3018 (2015) - 14.
Cohen, M.B., Kelner, J.A., Kyng, R., Peebles, J., Peng, R., Rao, A.B., Sidford, A.: Solving directed Laplacian systems in nearly-linear time through sparse LU factorizations. In: Proceedings of the 59th Annual IEEE Symposium on Foundations of Computer Science, pp. 898–909 (2018)

- 15.
Cohen, M.B., Kyng, R., Miller, G.L., Pachocki, J.W., Peng, R., Rao, A.B., Xu, S.C.: Solving SDD linear systems in nearly \(m \log ^{1/2}n\) time. In: Proceedings of the 46th Annual ACM Symposium on Theory of Computing, pp. 343–352 (2014)

- 16.
Diks, K., Djidjev, H.N., Sykora, O., Vrto, I.: Edge separators for planar graphs and their applications. In: International Symposium on Mathematical Foundations of Computer Science, pp. 280–290. Springer (1988)

- 17.
Durfee, D., Kyng, R., Peebles, J., Rao, A.B., Sachdeva, S.: Sampling random spanning trees faster than matrix multiplication. In: Proceedings of the 49th Annual ACM Symposium on Theory of Computing, pp. 730–742 (2017)

- 18.
Elkin, M., Emek, Y., Spielman, D.A., Teng, S.H.: Lower-stretch spanning trees. In: Proceedings of the 37th Annual ACM Symposium on Theory of Computing, pp. 494–503 (2005)

- 19.
Enacheanu, B., Raison, B., Caire, R., Devaux, O., Bienia, W., HadjSaid, N.: Radial network reconfiguration using genetic algorithm based on the matroid theory. IEEE Trans. Power Syst.

**23**(1), 186–195 (2008) - 20.
Fattahi, S., Lavaei, J., Atamtürk, A.: A bound strengthening method for optimal transmission switching in power systems. IEEE Trans. Power Syst.

**34**(1), 280–291 (2018) - 21.
Federickson, G.N.: Fast algorithms for shortest paths in planar graphs, with applications. SIAM J. Comput.

**16**(6), 1004–1022 (1987) - 22.
Fekete, S.P., Khuller, S., Klemmstein, M., Raghavachari, B., Young, N.: A network-flow technique for finding low-weight bounded-degree spanning trees. J. Algorithms

**24**(2), 310–324 (1997) - 23.
Fisher, E.B., O’Neill, R.P., Ferris, M.C.: Optimal transmission switching. IEEE Trans. Power Syst.

**23**(3), 1346–1355 (2008) - 24.
Gan, L., Li, N., Topcu, U., Low, S.H.: Exact convex relaxation of optimal power flow in radial networks. IEEE Trans. Autom. Control

**60**(1), 72–87 (2014) - 25.
Grastien, A., Rutter, I., Wagner, D., Wegner, F., Wolf, M.: The maximum transmission switching flow problem. In: Proceedings of the 9th International Conference on Future Energy Systems, pp. 340–360. ACM (2018)

- 26.
Gupta, A., Kleinberg, J., Kumar, A., Rastogi, R., Yener, B.: Provisioning a virtual private network: a network design problem for multicommodity flow. In: Proceedings of the 33rd Annual ACM Symposium on Theory of Computing, pp. 389–398. ACM (2001)

- 27.
Gurobi Optimization, L.: Gurobi optimizer reference manual version 9.0 (2020). https://www.gurobi.com/documentation/9.0/refman

- 28.
Haddock, J.: Projection algorithms for convex and combinatorial optimization. Ph.D. thesis, University of California, Davis (2018)

- 29.
Hildebrand, R., Weismantel, R., Zemmer, K.: An FPTAS for minimizing indefinite quadratic forms over integers in polyhedra. In: Proceedings of the 27th Annual ACM-SIAM Symposium on Discrete Algorithms, pp. 1715–1723 (2016)

- 30.
Kelner, J.A., Orecchia, L., Sidford, A., Zhu, Z.A.: A simple, combinatorial algorithm for solving SDD systems in nearly-linear time. In: Proceedings of the 45th Annual ACM Symposium on Theory of Computing, pp. 911–920 (2013)

- 31.
Khodabakhsh, A., Yang, G., Basu, S., Nikolova, E., Caramanis, M.C., Lianeas, T., Pountourakis, E.: A submodular approach for electricity distribution network reconfiguration. In: Proceedings of the 51st Hawaii International Conference on System Sciences, pp. 2717–2726 (2018)

- 32.
Khodr, H., Martinez-Crespo, J.: Integral methodology for distribution systems reconfiguration based on optimal power flow using benders decomposition technique. IET Gen. Trans. Distrib.

**3**(6), 521–534 (2009) - 33.
Khuller, S., Raghavachari, B., Young, N.: Balancing minimum spanning trees and shortest-path trees. Algorithmica

**14**(4), 305–321 (1995) - 34.
Klein, D.J., Randić, M.: Resistance distance. J. Math. Chem.

**12**(1), 81–95 (1993) - 35.
Kocuk, B., Dey, S.S., Sun, X.A.: New formulation and strong MISOCP relaxations for AC optimal transmission switching problem. IEEE Trans. Power Syst.

**32**(6), 4161–4170 (2017) - 36.
Kocuk, B., Jeon, H., Dey, S.S., Linderoth, J., Luedtke, J., Sun, X.A.: A cycle-based formulation and valid inequalities for DC power transmission problems with switching. Oper. Res.

**64**(4), 922–938 (2016) - 37.
Könemann, J., Ravi, R.: A matter of degree: improved approximation algorithms for degree-bounded minimum spanning trees. SIAM J. Comput.

**31**(6), 1783–1793 (2002) - 38.
Kumar, K.S., Naveen, S.: Power system reconfiguration and loss minimization for a distribution systems using “Catfish PSO” algorithm. Front. Energy

**8**(4), 434–442 (2014) - 39.
Lee, J., Mirrokni, V.S., Nagarajan, V., Sviridenko, M.: Maximizing nonmonotone submodular functions under matroid or knapsack constraints. SIAM J. Discrete Math.

**23**(4), 2053–2078 (2010) - 40.
Lehmann, K., Grastien, A., Van Hentenryck, P.: The complexity of DC-switching problems. arXiv preprint arXiv:1411.4369 (2014)

- 41.
Levin, D.A., Peres, Y.: Markov Chains and Mixing Times, vol. 107. American Mathematical Society, New York (2017)

- 42.
Lipton, R.J., Tarjan, R.E.: A separator theorem for planar graphs. SIAM J. Appl. Math.

**36**(2), 177–189 (1979) - 43.
Liu, Y.P., Sidford, A.: Faster energy maximization for faster maximum flow. In: Proceedings of the 52nd Annual ACM Symposium on Theory of Computing, pp. 803–814 (2020)

- 44.
Low, S.H.: Convex relaxation of optimal power flow-part I: formulations and equivalence. IEEE Trans. Control Netw. Syst.

**1**(1), 15–27 (2014) - 45.
Lyons, R., Peres, Y.: Probability on Trees and Networks. Cambridge University Press, Cambridge (2017)

- 46.
Madani, R., Sojoudi, S., Lavaei, J.: Convex relaxation for optimal power flow problem: mesh networks. IEEE Trans. Power Syst.

**30**(1), 199–211 (2014) - 47.
Madry, A.: Computing maximum flow with augmenting electrical flows. In: Proceedings of the 57th Annual IEEE Symposium on Foundations of Computer Science, pp. 593–602 (2016)

- 48.
Martin, R.: Using separation algorithms to generate mixed integer model reformulations. Oper. Res. Lett.

**10**(3), 119–128 (1991) - 49.
Molzahn, D.K., Hiskens, I.A.: A survey of relaxations and approximations of the power flow equations. Found. Trends Electric Energy Syst.

**4**(1–2), 1–221 (2019) - 50.
Molzahn, D.K., Lesieutre, B.C., DeMarco, C.L.: Investigation of non-zero duality gap solutions to a semidefinite relaxation of the optimal power flow problem. In: Proceedings of the 47th Hawaii International Conference on System Sciences, pp. 2325–2334 (2014)

- 51.
Morton, A.B., Mareels, I.M.: An efficient brute-force solution to the network reconfiguration problem. IEEE Trans. Power Deliv.

**15**(3), 996–1000 (2000) - 52.
Peng, Q., Low, S.H.: Distributed optimal power flow algorithm for radial networks, I: balanced single phase case. IEEE Trans. Smart Grid

**9**(1), 111–121 (2016) - 53.
Rao, C.R., Toutenburg, H.: Linear Models Least Squares and Alternatives, 2nd edn. Springer, New York (1999)

- 54.
Salazar, H., Gallego, R., Romero, R.: Artificial neural networks and clustering techniques applied in the reconfiguration of distribution systems. IEEE Trans. Power Deliv.

**21**(3), 1735–1742 (2006) - 55.
Sarfi, R.J., Salama, M., Chikhani, A.: A survey of the state of the art in distribution system reconfiguration for system loss reduction. Electr. Power Syst. Res.

**31**(1), 61–70 (1994) - 56.
Schrijver, A.: Combinatorial Optimization: Polyhedra and Efficiency, vol. 24. Springer, New York (2003)

- 57.
Seymour, P.D.: Disjoint paths in graphs. Discrete Math.

**29**(3), 293–309 (1980) - 58.
Shirmohammadi, D., Hong, H.W.: Reconfiguration of electric distribution networks for resistive line losses reduction. IEEE Trans. Power Deliv.

**4**(2), 1492–1498 (1989) - 59.
Singh, M., Lau, L.C.: Approximating minimum bounded degree spanning trees to within one of optimal. J. ACM

**62**, 1 (2015) - 60.
Spielman, D.A., Srivastava, N.: Graph sparsification by effective resistances. SIAM J. Comput.

**40**(6), 1913–1926 (2011) - 61.
Spielman, D.A., Teng, S.H.: Spectral sparsification of graphs. SIAM J. Comput.

**40**(4), 981–1025 (2011) - 62.
Williamson, D.P.: Network Flow Algorithms. Cambridge University Press, Cambridge (2019)

## Acknowledgements

We thank the participants of the Real-Time Decision Making Reunion Workshop, Mixed Integer Programming Workshop, and the IEEE Power & Energy Systems General Meeting for valuable feedback. We also thank David Williamson for pointing us to low-stretch spanning trees, Alexandra Kolla for pointing us to spectrally-thin trees, Tasos Sidiropoulos for pointing us to the grid embedding of planar graphs, and the anonymous referees for numerous useful suggestions to improve this manuscript.

## Author information

### Affiliations

### Corresponding author

## Additional information

### Publisher's Note

Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.

A part of this work was done while the authors were visiting the Simons Institute for the Theory of Computing, UC Berkeley. We gratefully acknowledge the financial support from NSF Grants CRII-1850182, CCF-1733832, CCF-1331863, and CCF-1350823.

## Appendices

### A Detailed overview of existing techniques

*Related work in power systems:* The problem of reconfiguring the electric distribution network to minimize line losses was first introduced by Civanlar et al. [12] and Baran and Wu [8] where they introduced and implemented an algorithm called “Branch Exchange”, which tries to locally improve the objective by swapping two edges of the graph. Unlike branch exchange that maintains a feasible spanning tree during its execution, there are other algorithms that start with the entire graph and delete edges one by one until a feasible solution is obtained [58]. We discussed this approach further in Sect. 3. Subsequently, many other heuristic algorithms were proposed for the reconfiguration problem, including but not limited to genetic algorithms [19], particle swarm optimization [38], artificial neural networks [54], etc. The missing part in all of these heuristics is a rigorous theoretical performance guarantee that shows why/when these algorithms perform well. To that end, Khodabakhsh et al. [31] recently showed that the reconfiguration problem is equivalent to a supermodular minimization problem under a matroid constraint.

*Existing techniques in combinatorial optimization:* One may ask the question if a simple spanning tree like breadth-first or depth-first search tree will be a good solution to the reconfiguration problem. It is shown in [31] that if the edges are identical, the optimal tree will include all the edges incident to the root. So the BFS tree might be a better candidate. However, as we showed in Sect. 4, a BFS tree can have a loss of \(\varOmega (n)\) times the optimal loss. Depth-first search can be worse; for example, a cycle with spokes and root in the center has a gap of \(\varOmega (n^2)\). (the optimal tree is a star with linear cost, while the DFS tree will take the cycle with cubic cost.)

Our problem looks like a *bicriteria tree* approximation; on the one hand, we want to connect demands to the root via shortest paths, on the other hand, we want the paths to be disjoint, i.e., degree of the nodes (except the root) in the tree must be small. Similar problems have been studied in the Computer Science literature: Könemann and Ravi [37] consider finding a minimum cost spanning tree subject to maximum degree at most *B*. The variation where each node has its own specified degree bound is also studied by Fekete et al. [22] and Singh and Lau [59]. Khuller et al. [33] also define Light Approximate Shortest-path Trees (LAST), in which a tree is \((\alpha ,\beta )\)-LAST if the distances to the root are increased by at most a factor of \(\alpha \) (compared to the original graph), while the cost of the tree is at most \(\beta \) times the minimum spanning tree. However, the main difficulty in using these approximations for the reconfiguration problem is accounting for the resultant flow in the spanning trees. The cost on the edges of the tree are then no longer linear (as in the above mentioned results) or even quadratic.

Electrical energy is minimized when considering *edge-disjoint paths* to connect nodes [57]. However, the complete disjointness is rarely achievable in our problem (unless the graph is a star with root in the center), and hence we want to limit the number of flows that merge together. This is more related to the Edge-Disjoint Path with Congestion (EDPwC) problem, studied by Andrews et al. [5], which is as follows: Given an undirected graph with *V* nodes, a set of terminal pairs and an integer *c*, the objective is to route as many terminal pairs as possible, subject to the constraint that at most *c* demands can be routed through any edge in the graph. They show hardness of approximation for EDPwC problem. The main differences with our problem are that in EDPwC there is a hard constraint on the flow routed through any edge, while in our problem there is a quadratic cost associated with that flow, as well as the additional spanning tree constraint in the reconfiguration problem.

A natural question is if there are some known graph families where one can exploit existing structures to find an approximation. We consider planar graphs, also motivated by the application since many distribution networks are designed that way. As we saw in Sect. 4, one way to obtain useful lower bounds for the objective function is via generating a packing of cuts that are small in size, i.e., do not have many edges. A celebrated result in the theory of planar graphs is the existence of a small set of vertices, called the vertex-separator, that can disconnect the graph into components of almost equal size [42]. This can even be applied in a recursive manner, as shown by Frederickson [21], to divide the graph into \({\mathcal {O}}(n/r)\) regions with no more than *r* vertices each, and \({\mathcal {O}}(n/\sqrt{r})\) boundary vertices in total. However, it is unclear how to bound the cost of these cuts or regions in the reconfiguration problem, unless we have more information about the direction of the resultant flow on boundary edges.

*Existing techniques in electrical flows:* Electrical flows have been an active area of research in the past two decades, due to their computational efficiency and numerous applications to graph theory problems. In particular, it was shown that one can compute an electrical flow in a graph in near-linear time [14, 15, 30]. Moreover, various novel graph algorithms involve computing an electrical flow as a subroutine. For example, Madry [47] and Liu and Sidford [43] use electrical flows to obtain the fastest algorithms for the Max-flow problem so far.

If we relax the spanning tree constraint, our problem reduces to the standard problem of computing an electrical flow in a graph that satisfies the demands. Even though the support of an electrical flow in its full generality does not form a spanning tree, still, it maybe be beneficial to use the minimum energy electrical flow in the graph as a starting point. Shirmohammadi and Hong [58] follow this approach and propose an iterative algorithm for the reconfiguration problem, where in each iteration they compute the electrical flow and delete the edge with smallest flow such that the graph remains connected. They demonstrated experimentally that their iterative algorithm performs well in practice but they provide no theoretical guarantees. In Sect. 3, we proposed a similar iterative edge-deletion algorithm and prove its approximation bound in Theorem 1.

At the heart of these edge deletions is the question of whether we can delete edges from the graph without increasing the energy cost too much. One approach that can be used to address this question is *spectral sparsification* [60], which aims to reduce the number of edges in the graph while maintaining \((1 \pm \epsilon )\) approximations of the Laplacian quadratic form. In their classic result, Spielman and Srivastava [61] show that one can construct such a sparsifier with \(\tilde{{\mathcal {O}}}(n/\epsilon ^2)\) edges. Chu et al. [11] slightly improve upon the results of Spielman and Srivastava, bringing the number of edges down to \(\tilde{{\mathcal {O}}}(n/\epsilon )\) for some specific instances.

Using the fact that electric flows are fully characterized by the Laplacian quadratic form, one may conclude that by using such a sparsifier we can reduce the number of edges in the graph without significantly increasing the energy cost. However, this is not true, because to obtain such sparsifier they compensate the deletion of edges by changing the weights (i.e. resistances) on the edges. Thus, since we assume resistances are fixed, to the best of our knowledge, the existing spectral sparsification approach does not extend to our problem. This motivates the need of a novel approach to handle edge deletions without increasing the energy too much.

*Uniform Spanning Trees:* To deal with the iterative edge deletions, we consider sampling from distributions over spanning trees. Random spanning trees are one of the most well-studied probabilistic combinatorial structures in graphs. Recent work has specifically considered *product distributions* over spanning trees where the probability of each tree is proportional to the product of its edge weights. (This is motivated by the desirable properties and numerous applications of such product distributions.) For example, Asadpour et al. [6] break the \({\mathcal {O}}(\log n)\) approximation factor barrier of the ATSP problem by rounding a point in the relative interior of the spanning tree polytope by sampling from a maximum entropy distribution over spanning trees; this maximum entropy distribution turns out to be a product distribution. Moreover, a beautiful property of product distributions over spanning trees is the fact that the marginal probability of an edge being in a random spanning tree is exactly equal to the product of the edge weight and the effective resistance of the edge (see Appendix 3). This is a fact that we exploit in our RIDe algorithm.

*Low-stretch trees:* Finally, another relevant approach in the electric flows literature, entails *low stretch trees*. Given a weighted graph *G*, a low-stretch spanning tree *T* is a spanning tree with the additional property that it approximates distances between the endpoints of any edge in *G*. In particular,^{Footnote 15} the *stretch* of an edge \(e =(u,v)\) is the ratio of the (unique) shortest path distance between *u* and *v* in *T* to \(r_e\) (the weight of edge *e* in *G*). Furthermore, the *total stretch* of *T* is defined as the sum of the stretch of all edges in *G*. Kelner et al. [30] show that for any tree, the gap between the energy of the flow in that tree and the flow in the original graph, is at most the total stretch of that tree. Naturally, one may wonder if there exists a low value for the (total) stretch such that all graphs have a spanning tree with that stretch. The answer to that question is unfortunately no. Abraham and Neiman [2] show that one can construct a spanning tree *T* for any connected graph with total stretch at most \({\mathcal {O}}(m \log n \log \log n)\) in near-linear time (Theorem 2.11 in [30]); this bound is tight up to an \({\mathcal {O}}(\log \log n)\) factor because Alon et. al [3] show that the total stretch is \(\varOmega (m\log n)\) for certain graph instances. Thus, this implies that the energy cost of *T* is at most \({\tilde{{\mathcal {O}}}}(m)\) times that of the original graph. We improve upon this approximation result using our RIDe algorithm.

### B Missing background information

We give a review of preliminaries on electrical flows, graph Laplacians and their pseudoinverse, and matrix inversion results. We refer the reader to [45, 62] for more details.

### B1 The graph Laplacian

Let \(G = (V,E)\) be a connected and undirected graph with \(|V |=n\), \(|E |=m\). Each edge \(e\in E\) is also associated with a *resistance* \(r_e>0\). The inverse of the resistance is called *conductance*, defined by \(c_e=1/r_e\). Let \(B \in {\mathbb {R}}^{n \times m}\) be the vertex-edge incidence matrix upon orienting each edge in *E* arbitrarily. Also, let *R* be an \(m\times m\) diagonal resistance matrix where \(R_{e,e} = r_{e}\). We define the weighted Laplacian \(L := BCB^T\), where \(C = R^{-1}\). Since *C* is a positive definite and symmetric matrix, we could write \( L = (C^{1/2}B^T)^T (C^{1/2}B^T)\), which implies that *L* is positive-semi definite, since \(x^TLx \ge 0\) for all \(x \in {\mathbb {R}}^n\).

Let \({\mathbf {1}}\) be the all-ones vector. For any matrix \(A \in {\mathbb {R}}^{m \times n}\), denote the span of the columns of *A* by \(\mathrm {im}(A) \subseteq {\mathbb {R}}^{m}\). It is well known that if *G* is connected, the only vector in the nullspace of the Laplacian *L* is the all-ones vector \({\mathbf {1}}\). In what follows, we will use the Moore-Penrose pseudoinverse, denoted by \(L^\dagger \), to invert the Laplacian. Since *L* is symmetric and positive semi-definite, we can write *L* in terms of its eigen-decomposition \(L= \sum _{i=1}^n \lambda _i u_i u_i^T\), where \(0 = \lambda _1 \le \dots \le \lambda _n\) are the eigenvalues of *L* sorted in increasing order and \(u_i\) are the corresponding singular orthonormal vectors. Now, the pseudoinverse could be conveniently characterized using \(L^\dagger = \sum _{i=2}^n \frac{1}{\lambda _i}u_i u_i^T\). Observe that \(L L^\dagger = \sum _{i=2}^n u_i u_i^T\) and is thus a projection matrix that projects onto \(\mathrm {im}(L)\). In other words, for any vector \(x \in {\mathbb {R}}^{n}\) such that \(x^T {\mathbf {1}} = 0\), \(L L^\dagger x = x\).

### B2 An introduction to electrical flows

Given a graph \(G = (V,E)\), a root \(r \in V\) and demands \(d_i \ge 0\) for all \(i \in V {\setminus }\{r\}\), we begin by assigning a demand \(d_r = - \sum _{i \in V {\setminus }\{r\}} b_i\) to the root, and we collect these demands into a demand vector \(b \in {\mathbb {R}}^{n}\). An electrical flow is a feasible flow that satisfies demands, while also minimizing the electrical energy. Hence, computing an electrical flow amounts to solving the following problem:

The optimality conditions^{Footnote 16} of (P2) (i.e. the problem of computing an electrical flow) imply the existence of a vector of potentials on the nodes (dual variables) \(\phi \in {\mathbb {R}}^n\) such that

or \(f^* = CB^T \phi \) in matrix notation. By pre-multiplying this equation with *B* on both sides, we have \(\phi = L^\dagger b\), which is well-defined since \({\mathbf {1}}^T b = 0\). Using these facts, one can easily show that

For any pair of vertices *u* and *v*, let \(\chi _{uv} \in {\mathbb {R}}^{n}\) be a vector with a \(-1\) in the coordinate corresponding to *u*, a 1 in the coordinate corresponding to *v*, and all other coordinates equal to 0. The *effective* resistance between a pair of vertices *u*, *v* is defined as

In other words, it is the energy of sending *one* unit of electrical flow from *u* to *v*.

For any edge \(e = (u,v)\), it is well known that \({R}_{\text {eff}}(e) \le r_e\), where equality holds if and only if *e* forms the only path between *u* and *v* (see for example Theorem D in [34]). Intuitively, if \({R}_{\text {eff}}(e) = r_e\), then, upon sending one unit of electrical flow between the endpoints of *e*, all that flow goes through *e*, which implies that *e* is *bridge* since otherwise we could otherwise reroute some of the flow through another \(u-v\) path and decrease the effective resistance, which would contradict the optimality of the electrical flow.

### B3 Uniform spanning trees

In a weighted graph, a uniform distribution of spanning trees is one such that probability of each tree is proportional to the product of the weight of its edges.

### Definition 1

For \(w : E \rightarrow {\mathbb {R}}_{++}\), we say \(\lambda \) is a \(w-\)uniform spanning tree distribution if it is a product distribution and for any spanning tree \(T \in {\mathcal {T}}\)

Let \(\lambda _e := {\mathbb {P}}_{T \sim \lambda } (e \in T)\) be the marginal probability of an edge \(e \in E\). It is known that (see for example [17, 45, 62])

where \(L_w\) is the weighted Laplacian defined with respect to the weights *w*. In particular, the vector of marginal probabilities \(\lambda _e\), \(e \in E\), is in the spanning tree polytope. In this work, we specifically consider the case when we choose *w* to be the conductances, i.e. \(\lambda \) is a \(c-\)uniform distribution. Hence, using (18) we know that \(\lambda _e = c_e \chi _e^T L^\dagger \chi _e = c_e {R}_{\text {eff}}(e)\), where *L* is the weighted Laplacian defined with respect to the conductances (see Appendix 1). Therefore, for any spanning tree \(T \in {\mathcal {T}}\),

where \(K = \sum _{T \in {\mathcal {T}}}{\prod _{e \in T}c_e}\) is the normalization factor.

Observe that under a \(c-\)uniform spanning tree distribution, if an edge \(e = (u,v)\) has a low marginal probability \(c_e {R}_{\text {eff}}(e)\), then there are relatively a lot of paths between *u* and *v* excluding *e*. Therefore upon deleting an edge *e* from the graph, it would not be costly to reroute the flow going through edge *e*. Similarly, if an edge has a high marginal probability, then rerouting the flow upon deleting that edge would be relatively very costly. This is the crucial observation that we use in our RIDe algorithm.

### B4 A note on reactive power

In this paper, we assumed that the demands (\(d_i\)’s) are real-valued parameters. However, in energy systems, demands are usually complex numbers \(d=p+{\mathbf {i}}q\), capturing the active (*p*) and reactive (*q*) parts of the demand. Consequently, the loss on each line will be \(r_e[(\sum _{i\in \text {succ}(e)}p_i)^2+(\sum _{i\in \text {succ}(e)}q_i)^2]\). Note that in this case, the objective function can be decomposed into two additive parts, in which one is only a function of real demands (*p*), and the other is only a function of the reactive part (*q*). We argue that our results would still hold. In particular, the approximate solutions in Theorems 1,2,3 are independent of the demands; hence, the approximation factor would hold for both the active and reactive parts of the objective function. In Theorem 4, the Min-Min algorithm would output the same spanning tree if performed with either *p* or *q*, given the uniform assumption on (complex) loads; therefore, the approximation factor holds for both parts of the objective function.

### C Convex optimization over the flow polytope

One can think of the reconfiguration problem (P0) as minimizing a convex function over the vertices of a (flow) polytope. However, the general results from convex optimization over flow polytopes do not lead to good guarantees. We propose a randomized algorithm RIDe that rounds the fractional solution obtained from the flow relaxation to vertices of the flow polytope, while providing an \({\mathcal {O}}(m-n)\) approximation guarantee. But before that, here we review this new perspective on our reconfiguration problem, and some main results of interest in convex optimization over polytopes.

For a directed and connected graph *G* with vertex-edge incidence matrix *B* and a demand vector \(b:V \rightarrow {\mathbb {R}}\), the general flow polytope is given by \(P = \{f\in {\mathbb {R}}^m:\, Bf =b, f \ge 0\}\). It is known that the support of the vertices of the flow polytope, denoted by \(\text {vert}(P)\), forms a spanning tree (see Theorem 7.4 in [9]). This follows from the fact that there is a one-to-one correspondence between the bases of the graphic matroid defined by *G* and the linear matroid defined on the incidence matrix *B*. In other words, there is a one-to-one correspondence between the spanning trees of *G* and subsets of \(n-1\) linearly independent columns of *B* (note that the rank of *B* is \(n-1\)). Therefore, a basic solution of the flow polytope will be one in which the flow is sent along a spanning tree (when ignoring the edge directions). If such a basic solution (spanning tree) additionally satisfies the flow conservation constraints while taking the edge directions into account, we obtain a basic *feasible* solution or a vertex of *P*. Since for undirected graphs we can replace each edge with two directed edges, we can replace the flow conservation constraints of the network reconfiguration problem given in (1) using the constraints given by *P* above, where an extreme point of that polytope will then correspond to a flow sent along a spanning tree rooted at the root *r*. Such an extreme point is precisely one of the feasible solutions of (P0) and (P1). Hence, we have arrived at the following formulation of the network reconfiguration problem:

In particular, if all the resistances are uniform, then the problem is equivalent to finding a vertex with the smallest Euclidean norm, which is known to be NP-hard (see, for example, Lemma 4.1.4 in [28]). To the best of our knowledge, there do not exist any approximation algorithms for minimizing convex functions over vertices of a polytope. Even if we just require the solution to be integral (instead of lie at a vertex), and make strong assumptions on the objective function like strong convexity and Lipschitz gradients, Baes et al. [7] have proved the following result:

### Theorem 5

(Theorem 2 in [7]) Let \({\mathcal {F}} = P \cap {\mathbb {Z}}^n\) be presented by an oracle for solving quadratic minimization problems of the type \(\min c^T x + \frac{\tau }{2} \Vert x\Vert _2^2\) with varying \(c \in {\mathbb {Q}}^n\) and \(\tau \in {\mathbb {Q}}_+\). There is no polynomial time algorithm that can produce for every \({\mathcal {F}} = P \cap {\mathbb {Z}}^n\) and every strongly convex function \(h: {\mathbb {R}}^n \rightarrow {\mathbb {R}}\) with Lipschitz gradients a feasible point \({\bar{x}}\) such that \(h({\bar{x}}) - h (x^*) \le n^2 - n\), where \(x^* = {{\,\mathrm{\hbox {arg min}}\,}}_{x\in {\mathcal {F}}}h(x)\).

The authors also show that this \(n^2 - n\) approximation is tight. Observe that this bound translates to an \(m^2 - m\) approximation in the context of the network reconfiguration problem. However, the \(\textsc {RIDe}\) algorithm we propose gives an \(O(m-n)\) approximation in the stronger setting in which we require the solution to be a vertex of the flow polytope.

More recently, Hildebrand et al. [29] show that there is an FPTAS for solving problems of the form \(\min _{P \cap {\mathbb {Z}}^n} x^TQx\), where \(P\subseteq {\mathbb {R}}^n\) is a polyhderon and \(Q \in {\mathbb {Z}}^{n \times n}\) is a symmetric matrix with at most one negative eigenvalue. Recall that the objective function of the network reconfiguration is \(f^T R f\), where *R* is positive definite and symmetric. Hence, if we additionally assume all the resistances are integral, then using the result of Hildebrand et al. [29], there exists an FPTAS for minimizing the energy of the flow over integral flows. However, this result clearly does not extend to the network reconfiguration problem, since one can obtain an integral flow whose support does not form a spanning tree.

### D Challenges for generalizing cut-based results to planar graphs

As mentioned in Sect. 4, one potential generalization of the cut-based approximation results is to find such a family of cuts for planar graphs and to try to get an \({\mathcal {O}}(\sqrt{n})\)-approximation for planar graphs with uniform edge resistances. In particular, the planar separator theorem can be interesting to solve this problem, as it guarantees the existence of small cuts for any planar graph. Here we discuss potential roadblocks towards this approach.

*1. Edge separators:* All planar graphs do not have small edge separators. For example, if we consider a wheel graph with *n* nodes as shown in Fig. 8-(left), any cut that splits the graph into two (almost) equal-size parts has at least a constant fraction of *n* edges. Even though each planar graph has a vertex separator of size \({\mathcal {O}}(\sqrt{n})\), when we consider edge separators, one can only guarantee an edge separator of size \({\mathcal {O}}(\sqrt{\varDelta n})\), where \(\varDelta \) is the maximum degree in the graph [16].

*2. Constrained separator cuts:* Suppose that the planar graph has a bounded degree, the second limitation is that the choice of the *k*th cut is constrained by the choice of previous cuts. The separator theorem is oblivious to the edge directions in the following sense: once we find a cut of \({\mathcal {O}}(\sqrt{\varDelta n})\) in our planar graph as shown in Fig. 8-(middle), it induces a natural direction on the corresponding edges, where the subsequent cuts have to respect those directions. In other words, if edge \((u_i,v_i)\) appears in our cut, there cannot be a future cut \(S \ni r\) such that \(v_i\in S\) and \(u_i\notin S\). Since the opposite is valid (\(u_i\in S, v_i\notin S\)), contracting \(u_i,v_i\) is not possible, without loss of generality.

The example in Fig. 8-(right) shows how finding appropriate cuts might be challenging even with contracting edges (note that by considering edge contraction, we are already losing the option of cut intersections, hence searching over a smaller family of cuts). The idea in this figure is that after we find our first (small) cut \(S_1\), we contract the edges that intersect the cut, in an attempt to avoid using those edges in violating directions in the future cuts. Now when we find our next cut \(S_2\) in the contracted graph (shown at the bottom), notice that node *x* becomes unreachable from the root. This is because cut \(S_1\) induces the direction of edge (*x*, *y*) to be from *x* to *y*, and cut \(S_2\) sets the direction of edge (*x*, *w*) from *x* to *w*. In other words, even with just 2 cuts, it has become infeasible to find a spanning tree that respects the cut directions.

If one can somehow incorporate these one-way constraints in the separator oracle, i.e., once a node \(v_i\) is picked in *S*, the corresponding \(u_i\)’s (could be more than one) from previous cuts should be picked in *S* as well, then one could recursively use this oracle and hope for an \({\mathcal {O}}(\sqrt{n})\) approximation.

### E Performance of shortest-path trees

The problem with shortest-path trees is that they are oblivious to the node demands. We now give a simple construction that demonstrates this behavior. Consider the complete undirected graph \(G_n = (V,E)\) on *n* nodes, where \(n \ge 3\). Fix a root *r* arbitrarily and let *P* be any Hamiltonian path in \(G_n\) starting at *r*. Now, suppose that \(r_e = 1\) for all \(e \in P\) and \(r_e = n\) for all other edges \(e \in E{\setminus } P\). Finally, let all the demands \(d_i = 1\) for all \(i \in V\).

By construction, in this example the shortest path tree rooted at *r* will be *P*. The cost of that tree is

where the last inequality follows since \(n \ge 3\). We now compare this with the LM Heuristic, which also attains the optimal tree in this example. The LM Heuristic will start by computing a BFS tree rooted at *r*. Since \(G_n\) is a complete graph, this tree will only have two layers: (i) layer 1 will just contain *r*, (ii) layer 2 will contain all other nodes in the graph. Now, the LM Heuristic will match the nodes in layer 2 to the nodes in layer 1 by solving the LP given in the main paper. However in this specific case, there is only one possible matching: match all nodes in layer 2 to the root node *r* in layer 1. This gives us a final tree, where all nodes \(i \in V{\setminus } \{r\}\) are connected to the root through the edge (*r*, *i*). The cost of that tree is \((1)(1)^2 + (n)(n-1)(1)^2 = n^2 - n + 1 \le n^2\). Hence the gap between the SPT and the LM tree (which is also the optimal tree) is at least *n*/6 or \(\varOmega (n)\). Note that the same gap could be achieved by the wheel gap, which is planar.

We can also extend this construction to grid graphs. Consider and \(n \times n\) grid and fix a root *r* in the corner of the grid. Further, consider a DFS tree rooted at *r*. A DFS tree in this case will be a Hamiltonian path *P* with \(n^2-1\) edges that starts at *r* and visits every other node in the graph. Now, suppose that \(r_e = 1\) for all \(e \in P\) and the resistances for other edges are greedily chosen as small as possible so that the shortest-paths tree coincides with *P*. Finally, let all the demands \(d_i = 1\) for all \(i \in V\). We give an example for a \(5\times 5\) grid in Fig. 9.

We see in Fig. 9 that the LM tree is near optimal and the ratio between the cost of SPT and LM tree is around 3. We extend this construction for varying grid sizes, and in line with the original experiments presented in the main body of the paper, we add noise to the edge resistances that is sampled from a normal distribution with mean 0 and standard deviation of 0.5, while also considering sparsification probabilities \(p\in \{0, 0.05,0.1,0.2\}\). This is how we generated the resistances for the adversarial second set of instances used in the computations. In Fig. 7-(right), we present the performance of our algorithms on those adversarial instances, where we find that LM is the best performing algorithm. The best feasible solution was obtained by running the MIP with the LM output as a warm-start in 64% of the instances, and Branch Exchange initialized with the LM output in 36% of the instances.

As shown in Fig. 10, we find that the cost of SPTs can be arbitrarily bad due to the fact that they are oblivious to node demands. We also see that as the sparsification probability increases, the ratio between SPTs and LM decreases, which is expected as the cost of the DFS tree decreases as the sparsification probability increases.

### F Computations

### F1 MIP formulation used in computations

Let \(G=(V,E)\) (\(|V |=n\), \(|E |=m\)) be a connected and undirected graph with: root \(r \in V\), resistances \(r_e>0\) for each edge \(e\in E\) and demands \(d_i\ge 0\) for each node \(i\in V\backslash \{r\}\) supplied by the root node (which implies that \(d_r = - \sum _{i\in V{\setminus } \{r\}} d_i\)). Also, let \(\delta ^+(v)\) and \(\delta ^-(v)\) denote the sets of incoming and outgoing edges of *v* (after fixing an arbitrary orientation on the edges). To incorporate acyclic support constraints we utilized Martin’s [48] extended formulation for spanning trees, which has \(O(n^3)\) constraints and variables. The *network reconfiguration* problem could be formulated as follows:

where *M* is a sufficiently large scalar. In particular it suffices to set \(M =\sum _{u \in V{\setminus } \{r\}} d_u = -d_r\). Note that the pairs \(\{v, w\}\) are unordered, while *v*, *v*, *w* are an ordered triple of distinct vertices with \(\{v, w\} \in E\) (and \(u \in V{\setminus } \{v,w\}\)).

### F2 More computational plots

Recall that for our first set of computational experiments, we constructed instances on \(25 \times 25\) grids with sparsification probability \(p \in \{0.05,0.1, 0.2\}\). Moreover we consider demands and resistances randomly chosen in [0.5, 1.5] and [1, 10] respectively. We benchmarked the performance of depth-first search (DFS) trees, RIDe, the Layered-Matching (LM) heuristic, the Branch Exchange heuristic and the convex integer program given in the previous section. In the main body of the paper we only presented the plots for when the sparsification probability was \(p = 0.2\). Here, we present additional plots (with more details about the performance of Ride and Branch Exchange initialized with the LM tree) for varying sparsification probabilities \(p \in \{0.05,0.1, 0.2\}\) (Fig. 11).

## Rights and permissions

## About this article

### Cite this article

Gupta, S., Khodabakhsh, A., Mortagy, H. *et al.* Electrical flows over spanning trees.
*Math. Program.* (2021). https://doi.org/10.1007/s10107-020-01614-x

Received:

Accepted:

Published:

### Keywords

- Electrical flows
- Distribution network reconfiguration
- Approximation algorithms
- Iterative rounding
- Spectral sparsification

### Mathematics Subject Classification

- 90C11
- 90C25
- 90C27
- 90C30
- 90C59
- 90C90
- 90B10