## 2 Matricial Power-Flow Formulation  
The classical backward-forward power-flow method was developed using the concept of iterative sweeps, which achieves the following [30]:  
* Calculates the total current demands at all the loads with assumed known voltages. * Determines all the currents that flow in all the branches of the network by applying the first Kirchhoff's law at each node. * Calculates the voltage drops by starting from the source and using an ordering stage that defines the layers at which nodes are located. * Updates the voltage profile in all the demand nodes and repeats all the stages until the convergence tolerance is reached. This structure of the backward-forward method has two main disadvantages: (i) It can only handle radial grid configurations, and (ii) it requires nodal ordering in layers [20]. However, to address these problems, it is possible to reformulate a power-flow problem using branch-to-nodal incidence matrices [18]. **Definition 1** (Branch-to-node incidence matrix \(\mathcal{A}\)). : _An electrical network that is represented by a connected graph with \(b\) links and \(n\) vertices can be represented by a rectangular matrix \(\mathcal{A}\in\mathbb{R}^{b\times n}\) by assuming arbitrary directions in the current flow through the lines as follows:_  
* \(\mathcal{A}_{i,j}=1\) _if the line_ \(i\) _is connected to the node_ \(j\) _and its current leaves from this node._
* \(\mathcal{A}_{i,j}=-1\) _if the line_ \(i\) _is connected to the node_ \(j\) _and its current arrives at this node._
* \(\mathcal{A}_{i,j}=0\) _if the line_ \(i\) _is not connected to the node_ \(j\)To exemplify the structure of the branch-to-node incidence matrix \(\mathcal{A}\), let us consider the electrical network depicted in Figure 1. This grid comprises six links (branches) and five nodes. The names of the lines are listed in Table 1.  
On considering the branch information reported in Table 1 and the electrical-grid configuration depicted in Figure 1, the branch-to-node matrix \(\mathcal{A}\) can take the following form:  
\[\mathcal{A}= \begin{bmatrix}1&-1&0&0&0\\ 1&0&-1&0&0\\ 0&1&0&-1&0\\ 0&0&1&-1&0\\ 0&0&1&0&-1\\ 0&0&0&1&-1\end{bmatrix}  \tag{1}\]  
It should be noted that this matrix can be split into two sub-matrices that are related to the slack source and the rest of the nodes as follows (This is made possible by assuming the slack node is located at node 1. ):  
\[\mathcal{A}=\left[\mathcal{A}_{s}\ \mathcal{A}_{d}\right], \tag{2}\]  
where \(\mathcal{A}_{s}\) is the first column of \(\mathcal{A}\) (slack node), and \(\mathcal{A}_{d}\) corresponds to the rest of the columns in \(\mathcal{A}\), i.e., the demand nodes. Now, let us define the voltage drop at line \(i\) as \(\mathbf{E}_{i}\) and the voltages at its terminals as \(\mathbf{V}_{j}\). Then, from Figure 1, we know that  
\[\mathbf{E}_{1} =\mathbf{V}_{1}-\mathbf{V}_{2},\] \[\mathbf{E}_{2} =\mathbf{V}_{1}-\mathbf{V}_{3},\] \[\mathbf{E}_{3} =\mathbf{V}_{2}-\mathbf{V}_{3},\] \[\mathbf{E}_{4} =\mathbf{V}_{2}-\mathbf{V}_{4},\] \[\mathbf{E}_{5} =\mathbf{V}_{3}-\mathbf{V}_{4},\] \[\mathbf{E}_{6} =\mathbf{V}_{4}-\mathbf{V}_{5},\]  
which can be rewritten using (1) and (2) as presented below:  
\[\mathbf{E}=\mathcal{A}_{s}\mathbf{V}_{s}+\mathcal{A}_{d}\mathbf{V}_{d}, \tag{3}\]  
Figure 1: Example of a connected electrical grid. \begin{table}
\begin{tabular}{c c c} \hline \hline
**Branch Number \(i\)** & **Send Node \(j\)** & **Receiving Node \(k\)** \\ \hline \(1\) & \(1\) & \(2\) \\ \(2\) & \(1\) & \(3\) \\ \(3\) & \(2\) & \(4\) \\ \(4\) & \(3\) & \(4\) \\ \(5\) & \(3\) & \(5\) \\ \(6\) & \(4\) & \(5\) \\ \hline \hline \end{tabular}
\end{table} 
Table 1: Node connections. where \(\mathbf{V}_{s}=\mathbf{V}_{1}\), \(\mathbf{E}\) is a vector that comprises all the voltage drops, and \(\mathbf{V}_{d}\) is a vector that comprises all the voltages in the demand nodes.