Various graph implementation fixes