---
title: Discrete Graph Auto-Encoder (DGAE) Overview
url: https://www.emergentmind.com/topics/discrete-graph-auto-encoder-dgae
type: topic
---

# Discrete Graph Auto-Encoder (DGAE) Overview

Searching arXiv for recent and related papers on “Discrete Graph Auto-Encoder” and acronym ambiguities.
{"query":"all:(\"Discrete Graph Auto-Encoder\" OR DGAE graph auto-encoder discrete)","max_results":10,"sort_by":"submittedDate","sort_order":"descending"}
{"query":"ti:\"Discrete Graph Auto-Encoder\" OR ti:\"Variational Disentangled Graph Auto-Encoders for Link Prediction\" OR ti:\"Graph Representation Learning with Diffusion Generative Models\"","max_results":10,"sort_by":"submittedDate","sort_order":"descending"}
The **Discrete Graph Auto-Encoder (DGAE)** is a two-stage graph generative model that addresses a central difficulty in graph generation: a graph does not have an intrinsic node ordering, so naïve sequential models are highly sensitive to arbitrary permutations. DGAE combines two strategies that had largely been pursued separately: permutation-equivariant graph neural auto-encoding, and autoregressive sequence modeling after canonicalization. In the first stage, a permutation-equivariant auto-encoder maps a graph to a **set** of discrete latent node representations, where each node is represented by a sequence of quantized vectors. In the second stage, that latent set is sorted lexicographically and modeled with a specifically designed autoregressive Transformer. The result is a graph-to-set-to-sequence framework intended to retain permutation symmetry where it is essential, while exploiting efficient sequence modeling once the latent representation has been converted into a sortable set [2306.07735].

## 1. Representation non-uniqueness and the generative problem

A graph with \(n\) nodes admits up to \(n!\) equivalent representations under node permutation. DGAE is motivated by the observation that this non-uniqueness makes graph generation difficult: a model should not treat all of these equivalent adjacency-matrix or node-list representations as different objects. The paper frames two broad responses. One is to reduce representational ambiguity by imposing an order, typically by sorting or traversal heuristics such as Breadth-First Search. The other is to use permutation-invariant or permutation-equivariant graph neural networks, which respect graph symmetries directly [2306.07735].

The paper adopts the standard definitions. A function \(f\) is permutation-invariant if
\[
f(\mathcal{G}) = x \iff f(\pi(\mathcal{G})) = x,
\]
and permutation-equivariant if
\[
f(\pi(\mathcal{G})) = \pi(f(\mathcal{G})).
\]
This distinction is important because graph-level summaries should generally be invariant, whereas node-wise latent representations should permute with the input graph. DGAE treats node-level latent representations as an equivariant object in stage 1, and only later converts them into a sequence [2306.07735].

The paper’s critique of existing strategies is two-sided. Ordering-based autoregressive methods can still inherit many equivalent representations, may create long-range dependencies between graph-near but sequence-distant nodes, and can be slow at sampling. Pure GNN-based permutation-equivariant models avoid ad hoc node orderings, but standard Message Passing Neural Networks have limited receptive field, oversmoothing issues, and expressiveness bounded by the Weisfeiler–Lehman \(1\)-WL test. DGAE is positioned as a hybrid response: use GNNs to solve the graph-to-latent mapping without ordering assumptions, then sort the latent set—where sorting is easy—and learn its distribution autoregressively [2306.07735].

## 2. Permutation-equivariant graph auto-encoding

The first stage is a permutation-equivariant graph auto-encoder. The encoder maps
\[
f_{\text{encoder}} : \mathbb{G} \mapsto \mathbb{Z}^h,
\]
from graph space to sets of continuous node embeddings, while the decoder maps
\[
f_{\text{decoder}} : \mathbb{Z}^q \mapsto \mathbb{G},
\]
from quantized latent node representations back to graphs. The encoder is an \(L\)-layer MPNN with edge and node updates
\[
e^{l+1}_{i, j} = \text{bn}(f_{\text{edge}}([h^{l}_i, h^{l}_j, e^{l}_{i, j}])),
\]
\[
h^{l+1}_{i} = \text{bn}\left(h^{l}_{i} + \sum_{j \in \mathcal{N}(i)}f_{\text{node}}([h^{l}_i, h^{l}_j, e^{l}_{i, j}])\right),
\]
and the final continuous latent representation of node \(i\) is
\[
z_i^h = h_i^L \in \mathbb{R}^{d_{\text{latent}}}.
\]
The graph-level latent object is therefore a set
\[
\mathcal{Z}^h = \{z_1^h,\dots,z_n^h\}.
\]
Because the encoder is permutation-equivariant, permuting node labels in the input graph only permutes the output set elements [2306.07735].

To strengthen local structural information before encoding, the model augments node and edge features with **\(p\)-path features**. In the reported experiments \(p=3\). The augmentation introduces virtual edges between nodes connected by paths of length \(2\) to \(p\), edge features counting the number of paths of lengths \(1,\dots,p\) between endpoints, and node features counting the number of emanating paths of those lengths. The path-count matrices are
\[
P_1 = A,\qquad
P_2 = A^2 - D,\qquad
P_3 = A^3 - AD - (D-I)A.
\]
Node features are augmented with \(p_j = P_j \mathbf{1}\), and edge features with the corresponding path-count vectors. This augmentation is presented as a way to compensate for the limited expressiveness of ordinary message passing [2306.07735].

The decoder reconstructs the graph from the set of quantized node latents. Because the explicit input graph structure is no longer present in the latent set, the decoder assumes a fully connected graph over latent nodes and applies another MPNN, without feature augmentation. For simple graphs, the final edge representation is a scalar and
\[
\sigma(e_{i,j}^L)=p_\theta(\epsilon_{i,j}=1 \mid \mathcal{Z}^q).
\]
For annotated graphs, node and edge outputs are decoded by softmax:
\[
\text{softmax}(h_i^L)=p_\theta(x_i \mid \mathcal{Z}^q),\qquad
\text{softmax}(e_{i,j}^L)=p_\theta(e_{i,j} \mid \mathcal{Z}^q).
\]
For undirected graphs, symmetry is enforced by averaging the output adjacency tensor with its transpose [2306.07735].

## 3. Discrete latent node representations

The defining operation of DGAE is the conversion of continuous node embeddings into discrete node-wise codes. Each continuous latent vector \(z_i^h \in \mathbb{R}^{d_{\text{latent}}}\) is partitioned into \(C\) subvectors,
\[
z_i^h = (z_{i,1}^h,\dots,z_{i,C}^h), \qquad z_{i,c}^h \in \mathbb{R}^{d_{\text{latent}}/C},
\]
and each partition is quantized independently with its own codebook \(H_c \in \mathbb{R}^{m \times d_{\text{latent}}/C}\). The partitionwise quantization rule is
\[
q_c(z^h_{i,c}) = z^q_{i,c} = h_{k,c}
\quad \text{with} \quad
k = \argmin_g \left( \|z^h_{i,c} - h_{g,c}\|_2 \right).
\]
Equivalently, each node may be represented by a sequence of codebook indices
\[
(k_{i,1},\dots,k_{i,C}),
\]
with \(k_{i,c}\in\{1,\dots,m\}\) [2306.07735].

The paper gives several reasons for discretization. Graphs are discrete objects; quantization produces a latent space with known finite support; and the discrete bottleneck acts as an information bottleneck that simplifies the second-stage density model. Partitioning is used because a single very large codebook would induce an unwieldy categorical latent space. With \(C\) partitions and codebook size \(m\) per partition, the effective dictionary size per node is
\[
M = m^C.
\]
Different codebooks are used for different partitions because no invariance across partition positions is assumed [2306.07735].

Quantization is non-differentiable, so the encoder is trained with a straight-through estimator. Codebooks are updated by an Exponential Moving Average scheme following the VQ-VAE setting, and are initialized by \(k\)-means++ after a warm-up period without quantization. A commitment loss keeps encoder outputs close to their selected codewords:
\[
\mathcal{L}_{\text{commit.}} =
\frac{1}{nC}\sum_{i=1}^n\sum_{c=1}^C
\|z^h_{i,c} - \text{sg}[z^q_{i,c}]\|_2^2,
\]
where \(\text{sg}[\cdot]\) denotes stop-gradient. The appendix reports a commitment cost \(\beta = 0.25\) and loss weight \(\gamma = 0.1\) [2306.07735].

A central implication is that DGAE does not use a continuous latent prior of the usual VAE type. The first stage instead learns a permutation-equivariant discrete node-level coding of graphs, and the second stage learns the distribution of those codes directly [2306.07735].

## 4. Sorting the latent set and the 2D-Transformer prior

Once a graph has been mapped to a set of discrete node codes, the paper argues that the difficult part of canonicalization has been transferred from graphs to sets. Unlike graphs, sets can be sorted uniquely by any deterministic sorting rule. DGAE sorts the latent node index tuples
\[
(k_{i,1},\dots,k_{i,C})
\]
in increasing lexicographic order. This yields a sequence
\[
\mathrm{K} \in \mathbb{R}^{n \times C},
\]
or equivalently a sequence of codeword vectors
\[
Z \in \mathbb{R}^{n \times C \times d_{\text{latent}}/C}.
\]
Sorting is a preprocessing step for stage 2; there is no backpropagation through sorting [2306.07735].

The prior over sorted latent sequences is factored autoregressively over two dimensions: node index \(i\) and partition index \(c\). The paper writes
\[
P\left((k_{1,1}\ldots,k_{1,C}),\ldots,(k_{n,1},\ldots,k_{n,C})\right)
=
\prod_{i=1}^n \prod_{c=1}^C
P(k_{i,c}\mid z_{<i,1},\ldots,z_{<i,C}, z_{i,<c}).
\]
Thus the prediction of partition \(c\) for node \(i\) conditions on all partitions of previous nodes and on previous partitions of the current node [2306.07735].

To parameterize this prior, the paper introduces a **2D-Transformer**. The model uses the codeword vectors as input and predicts the corresponding codebook indices. The initial representations are
\[
z^0_{i,0} = W^{in}_{0}[z_{i-1,1},\ldots,z_{i-1,C}],
\]
\[
z^0_{i,c} = W^{in}_{c}[z_{i-1,1},\ldots,z_{i-1,C}, z_{i,1},\ldots,z_{i,c}],
\]
with a virtual zero node \((z_{0,1},\dots,z_{0,C})\) used to start the sequence. After \(L\) Transformer blocks, the output distribution is
\[
P_\theta(k_{i,c}) = \text{softmax}(f_{out}(z^L_{i,c-1})).
\]
An end-of-sequence token is appended so that graphs of varying size can be generated [2306.07735].

The defining architectural choice of the 2D-Transformer is that attention keys and values are shared across partitions of a node, while queries remain partition-specific:
\[
k_i^l = f_k^l(z_{i+1,0}^l), \qquad
v_i^l = f_v^l(z_{i+1,0}^l), \qquad
q_{i,c}^l = f_{q,c}^l(z_{i,c}^l).
\]
Attention is then computed over previous nodes,
\[
a_{i,c} = \sum_{j < i} \text{softmax}\left(\frac{q_{i,c}^T k_j}{\sqrt{d_k}}\right)v_j.
\]
This design exploits the two-dimensional structure of the latent sequence while reducing redundancy. The paper also enforces the ordering constraint of the lexicographically sorted representation through masking, so impossible indices under the imposed order are suppressed during training [2306.07735].

## 5. Objectives, training procedure, and graph generation

DGAE is trained in two separate stages. Stage 1 trains the graph auto-encoder; stage 2 trains the autoregressive Transformer prior over sorted discrete latent node codes. The first-stage reconstruction loss is the negative log-likelihood of the graph given the quantized latent set,
\[
\mathcal{L}_{\text{recon.}} = -\mathbb{E}_{\mathcal{Z}^q}\ln\left(p_\theta(G\mid \mathcal{Z}^q)\right).
\]
For simple graphs this becomes a binary cross-entropy over edges. For annotated graphs, the appendix gives the practical cross-entropy form
\[
\mathcal{L}_{\text{recon.}} =
\frac{1}{n+n^2}
\left(
\sum_{i=1}^n \sum_{r=1}^R x_{i,r}\ln(\tilde{x}_{i,r})
+
\sum_{i=1}^n \sum_{\substack{j=1\\j\neq i}}^n \sum_{s=1}^S e_{i,j,s}\ln(\tilde{e}_{i,j,s})
\right).
\]
The total first-stage optimization combines this reconstruction objective with quantization and commitment terms, although the paper does not write a single final formula collecting all of them [2306.07735].

Stage 2 is trained as a standard autoregressive model on sorted latent code sequences, using the output distribution
\[
P_\theta(k_{i,c}) = \text{softmax}(f_{out}(z^L_{i,c-1}))
\]
and minimizing the negative log-likelihood of the target codebook indices. This stage contains no variational term; it is a discrete autoregressive prior over the latent node codes learned by stage 1 [2306.07735].

Generation also proceeds in two steps. First, the 2D-Transformer samples the latent index sequence autoregressively until the end-of-sequence token or a maximum number of nodes \(n_{\max}\) is reached. Second, each sampled index \(k_{i,c}\) is mapped back to its codeword in \(H_c\), producing a set or sequence of discrete latent node codes, which the decoder then maps to a graph in one shot. For simple graphs, edge probabilities are converted to a graph by taking the mode; for annotated graphs, node and edge labels are chosen by \(\arg\max\). For undirected graphs, symmetry is enforced by averaging outputs with their transpose [2306.07735].

A key practical claim is that this design shortens the sequential part of graph generation. Conventional autoregressive graph generators often have sequence length proportional to \(n^2\) because they generate edges, whereas DGAE uses a sequence of length proportional to \(nC\), that is, linear in the number of nodes. The paper further argues that the per-step complexity is bounded by the vector–matrix product \(q_{i,c}^T K^T\), which is \(\mathcal{O}(d_{\text{model}}^2)\) [2306.07735].

## 6. Empirical behavior, ablations, and limitations

The paper evaluates DGAE on simple graph datasets—Ego-Small, Community-Small, and Enzymes—and on molecular datasets QM9 and ZINC250k, using Maximum Mean Discrepancy on simple graphs and NSPDK MMD, Fréchet ChemNet Distance, and validity without correction on molecules. On simple graphs, DGAE reports average MMD values of \(0.023\) on Ego-Small, \(0.033\) on Community-Small, and \(0.025\) on Enzymes. The paper presents DGAE as best overall average on Community-Small and Enzymes, and close to the training-set baseline on Ego-Small [2306.07735].

On molecules, the picture is mixed but strong. On QM9, DGAE reports NSPDK \(0.0015\), FCD \(0.86\), and validity without correction \(92.0\%\). On ZINC250k, it reports NSPDK \(0.007\) and validity without correction \(77.9\%\), and the paper states that DGAE is superior on FCD and NSPDK in the table despite not always being best on raw validity. This pattern supports the paper’s interpretation that DGAE is especially effective at matching global distributional properties, even when chemically valid decoding without correction is not maximal [2306.07735].

The speed comparison is one of the paper’s most distinctive empirical findings.

| Dataset | DGAE | Comparator times |
|---|---:|---|
| QM9, 1000 graphs | \(0.33\) s | GDSS \(28.07\) s, DiGress \(54.01\) s |
| ZINC, 1000 graphs | \(1.80\) s | GDSS \(300.44\) s, DiGress \(799.43\) s |

The paper attributes these speedups to the latent autoregressive formulation: the prior samples node-level latent codes rather than edges or denoising trajectories over whole graphs [2306.07735].

The ablations emphasize two design trade-offs. First, feature augmentation matters. Spectral features and \(p\)-path features improve reconstruction, while cycle counts and random features contribute little alone. Removing \(p\)-path features causes the largest degradation among single-feature removals. Second, codebook design matters. Reconstruction generally improves as dictionary size grows, but generation does not necessarily improve, and a single large codebook with configuration \(4096^1\) leads to **codebook collapse**. The paper reports that \(C=2, m=32\) performs slightly best in generation on ZINC. This suggests that partitioned quantization is not merely an implementation convenience but part of the model’s inductive bias [2306.07735].

The limitations identified in the paper are equally central to its interpretation. Training is two-stage, which complicates hyperparameter tuning. The method is presented only for unconditional generation; conditional generation is left for future work. Scaling to larger graphs remains open. The latent sorting rule is generic rather than semantically optimal. Finally, although DGAE is strong on distributional metrics, it is not always best on validity without correction [2306.07735].

## 7. Position within graph auto-encoder research and acronym ambiguity

Within the broader graph auto-encoder literature, DGAE occupies a specific niche: it is a **discrete latent graph generative model** whose discreteness is realized through quantized node-level latent codes and an autoregressive prior. This distinguishes it from graph auto-encoders that reconstruct continuous node features on a fixed graph, such as the graph feature auto-encoder for biological networks, where the graph serves as support for message passing rather than as the decoded object [2005.03961]. It also differs from neighborhood-reconstruction graph auto-encoders, which replace edge decoding by neighborhood Wasserstein reconstruction and treat the neighborhood as a degree plus a distribution over neighbor representations, rather than as a discrete latent sequence [2202.09025].

A recurring source of confusion is acronym overlap. In “Variational Disentangled Graph Auto-Encoders for Link Prediction,” **DGAE** means **Disentangled Graph Auto-Encoder**, not **Discrete Graph Auto-Encoder**; the model decomposes node embeddings into multiple latent-factor-specific channels and uses mutual information regularization for link prediction [2306.11315]. Closely related work on “Learning Network Representations with Disentangled Graph Auto-Encoder” uses the labels **DGA** and **DVGA** for a multi-channel disentangled encoder with a factor-wise decoder and channel-wise flows, again with continuous rather than discrete latents [2402.01143]. Likewise, **DiGAE** refers to **Directed Graph Auto-Encoders**, where each node has separate source and target embeddings for directed link prediction, not discrete codes [2202.12449].

A more genuinely adjacent line is diffusion-based discrete graph auto-encoding. “Graph Representation Learning with Diffusion Generative Models” proposes a **Discrete Diffusion Autoencoder** with a GCN encoder and a conditional discrete diffusion decoder over the adjacency matrix. There the discrete aspect lies in a multi-step diffusion decoder over adjacency variables rather than in a quantized node-code prior. This suggests an alternative discrete graph auto-encoding paradigm: iterative denoising of graph structure rather than one-shot decoding from a learned discrete node set [2501.13133].

Taken together, these distinctions suggest that “DGAE” is not a stable acronym across graph learning. In the strict sense established by [2306.07735], however, **Discrete Graph Auto-Encoder** denotes a model that resolves graph permutation ambiguity by first learning a permutation-equivariant set of discrete node-level latent codes and then modeling the sorted latent set autoregressively. That two-stage graph-to-set-to-sequence construction is the defining property of DGAE in the discrete-latent sense [2306.07735].

Source: https://www.emergentmind.com/topics/discrete-graph-auto-encoder-dgae