---
title: 'Reverse-CGR: Reversible CGR for Sequence Recovery'
url: https://www.emergentmind.com/topics/reverse-cgr-r-cgr
type: topic
---

# Reverse-CGR: Reversible CGR for Sequence Recovery

Reverse-CGR (R-CGR) denotes a set of reversible formulations of Chaos Game Representation for biological sequences. Across recent arXiv literature, the term is used for exact sequence recovery from stored CGR traces, for formal inversion of rational CGR trajectories, and for reconstruction of sequences from Frequency CGR (FCGR) or $k$-mer statistics. In each case, the central objective is to remove the irreversibility of traditional CGR while retaining geometric structure suitable for visualization, feature extraction, and learning [2509.18408] [2604.18477] [2506.22172].

## 1. Conceptual basis and relation to classical CGR

Classical CGR maps a symbolic sequence to a geometric trace in the unit square, or more generally to corner points assigned to alphabet symbols, by iteratively moving toward the corner associated with the current symbol. In the reversible formulations, the same basic update is retained:
$$
p_t = \frac{1}{2}\big(p_{t-1} + c_{\sigma(s_t)}\big),
$$
with initialization at $p_0 = (0,0)$, where $\sigma$ maps a symbol to its corner index and $c_{\sigma(s_t)}$ is the corresponding corner [2604.18477].

The motivation for R-CGR is the irreversibility of standard CGR. Traditional CGR is described as losing the capacity to reconstruct the original sequence from the geometric path; character order and identity are not retrievable once the sequence has been mapped. The literature also identifies practical reasons for this failure: floating-point error accumulates during iteration, exact inversion is hindered, and the difficulty is amplified for larger alphabets such as proteins with $m=20$ symbols [2509.18408] [2604.18477].

This motivates a shift from purely geometric encoding to information-preserving geometric encoding. A plausible implication is that reversibility in this setting is not merely a decoding convenience but a design constraint that changes how corners are assigned, how coordinates are stored, and what auxiliary information is retained.

## 2. Exact reversibility from geometric trajectories

Two closely related but technically distinct reversible constructions appear in the literature. One stores the complete path explicitly. The other proves that exact inversion is possible from the rational trajectory itself.

In the explicit-path formulation, R-CGR augments CGR by storing the entire path trace. At each step, the representation records the current character $s_j$, the previous position $\mathbf{p}_{j-1}$, the new position $\mathbf{p}_j$, and the corner point $C_k$ associated with $s_j$. The trace is
$$
\mathcal{T}(S) = \left\{(s_1,\mathbf{p}_0,\mathbf{p}_1, C_{k_1}), \ldots, (s_n,\mathbf{p}_{n-1},\mathbf{p}_n, C_{k_n})\right\},
$$
and reconstruction is obtained by reading the stored characters in order; this yields exact recovery because character and positional information are preserved stepwise [2509.18408].

A second line of work constructs exact reversibility without storing the character stream separately. The corner set is placed on a rational grid:
$$
q = 2^{\lceil \log_2(4m) \rceil}, \qquad
c_i = \left(\mathrm{round}_q\!\left(\cos \frac{2\pi i}{m}\right), \mathrm{round}_q\!\left(\sin \frac{2\pi i}{m}\right)\right) \in \mathbb{Q}^2,
$$
with $\mathrm{round}_q(x) = \lfloor qx \rfloor / q$. Because the corners are distinct rationals and all arithmetic is exact, the inverse step is
$$
c_{\sigma(s_t)} = 2p_t - p_{t-1}.
$$
The stated theorem gives perfect reconstruction for $k=1$: if $s \in \Sigma^n$, the trajectory $(p_0,\ldots,p_n)$ is given, and $B \geq 2^{n+1}$, then the sequence can be recovered in $O(n)$ time by computing each corner from adjacent points and mapping it back to its unique symbol [2604.18477].

| Formulation | Given representation | Recovery mechanism |
|---|---|---|
| Explicit-path R-CGR | Final point plus path trace $\mathcal{T}$ | Concatenate stored symbols in order |
| Rational-trajectory Reverse-CGR | Exact trajectory $(p_0,\ldots,p_n)$ | Compute $2p_t-p_{t-1}$ and identify the corner |

For $k>1$, the rational inverse is applied to the stream of $k$-mers rather than single symbols; the full sequence is then reconstructed by concatenating overlapping $k$-mers through greedy overlap-extension. The literature states that this is always possible when the $k$-mers form a path in the de Bruijn graph induced by the sequence [2604.18477].

## 3. Multi-scale reversible CGR and hierarchical encoding

The multi-scale extension, termed Multi-Scale Reversible Chaos Game Representation (MS-RCGR), generalizes reversible CGR from single symbols to hierarchical $k$-mer streams. For each scale $k \geq 1$, one defines
$$
\mathbf{w}^{(k)} = (w_1^{(k)}, \ldots, w_{n-k+1}^{(k)}), \qquad
w_t^{(k)} = s_t s_{t+1} \cdots s_{t+k-1},
$$
maps each unique $k$-mer deterministically to a symbol, and applies the same rational CGR process to that stream. The resulting multi-scale encoding is
$$
\mathcal{E}(s) = \{ \mathcal{E}^{(k)}(s) \}_{k \in \mathcal{K}}.
$$
The description in the source states that this permits patterns ranging from individual nucleotides to motif structures of length $4$ to be jointly and losslessly represented [2604.18477].

MS-RCGR is presented as a unified framework spanning three analytical paradigms: traditional machine learning using extracted geometric features, computer vision models operating on CGR-generated images, and hybrid approaches combining protein language model embeddings with CGR features. The reversibility property is used here as a guarantee that the transformation preserves complete sequence information rather than discarding it for feature convenience alone [2604.18477].

This suggests a broader interpretation of Reverse-CGR: not only as a decoder, but as an encoding discipline in which reversibility is maintained across scales, alphabets, and downstream model families.

## 4. Reconstruction from FCGR and $k$-mer statistics

A different use of “Reverse-CGR” appears in reconstruction from FCGR images or $k$-mer frequency vectors. In that setting, the central result is that the FCGR of order $k$ is mathematically equivalent to the $k$-mer frequency vector of the sequence, and that FCGR arises by discretizing CGR at resolution $2^k \times 2^k$. For a sequence $s$ and a $k$-mer $w$, the source states
$$
FCGR_k(s)(i,j) = \text{number of times } w \text{ occurs in } s.
$$
This establishes a bijective mapping between FCGR grid indices and $k$-mers [2506.22172].

The associated reconstruction procedure uses a de Bruijn multigraph. Vertices are the observed $(k-1)$-mers. Each $k$-mer $w = a_1a_2\ldots a_k$ becomes a directed edge from $u = a_1\ldots a_{k-1}$ to $v = a_2\ldots a_k$ with multiplicity equal to its target count $c_w$. Reconstruction then proceeds by finding an Eulerian trail or cycle whose traversal emits a DNA sequence with the desired overlapping $k$-mer composition. The marginal constraint is
$$
\sum_{a \in \Sigma} c_{va} = \sum_{a \in \Sigma} c_{av},
$$
for each $(k-1)$-mer vertex $v$, except for possible start and end vertices in the linear case [2506.22172].

When exact balance is absent, the method adds the minimum number of artificial edges, or equivalently short $k$-mer walks, to restore Eulerian feasibility. Given a target frequency profile $\theta$ and sequence length $n$, integer counts are formed as
$$
c_w = \mathrm{round}\big((n-k+1)\cdot \theta_w\big),
$$
and the paper states the following error guarantee:
$$
\|\hat{\theta}_s - \theta\|_1 \leq \epsilon
$$
provided
$$
n \ge \frac{2(k-1)\cdot 4^k}{\epsilon} + k - 1.
$$
This version of Reverse-CGR therefore reconstructs a sequence matching the prescribed $k$-mer statistics with bounded error, rather than necessarily recovering the unique original sequence [2506.22172].

The same work also proves that symmetries of CGR images under the dihedral group $D_8$ correspond to specific nucleotide permutations in the originating sequence. That result links image-level geometric operations to symbolic transformations of DNA and further clarifies the relationship between CGR geometry and sequence combinatorics [2506.22172].

## 5. Empirical performance and downstream use

Reversible CGR methods are used not only for reconstruction but also for classification and hybrid feature design. The explicit-path R-CGR paper evaluates 7-class synthetic biological sequence classification involving 4 DNA classes and 3 protein classes. The reported results include the following accuracy and F1 values [2509.18408]:

| Model | Accuracy | F1 |
|---|---:|---:|
| R-CGR + VGG16 | 0.7907 | 0.7906 |
| R-CGR + Logistic Reg. | 0.7650 | 0.7670 |
| SeqVec | 0.7825 | 0.7784 |
| ESM2 | 0.7451 | 0.7418 |
| ProtT5 | 0.7348 | 0.7291 |
| Spike2CGR | 0.7575 | 0.7499 |

The same source states that R-CGR images with VGG16 outperform all baselines, and that even R-CGR with logistic regression exceeds sophisticated language-model baselines. The representation is described as generating feature-rich images suitable for deep learning while maintaining complete sequence information through explicit encoding [2509.18408].

MS-RCGR reports complementary empirical behavior. Across synthetic DNA and protein datasets containing seven distinct sequence classes, MS-RCGR features are said to consistently enhance classification performance across traditional machine learning, computer vision, and hybrid paradigms. In particular, the hybrid approach combining pre-trained language model embeddings such as ESM2 and ProtT5 with MS-RCGR features is reported to achieve superior performance compared to either method alone [2604.18477].

These results position Reverse-CGR as both a reconstruction mechanism and a modeling substrate. The geometric representation can be rendered as images for CNNs, converted into extracted descriptors for conventional classifiers, or fused with protein language model embeddings in hybrid systems.

## 6. Interpretability, storage, and terminological distinctions

Interpretability is a recurring motivation. The reversible encodings are presented as preserving direct links between geometric structure and sequence identity, enabling both machine analysis and human inspection. The explicit-path formulation describes position-aware coloring and feature-rich geometric traces, with DNA yielding square-patterned traces and proteins yielding intricate 20-sided polygon traces. Because the transformation is reversible, visual features can be related back to the underlying sequence rather than treated as anonymous image artifacts [2509.18408].

The explicit-path approach also gives a storage expression. If each step records the current character together with bounded-rational coordinates, total storage over $n$ steps is stated as
$$
\text{Total Storage} = n \cdot \left(\lceil \log_2 |\Sigma| \rceil + 2\log_2 P\right) + 2\log_2 P.
$$
The same source states that R-CGR cannot compress below the sequence entropy $H(S)$ without losing fidelity, matching Shannon’s theorem. This places a theoretical limit on how much reversibility can be achieved without storage overhead [2509.18408].

A common source of confusion is that “reversibility” is used in more than one sense. In the explicit-path variant, perfect reconstruction is guaranteed because the path trace stores the symbols themselves. In the rational-trajectory variant, perfect reconstruction follows from exact arithmetic, distinct corners, and access to the full trajectory. In the FCGR/$k$-mer setting, reconstruction refers to generating a sequence whose empirical $k$-mer profile matches a target profile, with provable error bounds but not necessarily uniqueness of the recovered sequence [2604.18477] [2506.22172].

Another common misconception is that classical CGR is already reversible. The cited literature states the opposite: traditional CGR loses sequence information during geometric mapping, and floating-point implementations introduce further irreversibility. Reverse-CGR is therefore best understood not as a minor implementation adjustment, but as a family of methods that redesign CGR around information preservation, exact arithmetic, or combinatorial reconstruction.

Source: https://www.emergentmind.com/topics/reverse-cgr-r-cgr