Tweak graph algorithms