Generic graph stuff (no oracle)

Revised version of #42