The fast solution of three-dimensional eddy current problems is still an open problem, especially when real-size finite element models with millions of degrees of freedom are considered. In order to lower the number of degrees of freedom a magnetic scalar potential can be used in the insulating parts of the model. This may become difficult when the model geometry presents some conductive parts which are multiply connected. In this work a multigrid-based algoritm is proposed that allows for a calculation in linear-time of cohomology, which is needed to introduce the scalar potential without cuts. This algorithm relies on an algebraic multigrid solver for curl-curl field problems, which ensures optimal computational complexity. Numerical resu...