I am implementing Kruskal's algorithm to find a minimal spanning tree of a connected graph $G$. If $H$ is a subtree of $G$, does anyone know a smart way of checking if $H+e$, where $e$ is an edge of $G$ not in $H$, has a cycle, i.e. is not anymore a tree?
EDIT: $H$ is not necessarily connected.
Ok, so the edge:
$e = (a, b)$
and the subtree:
$H= {T_0, T_1, ..., T_n}$
so let $a_T$ be the component of $H$ containing $a$ and define $b_T$ similarly. We have:
Some of that notation might be a bit unclear, but I think that covers it.