## 3 Generation of Equations
### Realizability Analysis
#### 3.2.2 Algorithm  
This section introduces an algorithm that selects the appropriate control type for each dissipative edge so that the partition \(\mathsf{B}=\{\mathsf{B}_{1},\mathsf{B}_{2}\}\) satisfies Proposition 1. From Remark 3, the total number \(n_{2}\) of current-controlled edges should be exactly equal to the number of nodes \(n_{N}\). From the special structure of the incidence matrix \(\Gamma\), this in turn ensures that the potential on each node is uniquelydefined by a linear combination of the voltages \(\mathbf{v}_{2}\) (elements in \(\mathbf{a}\) associated to current-controlled edges); i.e., \(\gamma_{2}\) is invertible. Consider the current-controlled edge \(b\) from node \(i\) to node \(j\) in Figure 3. If the potential on node \(j\) is known, the remaining potential is obtained from \(e_{i}=v_{b}\pm e_{j}\), where the sign depends on the orientation. In this case, we say edge \(b\)_imposes_ the potential on node \(i\). Now, the objective is to perform this analysis globally so that \(\mathbf{e}\) is a linear combination of \(\mathbf{v}_{2}\) with \(\mathbf{e}=(\gamma_{2}^{\intercal})^{-1}\cdot\mathbf{v}_{2}\). To that end, we introduce the _realizability matrix_\(\Lambda\) defined element-wise as follows  
\[[\Lambda]_{n,b} = \left\{ \begin{array}{ll}1&\text{if branch $b$ imposes potential on node $n$,}\\ 0&\text{else,}\end{array} \right. \tag{12}\] \[\Lambda = \left( \begin{array}{c}\lambda_{0}\\ \hline\lambda_{1}\end{array} \right|_{\lambda_{2}}\right),\quad\text{with }\lambda_{0}\in\mathbb{R}^{1\times n_{B}},\; \lambda_{1}\in\mathbb{R}^{n_{N}\times n_{1}}\;\lambda_{2}\in\mathbb{R}^{n_{N} \times n_{2}}. \tag{13}\]  
Then, a given graph is realizable if the type of each resistor can be selected so that the following set of constraints is fulfilled. * The potential on each node \(n\in[1,\cdots,n_{N}]\) is uniquely defined so that \(\sum_{b=1}^{n_{B}}[\Lambda]_{n,b}=1\). * Each Current-controlled edge \(b\in[n_{1}+1,\cdots,n_{N}]\) propagates the knowledge of the potential on one node to the other, so that \(\sum_{n=1}^{n_{N}}[\Lambda]_{n,b}=1\). * No edge imposes the reference potential \(e_{0}\) so that \(\lambda_{0}=\mathbb{0}_{1\times n_{B}}\). * No voltage-controlled edge \(b\in[1,\cdots,n_{1}]\) imposes any potential so that \(\lambda_{1}=\mathbb{0}_{n_{N}\times n_{2}}\). Constraints (C1-C2) ensure that \(\gamma_{2}\) is invertible, so that \(\mathbf{e}=(\gamma_{2}^{\intercal})^{-1}\cdot\mathbf{v}_{2}\). Constraint (C3) ensures that the reference potential on datum does not contribute to the system's dynamics. Constraint (C4) ensures that inputs of voltages-controlled edges are explicitly given by a linear combination of the nodes potentials so that \(\mathbf{v}_{1}=\gamma_{1}^{\intercal}\,\mathbf{e}=(\gamma_{2}^{-1}\cdot \gamma_{1})^{\intercal}\cdot\mathbf{v}_{2}\). To build and analyze the matrix \(\Lambda\), we start from the adjacency matrix \(\mathsf{A}\) of the graph, defined as follows:  
\[[\mathsf{A}]_{b,n}=\left\{ \begin{array}{ll}1&\text{if branch $b$ is connected to node $n$,}\\ 0&\text{else.}\end{array} \right.\]  
Then the non-zero elements in \(\mathsf{A}\) are analyzed to cope with the realizability constraints (C1-C4). This yields Algorithm 1. The PHS (5) is finally recovered as discussed in the proof of Property 1. Figure 3: Definitions and orientations for a single current-controlled edge \(b\) from node \(i\) to node \(j\), with nodes potentials \(e_{i}\) and \(e_{j}\), respectively. The knowledge of the potential \(e_{j}\) is transferred to node \(i\) with \(e_{i}=v_{b}+e_{j}\). ```
Input: A graph \(G=\{N,(B_{x},B_{w},B_{y})\}\) corresponding to the interconnection of storage, dissipative, and source edges. Output: Sets of voltage-controlled edges \(B_{1}\) and current-controlled edges \(B_{2}\).