clearing adjacency list if unneeded, improving memory management

1 job for master in 2 minutes and 2 seconds (queued for 2 seconds)