The regularity lemma of Szemereédi asserts that every graph can be partitioned in a certain regular way. This result has numerous applications, but its known proof is not algorithmic. Here we first demonstrate the computational difficulty of finding a regular partition; we show that deciding if a given partition of an input graph satisfies the properties guaranteed by the lemma is co-NP-complete. However, we also prove that despite this difficulty the lemma can be made constructive; we show how to obtain, for any input graph, a partition with the properties guaranteed by the lemma, efficiently. The desired partition, for an n-vertex graph, can be found in time O(M(n)), where M(n) = O(n2.376) is the time needed to multiply two n by n matrices with 0, 1-entries over the integers. The algorithm can be parallelized and implemented in NC1. Besides the curious phenomenon of exhibiting a natural problem in which the search for a solution is easy whereas the decision if a given instance is a solution is difficult (if P and NP differ), our constructive version of the regularity lemma supplies efficient sequential and parallel algorithms for many problems, some of which are naturally motivated by the study of various graph embedding and graph coloring problems.