General analytical solutions for DC/AC circuit network analysis

In this work, we present novel general analytical solutions for the currents that are developed in the edges of network-like circuits when some nodes of the network act as sources/sinks of DC or AC current. We assume that Ohm's law is valid at every edge and that charge at every node is conserved (with the exception of the source/sink nodes). The resistive, capacitive, and/or inductive properties of the lines in the circuit define a complex network structure with given impedances for each edge. Our solution for the currents at each edge is derived in terms of the eigenvalues and eigenvectors of the Laplacian matrix of the network defined from the impedances. This derivation also allows us to compute the equivalent impedance between any two nodes of the circuit and relate it to currents in a closed circuit which has a single voltage generator instead of many input/output source/sink nodes. Contrary to solving Kirchhoff's equations, our derivation allows to easily calculate the redistribution of currents that occurs when the location of sources and sinks changes within the network. Finally, we show that our solutions are identical to the ones found from Circuit Theory node analysis.


I. INTRODUCTION
The currents in each edge of an electrical circuit, which is composed of linear elements (i.e., resistance, capacitance, and inductance) and where conservation of charge at each node is granted, are generally found by solving Kirchhoff's equations [1]. In particular, for resistor networks, the solution for the currents at each edge is related to random walks in graphs [2], first-passage times [3], finding shortest-paths and community structures on weighted networks [4], and network topology spectral characteristics [5,6]. Though the relationship between currents and voltage differences in network circuits with linear elements follows Ohm's law, their modelling capability is enormous. For example, it is used to model fractures in materials [7], biologically inspired transport networks [8], airplane traffic networks [9], robot path planing [10], queueing systems [11], etc.
In practice, resistor networks are used in various electronic designs, such as current or voltage dividers, current amplifiers, digital to analogue converters, etc. These devices are usually inexpensive, relatively easy to manufacture, and require little precision on the constituents. In order to solve the voltages across these networks, two methods are broadly used: nodal analysis and mesh analysis [1]. In the former, nodes are labelled arbitrarily and voltages are set by using the Kirchhoff's current equations of the system. In the later, loops are defined with an assigned current which do not contain any inner loop, then the Kirchhoff's voltage equations are solved. These constitute classic techniques of Circuit Theory.
However, nodal and mesh methods (or even transfer function methods [12]) become inefficient to recalculate the voltage drops across the network if the location of inputs and outputs changes constantly, e.g., if the cathode and/or anode of a voltage generator are moved from one node of the network to another. This switching situation is common in the modelling of the modern power-grid as an impedance network circuit or in general supplydemand networks [5][6][7][8]. An example of this case is shown in Fig. 1 for a resistor network with a single source-sink nodes. Another redistribution of currents, which is also poorly accounted by these methods, happens if a single source node and single sink node are decentralized for multiple source and/or multiple sink nodes that preserve the initial input and output magnitudes [7,13]. In any case, either of the classical Circuit Theory methods requires to be applied for each configuration of the sources and sinks in order to find the currents at every edge of the network.
In this work, we present novel general analytical solutions for current conservative DC/AC circuit networks with resistive, capacitive, and/or inductive edge characteristics. The novelty comes from expressing the currents and voltage drops in terms of the eigenvalues and eigenvectors of the admittance (namely, the inverse of the edge impedance) Laplacian matrix of the circuit network.
In order to derive our novel solutions we assume that the impedance values at every edge and the location of the source/sink nodes are known. Our solutions give the exact DC/AC currents that each edge of the circuit holds and are identical in magnitude to the ones found from nodal Circuit Theory analysis. The practicality of our solutions comes from, allowing to compute the equivalent impedance between any two nodes of the network directly [14][15][16] and allowing to easily calculate the redistribution of currents that happens when the location of sources and sinks is changed within the network (such as in the example of Fig. 1). The scientific interest of our solutions comes from, establishing a clear relationship be-tween the currents and voltages in DC/AC circuits with the topology invariants of the network, namely, its eigenvalues and eigenvectors. FIG. 1: Panel (a) shows a schematic representation of a resistor network with a single input current of I = 6 A at a source node S and a single output current of I = 6 A at a sink node T . Panel (b) shows the same resistor network but with multiple inputs I1, I2, I3 (nodes S1, S2, S3) and outputs I4, I5 (nodes T1, T2) which add to the same inflow/outflow magnitudes than in panel (a). Changing the system from panel (a) to panel (b), or vice-versa, generates a global redistribution of currents.
The approach we develop provides new analytical insight into the transmission flow problem and exhibits different features than other available solutions. Moreover, it provides a new tool to achieve the voltage/current solutions and to analyse resonant behaviour in linear circuits [17]. As a practical application, we relate these solutions to closed circuits where a voltage generator is present (instead of having open sources/sinks that feed current to the network) and solve a simple network where we can compare our solutions to the ones provided by solving directly Kirchhoff's nodal equations.

II. DC/AC CIRCUIT NETWORKS
A. The mathematical model The model we solve corresponds to a conservative circuit network with known input/output net currents and obeys Ohm's and Kirchhoff's law for conservation of charge. We assume that the input (output) net current k I sk ( k I tk ) at the source (sink) node s (t), its frequency ω (with ω = 0 for DC currents and ω > 0 for AC currents), and their phases are known. The extension to various input or output nodes is done in Appendix C.
Ohm's law linearly relates the current at an edge of the circuit with the voltage difference between the nodes that the edge connects. Specifically, where I (s,t) kl is the current passing from node k to node l given a current source located at node s and a sink node located at node t, ∆V (s,t) kl is the voltage difference, and Z kl = Z lk is the impedance of the symmetric edge. Z kl depends on the edge's resistive, capacitive, and/or inductive properties, and the network topological properties of the circuit.
The variables in Eq. (1) are complex numbers in the case of AC input/output currents and real numbers for DC currents. In general, a resonance in the kl-edge appears for a minimum of the impedance, namely, when the input/output frequency ω is tuned to a frequency related to the natural frequency of the edge line. For example, in the case that the edge is modelled by a series RLC circuit, the impedance of the edge is where ω (LC) kl = 1/L kl C kl is the natural frequency of the edge, γ (RL) kl = R kl /L kl is the dissipation of the edge, L kl is the edge's inductance, C kl is the edge's capacitance, R kl is the edge's resistance, and j = √ −1. In this case, a resonance in the kl-edge appears if ω = ω The topological properties of the network are also included in the value of the impedance of each edge. For instance, the impedance between two nodes that are not connected is assumed to be |Z kl | = ∞ because R kl = ∞ for a non-existing line. Otherwise, the impedance of two connected nodes is |Z kl | < ∞. Hence, the inverse of the impedance defines a complex valued adjacency matrix, i.e., it gives which are the edges connecting the nodes in the circuit and their weights.
Kirchhoff's law of conservation of charge states that current is conserved at every node in the circuit. In other words, the inflow equals the outflow at a node, with the exception of the source and sink nodes (the extension to multiple sources and sinks is detailed in Appendix C). Specifically, where F in (F out ) is the complex valued net current inflow (outflow) and δ ks (δ kt ) is the Kronecker delta function. By assuming local conservation of charge at every node of the circuit, we get that the total flow in the network needs to be null, namely, global conservation of charge holds: Using Eqs. (1) and (3), the model equations are which are expressed in matrix form as where G is the weighted admittance Laplacian matrix of the network [with complex entries given by is the inflow/outflow vector (with non-zero entries only at node s, F , and at node t, −F ), and V (s,t) is the voltage potential at each node of the network. Properties of the weighted Laplacian matrix G are dealt in Appendix A.

B. The analytical solutions
We are deriving two main analytical results in this work. An expression for the DC/AC currents flowing through each edge of the network (as function of the location of the source and sink nodes and the net inflow magnitude) and the equivalent impedance between any two nodes of the network. Both results are expressed in terms of the eigenvalues and eigenvectors of the Laplacian matrix G of Eq. (5), and are found from the inversion of G (see Appendix B for details on the inversion of G).
We find that after the inversion of G the voltage difference between any two nodes of the circuit is given by where λ n (G) is the complex n-th eigenvalue of Laplacian G (with n = 0, 1, . . . , N − 1 and λ 0 (G) = 0 [2]) and [ v n ] k is the corresponding n-th eigenvector k coordinate (with k = 1, . . . , N ). With the exception of F (assuming the phase difference between the net input and output flows is null, which guarantees global charge conservation), the remaining quantities are complex numbers, hence, they have an amplitude and a phase, and the ⋆ indicates complex conjugation. Thus, where α with λ n (G R ) [λ n (G I )] being the n-th eigenvalue of the real [imaginary] part of the Laplacian matrix G (details on the properties of these eigenvalues are provided in Appendix A).
Our first main analytical result is the current passing through the kl-edge, namely, where Z kl = |Z kl | e j ϕ kl , ϕ kl being the impedance phase value. This phase also corresponds to the phase difference between the voltage drop ∆V (s,t) kl between nodes k and l and the current I (s,t) kl at the kl-edge. Setting the source at node k and the sink at node l, Eq. (6) results in and the second main analytical result is derived, i.e., is the effective weight that all edges linking node k with l weigh [5,6,15], namely, the equivalent impedance. Its value is identical to the ones obtained by using Green functions [14] or Circuit Theory analysis [1]. For example, if all series and parallel impedances between nodes k and l are added, then the final value is equal to the one that is found from Eq. (11).

C. Practical examples
Here we show how to relate the solution found so far [Eq. (9)] for the currents in the edges of a network-like circuit for given input/output nodes with the currents in the edges of a closed circuit with a single voltage generator. As it is known, solutions for closed linear circuits with given boundary voltage values correspond to finding solutions of the Laplace equation without sources, which are widely known. Hence, finding a relationship between Eq. (9) with the closed circuit currents, in our case, is equivalent to finding a relationship between topological invariant properties of the network structure (impedances) with Laplace boundary problem solutions.
shows a schematic representation of a resistor network with a single input current of I = 6 A at a source node S and a single output current of I = 6 A at a sink node T . Panel (b) shows the same resistor network but with a voltage generator and a resistive line connecting nodes S and T such that the inflow (outflow) at node S (T ) equals I.
For a single source-sink problem [like the one depicted in Fig. 2(a)] to be transformed to a Laplace problem [ Fig. 2(b)], the source and sink nodes (S and T ) are plugged into a voltage generator. The known data from the source-sink problem is the fixed input net current F , which the generator will need to provide to the network circuit between nodes S and T . Hence, the voltage requirement for the generator to supply is: ǫ st = V s − V t = ρ st F , where ρ st is the equivalent resistance between the nodes S and T of the known network circuit structure [dashed square in Fig. 2(b)]. The equivalent resistance is found from [3,5,6] where λ n ( v n ) is the real n-th eigenvalue (eigenvector) of the resistor network Laplacian matrix (which is also positively defined because its entries are all real valued). Equation (12) is the resistive version of Eq. (11). Then, the corresponding identical Laplace problem to the single source-sink pair of nodes is solved for the border conditions corresponding to a voltage generator supplying a constant voltage difference ǫ st between nodes S and T of magnitude where G = {V, E} is the node and edge set which define the circuit network. Equation (13) establishes a direct relationship between solving Laplace problems in circuits with transportation problems. Consequently, this relationship increases the importance of our voltage solution in terms of the Laplacian matrix eigenvalues and eigenvectors.
As another practical example, we compare our solutions for a square-like resistor network with equal edges with the solutions found from linear Circuit Theory analysis. We index the nodes in the square as s, a, t, b in clockwise direction and the edge's resistances as R sa = R at = R sb = R bt = R. Setting an input (output) source (sink) at node s (t) with magnitude F (st) s = I (F (st) t = −I), nodal analysis gives the following results for the edge currents that this circuit system has: I sa = I sb = I/2 and I ta = I tb = −I/2. Also, the resultant equivalent resistance between nodes s and t for the square is given by In our framework, we transform the resistor network into a topological problem, i.e., we analyse the Laplacian matrix G of the network. Applying Ohm's and Kirchhoff's laws, a square-like resistor network has the following conductance matrix G [see Eq. (5)] where the first column/row corresponds to node s, then node a, node b, and finally node t. The eigenvalues of G are λ 0 = 0, λ 1 = λ 2 = 2/R, and λ 3 = 4/R, and the eigenvectors are v 0 = 1 2 (1, 1, 1, 1) T , v 1 = 1 √ 2 (0, −1, 1, 0) T , v 2 = 1 √ 2 (1, 0, 0, −1) T , and v 3 = 1 2 (−1, 1, 1, −1) T . Thus, using Eq. (6) for the edge current between nodes s and a, we have that results in where the other eigenvector modes in the sum are cancelled or have null coordinates. Similarly, the remaining edge currents are calculated and found identical to the ones from nodal analysis. Moreover, the equivalent resistance we calculate for nodes s and t using Eq. (12) is which again, is identical to the one in Eq. (14). We can extend this problem easily for the case where the square circuit has equal impedances Z = R + j ω L [1 − (ω 2 0 /ω) 2 ] in every edge, where ω 2 0 = 1/LC is the characteristic frequency of each edge and ω is the input frequency (F The inverse of the impedance (admittance) is given by where A kl = 1 if node k is connected to node l, A kl = 0 otherwise, and tan(ϕ) = L (ω 2 − ω 2 0 )/Rω. The resultant admittance Laplacian matrix in this case is with G R (G I ) being the real (imaginary) part of the entries in Eq. (18) and L the Laplacian matrix from Eq. (15). Consequently, the eigenvalues of G are simply the eigenvalues of L divided by the impedance Z and these matrices share the same eigenvectors. In this case (the square circuit with identical impedances for its edges), the AC current flowing between nodes s and a is which is the same result as in the equal resistances DC case [Eq. (16)] for the modulus because Z sa = Z. Furthermore, the analogy is further seen when calculating the equivalent impedance between the source (s) and sink (t) nodes using Eq. (11). This results in The solution is identical to the one that Circuit Theory derives and is in direct correlation with the DC problem as expected.
In more general scenarios, the relationship between the DC and AC circuit is not direct. In such situations, the complex entries of the Laplacian matrix for the AC case are not related to the DC Laplacian matrix. Hence, further assumptions need to be done to find analytical solutions. For instance, one could have to impose that the input frequency to be larger than the natural frequencies of the lines (ω > ω kl for every edge), such that the imaginary part of the Laplacian be positive semi-defined (see Appendix A).

III. CONCLUSIONS
The approach we develop provides new analytical insight into the transmission flow problem and exhibits different features than other available solutions. Moreover, it provides a new tool to achieve the voltage/current solutions and to analyse resonant behaviour in linear circuits. As a practical application, we relate these solutions to closed circuits where a voltage generator is present (instead of having open sources/sinks that feed current to the network) and solve a simple network where we can compare our solutions to the ones provided by solving directly Kirchhoff's equations. Our findings help to solve problems, where the input and output nodes change in time within the network, more effectively than classical Circuit Theory techniques.

Appendix A: Complex weighted Laplacian matrix characteristics
The weighted Laplacian matrix of the circuit network G with edge properties given by the symmetric line impedances Z kl = Z lk has the following complex value entries hence, which is the first requirement for a Laplacian matrix: the zero row sum property. The eigenspace of G is composed of a set of N complex eigenvalues λ n and eigenvectors v n with n = 0, 1, . . . , N − 1, such that G v n = λ n v n , ∀ n , thus, where P = { v 0 , v 1 , . . . , v N −1 } is a unitary matrix (I = P −1 P = P ⋆T P, I being the identity matrix) of eigenvectors and Λ is a diagonal matrix of eigenvalues (Λ kl = δ kl λ k−1 ). Due to Eq. (A2), G has a null eigenvalue (referred to as λ 0 in the following) associated to the kernel vector v 0 = 1/ √ N , where 1 = (1, . . . , 1). Using Eq. (A2), G 1 = 0 = λ 0 1. Hence, the kernel of the matrix (the space of eigenvectors associated to the null eigenvalues) is at least of dimension 1 and direct inversion of the matrix is not possible. This is the second property of a Laplacian matrix, which implies that the rank of the matrix is less than N .
The third property is that Laplacian matrices are positive semi-defined. In particular, for any column vector x, the Dirichlet sum is such that where "·" is the inner product operation and W kl = 1/Z kl is the weighted adjacency matrix of the circuit network. This inequality holds only if W kl ≥ 0 for all k and l. As a consequence, it implies that all eigenvalues are nonnegative, because x can be any of the v n eigenvectors. In that case, where the last equality is possible because of the unitary property of the eigenvectors . However, Eq. (A5) is always valid only for Laplacian matrices with non-negative real entries.
For complex entries, such as in our G, the inequality in Eq. (A5) can be analysed by splitting the matrix G into a real (G R ) and an imaginary (G I ) part, i.e., G = G R + j G I , where and Z kl = |Z kl | e j ϕ kl . The Laplacian matrix G R contains the information of the network structure resistive part and the Laplacian matrix G I contains the information of the network structure reactive part. In other words, the dissipative and the resonant structure of the circuit network, respectively. In order to have a positive (or negative) semi-defined Laplacian matrix, the weighted adjacency matrix elements need to be positive (or negative) for all pairs of nodes. For example, for the real part, if W (R) kl = cos (ϕ kl ) / |Z kl | ≥ 0, then G R is positive semi-defined. Consequently, the validity of this property depends on the magnitude of the phases that the impedance of the lines introduce. In particular, for lines that can be modelled by series RLC, the W (R) kl ≥ 0 for every kledge, hence, G R has a non-negative spectra of eigenvalues. However, in such a case, the sign of W and Equation (A8) is the verification that the eigenvector set is composed solely by linearly independent vectors. Equation (A9) is the completeness property, and it is the verification that the set is also a generating set. Hence, it conforms a basis of the linear functions that operate over the set of nodes.

Appendix B: Inversion of the Laplacian matrix and the node Voltage Potential solutions
Due to the existence of the null eigenvalue in any Laplacian matrix, the inverse is ill defined. We overcome this problem by means of a translation in Eq. (5) and the removal of the kernel from the eigenvector base. Namely, where all entries of matrix J are equal to unity (J kl = 1) and e From Eq. (A3) we know we can write the elements of the Laplacian G in terms of its complex eigenvalues and eigenvectors by where the term corresponding to n = 0 has been removed because λ 0 = 0. In a similar fashion we define the following matrix X entries Here we show that X + J/N is the inverse matrix of G + J/N . In a sense, G is a matrix with elements that represent the conductivity of the edges, whereas X represents the impedance of the edges. First, we note that J 2 = N J, hence, J 2 /N 2 = J/N . Then, we observe that G J = 0 because of the zero row sum property. Similarly, X J = 0. This is seen from, However, as Eq. (A8) holds for every eigenvector of G, in ⋆ l = 0 for every spanning eigenvector (n = 0). Finally, where, using Eq. (A8), it results in Now, observing that Eq. (A9) can be written as Consequently, we have shown that Returning to Eq. (B1), and using Eq. (B6), we obtain the voltage potentials at each node where we use that X e (st) = 0 and J e (st) = N e (st) . If global conservation of charge is granted, namely, if the input current equals the output current in phase and magnitude, then, J F (st) = 0. Otherwise, J F (st) is a vector with all the elements equal to the magnitude and/or phase difference between the input and output net currents [see Eq. (3)]. We note that the role of e (st) in Eq. (B7) is to add an arbitrary constant to the node voltage potential. This is easily interpreted as the arbitrary energy reference point. Such arbitrary value is eliminated once voltage differences are calculated. Moreover, voltage differences eliminate also the possible constant value given by J F (st) . Consequently, the voltage difference between two arbitrary nodes k and l in the network is given by Appendix C: Many input/output flows and the relationship to voltage generators In order to analyse how Eq. (B8) changes when many sources and sinks are present, we need to rewrite Eq. (3) to include the new sources of inflow and sinks of outflow. Thus, in general, the net current at a node is where V s (V t ) is the set of nodes that act as sources (sinks) and a s (b s ) is the fraction of the total inflow (outflow) F that goes through node s ∈ V s (t ∈ V t ), namely, s∈Vs a s = 1 ( t∈Vt b t = 1). Consequently, global conservation of charge is granted. Substituting Eq. (C1) into Eq. (B8), the voltage difference between nodes k and l in the circuit network with multiple sources and sinks is . 3: Panel (a) shows a schematic representation of a resistor network with many input I1, I2, I3 (nodes S1, S2, S3) and output I4, I5 (nodes T1, T2) currents. Panel (b) shows the same resistor network but as a closed system containing a voltage generator and new resistors. These supply the input (output) currents at nodes S1, S2, S3 (T1, T2) via the new resistors (R1, R2, . . .) with an identical magnitude as in Panel (a).
When multiple sources and sinks exist [e.g., panel (a) in Fig. 3], then the transformation of the problem to a closed circuit problem requires the inclusion of a single super source S node and super sink node T need to be created [panel (b)]. All original source (sink) nodes are then connected to the new super source (sink) node that pro-vides the total input (output) that the multiple sources (sinks) were feeding (consuming) in the original system G, namely, I (−I). Consequently, the multiple source-sink configuration in G is transformed into a single S-T pair configuration of a new networkG that has 2 nodes more than the original network G. In such conditions, the former process enables to analyse the new network setting by means of a single generator that connects these two new nodes. In other words, once a super source S (sink T ) that connects to all the original sources S i ∈ V s ⊂ V (sinks T j ∈ V t ⊂ V) is defined, then a Laplace problem can be defined by setting a voltage generator which providesǫ where the equivalent resistance ρ ST G between the super source and super sink is unknown. This is because the impedance (resistance) values for the new edge connections between the multiple sources S i (sinks T j ) to the super source [which have to be set such that the current entering the network circuit through the old multiple sources (sinks) is identical to the one the particular source (sink) supplies (consumes), e.g., as in panel (b) of Fig. 3] are unknown. In order to determine the impedances (resistances) of the edges connecting the super source (sink) to the multiple source (sink) nodes, we observe that: where neither the voltages nor the resistances are known. Nevertheless, the voltages of the super nodes fulfil Eq. (C3), thus, arbitrarily setting the unknown resistances for the new edges to unity, ρ ST (G ⋆ ) can be derived and the node voltages for each of the multiple sources and sinks calculated. That is,