A Boolean algorithm for reconstructing the structure of regulatory networks