Graph theory remap and fix