A technique for reconstructing disconnected graphs