circus graph api imrpovement

algo + bugfixes + caching edges + general optimalisations