Graph working but too slow