Topological theory of resilience and failure spreading in flow networks

Link failures in supply networks can have catastrophic consequences that can lead to a complete collapse of the network. Strategies to prevent failure spreading are thus heavily sought after. Here, we make use of a spanning tree formulation of link failures in linear flow networks to analyse topological structures that prevent failures spreading. In particular, we exploit a result obtained for resistor networks based on the \textit{Matrix tree theorem} to analyse failure spreading after link failures in power grids. Using a spanning tree formulation of link failures, we analyse three strategies based on the network topology that allow to reduce the impact of single link failures. All our strategies do not reduce the grid's ability to transport flow or do in fact improve it - in contrast to traditional containment strategies based on lowering network connectivity. Our results also explain why certain connectivity features completely suppress any failure spreading as reported in recent publications.


I. INTRODUCTION
The theory of linear flow networks provides a powerful framework, allowing to study systems ranging from water supply networks [1,2] and biological networks, such as leaf venation networks [3][4][5], to resistor networks [6][7][8], or AC power grids [9,10]. Failures of transportation links in these networks can have catastrophic consequences up to a complete collapse of the network. As a result, link failures in linear flow networks and their prevention are a field of active study [11][12][13][14][15][16][17].
The study of linear flow networks is intimately related to graph theory since most phenomena can be analysed on purely topological grounds [6]. This connection dates back to work by Kirchhoff [7] who analysed resistor networks, and introduced several major tools that are now the basis of the theory of complex networks, such as the matrix tree theorem [6,7,18]. These tools can now serve as a basis for the analysis of failure spreading in AC power grids, which can be modelled as linear flow networks based on the DC approximation [10]. A substantial part of security analysis in power grids is dedicated to the study of transmission line outages since they can lead to cascading outages in a series of failures [19][20][21].
The topological approach to failure spreading has been exploited to demonstrate that the strength of flow rerouting after link failures decays with distance to the failing link [11][12][13][14]. In particular, the so-called rerouting distance based on cycles in the network has been found to predict flow rerouting very well [11]. However, the analysis of flow rerouting still lacks a theoretical foundation. Here, we demonstrate that these observations made for flow rerouting may be understood based on a formalism * f.kaiser@fz-juelich.de † d.witthaut@fz-juelich.de originally developed to study current flows in resistor networks that uses spanning trees (STs) of the underlying graph. Moreover, the formalism explains recent results regarding the shielding against failure spreading in complex networks. This publication is structured as follows; in the first section, we give an overview over the theory of linear flow networks and present an important lemma that relates the current flows in these networks to STs. In the next section, we demonstrate the analogy between such networks and AC power grids in the DC approximation and relate the ST formulation to line outages studied in power system security analysis. Finally, we show how this formulation may be used to understand why certain connectivity features inhibit failure spreading extending on recent results [22].

II. FUNDAMENTALS OF RESISTOR NETWORKS
Resistor networks are a prime example of linear flow networks and have inspired research throughout centuries [6,7,24]. A resistor network can be described using a graph as follows; let G = (E, V ) be a connected graph with vertex set V = {v 1 , ...v N } and M edges in the edge set E. Then we assign a weight w k to each edge e k = (a, b) in the graph given by the inverse resistance w k = R −1 k between its terminal vertices a and b. If there is a potential difference v k = V a − V b between the terminal vertices of edge e k = (a, b), according to Ohm's law there is a current flow i k between the two vertices given by In order to give a direction to the current flow, we assign an arbitrary orientation to each edge in the graph that is encoded by the graph's edge-node-incidence matrix B ∈ |∆F | ≈ 1.0 · 10 −3 (a) Initial grid strengthened link The current flows and voltages are then subject to Kirchhoff 's circuit laws [7]. The first of the laws, typically referred to as Kirchhoff's current law, at an arbitrary node j ∈ V (G) reads as M e k ∈Λ(j) Here, I j ∈ R is the current injected into node j and Λ(j) ⊂ E(G) is the set of all edges the connect to node j respecting their orientation. The current law may be regarded as a continuity equation and thus states that the inflows and outflows at each node in the network have to balance with the current injections at the respective node. It may be written more compactly making use of the node-edge-incidence matrix where i = (i 1 , ..., i M ) ∈ R M is a vector of current flows and I = (I 1 , ..., I N ) ∈ R N a vector of current injections. On the other hand, we can also introduce a more compact notation for Ohm's law (1) by defining a vector of nodal voltage levels V = (V 1 , ..., V N ) ∈ R N and a diagonal matrix of edge resistances R = diag(R 1 , ..., R M ) ∈ R M ×M such that Ohm's law reads as Combining Ohm's law with Kirchhoff's current law, we arrive at the following relationship between nodal voltages V and nodal current injections I This Poisson-like equation has been analysed in different contexts [6,11,25]. Note that Kirchhoff's voltage law is automatically satisfied by virtue of equation (3), because the resulting vector of potential differences v = B T V vanishes along any closed cycle due to the duality between the graph's cycle space and its cut space [6,26]. In addition to that, the potential at one node may be chosen freely without affecting the result. The matrix connecting the two quantities is referred to as weighted graph Laplacian or Kirchhoff matrix L = BR −1 B ∈ R N ×N and characterises the underlying graph completely. It has the following entries [6] For a connected graph, this matrix has exactly one zero eigenvalue λ 1 = 0 with corresponding unit eigenvector    v 1 = 1/ √ N such that L1 = 0. For this reason, the matrix is non-invertible. This is typically overcome by making use of the graph's Moore-Penrose-pseudoinverse L † which has properties similar to the actual inverse [28].
With this formalism at hand, we can in principle now determine the current on any edge given a particular injection pattern I and edge resistances R. As a start, consider the situation where each edge has a unit resistance R = diag(1) and a unit current is injected into a particular vertex s and withdrawn at another one t such that are the unit vectors with entry one at position i and zero otherwise. In this situation, the current across any edge in the graph = (a, b) is given by the following lemma which dates back to Kirchhoff [7,18] and has been popularised by Shapiro [6,29].
Lemma 1. Put a one-ampere current between the vertices s and t of a connected, unweighted graph G such that I = e s − e t . Then the current on any other edge (a, b) is given by where N (s, a → b, t) is the number of STs that contain a path from s to t of the form s, . . . , a, b, . . . , t and N is the total number of STs of the graph.
Whereas this lemma only holds for graphs where all links have unit resistances, real-world resistor networks or other types of linear flow networks are typically weighted with non-homogeneous resistances. However, the extension to weighted networks is straightforward as summarised in the following corollary. Corollary 1. Put a one-ampere current between the vertices s and t of a connected, weighted graph G such that I = e s − e t . Then the current on any other edge (a, b) is given by where N * = T ∈T e∈T w e is the sum over the products of the weights w e of all edges e ∈ T that are part of the respective spanning tree T and T is the set of all STs in the graph. We thus assign a weight to each ST given by the product of the weights of the edges on the ST and replace the unweighted STs in Lemma 1 by weighted STs.
We will demonstrate in the following sections how this lemma and corollary may be made use of to understand how failure spreading may be mitigated in linear flow networks such as AC power grids in the DC approximation.

III. ANALOGY BETWEEN RESISTOR NETWORKS AND POWER FLOW IN ELECTRICAL GRIDS
Importantly, the theoretical framework developed in the last section may not only be applied to resistor networks. In this section, we demonstrate how these results may be used to gain insight into the mitigation of failure spreading in power grids.

A. Modelling power grids as linear flow networks
Most electric power transmission grids are made up of AC transmission lines and are as such governed by the non-linear AC power flow equations [10]. However, the real power flow over transmission lines can be simplified to a linear flow model in what is referred to as the DC approximation of the AC power flow. This approximation is based on the following assumptions: • Nodal voltages vary little.
• Transmission lines are purely inductive, i.e. their resistance is negligible compared to their reactance r x , ∀ ∈ E(G).
• Differences between nodal voltage angles ϑ n , n ∈ V (G) of neighbouring nodes n, m are small ϑ n − ϑ m 1.
Typically, these assumptions are met if the power grid is not heavily loaded [30]. As a result, the real power flow F along a transmission line e = (n, m) ∈ E(G) in the DC approximation depends linearly on the nodal voltage phase angles ϑ n of neighbouring nodes   (3) holds and we may express it using vector quantities as follows [10,11] BF = P.
Here, P = (P 1 , ..., P N ) ∈ R N is the vector of nodal power injections which thus takes the role of nodal current injections I. We summarise these equivalences in Table I.

B. Sensitivity factors in power grid security analysis
In power grids security analysis, linear sensitivity factors are used to study and prevent line overloads which would prevent the power grids from running properly [10]. One of these factors is the Power Transfer Distribution Factor (PTDF). The PTDF s,t,k then quantifies the change in flow ∆F k on line e k ∈ E(G) if a power ∆P is injected at node r and withdrawn from node s. It is calculated as In addition to this factor, one typically considers the Line Outage Distribution Factor (LODF) which measures the change in power flow on a line e m when another line e k fails [10] LODF m,k = ∆F m Here, F will now show how the ST formula presented in Lemma 1 may be used for power systems security analysis. In the language of power grids, the lemma yields the PTDF s,t,m for an edge e m = (a, b) if a unit power ∆P is injected at node r and withdrawn from node s. For this reason, the PTDF may be calculated as follows Based on Eq. (11) which yields the LODF expressed in terms of the PTDF, we can make use of this expression to derive an equivalent expression for the LODF. If e k = (r, s) is the failing link and e m = (a, b) the link where the flow changes are monitored, the expression based on Eq. (12) reads as Here, N * \{k} denotes the weight of all STs in the graph evaluated after removing the edge e k . We thus found an expression for the LODFs that is based purely on certain STs in the graph. This equation is the basis of our analysis of subgraphs inhibiting failure spreading which we will perform in the following sections. Note that a similar expression for the LODFs based on spanning 2-forests has recently been derived by Guo et al. [15].

IV. MITIGATING FAILURE SPREADING
We have seen in the last section that the spreading of failures is studied using LODFs in power systems security analysis. To prevent large flow changes on other links after the failure of a link e k which may potentially trigger dangerous cascades of failures, it is desirable for overall power system security to keep the LODFs small. A natural question to ask is thus: Can we design or alter the network topology in such a way that LODFs stay small? Based on Equation (13) expressing the LODF in terms of STs, this question may be addressed in a purely topological manner. In particular, we deduce three strategies to reduce the effect of failure spreading 1. Fixing long paths between trigger link e k and monitoring link e l leaves only few degrees of freedom which reduces the relative contribution of the numerator in Eq. (13) 2. Fixing specific paths between trigger link e k and monitoring link e l can force links of large weights to be not contained in the numerator, thus reducing its relative contribution to Eq. (13) 3. Introducing symmetric elements between parts of the network may lead to a complete balancing between the two contributions in the numerator of Eq. (13) We will address each of the strategies in the following subsections.
A. The role of the rerouting distance With Eq. (13) expressing LODFs using STs at hand it is intuitively clear that certain paths in the network should play an important role in predicting the overall effect of line outages. In particular, we can see immediately that for a given failing link e k , the numerator in Eq. (13) depends on the paths going through the link monitoring the flow changes e l whereas the denominator does not. Therefore, we expect the flow changes to be smaller on another link e m that has a longer minimum path going through e m and e k compared to link e l . This is due to the fact that reducing the number of possible path in the sum over all STs N * (r, a → b, s) effectively reduces the number of STs by fixing a certain path.
This intuitive idea is demonstrated to hold also quantitatively in Figure 2,a,d: We illustrate that the number of STs τ (G/p) scales approximately exponentially with the length of the cyclic path contained in the STs for an unweighted Erdős-Rényi (ER) random graph G(200, 300) with 300 edges and 200 vertices [31] (a) and the power flow test case 'IEEE 118' [27,32] (d). To study this scaling, we contract a cyclic path p between two arbitrarily chosen edges and quantify the number of STs using Kirchhoff's matrix tree theorem [7]. The theorem states that the number of STs in a graph may be calculated using the determinant of the graph's Laplacian matrix τ (G) = det(L u ).
Here, L u is the matrix obtained from the Laplacian matrix L of G obtained by removing row and column corresponding to an arbitrarily chosen vertex u ∈ V (G). The number of STs τ (G/p) containing a path p may be calculated by contracting the path in the graph and the Laplacian matrix and then taking the determinant of the resulting Laplacian. Taking the difference in the numerator of Eq. (13) between the path and a reversed path will in general not affect the exponential scaling since the difference of two exponentials with different exponents or different prefactors will again scale exponentially.
We may thus expect an exponential decay of LODFs with the length of fixed, cyclic paths. This result complements recent progress made in the understanding of the role played by distance for failure spreading in linear flow networks. In Ref. [11], it was shown that flow changes after a link failure are not captured well by the ordinary graph distance between the failing link and the link monitoring flow changes. Instead, a different distance measure referred to as rerouting distance captures this effect much better. It is defined as follows; Definition 1. A rerouting path from vertex r to vertex s via the edge (m, n) is a path where no vertex is visited twice. The rerouting distance between two edges (r, s) and (m, n) denoted by is the length of the shortest rerouting path from r to s via (m, n) plus the length of edge (r, s). Equivalently, it is the length of the shortest cycle crossing both edges (r, s) and (m, n). If no such path exists, the rerouting distance is defined to be ∞.
The rerouting distance defined this way is a proper distance metric. With the arguments made before at hand it is intuitively clear why the rerouting distance performs very well in predicting the effects of line outages. Indeed, we observe an exponential scaling of the LODFs for a given trigger link in the ER random graph Figure 2,b and in the test case 'IEEE 118' (e).

B. The role of strong and weak network connectivity
Our second strategy to reduce failure spreading after link failures is based on fixing specific paths in the network in such a way that they cannot contain certain links with large weights. This way, the numerator in Equation (13) does not contain the contribution of the links with large weights whereas the denominator does, thereby reducing the overall impact of the link failure. Note that in contrast to the last section, the fixed paths do not necessarily have to be long to prevent failure spreading. We will demonstrate this strategy for two cases: First, we use this reasoning to demonstrate that weakening the links between two parts of the networkthus effectively dividing it into communities -may reduce failure spreading between them. This is expected as weakly connected networks generally suppress failure spreading from one part to the other one, but this also limits the possibility of power flow between the parts. This is no longer true for the second strategy: we illustrate why also strengthening the links that separate two parts of the network horizontally reduces the impact of link failures.
The two strategies are illustrated for a simple 3 × 6 square grid in Figure 3. The failure of a link e k = (r, s) (dotted, orange) leads to different contribution of the numerator in Equation (13) if the monitoring link e = (m, n) (green) is contained in the same part (e) as compared to a different, weakly connected part (f) in an otherwise symmetrical situation. Note that the distance between monitoring link and trigger link is also the same in both, panels e and f. For a link in the same part, the numerator also contributes with STs containing only one weak link (thin line, blue shading). For a trigger link located in the other part, each ST connecting trigger has to contain at least two weak links (shaded blue). Since the contribution in the numerator is proportional to the product of all weights along the ST and the situation is otherwise symmetric, we expect a weaker LODF and thus a shielding effect if the two links are contained in different, weakly connected parts.
In panels (b) and (d), we demonstrate that strong, horizontal connections have a similar effect on failure spreading: If the monitoring link e = (m, n) is contained in the same part of the network as the trigger link e k = (r, s) (g), now separated through strong connections, spanning trees connecting the two links may contain two -or generally: all -strong links. For a trigger link in the other part of the network, the spanning tree connecting them can contain maximally one -or generally: all minus one -strong links. Again, the term in the numerator scales with the link weights contained in the spanning trees. Therefore, we expect the effect of link failures to be stronger for links located in the same part as compared to links contained in the other part which is confirmed when simulating the failure of a single link in panel (d).
C. The role of symmetry As a third strategy for reducing failure spreading, we suggest building networks in such a way that the terms in the numerator of Equation (13) balance. In this case, failure spreading reduces to zero for the respective links. In order to balance the terms in the numerator of Equation (13), we need the spanning trees passing through the monitoring link e = (a, b) in both directions to have exactly the same weight Here, T (r, m → n, s) is the set of all spanning trees containing a path of the form (r, ..., m, n, ..., s). This equality is for example fulfilled if for each tree T ∈ T (r, m → n, s) there is a counterpart T ∈ T (r, n → m, s) of the same weight. This may be accomplished by introducing certain symmetric elements, referred to as network isolators [22], into the graph as demonstrated in Figure 4: For each ST connecting trigger link e k = (r, s) and monitoring link e = (m, n) and containing a path of the form (r, ..., m, n, ..., s) (grey and blue lines) there is an ST containing a path of the form (r, ..., n, m, ..., s) (grey and red lines). If we compare the product of weights for a single tree T 0 ∈ T (r, m → n, s) and its counterpart T * 0 ∈ T (r, n → m, s), such that both contain exactly the same edges except for the edges connecting the two parts, i.e., the links marked as blue and red arrows in Figure 4, we can see that these products are equal except for the links r 1 and r 2 (red links) being contained only in T 0 , and b 1 and b 2 (blue links) being contained only in T * 0 . We can thus conclude that the above equality is fulfilled, i.e., the product of weights is equal for both trees T 0 and In this case, a failure of link e k = (r, s) does not result in any flow changes on link e = (m, n) at all. This reasoning has been generalised recently, where the concept was termed network isolators [22]. We also note that similar arguments were put forward by Guo et al [15]. On general grounds, network isolators are defined as follows [22] Lemma 2. Consider a linear flow network consisting of two parts with vertex sets V 1 and V 2 and assume that a single link in the induced subgraph G(V 1 ) fails, i.e. a link (r, s) with r, s ∈ V 1 . If the adjacency matrix of the mutual connections has unit rank rank(A 12 ) = 1, then the flows on all links in the induced subgraph G(V 2 ) are not affected by the failure, that is The subgraph corresponding to the mutual interactions is referred to as network isolator.
Note that network isolators of arbitrary size may be understood using the same reasoning as presented above for a network isolator consisting of only four links.

Sign reversal of flow changes
Based on the symmetric elements -the network isolators -introduced in the last section, we can demonstrate yet another application of the ST formulation of link failures: We can modify the grid in such a way that the LODFs and thus the flow changes change their sign. This is again based on the symmetry of LODFs in terms of the paths (r, ..., m, n, ..., s) and (r, ..., n, m, ..., s). If we apply a symmetric modification such that paths of the first form are replaced by parts of the latter one, we can reverse the sign of the resulting flow changes. In  . (a,b) Modifying the subgraph connecting two graphs from the two parallel lines to the two crossing lines leads to a sign reversal of the LODFs in the connecting subgraphs (shades of grey). This is in line with the compensatory effect of the symmetric subgraphs used to create network isolator in Figure 4. particular, if we interchange the two terms appearing in the nominator of Eq.(13= for a subset of edges, we can change the sign of the LODF for these edges N * (r, m → n, s) → N * (r, n → m, s) N * (r, n → m, s) → N * (r, m → n, s) ⇒ LODF ,k → −LODF ,k .
This can achieved using a modification similar to the one shown in Fig. 4,a: If the initial network contains the subgraph indicated by dotted, blue arrows in the centre, we can revert the sign of the LODF ,k by changing this subgraph to the one indicated by red, dotted arrows. This is demonstrated in Figure 5: Changing the subgraph in the centre connecting the two graphs from the "x"-shaped subgraph (a) to the "="-shaped subgraph (b) leads to a sign reversal of the LODFs in the second graph (shades of grey) while the magnitude of LODFs is the same in both panels. This modifications thus allows to simulatenously change the sign of all LODFs in a subgraph which may prevent overloads that are caused by flows going in a particular direction.

V. CONCLUSION
We demonstrated how a spanning tree formulation of link failures may be used to understand which topological patterns aid the mitigation of failure spreading in power grids and other types of linear flow networks. In particular, we derived and explained three strategies for reducing the effect of link failures in linear flow networks based on spanning trees. Our results offer a new understanding of previous strategies used to inhibit failure spreading in power grids and may thus help increasing power grid security.
All strategies analysed here for reducing failure spreading are based on extending -or at least not reducing -the network's ability to transport flows. This is in contrast to typical containment strategies in power grid security which are based on islanding the power grid, i.e. reducing the connectivity for the sake of security. We illustrated how to exploit the intimate connection to graph theory to find and analyse subgraphs that allow for improving both power grid resilience and efficiency at the same time.
Our results offer a new understanding on a graphtheoretical level of network structures that have been found to inhibit or enhance failure spreading. We illustrated the fruitful approach of analysing failure spreading in power grids by using spanning trees for several subgraphs but are confident that other subgraphs for enhancing or inhibiting failure spreading may be unveiled using this formalism.