Updating my graph layout algorithm