Encoding, reconstructing and comparing complex evolutionary scenarios