Let G be an undirected graph having vertices\({\bf{V = \{ }}{{\bf{v}}_{\bf{1}}}{\bf{,}}{{\bf{v}}_{\bf{2}}}{\bf{,}}......{\bf{,}}{{\bf{v}}_{\bf{n}}}{\bf{\} }}\).
\(\begin{array}{c}{\bf{T = G}}\\{\bf{V = \{ }}{{\bf{v}}_{\bf{1}}}{\bf{,}}{{\bf{v}}_{\bf{2}}}{\bf{,}}......{\bf{,}}{{\bf{v}}_{\bf{n}}}{\bf{\} }}\\{\bf{L = \{ }}{{\bf{v}}_{\bf{1}}}{\bf{\} }}\\{\bf{M = \{ }}{{\bf{v}}_{\bf{1}}}{\bf{\} }}\end{array}\)
\(\begin{array}{c}{\rm{while }}{\bf{L}} \ne {\bf{M}}\\{\rm{if }}{\bf{M = }}\phi ;\forall j = 1{\rm{ to }}n.\\{\rm{if }}{{\bf{v}}_{\bf{j}}} \notin {\bf{L}}{\rm{ then L = L}} \cup \left\{ {{v_j}} \right\}\\{\rm{M = M}} \cup \left\{ {{v_j}} \right\}\\N = \phi \end{array}\)
For every vertex v in M \({\bf{forj = 1ton}}\).
If \({\bf{(}}{{\bf{v}}_{\bf{i}}}{\bf{,}}{{\bf{v}}_{\bf{j}}}{\bf{)}}\) is an edge in G then \({{\bf{v}}_{\bf{j}}} \in L\).
Remove the edge \({\bf{(}}{{\bf{v}}_{\bf{i}}}{\bf{,}}{{\bf{v}}_{\bf{j}}}{\bf{)}}\) from T.
Remove the edge \({\bf{(}}{{\bf{v}}_{\bf{i}}}{\bf{,}}{{\bf{v}}_{\bf{j}}}{\bf{)}}\) from G.
Else remove the edge from the graph G.
\(\begin{array}{c}{\bf{L = L}} \cup {\bf{\{ }}{{\bf{v}}_{\bf{j}}}{\bf{\} }}\\{\bf{N = N}} \cup {\bf{\{ }}{{\bf{v}}_{\bf{j}}}{\bf{\} }}\\{\bf{M = N}}\\{\bf{returnT}}\end{array}\)
Therefore, this is the required algorithm.