SlowGuess/NeurIPS_2023_OCR huggingface dataset:
$$
q \left(G _ {t} \mid G _ {t - 1}\right) = \prod_ {i j} q \left(\boldsymbol {a} _ {t} ^ {i j} \mid \boldsymbol {a} _ {t - 1} ^ {i j}\right) \text {a n d} q \left(G _ {t} \mid G _ {0}\right) = \prod_ {i j} q \left(\boldsymbol {a} _ {t} ^ {i j} \mid \boldsymbol {a} _ {0} ^ {i j}\right) \tag {8}
$$
The forward diffusion process transforms the input graph into pure noise when  $T$  goes to infinity. The pure noise graph  $G_{\infty}$  is an Erdős-Rényi random graph [63] with the probability  $\frac{1}{2}$  of being present or absent for each edge.
C.2 Continuous Diffusion Process
In this section, we discuss the extension of D4Explainer for the diffusion over continuous content features (i.e., node features, edge features, etc). Given a graph  $G(X_0, A_0)$  with the initial node features  $X_0 \in \mathbb{R}^{N \times d}$  and initial adjacency matrix  $A_0 \in \{0, 1\}^{N \times N}$ , where  $N, d$  is the number of nodes and feature dimensions respectively. Let  $X_t, A_t$  denote the noisy node feature and noisy adjacency matrix at timestep  $t$ .  $A_t$  is obtained by the discrete diffusion process in Sec. 3.2, while continuous noisy node features  $X_t$  rely on continuous Gaussian perturbations. The forward Markov process gradually adds Gaussian noise to the previous state:
$$
q \left(X _ {t} \mid X _ {t - 1}\right) = \mathcal {N} \left(X _ {t}; \sqrt {1 - \beta_ {t}} X _ {t - 1}, \beta_ {t} I\right), \tag {9}
$$
where  $\mathcal{N}$  denotes the high-dimensional Gaussian distribution,  $\beta_{t}$  is the variance at timestep  $t$ . Similar to discrete diffusion, there is a closed form that performs multi-step diffusion:
$$
q \left(X _ {t} \mid X _ {0}\right) = \mathcal {N} \left(X _ {t}; \sqrt {\bar {\alpha} _ {t}} X _ {0}; (1 - \bar {\alpha} _ {t}) I\right), \tag {10}
$$
where  $\alpha_{t} = 1 - \beta_{t}$  and  $\bar{\alpha}_{t} = \prod_{s=1}^{t} \alpha_{s}$ . The denoising model takes as input the adjacency matrix  $A_{t}$ , the noisy node features  $X_{t}$  and the noisy level indicator  $t$  and predicts the clean adjacency matrix  $\tilde{A}_{0}$
and node features  $\tilde{X}_0$ . Let  $\tilde{G}_0(\tilde{X}_0, \tilde{A}_0)$  denote the predicted explanatory graph. With the continuous diffusion over node features, we need to recover both the original adjacency matrix and original node features. Thus it becomes the cross-entropy between  $A_0$  and  $\tilde{A}_0$  as well as the cross-entropy between  $X_0$  and  $\tilde{X}_0$ . Therefore, the distribution loss can be expressed as
$$
\begin{array}{l} \mathcal {L} _ {\text {d i s t}} = - \mathbb {E} _ {q (A _ {0})} \sum_ {t = 1} ^ {T} \left(1 - 2 \cdot \bar {\beta} _ {t} + \frac {1}{T}\right) \mathbb {E} _ {q \left(A _ {t} \mid A _ {0}\right)} \log p _ {\theta} \left(A _ {0} \mid A _ {t}\right) \tag {11} \\ - \mathbb {E} _ {q (X _ {0})} \sum_ {t = 1} ^ {T} \left(1 - 2 \cdot \bar {\beta} _ {t} + \frac {1}{T}\right) \mathbb {E} _ {q (X _ {t} | X _ {0})} \log p _ {\theta} (X _ {0} | X _ {t}) \\ \end{array}
$$
The above continuous setting can also easily generalize to edge features diffusion.
D Model Details
D.1 Denoising Model: PPGN
Our PPGN implementation follows the original paper [50], and [20]. The difference is that we insert an MLP module that processes the noise level indicator  $t$  and learns time-related latent features to enhance the denoising capability. Given a graph  $G$ , let  $\mathbf{A}_t \in \mathbb{R}^{N \times N \times 2}$  denote the one-hot version of the adjacency matrix at timestep  $t$ , where the row vector  $\mathbf{a}_t^{i,j} \in \{0,1\}^2$  is a 2-dimensional one-hot encoding of the existence of the edge between node  $i$  and node  $j$ ,  $N$  is the number of nodes in the graph. Let  $X = [X_1, \dots, X_N] \in \mathbb{R}^{N \times d}$  denote the node features of the original graph, where  $d$  denotes the number of feature dimensions,  $X_i \in \mathbb{R}^d$  denotes the  $d$ -dimensional feature of the node  $i$ . We construct  $\mathbf{X} \in \mathbb{R}^{N \times N \times 2d}$ , where  $\mathbf{X}_{ij} \in \mathbb{R}^{2d}$  is the concatenation of node feature  $X_i$  and  $X_j$ . Specifically, we use a diagonal matrix  $\bar{\beta}_t \cdot \mathbf{I} \in \mathbb{R}^{N \times N \times 1}$  as the noise level indicator. An MLP module will process the time-related information and output a tensor  $\mathrm{MLP}(\bar{\beta}_t \cdot \mathbf{I}) \in \mathbb{R}^{N \times N \times 1}$
Let  $M_{in} = \mathrm{Cat}(A_t, X, \mathrm{MLP}(\bar{\beta}_t \cdot I)) \in \mathbb{R}^{N \times N \times (2d + 3)}$  as the input of PPGN model. The output tensor of PPGN is  $A_0' \in \mathbb{R}^{N \times N \times 1}$ , where each element  $[A_0']_{ij}$  represents the probability of  $q(\pmb{a}_t^{ij} | \pmb{a}_0^{ij})$ . The formulation of PPGN is as follows,
$$
\begin{array}{l} P G N N (\boldsymbol {M} _ {i n}) = L _ {o u t} \circ C (\boldsymbol {M} _ {i n}) \\ C \left(\boldsymbol {M} _ {i n}\right) = \operatorname {C o n c a t} \left(\left(B _ {d} \circ \dots B _ {1}\right) \left(\boldsymbol {M} _ {i n}\right), \right. \tag {12} \\ \left(B _ {d - 1} \circ \dots B _ {1}\right) \left(\boldsymbol {M} _ {i n}\right), \dots , B _ {1} \left(\boldsymbol {M} _ {i n}\right)) \in \mathbb {R} ^ {N \times N \times (d h)} \\ \end{array}
$$
Each  $B_{i}$  is a powerful layer that maps the input tensor to a tensor in  $\mathbb{R}^{N\times N\times h}$ . We concatenate  $d$  outputs of these powerful layers and obtain a tensor  $C(M_{in})\in \mathbb{R}^{N\times N\times (dh)}$ . The final  $L_{out}$  is an MLP module that maps the input tensor to the space of  $\mathbb{R}^{N\times N\times 1}$ :  $L_{out}:\mathbb{R}^{N\times N\times (dh)}\to \mathbb{R}^{N\times N\times 1}$ . We take the output of the PPGN model as the dense adjacency matrix as mentioned in Sec. 4.1.
D.2 Counterfactual Explanation Generation
The output of PPGN model  $A_0' = PGNN(M_{in}) \in \mathbb{R}^{N \times N \times 1}$  is taken as the dense adjacency matrix for the counterfactual explanation, where each element indicates the probability of the corresponding edge in the final counterfactual explanation. To obtain the discrete adjacency matrix and backpropagate the gradients, we utilize the Concrete relaxation of the Bernoulli distribution via
$$
\operatorname {B e r n o u l l i} (p) \approx \sigma \left(\frac {1}{\lambda} (\log p - \log (1 - p) + \log u - \log (1 - u))\right), \quad u \sim \operatorname {U n i f o r m} (0, 1),
$$
where  $\lambda$  is a temperature for the Concrete distribution and  $\sigma$  is the sigmoid function. Then, we create a discrete adjacency matrix by  $\tilde{A}_0[ij] \sim \text{Bernoulli}(A_0'[ij])$ , where  $[ij]$  denotes the  $ij$ -th element in the corresponding matrix. Once the denoising model is well trained, we can generate a counterfactual explanation given any noisy graph  $G_t$ , the node feature  $X$ , and noisy indicator  $t$ . In the explanation stage, let  $G_0$  denote the given graph to be explained, we randomly add noise to  $G_0$  and create a noisy version. We utilize the well-trained denoising model to output a dense adjacency matrix  $A_0'$ . The reparametrization trick is not applied in the inference stage. We directly sample  $\tilde{A}_0[ij] \sim \text{Bernoulli}(A_0'[ij])$  and construct the final counterfactual explanation. One may also calculate average  $A_0'$  by denoising from multiple noisy versions  $G_t$  with different noisy level indicators  $t$ .
D.3 Simplified Loss Function
Early efforts on denoising diffusion models mainly reconstruct each  $G_{t-1}$  from  $G_t$ . However, it poses a challenge to the training stability due to the dependence of  $G_{t-1}$  on the sampled diffusion trajectories and the intrinsic noise of  $G_{t-1}$ . The simplified loss was first proposed by [48], which is defined as
$$
\mathcal {L} _ {s i m p l e} = - \mathbb {E} _ {q (G _ {0})} \mathbb {E} _ {t \sim [ 0, T ]} \mathbb {E} _ {q (G _ {t} | G _ {0})} \log p _ {\theta} \left(G _ {0} \mid G _ {t}\right).
$$
Instead of reconstructing intermediate noisy graphs, the simplified loss directly pushes toward the terminal clean graph  $G_{0}$ , which improves both the training stability and training efficiency. In this work, we also target at recovering the final counterfactual graphs  $\tilde{G}_0$  with each noisy graph  $G_{t}$ . Moreover, we emphasize more challenging denoising tasks at larger timesteps by adding the weight  $1 - 2\cdot \bar{\beta}_{t} + \frac{1}{T}$  to each step.
D.4 Model-level Explanation Generation
Algorithm 1 Reverse Sampling for Model-level Explanation
Require: number of nodes  $N$  , number of candidates  $K$  , static GNN  $f$  , Diffusion Process  $q(\cdot)$  Denoising Model  $p_{\theta}(\cdot)$    
1: Sample an Erdos-Renyi graph  $G_T^r\sim \mathcal{B}_{N,1 / 2}$    
2: for  $t = T$  to 1 do   
3: Sample candidates  $\{\tilde{G}_{0,k}\mid \tilde{G}_{0,k}\sim p_{\theta}(G_0|G_t^r);k = 1,\dots ,K\}$    
4: Compute Prob[k]  $= f(\tilde{G}_{0,k})$  for  $k = 1,\dots ,K$    
5: Select  $\tilde{G}_{0,j}$  with the highest Prob[j]   
6: Temporary explanation  $\tilde{G}_0\coloneqq \tilde{G}_{0,j}$    
7: Sample  $G_{t - 1}^{r}\sim q(G_{t - 1}|\tilde{G}_{0})$    
8: end for   
9: return  $G_0^r$
Alg. 1 shows the multi-step reverse sampling algorithm for model-level explanations. Let  $N$  denote the number of nodes in the desired model-level explanation. We first generate a pure random graph  $G_T^r \sim \mathcal{B}_{N,1/2}$ . Given the noisy graph  $G_T^r$ , the denoising model predicts the distribution of the clean graphs by  $p_\theta(G_0|G_T^r)$ . We sample  $K$  candidates from the distribution of the clean graphs by  $\tilde{G}_{0,k} \sim p_\theta(G_0|G_T^r)$ , with  $k = 1, \dots, K$ , and refer to the well-trained GNN to select the optimal one with the highest explanation confidence (i.e.,  $f(C_i|\tilde{G}_{0,k}))$ ). Regularization constraints can be plugged into this step to further guarantee the desired properties of the generated explanation [16], e.g., sparsity, explanation size, connectivity incentive, etc. We nominate the optimal  $\tilde{G}_{0,j}$  as the temporary explanation  $\tilde{G}_0$ . Then,  $\tilde{G}_0$  is transformed to noisy graphs by forward diffusion process, i.e.,  $G_{t-1}^r \sim q(G_{t-1}|\tilde{G}_0)$ . We repeat the process for  $T$  times until we obtain the terminal  $G_0^r$  as the model-level explanation.
D.5 Unification of D4Explainer
The unification of D4Explainer lies in the same diffusion process and denoising model for different explanation scenarios. The differences between D4Explainer on counterfactual and model-level explanation tasks are (1) loss function and (2) reverse sampling process. Specifically, the loss function for the model-level explanation task does not contain  $\mathcal{L}_{cf}$ , which is designed to ensure the counterfactual property. Moreover, the reverse sampling process in the model-level explanation tasks utilizes multiple-step sampling to increase the explanation confidence score of generated model-level explanations. Moreover, the flexibility in the loss function and reverse sampling process enable D4Explainer to tackle other related explanation scenarios, such as instance-level factual explanation.
Table 6: Statistics of the eight datasets and test performance of the GNN model trained for each dataset. "-" means that there is no ground-truth motif in the dataset
BA-Shapes	Tree-Cycle	Tree-Grids	Cornell	BA-3Motif	Mutag	BBBP	NCI1
# of Nodes (avg.)	700	871	1231	183	21.92	30.32	25.95	29.87
# of Edges (avg.)	4110	1942	3130	280	29.51	30.77	24.06	32.30
# of Graphs	1	1	1	1	3000	4337	2039	4110
# of Classes	4	2	2	5	3	2	2	2
Motif	house	cycle	grid	-	house/cycle/grid	-	-	-
Target GNN	GCN	GCN	GCN	EGNN	GCN	GIN	GCN	GCN
Test accuracy	0.99	0.98	0.95	0.83	0.93	0.87	0.85	0.83
E.1 Dataset
In this work, we use four synthetic datasets: BA-shapes, Tree-Cycle, Tree-Grids, and BA-3Motif to evaluate the efficacy of the proposed D4Explainer. In the node-classification task, the graph consists of a base graph, which is randomly attached by different motifs, e.g., house, grid, cycle. The task is to determine whether or not the node is a part of the motif. For the graph classification task, each graph consists of a base graph randomly attached by one type of motif. The task is to classify what type of motifs the graph contains.
We also test D4Explainer over real-world datasets, Cornell, Mutag, BBBP, and NCI1. Mutag, BBBP and NCI1 are molecular datasets where each graph is labeled as either having a specific chemical property or not. For Mutag, the mutagenicity of a molecule is linked to the presence of electron-attracting elements combined with nitro groups (such as NO2). Additionally, molecules containing three or more fused rings are more likely to be mutagenic compared to those with one or two rings [64]. Cornell is a webpage dataset introduced by [52]. Nodes are web pages, and edges are hyperlinks between them. Node features are bag-of-words representations of web pages. Nodes are classified into one of five categories: Students, Projects, Courses, Faculty, and Staff. Cornell is a highly heterophilous dataset, i.e., the adjacent nodes tend to have different features and labels, which further poses a challenge to the explanation task. Nonetheless, there is no explicit motif that leads to a specific class in real-world datasets. The statistical information of all datasets is summarized in Table 6. We use different types of target GNNs to evaluate the performance of D4Explainer, including GCN, GIN, and EGNN. The last row shows the test accuracy of the target GNN. Each target GNN achieves more than  $80\%$  accuracy over the test dataset.
E.2 Metrics
We use the following metrics to evaluate the generated explanations, where the modification rate (MR) is our proposed adjustment to the sparsity metric used in previous works [13, 36].
- Counterfactual Accuracy (CF-ACC) [13] measures whether the explainer can generate effective counterfactual explanations. It is formulated as the proportion of generated explanations that change the model's prediction.
$$
\operatorname {C F} - \operatorname {A C C} = 1 - \frac {1}{| \mathcal {G} |} \sum_ {G ^ {o} \in \mathcal {G}} \left(\mathbb {1} \left(\hat {Y} _ {G ^ {c}} = \hat {Y} _ {G ^ {o}}\right), \right. \tag {13}
$$
where  $G^{o}$  is the original graph,  $G^{c}$  is the generated counterfactual explanation regarding  $G^{o}$ ,  $\mathcal{G}$  is the test dataset and  $|\mathcal{G}|$  denotes the size of  $\mathcal{G}$ .  $\hat{Y}_{G}$  is the label of  $G$  predicted by the target GNN  $f$ .  $\mathbb{1}(\cdot)$  is the indicator function to check whether  $\hat{Y}_{G^c}$  equals to  $\hat{Y}_{G^o}$ . Since we aim to generate counterfactual explanations, a higher CF-ACC is better.
- Fidelity [3, 36] quantifies the change in predicted probability over the original class. It is formulated as
$$
\text {F i d e l i t y} = \frac {1}{| \mathcal {G} |} \sum_ {G ^ {o} \in \mathcal {G}} \left[ f \left(G ^ {o}\right) \left[ \hat {Y} _ {G ^ {o}} \right] - f \left(G ^ {c}\right) \left[ \hat {Y} _ {G ^ {o}} \right] \right], \tag {14}
$$
where  $f(G)[\hat{Y}]$  denotes the probability output of the model  $f$  for graph  $G$  over class  $\hat{Y}$ . A higher fidelity score indicates better counterfactual explanations.
- Modification ratio is the proportion of changed edges:
$$
\mathrm {M R} = \frac {\left(\# \text {o f d e l t e d e d g e s} + \# \text {o f a d d e d e d g e s}\right)}{| E |}, \tag {15}
$$
where  $|E|$  is the number of edges in the original graph. For baseline models that only consider deleting edges, MR can be easily adjusted to the proportion of deleted edges with respect to the original graph, which is the sparsity metric used in prior works [13, 36].
E.3 Model Parameters
Table 7: Optimal parameters for each dataset
num hidden	num layers in PPGN	batch size	alpha
BA-shapes	64	6	4	0.005
Tree-Cycle	64	6	32	0.1
Tree-Grids	128	8	32	0.05
Cornell	128	6	4	0.05
BA-3Motif	128	6	32	0.05
Mutag	64	6	2	0.001
BBBP	128	6	16	0.005
NCI1	128	6	32	0.01
In the implementation, we need to perform multi-step diffusion. We uniformly sample  $\bar{\beta}_t$  in the range of  $[0, 0.5]$  to control the level of noise and generate the graph  $G_t$  with the corresponding level of noise. Given each  $G_t$ , the denoising model is trained to recover the clean graph  $\tilde{G}_0$ . During the training stage, we employ Adam [65] as our optimizer and ExponentialLR [66] as the scheduler. Table 7 shows the optimal numbers of hidden units, layers in PPGN, batch size, and the regularization coefficient  $\alpha$  for each dataset. We run 1500 epochs and set the initial learning rate as  $1 \times 10^{-3}$  across all datasets.
E.4 In-distribution Evaluation
MMD (Maximum Mean Discrepancy) is a metric used to compare the distance between two probability distributions. In the context of graph statistics, MMD can be used to compare the degree distribution, cluster coefficient distribution, and spectrum distribution. MMD is also widely used for accessing the distribution-learning ability of graph generative models [61, 19, 20, 62, 44].
A graph's degree distribution represents the frequency of nodes with different degree values in the graph. The clustering coefficient of a node is a measure of the node's local clustering or the fraction of triangles that the node participates in. Spectrum distribution refers to the distribution of eigenvalues of the adjacency matrix or Laplacian matrix of a graph, which can be used to study the graph's structure and dynamics. The MMD between two sets of samples from distributions  $p$  and  $q$  can be formulated as
$$
\operatorname {M M D} ^ {2} (p \| q) = \mathbb {E} _ {x, y \sim p} [ k (x, y) ] + \mathbb {E} _ {x, y \sim q} [ k (x, y) ] - 2 \mathbb {E} _ {x \sim p, y \sim q} [ k (x, y) ], \tag {16}
$$
where  $k(x,y)$  denotes the kernel function. Following the in-distribution evaluation setting in [61, 19, 20, 62, 44], we use Gaussian Earth Mover's Distance kernel to compute the MMDs of degree distributions, clustering coefficients, and spectrum distributions. Complete MMD results are shown in Table 8.
E.5 Diversity Evaluation
Figure 8 shows the generated counterfactual examples for BA-shapes, Tree-Cycle, Tree-Grid, and BA-3Motif. The graphs in the first row are the original graphs to explain. The second row shows the counterfactual examples generated by CF-GNNExplainer. The last two rows show two types of counterfactual examples generated by D4Explainer. Labels at the bottom right indicate the motif contained in the graph. We find that the easiest way to generate counterfactual explanations is to destroy the original motif by deleting essential edges, which we call "corruption".
Table 8: MMD distances between the generated explanations and test graphs. We report MMD distances of degree distributions (Deg.), cluster coefficients (Clus.), and spectrum distributions (Spec.). Sum. means the summation of the previous three metrics. We bold the smallest value and underlined the second-best value in each column.
Models	BA-3Motif	Mutag	BBBP	NCI1
Deg.	Clus.	Spec.	Sum.	Deg.	Clus.	Spec.	Sum.	Deg.	Clus.	Spec.	Sum.	Deg.	Clus.	Spec.	Sum.
RandomCaster	0.2336	0.0574	0.0532	0.3442	0.1593	0.0247	0.0417	0.2257	0.1693	0.0072	0.0397	0.2162	0.1847	1.9769	0.0404	2.2020
GNNExplainer	0.2366	0.0803	0.0531	0.3700	0.1614	0.0002	0.0409	0.2025	0.1615	0.0002	0.0395	0.2012	0.1577	0.0005	0.0405	0.1987
SAExplainer	0.2431	0.0108	0.0534	0.3073	0.0940	0.0032	0.0412	0.1384	0.1594	0.0032	0.0402	0.2028	0.189	0.0002	0.0408	0.2300
GradCam	0.2224	0.0825	0.0539	0.3588	0.1122	0.0083	0.0416	0.1621	0.0699	0.0026	0.0384	0.1109	0.1638	0.0003	0.0404	0.2045
IGExplainer	0.2474	0.0436	0.0533	0.3443	0.1292	0.0000	0.0411	0.1703	0.0908	0.0000	0.0394	0.1302	0.4288	0.0002	0.0398	0.4688
PGExplainer	0.2459	0.0308	0.0628	0.3395	0.1475	0.0002	0.0418	0.1895	0.2014	0.0018	0.0403	0.2435	0.1937	0.0000	0.0396	0.2333
PGMExplainer	0.2493	0.0246	0.0543	0.3282	0.1800	0.0002	0.0419	0.2221	0.1916	0.0003	0.0403	0.2322	0.2199	0.0000	0.0404	0.2603
CXplain	0.2356	0.0412	0.0535	0.3303	0.1734	1.2706	0.0417	1.4857	0.1768	0.0001	0.0394	0.2163	0.1629	0.0001	0.0404	0.2034
CF-GNNExplainer	0.1669	0.0366	0.0531	0.2566	0.1172	0.0000	0.0380	0.1552	0.0870	0.0001	0.0393	0.1264	0.1224	0.0001	0.0404	0.1629
D4Explainor(ours)	0.1028	0.0265	0.0517	0.1810	0.1172	0.0000	0.0244	0.1416	0.0530	0.0000	0.0331	0.0861	0.1006	0.0000	0.0353	0.1359
Figure 8: Counterfactual explanations generated by CF-GNNExplainer and D4Explainer over four datasets. The labels at the bottom right represent the type of generated counterfactual explanations. CF-GNNExplainenr can only corrupt the original motif, while D4Explainer can corrupt the original motif and create the counterfactual motif.
Analysis. We observe from Figure 8 that the previous explainer alters the model's prediction by corrupting the original motif as its counterfactual explanation. Moreover, in the explanation task for node classification, previous explainers tend to remove the connection between the node to be explained and its neighbors. For example, in the second row of BA-shapes, Tree-Cycle, and Tree-Grid, CF-GNN-Explainer deletes the edges between the blue node and its neighboring nodes. One possible reason is that the isolated node cannot receive the messages from its neighbors with the well-trained GNN, thus naturally becoming an out-of-distribution sample and degrading the model's prediction confidence. Instead, D4Explainer generates counterfactual explanations not only by destroying the original motif but also by creating the truly counterfactual motifs, as shown in the last row of Figure 8. It is noticeable that D4Explainer can identify the counterfactual motif and complete that based on the original graph, which is hardly achieved by previous methods that only consider the edge deletion.
E.6 Complexity and Inference Time Evaluation
The computation of the loss function involves four steps. (1) uniformly sample  $t$  from  $[0, T]$ , (2) apply forward diffusion process  $q(G_{t} | G_{0})$ , (3) calculate  $p_{\theta}(G_{0} | G_{t})$  via the denoising network and (4) sample counterfactual graphs from  $p_{\theta}(G_{0} | G_{t})$ . Let  $N$  denote the number of nodes in the original graph. The time complexity is  $\mathcal{O}(1)$  for Step(1) and  $\mathcal{O}(N^{2})$  for Step(2) and  $\mathcal{O}(N^{3})$  for Step(3) due to the matrix multiplication. Step(4) results in a time complexity of  $\mathcal{O}(N^{2})$  for sampling. Overall, the time complexity of D4Explainer is mainly determined by the denoising network.
To empirically evaluate the efficiency of D4Explaienr, we conduct the runtime comparison between D4Explainer and baselines. The results are shown in Table 9. Except for PGExplainer, other baselines reported in Table 9 are non-generative, that is, the model optimizes an explanation for input instances
one by one during the inference stage. Therefore, these models require more time to generate one explanation and become less efficient. On the contrary, D4Explainer incorporates the generative graph distribution learning into the optimization objective and captures the underlying distribution of the explanation graphs over the entire dataset. Consequently, D4Explainer is relatively efficient during the inference stage.
Table 9: Runtime analysis of all baselines. We compute mean/std values of inference time to generate explanations for a single instance
GNNExplainer	IGExplainer	PGExplainer	PGMExplainer	CXPlain	CF-GNNExplainer	D4Explainer
Tree-Cycle	1.367±0.023	2.684±0.368	0.028±0.007	1.145±0.012	1.427±0.277	2.637±0.540	0.022±0.002
Mutag	1.492±0.037	3.157±0.454	0.035±0.005	1.576±0.038	1.842±0.320	2.741±0.536	0.030±0.006
E.7 Robustness Evaluation
Figure 9: Robustness performance of all methods. The modification ratio is controlled as  $20\%$  across all methods.