Speed up for creating graph statistics

`python graphs.py` now runs in 5m on my home machine.

There are some drawbacks to this method, the main one being that we have
top run all the parts consequentially (and we cannot run them one by one
to test for errors for example). Also, the parts have to be run in the correct
order.

Moreover the information is now stored in a separate database table called
graphs, and hence the corresponding code in stacks-website has to be
modified to make use of this.