Optimal Morse functions and H(M,A) in Õ(N) time

In this work, we design a nearly linear time discrete Morse theory based algorithm for computing homology groups of 2-manifolds, thereby establishing the fact that computing homology groups of 2-manifolds is remarkably easy. Unlike previous algorithms of similar flavor, our method works with coefficients from arbitrary abelian groups. Another advantage of our method lies in the fact that our algorithm actually elucidates the topological reason that makes computation on 2-manifolds easy. This is made possible owing to a new simple homotopy based construct that is referred to as \emph{expansion frames}. To being with we obtain an optimal discrete gradient vector field using expansion frames. This is followed by a pseudo-linear time dynamic programming based computation of discrete Morse boundary operator. The efficient design of optimal gradient vector field followed by fast computation of boundary operator affords us near linearity in computation of homology groups. Moreover, we define a new criterion for nearly optimal Morse functions called pseudo-optimality. A Morse function is pseudo-optimal if we can obtain an optimal Morse function from it, simply by means of critical cell cancellations. Using expansion frames, we establish the surprising fact that an arbitrary discrete Morse function on 2-manifolds is pseudo-optimal.