Let \(\textrm{R}\) be a real closed field and \(\textrm{C}\) the algebraic closure of \(\textrm{R}\) . We give an algorithm for computing a semi-algebraic basis for the first homology group, \(\textrm{H}_1(S,{\mathbb {F}})\) , with coefficients in a field \({\mathbb {F}}\) , of any given semi-algebraic set \(S \subset \textrm{R}^k\) defined by a closed formula. The complexity of the algorithm is bounded singly exponentially. More precisely, if the given quantifier-free formula involves s polynomials whose degrees are bounded by d, the complexity of the algorithm is bounded by \((s d)^{k^{O(1)}}\) . This algorithm generalizes well known algorithms having singly exponential complexity for computing a semi-algebraic basis of the zeroth homology group of semi-algebraic sets, which is equivalent to the problem of computing a set of points meeting every semi-algebraically connected component of the given semi-algebraic set at a unique point. It is not known how to compute such a basis for the higher homology groups with singly exponential complexity. As an intermediate step in our algorithm we construct a semi-algebraic subset \(\Gamma \) of the given semi-algebraic set S, such that \(\textrm{H}_q(S,\Gamma ) = 0\) for \(q=0,1\) . We relate this construction to a basic theorem in complex algebraic geometry stating that for any affine variety X of dimension n, there exists Zariski closed subsets \(\begin{aligned} Z^{(n-1)} \supset \cdots \supset Z^{(1)} \supset Z^{(0)} \end{aligned}\) with \(\dim _\textrm{C}Z^{(i)} \le i\) , and \(\textrm{H}_q(X,Z^{(i)}) = 0\) for \(0 \le q \le i\) . We conjecture a quantitative version of this result in the semi-algebraic category, with X and \(Z^{(i)}\) replaced by closed semi-algebraic sets. We make initial progress on this conjecture by proving the existence of \(Z^{(0)}\) and \(Z^{(1)}\) with complexity bounded singly exponentially (previously, such an algorithm was known only for constructing \(Z^{(0)}\) ).