Should I format and upgrade to mavericks or upgrade to mavericks and format?
You could pick this route:


Back-up everything you need
Format your disk (this will format/clean Mountain Lion and all files)
Install a clean version of Mavericks
Put back the files you still need


Why this way? 
Easy, you won't have the old Mountain Lion files on your file system. This results in a clean new environment to start with.
The other methods you described will result in Mavericks on top of Mountain Lion.