Topology Reconstruction of a Resistor Network with Limited Boundary Measurements: An Optimization Approach
Extracted source text · arXiv 2412.02315
% autosam.tex
% Annotated sample file for the preparation of LaTeX files
% for the final versions of papers submitted to or accepted for
% publication in AUTOMATICA.
% See also the Information for Authors.
% Make sure that the zip file that you send contains all the
% files, including the files for the figures and the bib file.
% Output produced with the elsart style file does not imitate the
% AUTOMATICA style. The style file is generic for all Elsevier
% journals and the output is laid out for easy copy editing. The
% final document is produced from the source file in the
% AUTOMATICA style at Elsevier.
% You may use the style file autart.cls to obtain a two-column
% document (see below) that more or less imitates the printed
% Automatica style. This may helpful to improve the formatting
% of the equations, tables and figures, and also serves to check
% whether the paper satisfies the length requirements.
% Please note: Authors must not create their own macros.
% For further information regarding the preparation of LaTeX files
% for Elsevier, please refer to the "Full Instructions to Authors"
% from Elsevier's anonymous ftp server on ftp.elsevier.nl in the
% directory pub/styles, or frosm the internet (CTAN sites) on
% ftp.shsu.edu, ftp.dante.de and ftp.tex.ac.uk in the directory
% tex-archive/macros/latex/contrib/supported/elsevier.
%\documentclass[11pt,twocolumn]{elsarticle} % The use of LaTeX2e is preferred.
%\documentclass[twocolumn]{autart}
\documentclass[final,5p,twocolumn]{elsarticle}
\journal{...}
%\setcitestyle{square}
%\usepackage{cite}
\usepackage{amsmath,amssymb}
%\usepackage{stackengine}
\usepackage{MnSymbol}
\usepackage{verbatim}
\usepackage{algpseudocode}
\usepackage{algorithm}
\usepackage{algorithmicx}
%\usepackage{outlines}
\usepackage{physics}
\usepackage {optidef}
\usepackage{subcaption}
\usepackage{bm}
\usepackage{hyperref}
\hypersetup{
colorlinks=true,
linkcolor=blue,
filecolor=magenta,
urlcolor=cyan,
pdftitle={Overleaf Example},
pdfpagemode=FullScreen,
}
\newtheorem{thm}{Theorem}
\newtheorem{cor}[thm]{Corollary}
\newtheorem{lem}{Lemma}
\newtheorem{claim}[thm]{Claim}
\newtheorem{axiom}[thm]{Axiom}
\newtheorem{conj}[thm]{Conjecture}
\newtheorem{fact}[thm]{Fact}
\newtheorem{hypo}[thm]{Hypothesis}
\newtheorem{assum}[thm]{Assumption}
\newtheorem{prop}[thm]{Proposition}
\newtheorem{crit}[thm]{Criterion}
\newtheorem{defn}[thm]{Definition}
\newtheorem{exmp}[thm]{Example}
\newtheorem{rem}[thm]{Remark}
\newtheorem{prob}[thm]{Problem}
\newtheorem{prin}[thm]{Principle}
\newtheorem{proof}{Proof}
\usepackage{caption}
\usepackage{graphicx}
\usepackage{xcolor}
\usepackage[inline]{enumitem}
\usepackage{float}
%\usepackage{subfig}
\usepackage{subfloat}
%\usepackage{subcaption}
%\usepackage{amsfonts}
\begin{document}
\begin{frontmatter}
\title{Topology Reconstruction of a Resistor Network with Limited Boundary Measurements: An Optimization Approach}
\author[Paestum]{Shivanagouda Biradar}\ead{eez198372@ee.iitd.ac.in} % Add the
\author[Paestum]{Deepak U Patil}\ead{deepakpatil@ee.iitd.ac.in}
\address[Paestum]{Indian Institute of Technology Delhi, India}
\begin{keyword}
topology reconstruction; graph; optimization; resistance distance.
\end{keyword}
\begin{abstract}
A problem of reconstruction of the topology and the respective edge resistance values of an unknown circular planar passive resistive network using limitedly available resistance distance measurements is considered. We develop a multistage topology reconstruction method, assuming that the number of boundary and interior nodes, the maximum and minimum edge conductance, and the Kirchhoff index are known apriori. First, a maximal circular planar electrical network consisting of edges with resistors and switches is constructed; no interior nodes are considered. A sparse difference in convex program $\mathbf{\Pi}_1$ accompanied by round down algorithm is posed to determine the switch positions. The solution gives us a topology that is then utilized to develop a heuristic method to place the interior nodes. The heuristic method consists of reformulating $\mathbf{\Pi}_1$ as a difference of convex program $\mathbf{\Pi}_2$ with relaxed edge weight constraints and the quadratic cost. The interior node placement thus obtained may lead to a non-planar topology. We then use the modified Auslander, Parter, and Goldstein algorithm to obtain a set of planar network topologies and re-optimize the edge weights by solving $\mathbf{\Pi}_3$ for each topology. Optimization problems posed are difference of convex programming problem, as a consequence of constraints triangle inequality and the Kalmansons inequality. A numerical example is used to demonstrate the proposed method.
\end{abstract}
\end{frontmatter}
\section{Introduction}\label{sec:introduction}
Electrical networks are ubiquitous in daily life. Mechanical systems \cite{akbaba2022electric}, biological systems \cite{gomez2012modeling}, water distribution system \cite{veldman2015towards}, geological system \cite{jirkuu2019resistor}, and many fields use electrical networks to model the system and simplify analysis. In particular, resistor networks hold an important place in modeling different physical systems, such as modeling fractures in crystalline rocks \cite{jirkuu2019resistor}, the electrical resistivity of carbon composites \cite{lundstrom2022resistor}, soft robotics sensor arrays \cite{zhao2023measuring}, modeling graphene sheets and carbon nanotubes \cite{cheianov2007random}, Mott spiking neurons \cite{rocco2022exponential}, fluid transport networks \cite{zhu2006network} \& phylogenetic networks \cite{forcey2020phylogenetic} . In most practical cases, the network structure is often unavailable for analysis.\\
\indent Two main objectives considered in electrical network topology reconstruction are $i)$ to determine the structure and, $ii)$ to estimate the edge conductances of an unknown electrical network using available boundary measurements. Topology reconstruction of a resistor network is difficult to solve \cite{dorfler2012kron} because of the static nature of the network and the non-availability of boundary and interior measurements. In \cite{curtis1994finding} authors consider a class of circular resistor networks represented as $C(m,n)$, where $m$ is the number of circles placed one inside another, and $n$ is the number of rays emerging from $n$ boundary nodes placed on outermost circle. This structure is assumed to be known. It is also assumed that all the boundary terminals are available for measurements. Then using the response matrix and the boundary measurement computes the edge resistance values. In \cite{curtis1990determining} authors present an algorithm to compute the edge resistance of a general rectangular network, whose structure is assumed to be known; all the boundary nodes are assumed to be available for measurement. A gamma harmonic function (based on Kirchhoff's law) is defined on the rectangular resistor network to compute the edges resistances. However, the network structure is seldom known to us, and in many practical cases, not all boundary terminals are available for collecting measurements. For example, in a soft resistive sensor array network, no structural information is known apriori, and only some boundary terminals are available for collecting measurements. In such practical cases, only limited boundary measurements are available, with no information on the interior nodes and the network structure. In monograph \cite{curtis2000inverse}, the authors solve the resistor network reconstruction problem for a particular class of networks that are well-connected, critical, circular, and planar, assuming that all the boundary terminals are available for measurements. The problem is solved by computing all possible disjoint paths in an unknown network. Disjoint paths are computed using non-negative circular minors of the response matrix. These disjoint paths are then used to construct a medial graph that identifies the positions of the interior nodes. The authors then reconstruct an unknown resistive network using this information and the response matrix. However, the response matrix is not always fully known since only some nodes/terminals are available for gathering information. In addition, the assumption of the network being critical and well-connected is highly restrictive. A similar problem of network topology reconstruction has been studied widely in phylogenetics, wherein genetic distance measure, akin to resistance distance, is used to reconstruct the phylogenetic network\cite{forcey2020phylogenetic}. It is assumed that the response matrix is known. A work in \cite{ghosh2008minimizing} proposes a method based on convex optimization to allocate the edge weights of the graph based on the total resistance distance; it is assumed that the structure of the graph is known.\\
\indent The topology reconstruction problem is also prevalent in power systems and is being explored by many researchers. The aim here is to identify the admittance matrix of the distribution network using the current and voltage measurements at various nodes at appropriate time instants. The admittance matrix gives full information on the network structure. Since the distribution network has a radial (tree) structure, identification becomes tractable. The paper \cite{moffat2019unsupervised} uses this fact, assuming that only some nodes are measurable, and estimates the admittance matrix using least squares and complex recursive grouping algorithm. \cite{soumalas2017data} also uses this fact and estimates the admittance matrix. The topology reconstruction problem is also extensively studied in interconnected dynamical network systems, where, using time series input/output data and knowledge of the structure of the model, interconnections between dynamical networks are identified, as done in \cite{van2021topology}, \cite{nabi2012network}, \cite{sanandaji2011exact} and \cite{materassi2012problem}. \\
\indent In one of our previous works \cite{biradar2023topology}, we present a reconstruction algorithm for a general circular planar resistor network with no assumption on network structure. We assume that the response matrix is known and that no information about the interior node is available. The algorithm uses the \emph{Gr\"{o}bner basis}\cite{cox1994ideals} to construct the \emph{set of all electrical networks that meet the given response matrix}. In our work in \cite{biradar2022topology}, we consider the problem of reconstructing an unknown resistive network consisting of only $1\Omega$ edge resistance, using the \emph{partially available} resistance distance measurements. We also characterize a set of resistive networks that meet the partially available boundary measurements.\\
\indent In this paper, we consider a general unknown circular planar passive resistive $\left(\operatorname{CPPR}\right)$ network which is to be reconstructed. We consider that some of the boundary nodes, and all interior nodes are not available for measurements. We assume that the network is circular \& planar, the number of boundary and interior nodes, the maximum and minimum edge conductance and the Kirchhoff index are known a priori, no simplifying assumptions on the underlying network structure are assumed a priori. The topology reconstruction process is split into four stages;
\begin{enumerate}
\item {\textbf{Stage 1- Network Initialization:}} There is no information on the network topology to start with; therefore, to construct an initial network we start by building a network composed of resistors and switches. To build such a network, we first construct a maximal planar graph on the boundary nodes, then replace each edge with a network of resistors and switches. The switch positions $\left(\mbox{on or off}\right)$ decide the edge resistance. Now, the problem is to determine a combination of switch positions such that the resultant network closely satisfies the available resistance distance measurements and the Kirchhoffs index. This problem is formulated as a sparse difference of convex programming problem $\mathbf{\Pi}_1$, with quadratic cost and the round down algorithm. The round down algorithm induces sparsity. Solution to $\mathbf{\Pi}_1$ is an initial network $\Gamma_{aux}$. \\
This stage does not consider interior nodes. The placement of interior nodes in an initial network $\Gamma_{aux}$ is done in \textbf{Stage 2}.
\item \textbf{{Stage 2- Placement of Interior Nodes:}} In this stage, we develop a heuristic method to place $n_i$ interior nodes in an initial network $\Gamma_{aux}$. The heuristic method involves solving an optimization problem $\mathbf{\Pi}_2$ to identify the location of some of the $n_i$ interior nodes on the edges. The remaining interior nodes are classified as dangling nodes $\left( \mbox{no edges are incident to these nodes} \right)$. $\mathbf{\Pi}_2$ is reformulation of problem $\mathbf{\Pi}_1$ with relaxed constraints on edge conductances.
\item \textbf{{Stage 3- Constructing Planar Networks:}} Once the interior nodes are placed in $\Gamma_{aux}$ appropriately, the connections among interior nodes and, between the interior nodes and the boundary nodes are not known in the network. Therefore, initially, we connect interior nodes to every other node, to account for possible internal connections in the unknown network. Let such a network be called as $\hat{\Gamma}$. These interconnections may render the resultant network $\hat{\Gamma}$ non-planar. Therefore, constructing a set of planar networks from a non-planar network is essential. In this stage, we present a modified Auslander, Parter, and Goldstein algorithm that constructs a set of planar networks out of a non-planar network.
\item \textbf{{Stage 4- Edge Weight Assignment:}} Finally, the edge weights in the constructed planar networks are assigned by solving a optimization problem $\mathbf{\Pi}_3$, similar to $\mathbf{\Pi}_2$, such that the available resistance distance measurements and Kirchhoff's index are satisfied. We then choose an appropriate network from a set of planar network that closely satisfy the available resistance distance measurements and Kirchhoff's index, which is a reconstructed $\operatorname{CPPR}$ network.
\end{enumerate}
\subsection{Contributions}
\begin{enumerate}
\item In contrast to other works\cite{forcey2020phylogenetic},\cite{curtis2000inverse},\cite{biradar2022topology},\cite{ghosh2008minimizing},
\begin{enumerate*}
\item we assume that the available measurements are limited,
\item we consider the presence of interior nodes in the circuit that are inaccessible for experiments,
\item more importantly, we only assume the network structure is circular \& planar, and make no simplifying assumptions on the structure of underlying graph corresponding to an unknown network.
\end{enumerate*}
\item The difference of convex programming problems has been formulated to reconstruct an unknown $\left(\operatorname{CPPR}\right)$ network. The formulation consists of the quadratic cost with two constraints, i.e., the triangle and Kalmanson inequality defined on the resistance distances. The constraints induce a difference of convex programming problem.
\item In the proposed algorithm, a novel approach is adopted to construct an initial network as mentioned in \textbf{Stage 1}. We show that selecting an appropriate combination of switch positions based on resistance distances and the Kirchhoff index is a difference of convex programming problem. We also provide a way to generate an initial guess which is used in solver for optimization formulation. \\
For placing interior nodes, a heuristic method has been developed, which classifies some interior nodes as dangling nodes and others as non-dangling nodes. This involves solving a similar difference of convex programming problem.
\item We propose a modified Auslander, Parter, and Goldstein's planarity testing algorithm \cite{hopcroft1974efficient} to generate a set of planar electrical networks from a non-planar electrical network.
\end{enumerate}
\subsection{Mathematical Notations}
Let $S_1=\{a_1, a_2, \ldots, a_s\}$ be row indices, $S_2=\{b_1, b_2, \ldots, b_s\}$ be column indices, and let $M \in \mathbf{R}^{n \times n}$ be any arbitrary matrix, $M\left(S_1;S_2\right)$ be a submatrix formed from the set of row indices $S_1$ and the set of column indices $S_2$. $|\cdot|$ is the cardinality of the set. $\mathbf{R}^+$ is the set of positive real numbers and $\mathbf{Z}^+_{\le n}$ is the set of positive natural numbers up to value $n$. $\odot$ represents element wise multiplication. $\textbf{1}$ and $\textbf{0}$ is a vector of ones and zeros of appropriate dimension. $\mathcal{S}_m$ is a set of symmetric matrix of order $m$. $r^d_{i,j}$ is the resistance distance between nodes $i$ and $j$ and $r(ij)$ is the edge resistance of edge $ij$ in a network.
\section{Problem Formulation}
Consider a $CPPR$ electrical network $\Gamma=(\mathcal{G},\gamma)$. A finite, simple, connected circular planar graph $\mathcal{G}=\left(\mathcal{V},\mathcal{E}\right)$, is a graph embedded in a disc $D$ on the plane bounded by a circle $C$ as shown in Fig.\ref{fig1:unkplanegrap}. The set $\mathcal{V}$ is the set of nodes and the set $\mathcal{E} \subseteq \mathcal{V} \times \mathcal{V}$ is the set of edges. The nodes are of two categories, namely, boundary nodes which lie on circle $C$, and the interior nodes which lie in the disc $D$ as shown in Fig.\ref{fig1:unkplanegrap}. Thus, $\mathcal{V}=\mathcal{V_B} \bigcup \mathcal{V_I}$ with $\mathcal{V_B}$ as the set of boundary nodes and $\mathcal{V_I}$ as the set of interior nodes, respectively. The number of boundary nodes $|\mathcal{V_B}|=n_b$ and the number of interior nodes $|\mathcal{V_I}|=n_i$ are assumed to be known. Label the boundary nodes $\mathcal{V}_B$ from $1$ to $n_b$, in clockwise circular order around $C$ as shown in Fig.\ref{fig1:unkplanegrap}.
\begin{figure}[h]
\centering
\includegraphics[scale=0.3]{Draw1.jpg}
\caption{Unknown circular planar graph $\mathcal{G}$.}
\label{fig1:unkplanegrap}
\end{figure}
Let $\mathcal{A}$ be the set of boundary nodes available for voltage and current measurements. Then, the set of all nodes that are not available is $\mathcal{U}=\mathcal{V}\large\setminus \mathcal{A}$. Denote by $\mathcal{U_B}\subseteq \mathcal{U}$ the set of boundary nodes not available for the measurements.\\
The conductivity function $\gamma:\mathcal{E}\rightarrow \mathbf{R}^+$, assigns to each edge $\sigma \in \mathcal{E}$, a positive real number $\gamma(\sigma)$, known as the conductance of $\sigma$. The resistance of the edge $\sigma$ then is $r(\sigma)=\gamma{(\sigma)}^{-1}$, $\forall \sigma \in \mathcal{E}$. Let $\gamma_{max}:=\max \{\gamma(\sigma):\forall \sigma \in \mathcal{E} \}$ and $\gamma_{min}:=\min \{\gamma(\sigma):\forall \sigma \in \mathcal{E} \}$. The \emph{resistance distance}, $r^d_{i,j}$, between any two nodes $i,j \in \mathcal{V}$, is the effective resistance measured across nodes $i$ and $j$. Let $\textbf{R}_{\Gamma} \in \mathbf{R}^{m \times m}$, where $m=n_b+n_i$, be the resistance distance matrix with entries $R_\Gamma\left(i,j\right)=R_\Gamma\left(j,i\right)=r^d_{i,j} \, \mbox{and} \, R_\Gamma\left(i,i\right)=0\,\forall i,j \in \mathcal{V}$. A quantity related to the resistance distance is the so-called \emph{Kirchhoff's index}, which is the sum of the effective resistances across all pairs of nodes, \begin{equation}\label{eqn:kirchhoffindex}
K_{\Gamma}:=\frac{1}{2}\mathbf{1}^T
\textbf{R}_\Gamma \mathbf{1}= \sum\limits_{s < t}r^d_{s,t}.
\end{equation}
Since the network is passive with no internal sources, the resistance distance between any two available boundary nodes is obtained by applying a known voltage across them and measuring the current induced at the node. The resistance distance then is simply the ratio of the applied voltage to the induced current. For the nodes available in $\mathcal{A}$, measure the resistance distances. Denote the set of measured resistance distances by $r^d=\left\{r^d_{s,t}=\phi_{st}/i_s:\forall s,t \in \mathcal{A}\right\}$. Thus, we know a submatrix of the resistance distance matrix $\textbf{R}_{\Gamma}$ which is $\textbf{R}_\Gamma\left(\mathcal{A};\mathcal{A}\right)$ with entries taken from $r^d$.
\begin{prob}\label{prob1}
Let the Kirchhoff's index $K_{\Gamma}$, $n_b$, $n_i$, $\gamma_{max}$ and $\gamma_{min}$, be known. Further, let $\textbf{R}_\Gamma\left(\mathcal{A};\mathcal{A}\right)$ is available from measurements. Then,
\begin{enumerate}
\item Estimate the resistance distance matrix $\textbf{R}_{\Gamma}$ corresponding to unknown $\Gamma$.
\item Construct the topology using the estimated $\textbf{R}_{\Gamma}$ and compute the edge weights $\gamma(\sigma), \forall \sigma \in \mathcal{E}$, of $\mathcal{G}$.
\end{enumerate}
\end{prob}
\noindent To solve the problem \ref{prob1}, we first exploit the relationship between the resistance distance matrix and the Laplacian matrix to recover the topology. Furthermore, several properties of the resistance distance are also used to formulate an intermediate optimization problem that allows us to construct $\textbf{R}_{\Gamma}$ from $\textbf{R}_\Gamma\left(\mathcal{A};\mathcal{A}\right)$ . \\
A detailed multistage topology reconstruction process is explained from section \ref{sec:initalnetwork} onwards. Before this, we briefly explain the relation between the resistance distance and the Laplacian matrix, and the properties of the resistance distances.
\subsection{Laplacian and Resistance Distance Matrix}
The Laplacian matrix $\mathcal{L}$ corresponding to any graph ${\mathcal{G}}$ is a symmetric $n\times n$ matrix $\mathcal{L}\left({\mathcal{G}}\right)$, defined as follows: \\
\begin{equation}\label{lap_def}
\left[\mathcal{L}\left(\mathcal{G}\right)\right]_{ij}=\left[\mathcal{L}_{ij}\right]\left\{
\begin{array}{ll}
= -\gamma\left(ij\right), & \mbox{if $ij\in \mathcal{E}$},\\\\
= \sum\limits_{j\in \mathcal{N}\left( i \right)}{{\gamma\left(ij\right)}}, & \mbox{if $i=j$},\\\\
=0, & \mbox{otherwise}.
\end{array}
\right.
\end{equation}
It is shown in \cite{ghosh2008minimizing}, \cite{christiano2011electrical} that the resistance distance is related to the Laplacian matrix as follows:
\begin{equation}
r^d_{i,j} =\left[\mathcal{L}{\left( {\mathcal{G}} \right)^ \dagger }\right]_{ii} + \left[\mathcal{L}{\left( {\mathcal{G}} \right)^ \dagger }\right]_{jj} - 2\left[\mathcal{L}{\left( {\mathcal{G}} \right)^ \dagger }\right]_{ij}
\label{eqn:RDdef}
\end{equation}
where, $\mathcal{L(G)}^\dagger=\left(\mathcal{L(G)} + \frac{1}{n} \textbf{J}\right)^{-1}-\frac{1}{n}\textbf{J}$, $\textbf{J}=\mathbf{1}\mathbf{1}^T$, and $\mathbf{1}$ is vector of ones.
Using equation \eqref{eqn:RDdef}, we express $R_\Gamma$ as,
\begin{equation}
\textbf{R}_\Gamma = \textbf{J}\mbox{diag}\left(\mathcal{L(G)}^\dagger\right)+\mbox{diag}\left(\mathcal{L(G)}^\dagger\right) \textbf{J} - 2\mathcal{L\left(G\right)}^\dagger.
\end{equation} Further, let $\textbf{X}=\left(\mathcal{L(G)} + \frac{1}{n} \textbf{J}\right)^{-1}$ and $\bar{\textbf{X}}=\mbox{diag}\left(\mathcal{L(G)}^\dagger\right).$
Then \begin{equation}\label{eqn:resis_equa}
\textbf{R}_\Gamma = \textbf{J}\bar{\textbf{X}} + \bar{\textbf{X}}\textbf{J} - 2\textbf{X}.
\end{equation}
For more detailed exposition on resistance distance, refer to \cite{ghosh2008minimizing}, \cite{christiano2011electrical}.
\begin{comment}
\textcolor{red} {We know a submatrix of the resistance distance matrix $R_{\Gamma}$ which is $R_\Gamma\left(\mathcal{A};\mathcal{A}\right)$ with entries taken from $r^d$. The submatrix $R_{\Gamma}(\mathcal{A};\mathcal{A})$ is extracted from $R_{\Gamma}$ through the matrix $\mathcal{Q}$ as follows.
%through a linear transformation $\mathcal{Q}:R_\Gamma \rightarrow R_\Gamma\left(\mathcal{A};\mathcal{A}\right)$ defined as follows:
\begin{equation}
R_\Gamma\left(\mathcal{A};\mathcal{A}\right):=\mathcal{Q}R_\Gamma\mathcal{Q}^T.
\end{equation} }
\end{comment}
\subsection{Triangle Inequality \& Kalmanson's Inequality}
The triangle and Kalmansons inequality forms two important constraints to determine unknown entries of the resistance distance matrix in our work.\\
The resistance distances in a $\operatorname{CPPR}$ satisfies the triangle inequality\cite{choi2019resistance}, which is elucidated in Theorem \ref{lem:triineq}.
\begin{thm}\label{lem:triineq}\cite{choi2019resistance}
For any three distinct \textbf{boundary nodes} $i,j,k$ in CPPR $\Gamma$ such that $1\le i < j < k \le n_b$, the resistance distances $r_{i,j}^d$, $r_{j,k}^d$ and $r_{i,k}^d$ satisfies,
\begin{equation*}\label{triineq}
r_{i,k}^d \le r_{i,j}^d+r_{j,k}^d.
\end{equation*}
\end{thm}
For enforcing the triangle inequality constraints, we choose node indices $i,j,k$ such that atleast one node is from $\mathcal{U_B}$ and other nodes from $\mathcal{A}$,
then define a set $\Delta = \left\{
\left( {r_{i,j}^d + r_{j,k}^d} \right) - r_{i,k}^d: i,j,k\, \mbox{is chosen as explained above}
\right\}$
then, all elements of this set must be non-negative and we denote this constraint by $\Delta \succeq 0$. Next, we discuss another important property of resistance distances for a CPPR electrical network, viz. \emph{the Kalmansons property}.
\begin{thm} \cite{forcey2020phylogenetic}
For any four \textbf{boundary nodes} $i,j,k,l$ of CPPR $\Gamma$, satisfying $1 \le i<j<k<l \le n_b$, the resistance distances $r^d_{i,j}, r^d_{k,l}, r^d_{i,k}, r^d_{j,l}, r^d_{j,k}, \mbox{ and }r^d_{i,l}$ satisfy,
\begin{equation}
\begin{array}{l}
{r^d_{i,k}} + {r^d_{j,l}} \ge {r^d_{i,j}} + {r^d_{k,l}} \, and \,
{r^d_{i,k}} + {r^d_{j,l}} \ge {r^d_{j,k}} + {r^d_{i,l}}.
\end{array}
\end{equation}
\end{thm}
\noindent For enforcing the Kalmansons inequalities as constraints, we first select from valid boundary node indices say $i,j,k,l \in \{a,b,c,d:1 \le i<a<b<c<d \le n_b\}$ atleast one boundary node index from $\mathcal{U_B}$ and remaining boundary node indices from $\mathcal{A}$. Then, impose following Kalmansons inequalities,
\begin{equation}\label{kalman_resist}
\begin{array}{l}
({r^d_{i,k}} + {r^d_{j,l}}) - \left( {{r^d_{i,j}} + {r^d_{k,l}}} \right) \ge 0,\\
({r^d_{i,k}} + {r^d_{j,l}}) - \left( {{r^d_{j,k}} + {r^d_{i,l}}} \right) \ge 0.
\end{array}
\end{equation}
We collect all such Kalmansons inequality constraints in the set $\mathcal{K}$.
Since, all elements of the set $\mathcal{K}$ are non-negative, we therefore denote by $\mathcal{K} \succeq 0$ a list of all feasible Kalmansons inequality conditions on resistance distances defined on $\operatorname{CPPR}$.\\
\indent In the next section we present the network initialization method which is the first stage of the multi stage topology reconstruction approach.
\section{Network Initialization}\label{sec:initalnetwork}
\subsection{Construction of $MPRSN$}
Since no information on the structure of $\Gamma$ is known apriori, we first construct a maximal planar resistor switch network over the boundary nodes, abbreviated as $MPRSN$. In short, a $MPRSN$ is an electrical network formed by embedding a network of resistors and switches on each edge of a maximal circular planar graph.\\
On $n_b$ boundary nodes, we construct a special planar graph known as a maximal circular planar graph. Graph is maximal in the sense that addition of one more edge makes it a non planar graph. Let $\mathcal{G}^{max}_{n_b}=\left(\mathcal{V_B},\mathcal{E}^{max}\right)$ be a planar graph on $n_b$ boundary nodes, then,
\begin{defn}\label{max_planar}(Maximal circular planar graph)
$\mathcal{G}^{max}_{n_b}$ is said to be a \emph{maximal circular planar graph} on $n_b$ boundary nodes if,
\begin{itemize}
\item it has $n_b$ boundary nodes arranged in a circular clockwise direction on circle $C$,
\item On $n_b$ boundary nodes we construct a graph with $3n_b-6$ edges, which is a maximal planar graph \cite{nishizeki2004planar}.
\end{itemize}
\end{defn}
\noindent The construction of $MPRSN$ is done in three step, which are as follows,
\begin{enumerate}
\item in the first step, we construct a maximal circular planar graph $\mathcal{G}^{max}_{n_b}$.
\item In the second step, we construct a network, which is an interconnection of resistors and switches. Let us call this a resistor switch network (RSN). Number of resistors and switches are decided based on value $r_{max}=\gamma_{min}^{-1}$. An appropriate combination of $on$ and $off$ switches in a RSN induces a resistance value.
\item Finally, replace each edge in $\mathcal{G}^{max}_{n_b}$ by a RSN to construct a $MPRSN$.
\end{enumerate}
We now briefly explain each step in the construction of $MPRSN$. In the first step, we construct a circular graph with $3n_b-6$ edges on $n_b$ boundary nodes, to ensure maximal planarity as mentioned in Definition \ref{max_planar}. In the second step, we construct a RSN based on value $r_{max}=\gamma_{min}^{-1} \in \mathbf{R}^+$, as shown in Fig.\ref{fig:gen_RSN}.
\begin{figure}
\centering
\includegraphics[scale=0.23]{general_RSN.jpg}
\caption{A general construction of resistor switch network.}
\label{fig:gen_RSN}
\end{figure}
\noindent Let us call this general RSN across boundary nodes $i$ and $j$ as $\mathcal{C}_{ij}$; also, let $\mathcal{C}=\{\mathcal{C}_{ij}:ij \in \mathcal{E}^{max}\}$. Each $\mathcal{C}_{ij}$ has two components, i.e., component A and component B as shown in Fig.\ref{fig:gen_RSN}, which helps approximately generates all admissible values of edge resistance $r\left(ij\right) \le r_{max}$, for appropriate combinations of switches. This is explained briefly below.
\subsubsection{Component A}
Component A of $\mathcal{C}_{ij}$ is composed of a boundary node $i$, nodes $p_s^j$ and the corresponding switch variables $l_{ip_s^j}$, $\forall s \in \mathbf{Z}^+_{\le(r_{max}-1)}$. Since, each switch variable can take either $0$ or $1$, there are $2^{(r_{max}-1)}$ switch combinations which induces $2^{(r_{max}-1)}$ resistances values $r(ip^j_{r_{max}-1})$. The minimum resistance value induced by component A, i.e. $r_{min}(ip^j_{r_{max}-1})$, is generated when all the switches are on, whereas the maximum value is $r_{{max}}-1$. Switch positions in component A generates only $2^{(r_{max}-1)}$ resistance values in $\left[0 \,\, r_{max}-1\right]$ and hence has limited resolution and capability to generate other numbers in the mentioned range. Therefore, to improve this, we add one more component, named component B, as shown in Figure \ref{fig:gen_RSN}.
\subsubsection{Component B}
Component B of $\mathcal{C}_{ij}$ is capable of generating fractional edge resistances values $r(m_qj)$, $\forall q \in \mathbf{Z}^+_{\le 10}$. It is composed of $10$ resistances, constructed in such a way that each edge resistance $r(m_qj)$ is equal to the parallel combination of $q$ $1\Omega$ resistances as shown in Figure \ref{fig:gen_RSN}. Component B is connected to component A by a switch $l_{p^j_{(r_{max}-1)}m_q}$. \\
The designed $\mathcal{C}_{ij}$ approximately generates any resistance value in the range $\left[r_{min}\left(ip^j_{r_{max}-1}\right)+0.1 \,\, r_{max}\right]$; other designs can also be explored to generate better resistances values in the range $[0 \,\, r_{max}]$. \\
Finally, to construct a $MPRSN$ we replace each edge $ij \in \mathcal{E}^{max}$ in $\mathcal{G}^{max}_{n_b}$ by a $RSN$ $\mathcal{C}_{ij}$. This concludes the construction of $MPRSN$. An example on construction of $MPRSN$ in given in Example \ref{exam_MPRSN} for better understanding.
\begin{rem}
The number of edges in an unknown $\operatorname{CPPR}$ network $\Gamma$ is less than or equal to $3n_b -6$, as discussed in Definition \ref{max_planar}. To identify such edges, a switching-based network structure is adopted here. The switch $l_{p^j_{(r_{max}-1)}m_q}$ helps decide whether an edge $ij$ is present in an unknown topology, based on the available resistance distance measurements and the Kirchhoffs index.
\end{rem}
\begin{exmp}\label{exam_MPRSN}
Let $n_b=4$ and $r_{max}=\gamma_{min}^{-1}=4\Omega$ are known apriori. The first step is the construction of $\mathcal{G}^{max}_4$, on $4$ boundary nodes, as shown in Fig.\ref{fig:maxplangraph}.
\begin{figure}[H]
\centering
\includegraphics[scale=0.2]{1ohmDraw4.jpg}
\caption{Maximal circular planar graph $\mathcal{G}^{max}_4$.}
\label{fig:maxplangraph}
\end{figure}
\noindent The second step is constructing the resistor switch network $\mathcal{C}_{ij}$ across the boundary nodes $i,j \in \mathcal{V_B}$, based on $r_{max}$, as shown in Fig.\ref{exmprsn}.
\begin{figure}[h]
\centering
\includegraphics[width=0.3\textwidth]{lcss_draw_6.jpg}
\caption{Resistor switch network.}
\label{exmprsn}
\end{figure}
Component A of $\mathcal{C}_{ij}$ has three switches $l_{ip^j_1}, l_{ip^j_2}, l_{ip^j_3}$, therefore, there are $2^3$ switch combinations that induce $2^3$ resistance values. These resistance values are $\{\infty, 1, 2, 0.666, 3, 0.75, 1.66, 0.625\}$. The minimum value $0.625\Omega$ is obtained when all switches in component A are $on$, and the maximum value is $3\Omega$ other than $\infty \Omega$. Component B is added to component $A$ through a switch $l_{p_3^jm_q}$, where $1\le q \le 10$ and $q \in \mathbf{Z}^+_{\le 10}$. The designed $\mathcal{C}_{ij}$, approximately generates resistance values $r\left(ij\right)$ in the range $\left[0.725\,\,4\right]$ ($\infty$ not included). \\
In the last step, we replace each edge in $\mathcal{G}^{max}_4$ by a resistor switch network. The resultant $MPRSN$ is as shown in Fig.\ref{fig:mprsn}.
\begin{figure}[H]
\centering
\includegraphics[width=0.15\textwidth]{lcss_draw_4_1.jpg}
\caption{$MPRSN$ on $4$ boundary nodes}
\label{fig:mprsn}
\end{figure}
\end{exmp}
Let the constructed $MPRSN$ be called as $\Gamma_{M}=\left(\mathcal{G}_{M},\gamma_M \right)$. Where $\mathcal{G}_{M}=\left( \mathcal{V}_M,\mathcal{E}_M\right)$, $\mathcal{V}_M$ is the set of all nodes and $\mathcal{E}_M$ is a set of all edge in $\Gamma_M$. Let $\mathbf{S}_M \large\subset \mathcal{E}_M$ is a set of all node pairs connected through a resistor and switch, for example, in Fig.\ref{exmprsn}, a node pair $i$ and $p_1^j$ are connected by a $1\Omega$ resistor and a switch, therefore $ip_1^j \in \mathbf{S}_M$. The conductance function $\gamma_M:\mathcal{C}\rightarrow\mathbf{R}^+$. The Laplacian matrix of $\Gamma_M$ is $\mathcal{L}\left(\Gamma_M\right)$, defined as follows.
\begin{equation}
\left[\mathcal{L}\left(\Gamma_M\right)\right]_{kl}=\left[\mathcal{L}_{kl}\right]=\left\{
\begin{array}{ll}
-\gamma\left(kl\right)=-1, & \mbox{if $kl\in \mathcal{E}_M \setminus \mathbf{S}_M$},\\\\
-\gamma\left(kl\right)=-l_{kl}, & \mbox{if $kl\in \mathbf{S}_M$},\\\\
\sum\limits_{l\in \mathcal{N}\left( k \right)}{{\gamma\left(kl\right)}}, & \mbox{if $k=l$},\\\\
0, & \mbox{otherwise}.
\end{array}
\right.
\end{equation}
\noindent The size of $\mathcal{L}\left(\Gamma_M\right)$ is large compared to the Laplacian matrix of unknown network $\mathcal{L}\left(\Gamma\right)$. Now, in $\Gamma_M$, we aim to determine a combination of switch positions such that $r^d_{i,j}-r^d_{i,j}(\Gamma_M),\,\forall i,j \in \mathcal{A},$ is minimum, where $r^d_{i,j} \in r^d$ and $r^d_{i,j}(\Gamma_M)$ is the resistance distance across boundary nodes $i,j \in \mathcal{V_B}$ in $\Gamma_M$. The resistance distance $r^d_{i,j}(\Gamma_M)\,\forall i,j \in \mathcal{V_B}$ are function of switch positions. In the next section, we will formulate an optimization problem $\mathbf{\Pi}_1$ that helps decide the switch positions in $MPRSN$ $\Gamma_M$.
\subsection{Determining Switch Positions in $\Gamma_M$}
\label{sec:const_auxgamma}
The switch position variables $l_{ip_s^j}$ in each $\mathcal{C}_{ij}$ are unknown. Therefore, let $\bm{\rho} \in \{0,1\}^{t}$ be a vector of $t$ switch variables, where $t=\left(3n_b-6\right)\left(\left \lfloor{r_{max}}\right \rfloor - 1\right) + 10$. To determine $\bm{\rho}$ we formulate two optimization problems, labelled as problem $\mathcal{I}$ and $\mathbf{\Pi_1}$. $\mathcal{I}$ is primarily used to compute the estimates of the unknown resistance distances $r^d_{i,j}\,\forall i,j \in \mathcal{U_B}$. Let the estimates be represented as $\hat{r}^d_{i,j}\,\forall i,j \in \mathcal{U_B}$. The problem $\mathbf{\Pi_1}$ uses the known resistance distances $r_{i,j}^d\,\forall i,j \in \mathcal{A}$ and the estimated resistance distances $\hat{r}^d_{i,j}\,\forall i,j \in \mathcal{U_B}$ to determine the status of switch variables. The problem $\mathcal{I}$ is formulated below first and then $\mathbf{\Pi_1}$ is explained.
\subsubsection{Optimization problem $\mathcal{I}$}
Consider equation (\ref{eqn:resis_equa}), from which we have,
\begin{equation}\label{eqn:resis_equa1}
r^d_{s,t} = x_{ss} + x_{tt} - 2x_{st}, \forall s,t \in \mathcal{A},
\end{equation}
where $x_{st}=X(s,t)$. There are $\frac{|\mathcal{A}|\left(|\mathcal{A}|+1\right)}{2}$ such linear equations. From the definition of $\textbf{X}$ we have $\textbf{X}\mathbf{1}=\mathbf{1}$, which is framed as $m$ linear equations, here $m=n_b+n_i$. Since, Kirchhoffs index $K_{\Gamma}$ is known, equation (\ref{eqn:kirchhoffindex}) is also posed as a linear equation. \\
Now, club $\frac{|\mathcal{A}|\left(|\mathcal{A}|+1\right)}{2}+m+1$ linear equations as a system of linear equations, as shown in equation (\ref{eqn:laplstru}),
\begin{equation}\label{eqn:laplstru}
\textbf{A}\mathbf{x}=\begin{bmatrix} \mathbf{r} \\ \mathbf{1} \end{bmatrix}.
\end{equation}
Where $\mathbf{x} \in \mathbf{R}^{\frac{m(m+1)}{2} \times 1}$ is a vector of unknowns, whose elements are obtained from unknown matrix $\textbf{X} \in \mathcal{S}_m$, $\mathbf{r} \in \mathbf{R}^{\frac{|\mathcal{A}|\left(|\mathcal{A}|-1\right)+2}{2}}$ is the vector known resistance distances, appended by value $K_{\Gamma}$.
Now, consider equation (\ref{eqn:laplstru}) and let $\mathcal{T}$ be a transformation such that $\mathcal{T}:\mathbf{R}^{\frac{m(m+1)}{2} \times 1} \rightarrow \mathcal{S}_m$. To compute the estimates of unknown resistance distances $r^d_{i,j} \forall i,j \in \mathcal{U_B}$, solve
\begin{equation*}\label{initaloptimiformulation}
\min_{\mathbf{x}} \, \norm{\textbf{A}\mathbf{x}-\begin{bmatrix} \mathbf{r} \\ \mathbf{1} \end{bmatrix}}_2^2\\
\textrm{s.t}\,\, \mathcal{T}\left(x\right)\succ 0,
\Delta \succeq 0,
\mathcal{K} \succeq 0. \hspace{1.6cm} \left(\mathcal{I}\right)
\end{equation*}
The solution to the problem $\mathcal{I}$ is $\hat{\mathbf{x}}$, from $\hat{\mathbf{x}}$ construct $\hat{\textbf{X}}$, i.e, $\mathcal{T}(\hat{\mathbf{x}})=\hat{\textbf{X}}$. Then, compute estimated resistance distance matrix $\hat{\textbf{R}}_{\Gamma}$ from $\hat{\textbf{X}}$ using relation (\ref{eqn:resis_equa}). Therefore, the estimated resistance distances are $\hat{r}^d_{ij}=\hat{R}_{\Gamma}\left(i,j\right), \forall i,j \in \mathcal{U_B}$.
\subsubsection{Optimization problem $\mathbf{\Pi_1}$}
The optimization problem $\mathbf{\Pi_1}$ is formulated such that the resistance distance error $\tilde r_{i,j}^d = \left\{ \begin{array}{l}
r_{i,j}^d - r_{i,j}^d\left( {{\Gamma _M}} \right),\quad\mbox{if}\,\, i,j \in \mathcal{A}\\
\hat r_{i,j}^d - r_{i,j}^d\left( {{\Gamma _M}} \right),\quad\mbox{if}\,\, i,j \in \mathcal{U_B}
\end{array} \right\},\, \forall i,j \in \mathcal{V_B}$ are minimum. Here, $r_{i,j}^d \in r^d$ is the measured resistance distances and $\hat r_{i,j}^d$ is the estimated resistance distance, $r_{i,j}^d\left( {{\Gamma _M}} \right)$ is the resistance distance of $\Gamma_M$ across boundary nodes $i,j$. Now, let the $\textbf{r}^{d*} \in \mathbf{R}^{\frac{n_b(n_b-1)}{2} \times 1}$ be vector of measured and estimated resistance distances, and $\textbf{r}^{d}\left(\Gamma_M\right)\in \mathbf{R}^{\frac{n_b(n_b-1)}{2} \times 1}$ be a vector of resistance distances corresponding to $\Gamma_M$, which is a function of switch positions $\rho$. Then, $\tilde{\textbf{r}}^d\triangleq \textbf{r}^{d*} - \textbf{r}^{d}\left(\Gamma_M\right)$ is the resistance distance error vector, which is to be minimized with respect to switch positions $\bm{\rho}$. The $\mathbf{\Pi_1}$ is defined below,
\begin{equation*}\label{optimiformulation}
\begin{aligned}
\min_{\bm{\rho},\textbf{W}} \, & ({\tilde{\textbf{r}}^d})^T \textbf{W} {\tilde{\textbf{r}}^d}\\
\textrm{s.t} \,\, & \bm{\rho} \odot \left( \mathbf{1}-\bm{\rho}\right){\succeq 0}, \Delta \succeq 0,
\mathcal{K} \succeq 0,\\&
0.5 \le W_{ij}\le 0.9\, \forall i,j \in \mathcal{U_B}
\hspace{3.2cm} \left(\mathbf{\Pi_1}\right)
\end{aligned}
\end{equation*}
In $\mathbf{\Pi_1}$, weighting matrix $\textbf{W} \in \mathbf{R}^{\frac{n_b(n_b-1)}{2} \times \frac{n_b(n_b-1)}{2}}$ is a diagonal matrix with positive entries. The entries of $\textbf{W}$, say $W_{ij}$ weighing $\tilde r_{i,j}^d, \forall i,j \in \mathcal{A}$ are fixed to $1$, whereas the entry $W_{ij}$ weighing $\tilde{r}_{i,j}^d, \forall i,j \in \mathcal{U_B}$ are constrained between $0.5$ to $0.9$, as posed in $\mathbf{\Pi_1}$. The terms $\left( {r_{i,k}^d + r_{j,l}^d} \right) - \left( {r_{i,j}^d + r_{k,l}^d} \right) \mbox{and} \left( {r_{i,k}^d + r_{j,l}^d} \right) - \left( {r_{j,k}^d + r_{i,l}^d} \right)$ in $\mathcal{K}$ are difference of convex functions, therefore, the formulated optimization problem $\mathbf{\Pi}_1$ is a difference of convex programming $(\mbox{DCCP})$ problem \cite{shen2016disciplined}. $\mathbf{\Pi_1}$ is solved using \emph{disciplined convex concave programming} package\cite{shen2016disciplined}, \cite{lipp2016variations}.
For computing initial guess various methods have been mentioned in \cite{shen2016disciplined}. We present a novel alternate method to construct an initial guess for $\mathbf{\Pi}_1$, explained in appendix \ref{append:choice_initial}. This alternate method works well in our experience in this work.\\
A term $({\tilde{\textbf{r}}^d})^T \textbf{W} {\tilde{\textbf{r}}^d}$ in objective function is convex if and only if each $r^d_{i,j}\left( \Gamma_M \right)$ is convex with respect to the edge conductances. The convexity of resistance distance with respect to the edge conductance is discussed in \cite{ghosh2008minimizing}. Here, we mention the same as proposition \ref{convexrho}, and an alternate proof is presented in \ref{append:convex}.
\begin{prop}\label{convexrho}
Let $\mathbf{c}$ be a vector of edge conductances of any $\Gamma$. The resistance distance $r_{s,t}^{d}\left(\mathbf{c}\right)$ is a convex function of $\mathbf{c}$.
\end{prop}
\noindent The solution to $\mathbf{\Pi_1}$ is $\bm{\rho} \in [0,1]^p$. However, we need elements of $\bm{\rho}$ to be either $0$ or $1$. Therefore, to arrive at a boolean vector, we apply the \emph{Round-Down algorithm}\cite{boros2002pseudo}.
\subsubsection{Round Down Algorithm}
Constraining $\bm{\rho}$ to be either $0$ or $1$ leads to non convex constraint, therefore $\bm{\rho}$ is constrained to be in between $[0,1]$. The solution vector $\bm{\rho} \in [0,1]^t$ is converted to a boolean vector $\mathbf{x} \in \{0,1\}^{t}$ using the Round-Down algorithm\cite{boros2002pseudo}. The Round-Down algorithm is based on Proposition \ref{prop:bool}, as given below,
\begin{prop}\cite{boros2002pseudo}\label{prop:bool}
Consider a boolean function $f:\{0,1\}^n \rightarrow \mathbf{R}$ and let $\bm{\rho} \in \mathbf{R}^n$. There exist boolean vectors $\mathbf{x}$, $\mathbf{y} \in \{0,1\}^n $ for which $f(\mathbf{x}) \le f(\rho) \le f(\mathbf{y})$.
\end{prop}
\noindent Therefore, there exist a boolean vector $\mathbf{x}$, which minimizes the objective function $f_o\left( \bm{\rho} \right)$ in $\mathbf{\Pi_1}$. To facilitate the computation of boolean vector $\mathbf{x}$, the derivative of $f_o\left( \bm{\rho} \right)$, $\delta_i\left(\bm{\rho}\right)$ is defined as,
\begin{equation}\label{boolean_derivative}
\begin{split}
\delta_i\left( \bm{\rho} \right)
\triangleq f_o\left(\ldots,\rho_{i-1},1,\rho_{i+1},\ldots\right)-f_o\left(\ldots,\rho_{i-1},0,\rho_{i+1},\ldots \right).
\end{split}
\end{equation}
The Round-Down algorithm checks whether each element in vector $\bm{\rho}$, say $\rho_i
\in \left(0,1\right)$. If yes, then, check the derivative $\delta_i\left(\bm{\rho}\right)$. Based on the sign of $\delta_i\left(\bm{\rho}\right)$, the $i^{th}$ element is flipped to 0 or 1, and then the triangle and Kalmansons constraints is checked. The Round-Down algorithm is given in detail in Algorithm \ref{euclid}.\\
\begin{algorithm}[h]
\caption{Round-Down Algorithm}\label{euclid}
\begin{algorithmic}[1]
%\Procedure{RoundDown}{}
\Require $i \gets 1$, $\mathbf{q}^0 \gets \bm{\rho}$ \& $k \leftarrow 0$
\Repeat
\State $k \leftarrow k+1$
\If{$0 < q_i^{(k-1)} < 1$ \& $\delta_i\left(\mathbf{q}^{(k-1)}\right) > 0$}
\State $q_i^{(k)} \leftarrow 0$
\If{$\Delta\left(\mathbf{q}^{(k-1)}\right) \ge 0$ \& $\mathcal{K}\left(\mathbf{q}^{(k-1)}\right) \ge 0$}
\State $q_i^{(k)} \leftarrow 0$
\Else
\State $q_i^{(k)} \leftarrow 1$
\EndIf
\ElsIf{$0 < q_i^{(k)} < 1$ \& $\delta_i\left(\mathbf{q}^{(k-1)}\right) < 0$}
\State $q_i^{(k)} \leftarrow 1$
\If{$\Delta\left(\mathbf{q}^{(k-1)}\right) \ge 0$ \& $\mathcal{K}\left(\mathbf{q}^{(k-1)}\right) \ge 0$}
\State $q_i^{(k)} \leftarrow 1$
\Else
\State $q_i^{(k)} \leftarrow 0$
\EndIf
\Else
\State $q_i^{(k)} \leftarrow q_i^{(k-1)}$
\EndIf
\State $i \leftarrow i+1$
\Until{$i \le n$}
\State x=q
\end{algorithmic}
\end{algorithm}
The boolean vector $\mathbf{x}$ contains the appropriate switch positions which are used to construct an equivalent initial resistive network. Let us call this initial network as an auxiliary network $\Gamma_{aux}=\left(\mathcal{G}_{aux},\gamma_{aux}\right)$, where $\mathcal{G}_{aux}=\left(\mathcal{V_B}, \mathcal{E}_{aux}\right)$. The initial network $\Gamma_{aux}$ gives us an initial topology $\mathcal{G}_{aux}$ which will be used in next stage of reconstruction. The edge conductances $\gamma_{aux}:\mathcal{E}_{aux} \rightarrow \mathbf{R}^+$ will be used in the next stages as an initial guess in an optimization problem $\mathbf{\Pi}_2$.\\
Since the interior nodes are not taken into account in $\Gamma_{aux}$, a structured way of embedding interior nodes is needed. Placement of interior nodes in $\Gamma_{aux}$ is explained in detail in section \ref{place_int_nodes}.
\section{Heuristic of Placement of Interior Nodes}\label{place_int_nodes}
Consider a modified network $\Bar{\Gamma}_{aux}=\left(\Bar{\mathcal{G}}_{aux}, \Bar{\gamma}_{aux} \right)$ constructed from initial network $\Gamma_{aux}$ by replacing each edge conductance $\gamma_{aux}(\sigma)$ with an unknown $l_{\sigma}, \forall \sigma \in \mathcal{E}_{aux}$. Here, $\Bar{\mathcal{G}}_{aux}={\mathcal{G}}_{aux}$ and $\Bar{\gamma}_{aux}:\mathcal{E}_{aux} \rightarrow \mathbf{R}^+$. Let $\bar{\mathbf{c}} \in \mathbf{R}^{|\mathcal{E}_{aux}| \times 1}$ be the vector of unknown edge conductances in $\Bar{\Gamma}_{aux}$, also let $\Bar{\textbf{r}}$ be a corresponding edge resistance vector.
In this section, we aim to search for edges in $\Bar{\Gamma}_{aux}$ to introduce interior nodes. To identify such edges, we formulate an optimization problem $\mathbf{\Pi}_2$ and solve for $\bar{\mathbf{c}}$. The problem $\mathbf{\Pi}_2$ is reformulation of $\mathbf{\Pi}_1$ with addition of a Kirchhoff's index error term $\left( K_{\Bar{\Gamma}_{aux}}-K_{\Gamma} \right)^2$ in the objective function and a relaxed edge conductance constraints, as given below,
\begin{equation*}\label{optimiformulaux}
\begin{aligned}
\min_{\bm{\rho},\textbf{W}} \, & ({\tilde{\textbf{r}}^d})^T \textbf{W} {\tilde{\textbf{r}}^d} + \left( K_{\Bar{\Gamma}_{aux}}-K_{\Gamma} \right)^2\\
\textrm{s.t} \,\, & \bar{\mathbf{c}}\,\succeq 0, \Delta \succeq 0,
\mathcal{K} \succeq 0,\\&
0.5 \le W_{ij}\le 0.9\, \forall i,j \in \mathcal{U_B}.
\hspace{3.2cm} \left(\mathbf{\Pi_2}\right)
\end{aligned}
\end{equation*}
In $\mathbf{\Pi_2}$, $K_{\Bar{\Gamma}_{aux}}$ is the Kirchhoff's index corresponding to network $\Bar{\Gamma}_{aux}$ and is a function of unknown edge conductances. The initial guess $\bar{\mathbf{c}}^{(0)}$ for $\mathbf{\Pi}_2$ is equal to the edge conductances obtained in initial network.
The edges where interior nodes are to be placed is based on the edge resistance vector $\Bar{\textbf{r}}$, which is the solution to problem $\mathbf{\Pi}_2$. To understand this, consider for an instance that we introduce an interior node, say $k$, on a resistive edge $ij \in{\mathcal{E}}_{aux}$. This results in two new resistive edges, $ik$ and $kj$. Each of these resistive edge can take a maximum edge resistance of $r_{max}$ as per the assumption. In some cases an edge with interior node, say $k$, is likely to have an edge resistance $r(ij)=r(ik)+r(kj)$ greater than $r_{max}$. To detect such edges, we examine solution $\Bar{\textbf{r}}$ and collect all the edge resistances greater than $r_{max}$. Arrange them in descending order and store it in another vector, say $\textbf{d}_r$. Let $n_{d_r}$ be number of elements in $\textbf{d}_r$. If, \begin{enumerate}
\item $n_{d_r} < n_i$, place $n_{d_r}$ interior nodes on $n_{d_r}$ edges. The $n_{d_r}$ edges corresponds to first $n_{d_r}$ edge resistances in $\textbf{d}_r$. Whereas, $n_i-n_{d_r}$ interior nodes are placed as dangling nodes.
\item $n_{d_r} > n_i$, place $n_{i}$ interior nodes on $n_i$ edges. The $n_{i}$ edges corresponds to first $n_{i}$ edge resistances in $\textbf{d}_r$.
\end{enumerate}
\begin{figure*}
\centering
\subfloat[Unknown Network $\Gamma$]{\label{fig:unk_gamma}\includegraphics[width=.19\linewidth]{lcss_draw_7.jpg}}\hfill
\subfloat[Auxiliary network $\Gamma_{aux}$.] {\label{fig:aux_gamma}\includegraphics[width=.19\linewidth]{lcss_draw_8.jpg}} \hfill
\subfloat[$\bar{\Gamma}_{aux}$] {\label{fig:auxbar_gamma}\includegraphics[width=.19\linewidth]{lcss_draw_10.jpg}}\hfill
\subfloat[$\hat{\Gamma}$]{\label{fig:auxhat_gamma}\includegraphics[width=.19\linewidth]{lcss_draw_11.jpg}}
\caption{Topology Reconstruction Example.}
\end{figure*}
Once the placement of interior nodes are known. The next natural question is how are the interior nodes connected to the remaining nodes?. Next section answers this questions in detail.
\section{Constructing Planar Networks and Rewiring}\label{cons_planar_net}
\subsection{Planarity checking and planar construction}
Once we proximately know the positions of interior nodes, we place $n_i$ interior nodes in $\mathcal{G}_{aux}$ appropriately. Then, connect the interior nodes to every other node, keeping the edges in $\mathcal{E}_{aux}$ intact. Let the resultant graph be called as $\hat{\mathcal{G}}_{aux}=\left( \mathcal{V_B},\mathcal{V_I},\hat{\mathcal{E}} \right)$, where $\hat{\mathcal{E}}=\mathcal{E}_{aux} \bigcup \mathcal{E}_p$ and $\mathcal{E}_p=\left\{ij:\forall \, i \in \mathcal{V_I} \, \& \, \forall \, j \in \mathcal{V_I} \bigcup \mathcal{V_B} \right\}$. Connecting interior nodes to every other node may render the resultant network $\hat{\mathcal{G}}_{aux}$ non-planar. Since the aim is to reconstruct a planar resistive network, we, therefore, extract a set of planar networks from $\hat{\mathcal{G}}_{aux}$. Next, we answer two related questions,
\begin{enumerate*}
\item how to decide whether the graph $\hat{\mathcal{G}}_{aux}$ is planar or non-planar?
\item If the graph is non-planar, how to extract planar graphs?
\end{enumerate*}
\subsubsection{Planarity Testing \& Construction} Let us define a transformation $\mathcal{T}$ which maps a graph $\hat{\mathcal{G}}_{aux}$ onto a plane such that,
\begin{enumerate*}
\item every vertex in $\hat{\mathcal{G}}_{aux}$ is mapped to a distinct point in plane,
\item all edges in $\hat{\mathcal{G}}_{aux}$ are mapped to a \textit{simple curve} on a plane. Vertices accompanying the edges are mapped as mentioned in point 1.
\end{enumerate*}
The diagram $\mathcal{T}(\hat{\mathcal{G}}_{aux})$ on the plane is called an embedding of $\hat{\mathcal{G}}_{aux}$. A graph $\hat{\mathcal{G}}_{aux}$ is said to be planar iff \textbf{no} distinct curves cross each other in $\mathcal{T}(\hat{\mathcal{G}}_{aux})$. $\mathcal{T}(\hat{\mathcal{G}}_{aux})$ is then said to be a planar embedding of $\hat{\mathcal{G}}_{aux}$ on a plane. Before presenting an algorithm for planarity testing, we define some essential terms to understand the algorithm. First, we need a systematic way to explore an undirected graph $\hat{\mathcal{G}}_{aux}$; to do this, we use \emph{depth first search (DFS)}. For detailed explanation on DFS refer to \cite{tarjan1972depth}.
The DFS algorithm partitions the edge into two classes, i.e. \begin{enumerate*}
\item tree arcs, and
\item back edges.
\end{enumerate*}
These are defined as follows,
\begin{defn}[Tree arc \& Back edges]
A directed edge say $ij$ $(\mbox{directed from}\, i\, \mbox{to}\, j)$, is a tree arc, represented as $i \rightarrow j$, if $i < j$. Similarly, a directed edge $ij$ is a back edge, represented as $i \dashedrightarrow j$, if $i > j$.
\end{defn}
\noindent If such partitions exist for $\hat{\mathcal{G}}_{aux}$, we then construct a palm tree diagram $P$ for $\hat{\mathcal{G}}_{aux}$. For example, the palm tree representation $P$ of $\hat{\mathcal{G}}_{aux}$ is shown in Fig.\ref{fig:palm}. This $\hat{\mathcal{G}}_{aux}$ corresponds to an example $\hat{\Gamma}$, as shown in Fig.\ref{fig:auxhat_gamma}.
\begin{figure}
\centering
\includegraphics[scale=0.35]{lcss_draw_11_graph.jpg}
\caption{Palm tree representation $P$ of $\hat{\mathcal{G}}_{aux}$. Bold edges are the tree arcs and dashed edges are the back edges.}
\label{fig:palm}
\end{figure}
\par To test a graph's planarity, we apply DFS to $\hat{\mathcal{G}}_{aux}$ and construct a palm tree representation $P$. Then apply a modified Auslander, Parter, and Goldstein's algorithm\cite{auslander1961psv}, \cite{goldstein1963efficient}. This algorithm
\begin{itemize}
\item searches for a cycle $c$ in the palm tree $P$, and deletes it, resulting in a set of disconnected segments. As shown in example Fig.\ref{fig:palm_compo}(b), in \ref{append:mod_planar}.
\item Algorithm then embeds cycle $c$ first, and then sequentially embeds each segment, while also checking whether the embeddings cross each other. If there is a crossing then $\hat{\mathcal{G}}_{aux}$ is non planar.
\item When $\hat{\mathcal{G}}_{aux}$ is non planar, the algorithm detects the embedded segments which crosses the recently added segment's embedding. Then constructs two planar embeddings, such that one of them has only recently added segment and deleting the embeddings crossing it. Whereas, in other planar embedding, the recently added segment is deleted and all other embeddings are preserved.
\end{itemize}
The detailed description of modified Auslander, Parter, and Goldstein's algorithm is given in \ref{append:mod_planar}.\\
All the planar embeddings constructed out of non planar graph $\hat{\mathcal{G}}_{aux}$ is transformed back to planar graphs, after applying Algorithm \ref{alg:planar_nplanar} in \ref{append:mod_planar}. Let the set of all planar graphs be $\hat{\mathcal{G}}_{aux}^p$.
\begin{figure*}
\centering
\begin{subfigure}[b]{0.22\textwidth}
\centering
\includegraphics[width=\textwidth]{lcss_path_admit1.jpg}
\caption{A admissible planar network $\Gamma_1$.}
\label{fig:plane_net_admit1}
\end{subfigure}
\hfill
\begin{subfigure}[b]{0.22\textwidth}
\centering
\includegraphics[width=\textwidth]{lcss_path_admit2.jpg}
\caption{A admissible planar network $\Gamma_2$.}
\label{fig:plane_net_admit2}
\end{subfigure}
\hfill
\begin{subfigure}[b]{0.22\textwidth}
\centering
\includegraphics[width=\textwidth]{lcss_draw_12.jpg}
\caption{Reconstructed network $\Gamma^*$}
\label{fig:gammastar1}
\end{subfigure}
\hfill
\begin{subfigure}[b]{0.22\textwidth}
\centering
\includegraphics[width=\textwidth]{lcss_draw_71.jpg}
\caption{Original $\operatorname{CPPR}$ network.}
\label{fig:gammastar}
\end{subfigure}
\caption{Topology Reconstruction Example.}
\label{fig:three graphs}
\end{figure*}
\section{Rewiring}\label{rewiring1}
For every graph $\hat{\mathcal{G}}_{aux,i}^{p} \in \hat{\mathcal{G}}_{aux}^p$, where $\hat{\mathcal{G}}_{aux,i}^{p}=\left( \mathcal{V_B} \bigcup \mathcal{V_I}, \hat{\mathcal{E}}_{aux,i}^{p}\right)$, construct a resistor network $\hat{\Gamma}_i=\left( \hat{\mathcal{G}}_{aux,i}^{p},\hat{\gamma}_i \right)$, where $\hat{\gamma}_i:\hat{\mathcal{E}}_{aux,i}^{p} \rightarrow \mathbf{R}^+, \forall 1 \le i \le |\hat{\mathcal{G}}_{aux}^p|$. The conductivity function $\hat{\gamma}_i$ is unknown. Therefore, let $\hat{\mathbf{c}}_i$ be a vector of unknown conductances of $i^{th}$ network $\hat{\Gamma}_i$. Our aim now is to determine possible rewirings and assignment of the edge conductances in $\hat{\Gamma}_i$. This is done by formulating a sparse difference of convex optimization problem $\mathbf{\Pi_3}$, as given below,
\begin{equation*}\label{optimiformulationxx}
\begin{aligned}
\min_{\hat{\mathbf{c}}_i,\textbf{W}} \, & ({\tilde{\textbf{r}}^d})^T \textbf{W} {\tilde{\textbf{r}}^d} + \left( K_{\hat{\Gamma}_{i}}-K_{\Gamma} \right)^2\\
\textrm{s.t} \,\, & 0 \preceq \hat{\mathbf{c}}_i \preceq \gamma_{max}\mathbf{1}, \Delta \succeq 0,
\mathcal{K} \succeq 0,\\&
0.5 \le W_{ij}\le 0.9\, \forall i,j \in \mathcal{U_B}.
\hspace{3.2cm} \left(\mathbf{\Pi_3}\right)
\end{aligned}
\end{equation*}
$\hat{\mathbf{c}}_i$ is the solution of the convex optimization problem $\mathbf{\Pi_3}$. If some of the elements of solution vector $\hat{\mathbf{c}}_i \in [0 \,\, \gamma_{min}]$ then apply the round algorithm. The round algorithm based on the sign of derivative (similar to defined in equation (\ref{boolean_derivative})) assigns elements in $\hat{\mathbf{c}}_i \in (0 \,\, \gamma_{min})$ to either $0$ or $\gamma_{min}$. Then, again run $\mathbf{\Pi_3}$ with this modified $\hat{\mathbf{c}}_i$ as the initial condition.
\indent Solve $\mathbf{\Pi}_3$ for each $\hat{\Gamma}_i$ and let $\hat{\mathbf{c}}=\left\{\hat{\mathbf{c}}_i:1 \le i \le |\hat{\mathcal{G}}_{aux}^p|\right\}$ be the set of solution vector. Choose from $\hat{\mathbf{c}}$ a conductance vector $\mathbf{c}^*$ which has a minimum value of $({\tilde{\textbf{r}}^d})^T \textbf{W} {\tilde{\textbf{r}}^d} + \left( K_{\hat{\Gamma}_{i}}-K_{\Gamma} \right)^2$. Such $\mathbf{c}^*$ gives us a reconstructed network $\Gamma^*$ corresponding to unknown $CPPR$ network $\Gamma$.
We derive the gradient and hessian of resistance distance error and the Kirchhoff's index error, in \ref{append:derivative}, which will be useful in solving $\mathbf{\Pi_1}$, $\mathbf{\Pi_2}$ and $\mathbf{\Pi_3}$.
\section{Example}\label{example_prob}
Let us consider an unknown network $\Gamma=\left(\mathcal{G},\gamma\right)$ as shown in Fig.\ref{fig:unk_gamma}. The following are the knowns $n_b=4$, $\mathcal{U}=\{2,5,6\}$, $n_i=2$, $\mathcal{A}=\{1,3,4\}$, $r_{max}=\gamma_{min}^{-1}=4\Omega$, $K_{\Gamma}=19.8\Omega$, and we have $r^d=\{r^d_{1,3}=1.4984\Omega, r^d_{1,4}=1.351\Omega, r^d_{3,4}=1.0795\Omega\}$. We construct an appropriate $MPRSN$ as shown in Fig.\ref{fig:mprsn} in Example \ref{exam_MPRSN}. Formulate an optimization problem $\mathcal{I}$ to compute the estimates $\hat{r}^d_{i,j}\,\forall i,j \in \mathcal{U_B}$ and, then solve $\mathbf{\Pi_1}$ to find an optimal switch combination. The solution to this problem is $\Gamma_{aux}$, shown in Fig.\ref{fig:aux_gamma}. Now, to place interior nodes appropriately, apply heuristic method.
\begin{comment}
which involves solving $\mathbf{\Pi}_2$ and finding edge resistances greater than $r_{max}$.
\end{comment}
Solution to $\mathbf{\Pi}_2$ is shown in Fig.\ref{fig:auxbar_gamma}. Then, by examining the solution edge resistance vector $\bar{r}$, interior node $5$ is placed on edge $13$ and interior node $6$ is a dangling node as shown in Fig.\ref{fig:auxhat_gamma}. Now, connect all the interior nodes to every other node to get a network $\hat{\Gamma}$ as shown in Fig.\ref{fig:auxhat_gamma}. The network $\hat{\Gamma}$ may be non planar, we therefore apply modified Auslander, Parter, Goldstein algorithm and construct corresponding planar resistive electrical networks $\hat{\Gamma}_1$ and $\hat{\Gamma}_2$ as shown in Fig. \ref{fig:plane_net_admit1} \& \ref{fig:plane_net_admit2}.
It can be seen that the networks are structurally similar with different numbering for interior nodes. Therefore, solve problem $\mathbf{\Pi}_3$ for $\Gamma_1$ or $\Gamma_2$ to get the solution $\mathbf{c}^*=\hat{\mathbf{c}}_1$ or $\mathbf{c}^*=\hat{\mathbf{c}}_2$. The reconstructed network $\Gamma^{\star}$ corresponding to an unknown $CPPR$ electrical network is shown in Fig. \ref{fig:gammastar1}, and the original network is shown in Fig \ref{fig:gammastar}. The authors would like to acknowledge the availability of the source code related to this example on \href{https://github.com/ShivanB/Topology_Reconstruction_Codes?tab=readme-ov-file#topology_reconstruction_codes}{GitHub}.
\section{Discussions}
\subsection{Number of Measurements}
In equation (\ref{eqn:laplstru}), if all nodes, i.e. $|\mathcal{V}|=m$, are available, we get a unique solution to the reconstruction problem. If all the boundary nodes are available for performing experiments, the interior nodes are still not available. In such case we will always have infinite number of solutions satisfying equation (\ref{eqn:laplstru}). Hence, we can construct infinite number of electrical networks satisfying available resistance distance measurements. Therefore, to search for a valid network, we introduce the triangle and Kalmansons inequality constraints.
\subsection{Methodology}
The methodology proposed works well for small $CPPR$ networks. As the number of boundary nodes increases, the number of edges in the maximal planar graph increases almost exponentially. The lower bound on the number of edges for a given number of vertices is given in \cite{tutte1962census}. \\
In the construction of $MPRSN$, as the value $r_{max}$ increases, number of switch positions to be optimized also increases, thereby increasing the complexity of problem $\mathbf{\Pi}_1$. The $DCCP$, in general, constructs a global overestimator of the objective function and solves the resulting convex subproblem with cheap per iteration complexity\cite{shen2016disciplined}.\\
The proposed method depends on the planarity testing algorithm and extracting admissible planar embeddings simultaneously. This process becomes computationally heavy for large networks. The number of planar embeddings depends on the number of dangling and non-dangling nodes. Also, as the number of dangling nodes increases, the number of admissible planar embeddings increases. The Auslander, Parter and Goldsteins algorithm has complexity of $\mathcal{O}\left(m\right)$, where $m$ is the number of nodes in graph.
\subsection{Error}
Three major sources of errors that induces error in the reconstructed network are,
\begin{enumerate*}
\item number of available resistance distance measurements,
\item number of resistances in component B of the RSN, in $\Gamma_{M}$,
\item choice of initial conditions for optimization formulation.
\end{enumerate*}
\\ \indent As the number of available resistance distance measurements increases, switch positions can be tuned appropriately to get a better $\Gamma_{aux}$. Therefore, more resistance distance measurements will lead to a reliable $\Gamma_{aux}$, and this $\Gamma_{aux}$ will further lead to proper reconstruction of the network.\\
\indent Let us consider a case wherein the available boundary measurements can properly reconstruct a network. We now consider the effect of the number of resistances in component B of RSN on the value of $f_o$ corresponding to $\Gamma^\star$. It is seen that, as the number of resistances in component B increases, the value of $f_o$ decreases for some values and then remains almost constant, as shown in Fig.\ref{fig:fo}.
\begin{figure}[h]
\centering
\includegraphics[scale=0.05]{error_plot.jpg}
\caption{Value of $f_0$ $(\mbox{corresponding to}\hspace{0.1cm} \Gamma^\star)$ w.r.t number of resistances in component B}
\label{fig:fo}
\end{figure}
\\ \indent Initial guess values fed into the optimization routine must be chosen judiciously, for proper network reconstruction. The quality of reconstructed network $\Gamma^{\star}$ is sensitive to the choice of guesstimate of switch variables vector $\bm{\rho}$ for $\mathbf{\Pi_1}$. Therefore, a novel method for choosing a proper initial guess of switch positions in $\Gamma_M$ for $\mathbf{\Pi_1}$ is explained in appendix \ref{append:choice_initial}.
\subsection{Initial Conditions}
The problems $\mathbf{\Pi}_1$, $\mathbf{\Pi}_2$ \& $\mathbf{\Pi}_3$ are implemented using a $DCCP$ and is sensitive to initial guess. Therefore, a proper choice of initial guess is necessary to get the right solution. In problem $\mathbf{\Pi}_1$, the initial $\bm{\rho}^{(0)} \in \{0,1\}^p$ is chosen by applying algorithms mentioned in \ref{append:choice_initial}. The solution to the problem $\mathbf{\Pi}_1$ is $\Gamma_{aux}$. For problem $\mathbf{\Pi}_2$, the initial guesstimate $\mathbf{\bar{c}}^{(0)} \in \mathbf{R}^{|\mathcal{E}_{aux}| \times 1}$ is based on the edge resistances of $\Gamma_{aux}$. Therefore, the $l^{th}$ element of $\mathbf{\bar{c}}^{(0)}$, which is also the $l^{th}$ edge of $\Gamma_{aux}$ is $\mathbf{\bar{c}}_{l}^{(0)}=\gamma_{aux}(l)$. For $\mathbf{\Pi}_3$, the initial guesstimate $\mathbf{\hat{c}}_i^{(0)} \in \mathbf{R}^{|\mathcal{\hat{E}}| \times 1}$ is inferred from the edge resistances of network $\bar{\Gamma}_{aux}$ and $\gamma_{max}$. The $\mathbf{\hat{c}}_i^{(0)}$ is decided as follows, the edge conductance $\mathbf{\hat{c}}^{(0)}_{i}(\sigma)=\Bar{\gamma}(l)$ if $\sigma \in \mathcal{E}_{aux}$, $\mathbf{\hat{c}}^{(0)}_{i}(\sigma)={\gamma}_{max}$ if $\sigma \in \mathcal{E}_{p}$ and $\mathbf{\hat{c}}^{(0)}_{i}(\sigma)=0$ if $\sigma \notin \mathcal{E}_{aux}$.
\section{Conclusion}
We presented a multistage topology reconstruction algorithm for a general $\operatorname{CPPR}$ electrical network. We assume that only some of the resistance distance measurements are available, the number of boundary and interior nodes, minimum and maximum value of edge conductance and the Kirchhoffs index are known corresponding to an unknown network $\Gamma$. We start the reconstruction process by constructing an initial network $\Gamma_{aux}$. The construction of $\Gamma_{aux}$ comprises two steps; the first is constructing a maximal planar network whose edges are composed of resistors and switches in a specific configuration based on the maximum resistance value. Therefore, the switch positions decide the edge resistance. In the second step, the switch positions are decided based on the available and estimated resistance distance measurements. This is done by formulating a difference of convex programming problem $\mathbf{\Pi}_{1}$ involving a quadratic cost function, constrained by triangle and the Kalmansons inequalities. The resultant switch positions thus give us an initial network $\Gamma_{aux}$. The $\Gamma_{aux}$ gives us an initial topology which is used subsequently for adding interior nodes.\\
\indent Interior nodes are not considered in the $\Gamma_{aux}$. Therefore, we develop a heuristic approach that re-optimizes the edge resistances of initial topology of $\Gamma_{aux}$. Re-optimization involves solving optimization problem $\mathbf{\Pi}_{2}$, which is a reformulation of $\mathbf{\Pi_1}$ with Kirchhoffs index and relaxed edge conductance constraints. We then examine optimized edge resistances and introduce an appropriate number of interior nodes on edges with edge resistance greater than the maximum resistance; the remaining interior nodes are considered dangling nodes.\\
\indent Since the interconnection among interior nodes and between interior nodes and boundary nodes is unknown, we connect the interior nodes to all other nodes to account for all possible edges in an unknown network. This may result in a non-planar network. Therefore, we propose a modified Auslander, Parter, and Goldstein’s algorithm to get planar networks from a non-planar network. Then, each planar network's edge conductance is computed by solving an optimization formulation similar to $\mathbf{\Pi}_{1}$. A network which best satisfies the available measurements is chosen as a reconstructed network.\\
\indent The proposed methodology is suitable for networks with fewer boundary and interior nodes. The computation of the initial network $\Gamma_{aux}$, the heuristic method proposed for the placement of interior nodes, and the algorithm for construction of a set of planar networks can be further improved, to improve the efficiency of the overall proposed algorithm. The Kirchhoff's index is assumed to be known in this work, but in general, it is not known. A work in \cite{bianchi2013bounds} computes upper and lower bounds on the the Kirchhoffs index for a weighted graph, these bounds can be used in our work by blending in these bounds into the optimization formulation. The proposed multistage topology reconstruction procedure can be generalized to reconstruct RLC networks, which are the subject of future research.
\bibliographystyle{elsarticle-num}
\bibliography{autosam}
\appendix
\section{Convexity of Resistance Distance \& Kirchhoff's Index}
\label{append:convex}
The convexity of resistance distance with respect to the edge conductance is discussed in \cite{ghosh2008minimizing} by omitting proof. Here, we mention the same with detailed alternate proof.
\begin{prop}
Let $\mathbf{c}$ be a vector of edge conductances of $\Gamma$, then the resistance distance $r_{s,t}^{d}\left(\mathbf{c}\right)$ is a convex function of $\mathbf{c}$.
\end{prop}
\begin{proof}
Consider a $\operatorname{CPPR}$ electrical network $\Gamma=\left(\mathcal{G},\gamma\right)$. Let $\mathbf{c_1}, \mathbf{c_2}$ \& $\mathbf{c_3} \in \mathbf{R}^{|\mathcal{E}|}$ be vector of edge conductance's, such that $\mathbf{c}_3=\theta\mathbf{c_1}+\left(1-\theta\right)\mathbf{c_2}$.
The resistance distance $r^d_{s,t}$ is said to be a convex function if it satisfies equation \eqref{eqn:jensen},
\begin{equation}\label{eqn:jensen}
r^d_{s,t}\left( \theta\mathbf{c_1} + \left(1-\theta\right) \mathbf{c_2} \right) \le \theta r^d_{s,t}\left(\mathbf{c_1}\right) + \left(1-\theta\right) r^d_{s,t}\left(\mathbf{c_2}\right).
\end{equation}
Let $\mathcal{L\left(G\right)}$ be the Laplacian matrix corresponding to conductance vector $\mathbf{c_i} \, \forall i \in \{1,2,3\}$, to denote its dependence on $\mathbf{c_i}$ we call it $\mathcal{L}\left(\mathbf{c}_i\right)$. Let $\mathbf{B} \in \mathbf{R}^{m \times |\mathcal{E}|}$ to be the incidence matrix corresponding to the graph $\mathcal{G}$, then $\textbf{b}_l$ is the $l^{th}$ column of $\mathbf{B}$.
We can write,
\begin{align}{} \mathcal{L}\left(\mathbf{c_3}\right)+\frac{1}{n}J&=\sum\limits_{l=1}^{|\mathcal{E}|}c_{3,l}\textbf{b}_l\textbf{b}_l^T + \frac{1}{n}\textbf{J},&\\
% &=\sum\limits_{l=1}^{|\mathcal{E}|} \left(\theta \cdot c_{1,l}+\left(1-\theta\right) \cdot c_{2,l}\right) b_lb_l^T + \frac{1}{n}J,&\\
&=\theta \mathcal{L}\left(\mathbf{c_1}\right) + \left(1-\theta\right) \mathcal{L}\left(\mathbf{c_2}\right) + \frac{1}{n}\textbf{J}.
\end{align}
Taking inverse on both side, we get,
\begin{equation}
\left(\mathcal{L}\left(\mathbf{c_3}\right)+\frac{1}{n}\textbf{J}\right)^{-1}= \left( \theta \mathcal{L}\left(\mathbf{c_1}\right) + \left(1-\theta\right) \mathcal{L}\left(\mathbf{c_2}\right) + \frac{1}{n}\textbf{J} \right)^{-1}.\label{eqn:eqn3}
\end{equation}
Without loss of generality, let $\theta=0.5$ and using Theorem \ref{theorem:thm1}, as given below,
\begin{comment}
\begin{equation}\label{eqn:eqn1}
\begin{split}
\left( \theta \mathcal{L}\left(\mathbf{c_1}\right) + \left(1-\theta\right) \mathcal{L}\left(\mathbf{c_2}\right) + \frac{1}{n}J \right)^{-1}= \\ \left( 0.5\left(\mathcal{L}\left(\mathbf{c_1}\right) + \frac{1}{n}J \right)+ 0.5\left(\mathcal{L}\left(\mathbf{c_2}\right) + \frac{1}{n}J \right) \right)^{-1}.
\end{split}
\end{equation}
\end{comment}
\begin{thm}\cite{fedorov2013theory}\label{theorem:thm1}
If $\textbf{M}$ and $\textbf{P}$ are positive definite matrix, then,
\begin{equation}
\left[\alpha \textbf{M} + (1-\alpha)\textbf{P}\right]^{-1} \le \alpha \textbf{M}^{-1} + (1-\alpha)\textbf{P}^{-1},
\end{equation}
\end{thm}
\noindent we get,
\begin{equation}\label{eqn:eqn2}
\begin{split}
\left( 0.5\left(\mathcal{L}\left(\mathbf{c_1}\right) + \frac{1}{n}\textbf{J} \right)+ 0.5\left(\mathcal{L}\left(\mathbf{c_2}\right) + \frac{1}{n}\textbf{J} \right) \right)^{-1} \le \\ 0.5 \left(\mathcal{L}\left(\mathbf{c_1}\right) + \frac{1}{n}\textbf{J} \right)^{-1} + 0.5 \left(\mathcal{L}\left(\mathbf{c_2}\right) + \frac{1}{n}\textbf{J} \right)^{-1}.
\end{split}
\end{equation}
From equation.\eqref{eqn:eqn3} and \eqref{eqn:eqn2}, we finally have,
\begin{equation}
\begin{split}
\left(\mathcal{L}\left(\mathbf{c_3}\right)+\frac{1}{n}\textbf{J}\right)^{-1}
\le 0.5 \left(\mathcal{L}\left(\mathbf{c_1}\right) + \frac{1}{n}\textbf{J} \right)^{-1} +\\ 0.5 \left(\mathcal{L}\left(\mathbf{c_2}\right) + \frac{1}{n}\textbf{J} \right)^{-1}.
\end{split}
\end{equation}
Then the following is also true,
\begin{equation}
\begin{split}
b_{st}^T\left(\mathcal{L}\left(\mathbf{c_3}\right)+\frac{1}{n}\textbf{J}\right)^{-1} b_{st}
\le 0.5 b_{st}^T \left(\mathcal{L}\left(\mathbf{c_1}\right) + \frac{1}{n}\textbf{J} \right)^{-1}b_{st} +\\ 0.5 b_{st}^T \left(\mathcal{L}\left(\mathbf{c_2}\right) + \frac{1}{n}\textbf{J} \right)^{-1}b_{st}.
\end{split}
\end{equation}
Hence,
\begin{equation*}
r^d_{s,t}\left( \theta\mathbf{c_1} + \left(1-\theta\right) \mathbf{c_2} \right) \le \theta r^d_{s,t}\left(\mathbf{c_1}\right)
+ \left(1-\theta\right) r^d_{s,t}\left(\mathbf{c_2}\right).
\end{equation*}
\end{proof}
\begin{cor}
$K_\Gamma$ is a convex function, Since it is the sum of resistance distances.
\end{cor}
\section{Gradient and Hessian}
\label{append:derivative}
We derive gradient and hessian of $({\tilde{\textbf{r}}^d})^T \textbf{W} {\tilde{\textbf{r}}^d}$ and $K_{\underline\Gamma}$ and which will be useful in solving $\mathbf{\Pi_1}$, $\mathbf{\Pi_2}$ \& $\mathbf{\Pi_3}$. Here. $\underline\Gamma$ can be any network $\Gamma_M$ in $\Pi_1$ or $\Bar{\Gamma}_{aux}$ in $\mathbf{\Pi_2}$ or $\hat{\Gamma}$ in $\mathbf{\Pi_3}$.
The derivative of weighted error resistance distance across boundary nodes $i$ and $j$, i.e., ${W_{ij}} ({\tilde{{r}}^d_{i,j}})^2$ is,
\begin{equation}
\begin{split}
\frac{\partial {W_{ij}} ({\tilde{{r}}^d_{i,j}})^2 }{\partial \rho_l}&=2W_{ij} \nabla_{\rho_l}{\tilde{{r}}^d_{i,j}},\\&
=2W_{ij}{{{\tilde r}}^d_{i,j}}\frac{\partial \left({{{r}}^{d*}_{i,j}}-{{{r}}^{d}_{i,j}}\left(\underline \Gamma\right)\right)}{\partial \rho_l}\\&
=-2W_{ij}{{{\tilde r}}^d_{i,j}} \nabla_{\rho_l}{{{r}}^{d}_{i,j}}\left(\underline \Gamma\right)
\end{split}
\end{equation}
The derivative $\nabla_{\rho_l}{{{r}}^{d}_{i,j}}\left(\underline \Gamma\right)$ is given as,
\begin{equation}
\begin{split}
\nabla_{\rho_l}{{{r}}^{d}_{i,j}}\left(\underline \Gamma\right)= \frac{\partial (e_i-e_j)^T\mathcal{L}^{\dagger}(e_i-e_j) }{\partial \rho_l}=e_{ij}^T \nabla_{\rho_l}\mathcal{L}^{\dagger} e_{ij}.
\end{split}
\end{equation}
where $e_{ij}=e_i-e_j$. Then,
\begin{equation}
\begin{split}
\nabla_{\rho_l}{{{r}}^{d}_{i,j}}\left(\underline\Gamma\right)&=e_{ij}^T\norm{\left(\mathcal{L}+\frac{1}{n}\textbf{J}\right)^{-1}\textbf{b}_l}e_{ij},
\end{split}
\end{equation}
here $\textbf{b}_l$ is the $l^{th}$ column of adjacency matrix $\textbf{B}$.
The second derivative of ${W_{ij}} ({\tilde{{r}}^d_{i,j}})^2$ is,
\begin{equation}
\begin{split}
\nabla_{\rho_l}^2 {W_{ij}} ({\tilde{{r}}^d_{i,j}})^2 &=-2W_{ij} \left\{\left( \nabla_{\rho_l} {\tilde{{r}}^d_{i,j}}\right) \nabla_{\rho_l}{{{r}}^{d}_{i,j}}\left(\underline\Gamma\right) + \tilde r_{i,j}^d \nabla_{\rho_l}^2 r^d_{i,j}\left(\underline\Gamma\right) \right\},
\end{split}
\end{equation}
here $\nabla_{\rho_l}^2r^d_{i,j}\left(\underline\Gamma\right)=2\textbf{b}_l^T(\mathcal{L}+\frac{1}{n}\textbf{J})^{-1}\textbf{b}_l\textbf{b}_l^T(\mathcal{L}+\frac{1}{n}\textbf{J})\textbf{b}_l$.
The Kirchhoff's index \cite{ghosh2008minimizing} is given by,
\begin{equation}
K_{\underline\Gamma}=n\mathbf{Tr}\left( \mathcal{L}+\frac{1}{n}\textbf{J} \right)^{-1}-n
\end{equation}
The derivative of the Kirchhoff's index is,
\begin{equation}
\frac{\partial K_{\underline\Gamma}}{\partial \rho_l}=-n \norm{\left( \mathcal{L}+\frac{1}{n}\textbf{J} \right)^{-1}\textbf{b}_l}^2.
\end{equation}
Whereas the second derivative is,
\begin{equation}
\frac{\partial^2 K_{\underline \Gamma}}{\partial \rho_l^2}=2n\textbf{b}_l^T \left(\mathcal{L}+\frac{1}{n}\textbf{J}\right)^{-1} \textbf{b}_l\textbf{b}_l^T \left(\mathcal{L}+\frac{1}{n}\textbf{J}\right) \textbf{b}_l.
\end{equation}
%\underbar
\section{Construction of Initial Guess for $\mathbf{\Pi_1}$}\label{append:choice_initial}
The initial guess fed into $\mathbf{\Pi_1}$ are the initial switch positions in $\Gamma_M$. We present a novel algorithm to compute an initial guess $\bm{\rho}^{(0)} \in \{0,1\}^{t}$, where $t=\left(3n_b-6\right)\left(\left \lfloor{r_{max}}\right \rfloor - 1\right) + 10$. The algorithm comprises of solving $\mathcal{I}$ first. Then, using $\textbf{r}^d$ and the estimated resistance distances $\hat{r}^d_{i,j} \forall i,j \in \mathcal{U_B}$, an iterative algorithm is run to compute $\bm{\rho}^{(0)}$, i.e., the initial switch positions. \\
The estimated resistance distances $\hat{r}^d_{ij}=\hat{\textbf{R}}_{\Gamma}\left(i,j\right), \forall i,j \in \mathcal{U_B}$ computed from $\mathcal{I}$ and the available resistance distances in set $\textbf{r}^d$ are used in the proposed iterative algorithm to get initial guess vector $\bm{\rho}^{(0)}$.
The iterative algorithm involves,
\begin{enumerate*}
\item[1.)] computation of edge resistances, by increasing and decreasing edge resistance by $1\Omega$,
\item[2.)] addition and deletion of edges,
\end{enumerate*}
based on $\textbf{r}^d$ and $\hat{r}^d_{i,j} \forall i,j \in \mathcal{U_B}$. The algorithm is designed specifically to assign only integer edge resistances upto value $r_{max}$. The iterative algorithm gives an electrical network from which an initial switch position guess $\bm{\rho}^{(0)}$ is determined to be fed into $\mathbf{\Pi}_1$.\\
\indent At $0^{th}$ iteration, we consider network $\Gamma_{I}^{(0)}=\left(\mathcal{G}_I^{(0)},\gamma^{(0)} \right)$, where $\mathcal{G}_I^{(0)}=\mathcal{G}_{n_b}^{max}$. Instead of using edge conductance, we use edge resistance for explanation in this section. The edge resistances are set to $r^{(0)}\left(ij\right)=1\Omega,\, \forall ij \in \mathcal{E}^{max}$. Let the corresponding Laplacian matrix be $\mathcal{L}\left(\Gamma_I^{(0)}\right)$. Then, set of resistance distances corresponding to $\Gamma_I^{(0)}$ is $r^{d}\left(\Gamma_I^{(0)}\right)\triangleq \left\{r^{d}_{i,k}\left(\Gamma_I^{{(0)}}\right)=\textbf{b}_{ik}^T \mathcal{L}\left(\Gamma_I^{(0)}\right)^{\dagger}\textbf{b}_{ik}| i,k \in \mathcal{V_B}\right\}$, and the resistance distance error set is
${\tilde r^{d,\left( 0 \right)}} = \left\{ \begin{array}{l}
\tilde r_{i,k}^{d,\left( 0 \right)} = r_{i,k}^d\left( {\Gamma _I^{\left( 0 \right)}} \right) - r_{i,k}^d{\rm{, if }}\,i,k \in \mathcal{A}\,{\rm{ or}}\\
{\rm{ }}\tilde r_{i,k}^{d,\left( 0 \right)} = r_{i,k}^d\left( {\Gamma _I^{\left( 0 \right)}} \right) - \hat r_{i,k}^d,{\rm{ if }}\,i,k \in \mathcal{U_B} {\rm{ }}
\end{array} \right\}$. Since algorithm involves deletion and addition of edges we keep track of added and deleted edges, using $\mathcal{D}^{(0)}$, the set of deleted edges and $A^{(0)}$ be the set of edges added at $0^{th}$ iteration. Initially, $\mathcal{D}^{(0)}=\emptyset$ and $A^{(0)}=\emptyset$. Let $d_i^{(0)}$ be the degree of node $i$ at $0^{th}$ iteration. If degree of any node in an edge is $1$ we call such edge as a floating edge. The algorithm starts with identifying nodes pairs, say $s,t \in \mathcal{V_B}$, across which the maximum absolute resistance distance error occurs and $st \in \mathcal{E}^{max}$ ($\mathcal{E}^{max}$ is defined in section \ref{sec:initalnetwork}). Now, the aim is to increase or decrease the edge resistance $r^{(0)}(st)$ such that $\tilde{r}^{d,(0)}_{s,t}$ is minimized. Hence, if $\tilde{r}^{d,(0)}_{s,t}<0$, then we either delete the edge $st$ or increase the edge resistance $r^{(0)}(st)$ by $1\Omega$, whichever is better. Whereas, if $\tilde{r}^{d,(0)}_{s,t}>0$ then we either add an edge with edge resistance $1\Omega$ or decrease edge resistance value by $1\Omega$. This is exemplified for $n^{th}$ iteration, given below.
\\
\indent At $n^{th}$ iteration, consider a network $\Gamma_I^{(n)}=\left(\mathcal{G}_I^{(n)}, \gamma^{(n)}\right)$, where $\mathcal{G}_I^{(n)}=\left(\mathcal{V_B},\mathcal{E}_I^{(n)}\right)$ and $r^{(n)}:\mathcal{E}_I^{(n)} \rightarrow \mathbf{Z}^+_{\le r_{max}}$. Then, ${r^d}\left( {\Gamma _I^{\left( n \right)}} \right) = \left\{ \begin{array}{l}
r_{i,k}^d\left( {\Gamma _I^{\left( n \right)}} \right) = \textbf{b}_{ik}^T\mathcal{L}{\left( {\Gamma _I^{\left( n \right)}} \right)^ \dagger }{\textbf{b}_{ik}}:\\
i,k \in {\mathcal{V_B}}
\end{array} \right\}$ is a set of resistance distances corresponding to $\Gamma_I^{(n)}$, and a resistance distance error set
${\tilde r^{d,\left( n \right)}} = \left\{ \begin{array}{l}
\tilde r_{i,k}^{d,\left( n \right)} = r_{i,k}^d\left( {\Gamma _I^{\left( n \right)}} \right) - r_{i,k}^d{\rm{, if }}\,i,k \in \mathcal{A}\,{\rm{ or}}\\
{\rm{ }} \tilde r_{i,k}^{d,\left( {n} \right)} = r_{i,k}^d\left( {\Gamma _I^{\left( n \right)}} \right) - \hat r_{i,k}^d,{\rm{ if }}\,i,k \in \mathcal{U_B}{\rm{ }}\end{array} \right\}$. Also, let $\mathcal{D}^{(n)}$ and $A^{(n)}$ be non empty set, then $\mathcal{E}_I^{(n)}=\left(\mathcal{E}^{(0)} \setminus \mathcal{D}^{(n)}\right) \bigcup A^{(n)}$. Now choose an index pair, say $\{s,t\} \in \mathcal{V_B}$, across which maximum absolute resistance distance error occurs from set $\tilde{r}^{d,(n)}$, let us denote this process of choosing $\{s,t\}$ as, $\{s,t\}=\textbf{indexmax}\left( \tilde{r}^{d,(n)} \right) $. Then, based on the sign of $\tilde{r}^{d,(n)}_{s,t}$ and various other criteria, several operations on graph $\mathcal{G}^{(n)}_{I}$ are executed at $n^{th}$ iteration. That is, if \begin{enumerate*}
\item[1.)] if $\tilde{r}^{d,(n)}_{s,t}<0$ and $st \in \mathcal{E}_I^{(n)}$, then we either delete an edges $st$ (let us call this operation $\mathcal{OP}1$) or increase the edge resistance by $1\Omega$ (let us call this operation $\mathcal{OP}2$). Both operations are given in details as Algorithm-\ref{algo_initialguess1} and \ref{algo_initialguess2} respectively.
\item[2.)] if $\tilde{r}^{d,(n)}_{s,t}<0$ and $st \notin \mathcal{E}_I^{(n)}$ then, find another node pair, say $\{s_1,t_1\}$, such that $\{s_1,t_1\}=\textbf{indexmax}\left( \tilde{r}^{d,(n)} \right) $ and $s_1t_1 \ne st$.
\item[3.)] if $\tilde{r}^{d,(n)}_{s,t}>0 \land st \notin \mathcal{E}_I^{(n)}$ then, we add a new edge $st$ across nodes $s$ and $t$. This operation is called as $\mathcal{OP}3$ and is presented in details as Algorithm-\ref{algo_initialguess3}.
\item [4.)] if $\tilde{r}^{d,(n)}_{s,t}>0 \land st \in \mathcal{E}_I^{(n)}$ then we decrease the edge resistance $r^{(n)}(st)$ by $1\Omega$. Let this operation be named as $\mathcal{OP}4$ and is given in detail as Algorithm-\ref{algo_initialguess4}.
\end{enumerate*}\\
Each operation is briefly explained case by case below,\\
\textbf{Case-1:}\,if $\tilde{r}^{d,(n)}_{s,t}<0$ and $st \in \mathcal{E}_I^{(n)}$ then,\\ \begin{enumerate*} \item[1.] the edge $st$ can be deleted, or, \item[2.] edge resistance $r^{(n)}(st)$ is increased by $1\Omega$.\end{enumerate*} Let us call an operation in point $1$ as $\mathcal{OP}1$ and, operation in point $2$ as $\mathcal{OP}2$. In case-1, first implement operation $\mathcal{OP}1$, then operation $\mathcal{OP}2$ on $\Gamma_I^{(n)}=\left(\mathcal{G}_I^{(n)}, \gamma^{(n)}\right)$ independently. Let $\tilde{r}^d_{s,t}\left(\mathcal{OP}1\right)$ and $\tilde{r}^d_{s,t}\left(\mathcal{OP}2\right)$ be the resistance distance error across $s,t \in \mathcal{V_B}$ after committing operation $\mathcal{OP}1$ and $\mathcal{OP}2$ respectively.\\
\indent An operation is said to be valid if a committed operation results in improvement of resistance distance error, i.e., if $\left|\tilde{r}^d_{s,t}\left(\mathcal{OP}1\right)\right|<\left|\tilde{r}^{d,(n)}_{s,t}\right|$ then $\mathcal{OP}1$ is a valid operation to commit. Now, if both $\mathcal{OP}1 \, \mbox{and} \, \mathcal{OP}2$ are valid, then choose an operation which results in $\min\left\{|\tilde{r}^d_{s,t}\left(\mathcal{OP}1\right)|, |\tilde{r}^d_{s,t}\left(\mathcal{OP}2\right)|\right\}$. If only any one of the operation is valid, then implement that operation. If both are invalid then find another node pair, say $s_1,t_1$, such that $\left\lbrace s_1,t_1 \right\rbrace=\textbf{indexmax}\left( \tilde{r}^{d,(n)} \right)$ and $s_1t_1 \notin \mathcal{D}^{(n)}$. Therefore, let us define a function $\textbf{OPselect}\left(\mathcal{OP}1, \mathcal{OP}2\right)$, which helps select an appropriate operation based on $\tilde{r}^d_{s,t}\left(\mathcal{OP}1\right)$, $\tilde{r}^d_{s,t}\left(\mathcal{OP}2\right)$ and $\tilde{r}^{d,{(n)}}_{s,t}$ as explained above. This function is used in Algorithm-\ref{algo_initialguess2} and is explained in Algorithm-\ref{algo_initialguess5}.
The operations $\mathcal{OP}1$ and $\mathcal{OP}2$ are given in details as Algorithm-\ref{algo_initialguess1} and \ref{algo_initialguess2}.
\begin{algorithm}[h]
\caption{$\mathcal{OP}1:$ Edge deletion}\label{algo_initialguess1}
\begin{algorithmic}[1]
\State \textbf{Input:}\,$\{s,t\}=\textbf{indexmax}\left( \tilde{r}^{d,(n)} \right) $, $\Gamma_I^{(n)}$, $\mathcal{D}^{(n)} $
\State delete edge $st$, therefore $\mathcal{D}^{(n)}\leftarrow\mathcal{D}^{(n)}\bigcup \left\{st\right\}$
\If {$d_{s}^{(n)} \neq 1 \lor d_{t}^{(n)} \neq 1 $}
\State $r^{(n+1)}{(st)} \leftarrow \infty$
\State Compute $\tilde{r}^d_{s,t}\left(\mathcal{OP}1\right)$ corresponding to $\mathcal{OP}1$
\State Add the edge back, $\therefore$ $\mathcal{D}^{(n)}\leftarrow\mathcal{D}^{(n)} \setminus \left\{st\right\}$.
\If{$\left|\tilde{r}^d_{s,t}\left(\mathcal{OP}1\right)\right|<\left|\tilde{r}^{d,(n)}_{s,t}\right|$}
\State Go to Algorithm-\ref{algo_initialguess2}
\Else
\State Operation $\mathcal{OP}1$ is an \emph{invalid operation}.
\State Add the edge back, $\therefore$ $\mathcal{D}^{(n)}\leftarrow\mathcal{D}^{(n)} \setminus \left\{st\right\}$.
\State $r^{(n+1)}{(st)} \leftarrow r^{(n)}{(st)}$.
\State Compute $\tilde{r}^d_{s,t}\left(\mathcal{OP}1\right)$ and go to Algorithm-3.
%\State Go to Algorithm-\ref{algo_initialguess2}.
\EndIf
\Else
\State Add the edge back, $\therefore$ $\mathcal{D}^{(n)}\leftarrow\mathcal{D}^{(n)} \setminus \left\{st\right\}$.
\State $\tilde{r}^d_{s,t}\left(\mathcal{OP}1\right) \leftarrow \tilde{r}^{d,(n)}_{s,t}$ and go to Algorithm-3.
%\State Go to Algorithm-3.
\EndIf \label{endop1}
\end{algorithmic}
\end{algorithm}
\begin{algorithm}[h]
\caption{$\mathcal{OP}2:$ Increase edge resistance by $1\Omega$}\label{algo_initialguess2}
\begin{algorithmic}[1]
\State \textbf{Input:}\,$\{s,t\}=\textbf{indexmax}\left( \tilde{r}^{d,(n)} \right) $, $\Gamma_I^{(n)}$, $\mathcal{D}^{(n)} $
\If {$r^{(n)}{(st)}<r_{max}$}
\State $r^{(n+1)}(st) \leftarrow r^{(n)}(st) + 1\Omega$
\State Compute $\tilde{r}^d_{s,t}\left(\mathcal{OP}2\right)$ corresponding to $\mathcal{OP}2$
\State{$\{\Gamma^{(n+1)}_I, \mathcal{D}^{(n+1)}, A^{(n+1)} \}=\textbf{OPselect}\left(\mathcal{OP}1, \mathcal{OP}2\right)$}{}
\State Find node pair, say $\{s_{1},t_{1}\}$, such that $\{s_1,t_1\}=\textbf{indexmax}\{\tilde{r}^{d,(n+1)}\}$, and $s_1t_1 \notin \mathcal{D}^{(n+1)}$.
\State Go to step \ref{endopx}.
\Else
\State Implement $\mathcal{OP}1$, $\therefore$
\State $\Gamma^{(n+1)}_I \leftarrow \Gamma_I^{(n)} \mbox{with committed operation}\,\mathcal{OP}1$
\State $\mathcal
{D}^{(n+1)} \& A^{(n+1)} \leftarrow \mbox{Update}\,\mathcal
{D}^{(n)} \& A^{(n)}$.
\State Find node pair, say $\{s_{1},t_{1}\}$, such that $\{s_1,t_1\}=\textbf{indexmax}\{\tilde{r}^{d,(n+1)}\}$, and $s_1t_1 \notin \mathcal{D}^{(n+1)}$.
\EndIf \label{endopx}
\end{algorithmic}
\end{algorithm}
\begin{algorithm}[h]
\caption{Selecting an operation among $\left(\mathcal{OP}1, \mathcal{OP}2\right)$}\label{algo_initialguess5}
\begin{algorithmic}[1]
\State \textbf{Input:} $\tilde{r}^d_{s,t}\left(\mathcal{OP}2\right)$, $\tilde{r}^d_{s,t}\left(\mathcal{OP}1\right), \tilde{r}^{d,(n+1)}_{s,t}$
\State \textbf{Output:} $\Gamma^{(n+1)}_I$, $\mathcal
{D}^{(n+1)}$ and $A^{(n+1)}$
\Function {$\textbf{OPselect}\left(\mathcal{OP}1, \mathcal{OP}2\right)$}{}
\If{$\left|\tilde{r}^d_{s,t}\left(\mathcal{OP}2\right)\right|<\left|\tilde{r}^{d,(n+1)}_{s,t}\right| \land \left|\tilde{r}^d_{s,t}\left(\mathcal{OP}1\right)\right|<\left|\tilde{r}^{d,(n+1)}_{s,t}\right|$}
\State Choose and commit an operation which results in $\min{\left\{|\tilde{r}^d_{s,t}\left(\mathcal{OP}1\right)|, |\tilde{r}^d_{s,t}\left(\mathcal{OP}2\right)|\right\}}$
\ElsIf{$\left|\tilde{r}^d_{s,t}\left(\mathcal{OP}2\right)\right|<\left|\tilde{r}^{d,(n+1)}_{s,t}\right| \land \left|\tilde{r}^d_{s,t}\left(\mathcal{OP}1\right)\right|>\left|\tilde{r}^{d,(n+1)}_{s,t}\right|$}
\State Choose operation $\mathcal{OP}2$
\ElsIf{$\left|\tilde{r}^d_{s,t}\left(\mathcal{OP}2\right)\right|>\left|\tilde{r}^{d,(n+1)}_{s,t}\right| \land \left|\tilde{r}^d_{s,t}\left(\mathcal{OP}1\right)\right|<\left|\tilde{r}^{d,(n+1)}_{s,t}\right|$}
\State Choose operation $\mathcal{OP}1$
\Else
\State Go to step-\ref{step13}
\EndIf \label{endfun}
\State $\Gamma^{(n+1)}_I \leftarrow \Gamma_I^{(n)} \mbox{with committed operation}$\label{step13}
\State $\mathcal
{D}^{(n+1)}_I \& A^{(n+1)}_I \leftarrow \mbox{Update}\,\mathcal
{D}^{(n)} \& A^{(n)}$.
%\State Go to step \ref{endfun}.
\State \Return $\Gamma_I^{(n+1)}, \mathcal
{D}^{(n+1)}, A^{(n+1)}$
\EndFunction
\end{algorithmic}
\end{algorithm}
\\\noindent \textbf{Case-2:}\,If $\tilde{r}^{d,(n)}_{s,t}<0$ and $st \notin \mathcal{E}_I^{(n)}$, then choose another node pair $s_1,t_1 \in \mathcal{V_B}, \mbox{and}\, s_1t_1 \in \mathcal{E}_I^{(n)}$, across which next maximum absolute resistance distance error occurs. Then, check the sign of $\tilde{r}^{d,(n)}_{s,t}$ to decide an operation to commit.\\
\textbf{Case-3:}\,Now, if $\tilde{r}^{d,(n)}_{s,t}>0 \land st \notin \mathcal{E}_I^{(n)}$, then add an edge $st$ with edge resistance $r^{(n)}(st)=1\Omega$. Edge addition operation for case-$3$ is called as $\mathcal{OP}3$ and is given as Algorithm \ref{algo_initialguess3} $\left(\mbox{at}\,n^{th}\,\mbox{iteration} \right)$. Let $\tilde{r}^d_{s,t}\left(\mathcal{OP}3\right)$ be the resultant resistance distance after committing an operation $\mathcal{OP}3$, if $|\tilde{r}^d_{s,t}\left(\mathcal{OP}3\right)|>|\tilde{r}^{d,(n)}_{s,t}|$ then $\mathcal{OP}3$ is an invalid operation. In case of invalid operation $\mathcal{OP}3$, find another node pair, say $s_1,t_1$, such that $\{s_1,t_1\}=\textbf{indexmax}\left( \tilde{r}^{d,(n)} \right)$.
\begin{algorithm}[h]
\caption{$\mathcal{OP}3:$ Edge addition}\label{algo_initialguess3}
\begin{algorithmic}[1]
\State \textbf{Input:}\, Index $\left\lbrace s,t \right\rbrace $, $\Gamma_I^{(n)}$, $A^{(n)} $
\If {$ \tilde{r}^{d,(n)}_{s,t}>0$}
\If{$st \notin \mathcal{E}_I^{(n)}$}
\State add edge $st$ with $r^{(n)}(st)=1\Omega$ , $\therefore$ $A^{(n+1)}\leftarrow A^{(n)}\bigcup \left\{st\right\}$
\State Compute $\tilde{r}^d_{s,t}\left(\mathcal{OP}3\right)$
\If{$\left|\tilde{r}^d_{s,t}\left(\mathcal{OP}3\right)\right|<\left|\tilde{r}^{d,(n)}_{s,t}\right|$}
\State Choose operation $\mathcal{OP}3$
\State $\Gamma^{(n+1)}_I \leftarrow \Gamma_I^{(n)} \mbox{with committed operation}\,\mathcal{OP}3$
\State $\mathcal
{D}^{(n+1)} \& A^{(n+1)} \leftarrow \mbox{Update}\,\mathcal
{D}^{(n)} \& A^{(n)}$.
\State Compute $\tilde{r}^{d,(n+1)}$ and find node pair, say $s_1,t_1$, such that $\{s_1,t_1\}=\textbf{indexmax}\{\tilde{r}^{d,(n+1)}\}$.
\State Go to Step \ref{endop3}
\Else
\State Operation $\mathcal{OP}3$ is an \emph{invalid operation}.
\State Remove added edge, $A^{(n+1)}\leftarrow A^{(n+1)} \setminus \left\{st\right\}$
\State $\Gamma^{(n+1)}_I \leftarrow \Gamma_I^{(n)}$
\State $\mathcal
{D}^{(n+1)} \& A^{(n+1)} \leftarrow \mbox{Update}\,\mathcal
{D}^{(n)} \& A^{(n)}$.
\State Find another node pair, say $\{s_{1},t_{1}\}$, such that $\{s_1,t_1\}=\textbf{indexmax}\{\tilde{r}^{d,(n)}\}$, and $s_1t_1 \notin \mathcal{D}^{(n)}$.
\State Go to step \ref{endop3}.
\EndIf
\Else
\State Go to Algorithm-\ref{algo_initialguess4}
\EndIf
\Else
\State Implement $\{\mathcal{OP}1,\mathcal{OP}2\}$
\EndIf \label{endop3}
\end{algorithmic}
\end{algorithm}
\\\noindent \textbf{Case-4:} If $\tilde{r}^{d,(n)}_{s,t}>0 \land st \in \mathcal{E}_I^{(n)}$, then reduce the edge resistance $r^{(n)}(st)$ by $1\Omega$. Edge addition operation for case-$4$ is called as $\mathcal{OP}4$ and is given as algorithm \ref{algo_initialguess4}.\\
\begin{algorithm}[h]
\caption{$\mathcal{OP}4:$ Decreasing edge resistance value by $1\Omega$}\label{algo_initialguess4}
\begin{algorithmic}[1]
\If {$st \in \mathcal{E}_I^{(n)} \land r^{(n-1)}(st)\ge2\Omega$}
\State $r^{(n+1)}(st) \leftarrow r^{(n)}(st) -1\Omega$
\State Compute $\tilde{r}^d_{s,t}\left(\mathcal{OP}4\right)$ corresponding to $\mathcal{OP}4$
\If{$\left|\tilde{r}^d_{s,t}\left(\mathcal{OP}4\right)\right|<\left|\tilde{r}^{d,(n)}_{s,t}\right|$}
\State Choose operation $\mathcal{OP}4$
\State $\Gamma^{(n+1)}_I \leftarrow \Gamma_I^{(n)} \mbox{with committed operation}\,\mathcal{OP}4$
%\State $\mathcal
%{D}^{(n+1)} \& A^{(n+1)} \leftarrow \mbox{Update}\,\mathcal
%{D}^{(n)} \& A^{(n)}$.
\State Compute set $\tilde{r}^{d,(n+1)}$ and find node pair, say $s_1,t_1$, such that $\{s_1,t_1\}=\textbf{indexmax}\{\tilde{r}^{d,(n+1)}\}$.
\State Go to step \ref{endop4}
\Else
\State $\mathcal{OP}4$ is an \emph{invalid operation}.
\State $r^{(n+1)}(st) \leftarrow r^{(n)}(st)$
\State $\Gamma^{(n+1)}_I \leftarrow \Gamma_I^{(n)}$
\State Find another node pair, say $\{s_{1},t_{1}\}$, such that $\{s_1,t_1\}=\textbf{indexmax}\{\tilde{r}^{d,(n)}\}$, and $s_1t_1 \notin \mathcal{D}^{(n)}$.
\State Go to step \ref{endop4}.
\EndIf
\Else
\State Find another node pair, say $\{s_{1},t_{1}\}$, such that $\{s_1,t_1\}=\textbf{indexmax}\{\tilde{r}^{d,(n)}\}$, and $s_1t_1 \notin \mathcal{D}^{(n)}$.
\EndIf \label{endop4}
\end{algorithmic}
\end{algorithm}
If both $\mathcal{OP}3$ and $\mathcal{OP}4$ are invalid operations, find another pair $s_1,t_1 \in \mathcal{V_B}$ across which next minimum absolute resistance distance error occurs.\\
\indent For every computed node pair across which maximum absolute resistance distance error occurs the sign of corresponding resistance distance error is checked and accordingly operations $\left\{\mathcal{OP}1,\mathcal{OP}2\right\}$ or $\left\{\mathcal{OP}3,\mathcal{OP}4\right\}$ is carried out. \emph{Iterations are carried out till the resistance distance errors in set $\tilde{r}^{d,(n)} \le \epsilon$}, i.e. eventually the resistance distance errors in set $\tilde{r}^{d,(n)}$ does not change significantly. The bound $\epsilon$ can also chosen based on users experience or trial and error. Let the algorithm stops at $n_1$ iteration, then the corresponding network $\Gamma_I^{(n_1)}=\left(\mathcal{G}_I^{(n_1)}, \gamma^{(n_1)}\right)$ is transformed into a $MPRSN$, wherein each edges $ij \in \mathcal{E}_I^{(n_1)}$ is converted to $\mathcal{C}_{ij}$ with appropriate switch positions. Then, the switch positions or the initial guess $\rho^{(0)}$ are extracted from this $MPRSN$.
\begin{comment}
Here, $\Gamma_I^{(n)}$ is a network at $n^{th}$ iteration, $\mathcal{D}^{(n)}$ and $A^{(n)}$ is set of edges deleted and added at $n^{(th)}$ iteration and $\mathcal{L}\left(\Gamma_I^{n}\right)$ is the corresponding Laplacian matrix. At $n^{th}$ iteration, algorithm,
\begin{itemize}
\item identifies node pair across which maximum absolute resistance distance error occurs. Let, such node pair be $s,t \in \mathcal{V_B}$. Then, algorithm checks whether $st \in \left(\mathcal{E}^{max}\setminus \mathcal{D}^{(n-1)}\right)\bigcup A^{(n-1)}$. If this is not true, then node pair corresponding to next maximum absolute resistance distance error is chosen.
\item If $\tilde{r}^{(d)}_{s,t}<0$, then remove or increase the edge resistance $r^{(n-1)}(st)$ by $\delta$, otherwise decrease $r^{(n-1)}(st)$ by $\delta$.
\item Then, algorithm checks whether edge $st$ is a dangling edge, i.e., if
$d^{(n-1)}_s$ or $d^{(n-1)}_t$ is equal to $1$. If
\item If the above conditions are true,
\end{itemize}
Let $s$ and $t$ be such nodes. Then algorithm checks whether the edge resistance at $(n-1)^{th}$ iteration, i.e., $r^{(n-1)}(\mathcal{C}_{st}) < r_{max}$. If this is true, we increase the edge resistance across $s,t$ by $1\Omega$. In each iteration, $r^{d}\left(\Gamma_m^{(n)}\right)$ changes, one must make sure that the resistance distances in $r^{d}\left(\Gamma_m^{(n)}\right)$ must confirm to the triangle inequality $\Delta$ and the Kalmansons inequality $\mathcal{K}$. Therefore, the algorithm at each iterations checks whether the resultant resistance distances in $r^{d}\left(\Gamma_m^{(n)}\right)$ satisfy $\Delta$ and $\mathcal{K}$. Therefore, let $\Delta^{(n)}$ and $\mathcal{K}^{(n)}$ to be the set of triangle and Kalmansons inequality at $n^{th}$ iteration, defined on all boundary nodes $\mathcal{V_B}$. The algorithm is run until the resistance distance errors $\tilde{r}^{d,(n)}_{i,k} < \epsilon, \forall \, i,k \in \mathcal{A}$, where $\epsilon$ is chosen based on hit and trial method. The pseudocode of the algorithm is given as Algorithm-\ref{algo_initialguess}.
In Algorithm-\ref{algo_initialguess}, function $\textbf{indexmax}$ outputs node pairs across which maximum error resistance distance occurs.
The term $r^{(n+1)}(st) \gets r^{(n)}(st)+1\Omega$ in step-4 implies to adjust the switch position such that edge resistance across nodes $s$ and $t$ is increased by $1\Omega$. Then, update the Laplacian matrix after switch position changes as done in step-5.
\end{comment}
\section{Modified Auslander, Parter and Goldstein's Algorithm}\label{append:mod_planar}
\noindent Let us begin the algorithm by constructing a palm tree representation $P$. A directed tree $T$ in $P$ is a directed graph with a root vertex such that every vertex in $T$ is reachable from the root vertex, no tree arc enters root vertex and, exactly one tree arc enters every other vertex in $T$. The relation $i \rightarrow^* j$ means there is a path from $i$ to $j$ in $T$. \\
To every vertex in $P$ we associate them with two numbers i.e. \emph{low points}, for example, for $i^{th}$ vertex in $P$, $L_1(i)$ and $L_2(i)$ are two low points. Also, to every edge in $P$, we associate it with an integer through a function $\phi:\hat{\mathcal{E}}_{aux} \rightarrow \mathbf{Z}^{+}$, which is used to order the adjacency list. For detailed description on low points and function $\phi$ refer to \cite{hopcroft1974efficient}, \cite{behrensplanarity}.\\
The cycle $c$ is a sequence of tree arcs and one back edge in $P$. Each segment, not in $c$, can either be a back edge $i \dashedrightarrow j$ or a $i \rightarrow^* j$ adjoined by all back edges emanating from $j$. Let the set of all segments be $\mathbb{S}$. A path in a segment, say $\mathbb{S}_k \in \mathbb{S}$,
is either a single back edge $i_1 \dashedrightarrow j_1$ or a $i_1 \rightarrow^* j_1$ with a back edge emanating from $j_1$. To identify a cycle $c$ and paths in each segments $S$ we use the path finding algorithm. In general, a path finding algorithm identifies paths using DFS and the available adjacency list. To speed up the process the adjacency list is arranged in an increasing order of values $\phi(ij), \forall i,j \in \hat{\mathcal{E}}_{aux}$ \cite{behrensplanarity}.
\begin{figure}[h]
\centering
\includegraphics[scale=0.3]{lcss_palm_compo1.jpg}
\caption{\textbf{a}) Paths generated by path finding algorithm from $P$ in Fig. \ref{fig:palm} are $c$: 1-2-3-4-5-6-1 A: 6-2 B: 6-3 C: 6-4 D: 4-1 E: 5-3 F: 5-2 G: 5-1. \textbf{b}) segments $\mathbb{S}_1$ to $\mathbb{S}_7$ are obtained after deleting initial cycle $c$ from $P$. }
\label{fig:palm_compo}
\end{figure}
The algorithm basically finds an edge based on the ordered adjacency list, and augments it to the current path. If a back edges is encountered during exploration it is added to current path and search is considered complete. The path finding algorithm is given in detail in \cite{hopcroft1974efficient}, \cite{behrensplanarity}. This algorithm is illustrated for an example palm tree $P$ as shown in Fig. \ref{fig:palm_compo}(a). The algorithm constructs a cycle $c$ which is deleted from palm tree $P$. The deletion of $c$ from $P$ leaves behind disconnected segments, as shown in Fig.\ref{fig:palm_compo}(b) for an example. The path finding algorithm is also used for listing paths in segments. Once the structuring and path finding is over, we use this information for testing planarity. Going forward, we will briefly look into planarity testing algorithm.\\
\indent The planarity testing algorithm in general does the following,
\begin{itemize}
\item embed the cycle $c$ on a plane to get $\mathcal{T}(c)$,
\item embed each segment $\mathbb{S}_k \in \mathbb{S}$ i.e. $\mathcal{T}(\mathbb{S}_k)$ one by one on $\mathcal{T}(c)$. In embedding $\mathbb{S}_k$, which is other than a back edge, we apply path finding algorithm on $\mathbb{S}_k$ and generate all paths. Then, \emph{embed each path one after another on $\mathcal{T}(c)$}.
\item Every $\mathcal{T}(\mathbb{S}_k)$ \emph{must go either on the left or right side of $\mathcal{T}(c)$}. When a segment is added to $\mathcal{T}(c)$, certain segments, if needed, are moved from left to right or vice versa to avoid curve crossings. If all $\mathcal{T}(\mathbb{S}_k)$ can be added to $\mathcal{T}(c)$ without any curve crossing, then $\hat{\mathcal{G}}_{aux}$ is said to be planar.
\end{itemize}
For more detailed exposition on planarity testing refer to \cite{hopcroft1974efficient}, for a concise explanation refer to \cite{behrensplanarity}.\\
\indent Further, we explain a modification done on Hopcroft, Tarjan and Goldsteins algorithm to extract planar graphs from a non-planar graph. Let us assume that we have embedded $c$ along with some segments on plane and let $\mathbb{S}_k$ be the segment to be embedded next. Consider a path $p$ in $\mathbb{S}_k$ which is to be embedded on $\mathcal{T}(c)$. The following lemma gives a necessary and sufficient condition for embedding $p$,
\begin{lem}\cite{hopcroft1974efficient}\label{lemma:three}
An embedding of a path from $i_1$ to $j_1$ can be added to $\mathcal{T}(c)$ by placing it on left (right) of $\mathcal{T}(c)$ iff \textbf{no} back edge $l \dashedrightarrow k$ that has already been embedded on left satisfies $j_1<k<i_1$.
\end{lem}
We will therefore use Lemma \ref{lemma:three} to decide whether a graph is planar. Now, choose a side $\left(\mbox{left or right}\right)$ in $\mathcal{T}(c)$ where $\mathcal{T}\left(p\right)$ is to be placed. Let $\mathcal{T}\left(p\right)$ is placed on the left of $\mathcal{T}(c)$. Check whether $\mathcal{T}(p)$ satisfies Lemma \ref{lemma:three}. If it does not satisfy Lemma \ref{lemma:three}, it means that there is a crossing. Therefore, to avoid crossings, move some already embedded segments on the left side to the right side of $\mathcal{T}(c)$. Again, check whether $\mathcal{T}(p)$ satisfies Lemma \ref{lemma:three}. If it satisfies Lemma \ref{lemma:three}, embed $\mathcal{T}(p)$ on the left side. This strategy is shown in an example in Figure \ref{fig:embed21},
\begin{figure}[h]
\centering
\includegraphics[scale=0.25]{lcss_path_embed2.jpg}
\caption{Consider embedding segments $\mathbb{S}_4$ on left side of $\mathcal
T(c)$, it is seen that Lemma \ref{lemma:three} does not satisfy. Therefore, \textbf{shift some already embedded segments (on left), i.e., $\mathbb{S}_1, \mathbb{S}_2, \mathbb{S}_3$} to the right side of $\mathcal{T}(c)$ to preserve planarity. }
\label{fig:embed21}
\end{figure}
\noindent Similarly, we embed each path of $\mathbb{S}_k$ one by one to completely place $\mathcal{T}(\mathbb{S}_k)$ on one side of $\mathcal{T}(c)$. We then move on to embedding the next segment.\\
\indent To implement the placement of paths, Hopcroft and Tarjan\cite{hopcroft1974efficient} proposed the usage of data structure stack $L$ and $R$ to save the position of paths and segments during execution. The stack
$L$ stores all the vertices $i_k$ such that $1 \rightarrow^* i_k \rightarrow^* i_1$, $1 < i_k < i_1$ and some embedded back edge enters $i_k$ from left. Stack $R$ is defined similarly wherein back edges enter $i_k$ from the right. Implementation of stack $L$ and $R$ is shown in an example in Figure \ref{fig:embed21}.
\begin{comment}
Let us understand the data structure by considering an example in Fig.\ref{fig:palm_compo}. Here, cycle $c$ is embedded on plane which is represented as $\mathcal{T}(c)$, then the embedding $\mathcal{T}(S_1)$, $\mathcal{T}(S_2)$ and $\mathcal{T}(S_3)$ are placed one after another in a given order on left side of $\mathcal{T}(c)$ without crossings, as shown in Fig.\ref{fig:embed1}. The corresponding $L$ and $R$ is also listed in Fig.\ref{fig:embed1}. Since the entries of $L$ are in descending order, the embeddings satisfy Lemma \ref{lemma:three}, and therefore there are no crossings. Hence, the embedding is planar till this point.
\begin{figure}[H]
\centering
\includegraphics[scale=0.25]{lcss_path_embed1.jpg}
\caption{Embedding segments $S_1$, $S_2$, $S_3$ on left side of $\mathcal
T(c)$.}
\label{fig:embed1}
\end{figure}
Now, consider segment $S_4$ to be embedded next. Let $\mathcal{T}(S_4)$ be placed on the left side of $\mathcal{T}(c)$ as shown in Fig.\ref{fig:embed2}, the corresponding back edge head index i.e. 1, is placed on the top of stack $L$. The entries in $L$ are not in descending order, i.e., $1<4$, $1<3$, $1<2$ and hence Lemma \ref{lemma:three} does not satisfy. Therefore, check whether moving some already embedded segments in left to the right of $\mathcal{T}(c)$ helps satisfy Lemma \ref{lemma:three}, as shown in Fig.\ref{fig:embed2}. Moving $\mathcal{T}(S_1)$, $\mathcal{T}(S_2)$ \& $\mathcal{T}(S_3)$ to the right side of $\mathcal{T}(c)$ helps satisfy the Lemma \ref{lemma:three}.
\begin{figure}[H]
\centering
\includegraphics[scale=0.25]{lcss_path_embed2.jpg}
\caption{Embedding segments $S_4$ on left side of $\mathcal
T(c)$ and shifting segments $S_1, S_2, S_3$ on the right side of $\mathcal{T}(c)$ to preserve planarity. }
\label{fig:embed2}
\end{figure}
\end{comment}
Consider a case of embedding a path, say $\Bar{p}$, of some segment on the left side of $\mathcal{T}(c)$. Update the stacks $L$ and $R$ appropriately and check that the embedding satisfies Lemma \ref{lemma:three}. If it does not satisfy, it means that the embeddings of segments are crossing on the left side. Therefore, shift appropriate segment from left to the right of $\mathcal{T}(c)$ to avoid crossings on left side, and update the entries in $L$ and $R$. Again check whether Lemma \ref{lemma:three} is satisfied on the right side of $\mathcal{T}(c)$. If it does not satisfy then we say that the graph $\hat{\mathcal{G}}_{aux}$ is non planar. At this stage, we extract planar graphs from a non planar graph. The embedding $\mathcal{T}(\Bar{p})$ cannot be placed either on the left or the right side of $\mathcal{T}(c)$. Therefore,
\vspace{-\topsep}
\begin{itemize}
\item first place $\mathcal{T}(\Bar{p})$ on the left side of $\mathcal{T}(c)$ and update stack $L$.
\item Find all the instances where the already embedded back edges violate lemma \ref{lemma:three}. We call such back edges as blocking segments and remaining segments as non blocking segments.
\item The $\mathcal{T}(\Bar{p})$ and blocking segments cannot stay on the left side of $\mathcal{T}(c)$ for maintaining planarity. We therefore construct two planar embeddings, one comprising of $\mathcal{T}(\Bar{p})$ and all non blocking segments and, other containing only blocking segments and non blocking segments.
\item Then, check whether all the edges of $\mathcal{E}_{aux}$ are present in the constructed planar embeddings. If not, reject that planar embedding from further analysis.
\end{itemize}
\vspace{-\topsep}
The above procedure can be understood from an example in Figure \ref{fig:embed6}, wherein embedding $\mathcal{T}(\mathbb{S}_7)$ leads to non planarity. On the left side, the blocking segments are $\left\{\mathcal{T}(\mathbb{S}_5),\mathcal{T}(\mathbb{S}_6)\right\}$ and all remaining segments are called the non blocking segments with respect to $\mathcal{T}(\mathbb{S}_7)$. Both planar embeddings are shown in Fig.\ref{fig:embed7}.
\begin{figure}[h]
\centering
\includegraphics[scale=0.25]{lcss_path_embed6.jpg}
\caption{Place the segment $\mathbb{S}_7$ on both left and right side of $\mathcal{T}(c)$ and find the blocking segments.}
\label{fig:embed6}
\end{figure}
\begin{figure}[h]
\centering
\includegraphics[scale=0.25]{lcss_path_embed7.jpg}
\caption{Embedding of $\mathcal{G}$, $\mathcal{T(G)}$}
\label{fig:embed7}
\end{figure}
Now, for each planar embeddings check whether all the edges of $\mathcal{E}_{aux}$ are present in it. If not, reject that planar graph from further analysis. In Fig.\ref{fig:embed7}(b) the edge $41 \in \mathcal{E}_{aux}$ is not present, therefore it is not considered for further analysis.
Similarly place $\mathcal{T}(\mathbb{S}_7)$ on the right side of $\mathcal{T}(c)$ as shown in Fig.\ref{fig:embed6} (b). Find the blocking and non blocking edges with respect to the $\mathcal{T}(\mathbb{S}_7)$. The segments $\{\mathcal{T}(\mathbb{S}_2), \mathcal{T}(\mathbb{S}_1)\}$ are the blocking segments. The planar embeddings corresponding to this is shown in Fig.\ref{fig:embed8}
\begin{figure}[h]
\centering
\includegraphics[scale=0.25]{lcss_path_embed8.jpg}
\caption{Embedding of $\mathcal{G}$, $\mathcal{T(G)}$}
\label{fig:embed8}
\end{figure}
\noindent A generalised algorithm is given in Algorithm \ref{alg:planar_nplanar}. Every time a path is to be embedded Algorithm \ref{alg:planar_nplanar} is invoked.
%\algsetup{linenodelimiter=.}
\begin{algorithm}[H]
\caption{Constructing planar embeddings from a non embedding}\label{alg:planar_nplanar}
\begin{algorithmic}[1]
\State \textbf{Input:} $c$, $\mathbb{S}_j$.
\State \textbf{Output:} Set of admissible planar embeddings.
\Require $L^{(1)}$ \& $R^{(1)}$ are empty stack,
%\For {$j \le |S_i|$}
\State Compute all paths in segment $\mathbb{S}_j$
\For {$i \le \mbox{total number of paths in}\,\mathbb{S}_j$}
\State {place $\mathcal{T}(p_i)$ on $\mathcal{T}(c)$ along with already embedded segments. Where $p_i$ is $i^{th}$ path in $\mathbb{S}_j$.}
\If {\texttt{embedding is planar}}
%\State Place $\mathcal{T}(p_i)$ on $\mathcal{T}(c)$ appropriately
\State {$L^{(i)}\leftarrow \mbox{Update}\,L^{(i-1)}$ and $R^{(i)}\leftarrow\mbox{Update}\,R^{(i-1)}$}
\Else
\State Place $\mathcal{T}(p_i)$ on left side of $\mathcal{T}(c)$
\State {Update $L^{(i-1)}$ and $R^{(i-1)}$ to construct $L^{(i)}$ and $R^{(i)}$} \vspace{0.1cm}
\State Find blocking segments \vspace{0.1cm}
\State {Construct planar embeddings wherein embedding of blocking segments and $\mathcal{T}(p_i)$ are not together.}\vspace{0.1cm}
\State {Check whether all the edges in $\mathcal{E}_{aux}$ are contained in the constructed planar embeddings. If not, reject such planar embeddings from further analysis.}\vspace{0.1cm}
\State {Now, delete $\mathcal{T}(p_i)$ on the left side and place $\mathcal{T}(p_i)$ on right side of $\mathcal{T}(c)$}\vspace{0.1cm}
\State {Update $L^{(i-1)}$ and $R^{(i-1)}$ to construct $L^{(i)}$ and $R^{(i)}$}\vspace{0.1cm}
\State Find blocking segments\vspace{0.1cm}
\State {Construct planar embeddings wherein embedding of blocking segments and $\mathcal{T}(p_i)$ are not together}\vspace{0.1cm}
\State {Check whether all the edges in $\mathcal{E}_{aux}$ are contained in the constructed planar embeddings. If not, reject such planar embeddings from further analysis.}\vspace{0.1cm}
\EndIf
\State $i \leftarrow i+1$
%\Until{$i \le \mbox{Total number of paths in}$ $S_i$}
\EndFor
\State Construct a set of admissible planar embeddings.
%\EndFor
\end{algorithmic}
\end{algorithm}
\end{document}
\end{document}
\begin{thebibliography}{10}
\expandafter\ifx\csname url\endcsname\relax
\def\url#1{\texttt{#1}}\fi
\expandafter\ifx\csname urlprefix\endcsname\relax\def\urlprefix{URL }\fi
\expandafter\ifx\csname href\endcsname\relax
\def\href#1#2{#2} \def\path#1{#1}\fi
\bibitem{akbaba2022electric}
M.~Akbaba, O.~Dakkak, B.-S. Kim, A.~Cora, S.~A. Nor, Electric circuit-based modeling and analysis of the translational, rotational mechanical and electromechanical systems dynamics, IEEE Access 10 (2022) 67338--67349.
\bibitem{gomez2012modeling}
F.~Gomez, J.~Bernal, J.~Rosales, T.~Cordova, Modeling and simulation of equivalent circuits in description of biological systems-a fractional calculus approach, Journal of Electrical Bioimpedance 3~(1) (2012) 2--11.
\bibitem{veldman2015towards}
F.~Veldman-de Roo, A.~Tejada, H.~van Waarde, H.~L. Trentelman, Towards observer-based fault detection and isolation for branched water distribution networks without cycles, in: 2015 European Control Conference (ECC), IEEE, 2015, pp. 3280--3285.
\bibitem{jirkuu2019resistor}
J.~Jirkuu, J.~Vilhelm, Resistor network as modeling tool for fracture detection in crystalline rocks., Acta Geodynamica et Geomaterialia 16~(4) (2019).
\bibitem{lundstrom2022resistor}
F.~Lundstrom, K.~Frogner, M.~Andersson, A resistor network model for analysis of current and temperature distribution in carbon fibre reinforced polymers during induction heating, Journal of Composite Materials 56~(20) (2022) 3159--3183.
\bibitem{zhao2023measuring}
Y.~Zhao, C.~K. Khaw, Y.~Wang, Measuring a soft resistive strain sensor array by solving the resistor network inverse problem, in: 2023 IEEE International Conference on Soft Robotics (RoboSoft), IEEE, 2023, pp. 1--7.
\bibitem{cheianov2007random}
V.~V. Cheianov, V.~I. Fal’ko, B.~L. Altshuler, I.~L. Aleiner, Random resistor network model of minimal conductivity in graphene, Physical review letters 99~(17) (2007) 176801.
\bibitem{rocco2022exponential}
R.~Rocco, J.~del Valle, H.~Navarro, P.~Salev, I.~K. Schuller, M.~Rozenberg, Exponential escape rate of filamentary incubation in mott spiking neurons, Physical Review Applied 17~(2) (2022) 024028.
\bibitem{zhu2006network}
J.~Zhu, A.~Jabini, K.~Golden, H.~Eicken, M.~Morris, A network model for fluid transport through sea ice, Annals of Glaciology 44 (2006) 129--133.
\bibitem{forcey2020phylogenetic}
S.~Forcey, D.~Scalzo, Phylogenetic networks as circuits with resistance distance, Frontiers in Genetics 11 (2020) 586664.
\bibitem{dorfler2012kron}
F.~Dorfler, F.~Bullo, Kron reduction of graphs with applications to electrical networks, IEEE Transactions on Circuits and Systems I: Regular Papers 60~(1) (2012) 150--163.
\bibitem{curtis1994finding}
E.~Curtis, E.~Mooers, J.~Morrow, Finding the conductors in circular networks from boundary measurements, ESAIM: Mathematical Modelling and Numerical Analysis 28~(7) (1994) 781--814.
\bibitem{curtis1990determining}
E.~B. Curtis, J.~A. Morrow, Determining the resistors in a network, SIAM Journal on Applied Mathematics 50~(3) (1990) 918--930.
\bibitem{curtis2000inverse}
E.~B. Curtis, J.~A. Morrow, Inverse problems for electrical networks, Vol.~13, World Scientific, 2000.
\bibitem{ghosh2008minimizing}
A.~Ghosh, S.~Boyd, A.~Saberi, Minimizing effective resistance of a graph, SIAM review 50~(1) (2008) 37--66.
\bibitem{moffat2019unsupervised}
K.~Moffat, M.~Bariya, A.~Von~Meier, Unsupervised impedance and topology estimation of distribution networks—limitations and tools, IEEE Transactions on Smart Grid 11~(1) (2019) 846--856.
\bibitem{soumalas2017data}
K.~Soumalas, G.~Messinis, N.~Hatziargyriou, A data driven approach to distribution network topology identification, in: 2017 IEEE Manchester PowerTech, IEEE, 2017, pp. 1--6.
\bibitem{van2021topology}
H.~J. van Waarde, P.~Tesi, M.~K. Camlibel, Topology identification of heterogeneous networks: Identifiability and reconstruction, Automatica 123 (2021) 109331.
\bibitem{nabi2012network}
M.~Nabi-Abdolyousefi, M.~Mesbahi, Network identification via node knockout, IEEE Transactions on Automatic Control 57~(12) (2012) 3214--3219.
\bibitem{sanandaji2011exact}
B.~M. Sanandaji, T.~L. Vincent, M.~B. Wakin, Exact topology identification of large-scale interconnected dynamical systems from compressive observations, in: Proceedings of the 2011 American Control Conference, IEEE, 2011, pp. 649--656.
\bibitem{materassi2012problem}
D.~Materassi, M.~V. Salapaka, On the problem of reconstructing an unknown topology via locality properties of the wiener filter, IEEE transactions on automatic control 57~(7) (2012) 1765--1777.
\bibitem{biradar2023topology}
S.~Biradar, D.~U. Patil, Topology reconstruction of a circular planar resistor network, in: 2023 European Control Conference (ECC), IEEE, 2023, pp. 1--6.
\bibitem{cox1994ideals}
D.~Cox, J.~Little, D.~O'Shea, M.~Sweedler, Ideals, varieties, and algorithms, American Mathematical Monthly 101~(6) (1994) 582--586.
\bibitem{biradar2022topology}
S.~Biradar, D.~U. Patil, Topology reconstruction of a resistive network with limited boundary measurements, in: 2022 Eighth Indian Control Conference (ICC), IEEE, 2022, pp. 379--384.
\bibitem{hopcroft1974efficient}
J.~Hopcroft, R.~Tarjan, Efficient planarity testing, Journal of the ACM (JACM) 21~(4) (1974) 549--568.
\bibitem{christiano2011electrical}
P.~Christiano, J.~A. Kelner, A.~Madry, D.~A. Spielman, S.-H. Teng, Electrical flows, laplacian systems, and faster approximation of maximum flow in undirected graphs, in: Proceedings of the forty-third annual ACM symposium on Theory of computing, 2011, pp. 273--282.
\bibitem{choi2019resistance}
M.~C. Choi, On resistance distance of markov chain and its sum rules, Linear Algebra and its Applications 571 (2019) 14--25.
\bibitem{nishizeki2004planar}
T.~Nishizeki, M.~S. Rahman, Planar graph drawing, Vol.~12, World Scientific, 2004.
\bibitem{shen2016disciplined}
X.~Shen, S.~Diamond, Y.~Gu, S.~Boyd, Disciplined convex-concave programming, in: 2016 IEEE 55th conference on decision and control (CDC), IEEE, 2016, pp. 1009--1014.
\bibitem{lipp2016variations}
T.~Lipp, S.~Boyd, Variations and extension of the convex--concave procedure, Optimization and Engineering 17 (2016) 263--287.
\bibitem{boros2002pseudo}
E.~Boros, P.~L. Hammer, Pseudo-boolean optimization, Discrete applied mathematics 123~(1-3) (2002) 155--225.
\bibitem{tarjan1972depth}
R.~Tarjan, Depth-first search and linear graph algorithms, SIAM journal on computing 1~(2) (1972) 146--160.
\bibitem{auslander1961psv}
L.~Auslander, Psv on imbedding graphs in the plane, Journal of Mathematics and Mechanics 10~(3) (1961) 517--523.
\bibitem{goldstein1963efficient}
A.~Goldstein, An efficient and constructive algorithm for testing whether a graph can be embedded in a plane, in: Graph and Combinatorics Conference, Contract No. NONR 1858-(21), Office of Naval Research Logistics Proj., Dept. of Mathematics, Princeton University, May 16-18, 1963.
\bibitem{tutte1962census}
W.~T. Tutte, A census of planar triangulations, Canadian Journal of Mathematics 14 (1962) 21--38.
\bibitem{bianchi2013bounds}
M.~Bianchi, A.~Cornaro, J.~L. Palacios, A.~Torriero, Bounds for the kirchhoff index via majorization techniques, Journal of mathematical chemistry 51~(2) (2013) 569--587.
\bibitem{fedorov2013theory}
V.~V. Fedorov, Theory of optimal experiments, Elsevier, 2013.
\bibitem{behrensplanarity}
K.~Behrens, Planarity testing--the efficient way?
\end{thebibliography}