Abstract
Numerous networks in the real world change over time, in the sense that nodesand edges enter and leave the networks. Various dynamic random graph modelshave been proposed to explain the macroscopic properties of these systems andto provide a foundation for statistical inferences and predictions. It is ofinterest to have a rigorous way to determine how well these models matchobserved networks. We thus ask the following goodness of fit question: given asequence of observations/snapshots of a growing random graph, along with acandidate model M, can we determine whether the snapshots came from M or fromsome arbitrary alternative model that is wellseparated from M in some naturalmetric? We formulate this problem precisely and boil it down to goodness of fittesting for graphvalued, infinitestate Markov processes and exhibit andanalyze a universal test based on nonstationary sampling for a natural classof models.
Quick Read (beta)
[
Abstract
Numerous networks in the real world change over time, in the sense that nodes and edges enter and leave the networks. Various dynamic random graph models have been proposed to explain the macroscopic properties of these systems and to provide a foundation for statistical inferences and predictions. It is of interest to have a rigorous way to determine how well these models match observed networks. We thus ask the following goodness of fit question: given a sequence of observations/snapshots of a growing random graph, along with a candidate model $M$, can we determine whether the snapshots came from $M$ or from some arbitrary alternative model that is wellseparated from $M$ in some natural metric? We formulate this problem precisely and boil it down to goodness of fit testing for graphvalued, infinitestate Markov processes and exhibit and analyze a universal test based on nonstationary sampling for a natural class of models.
Testing Dynamic Network Models]Toward Universal Testing of Dynamic Network Models
1 Introduction
Timevarying networks abound in various domains. To explain their macroscopic properties (e.g., subgraph frequencies, diameter, degree distribution, etc.) and to make predictions and other inferences (such as link prediction, community detection, etc.), a plethora of generative models have been proposed (see [Newman(2010), Hofstad(2016)] for broad overviews of classical random graph models; for a mathematical approach via exchangeable random structures, see, for example, [Veitch and Roy(2016), Orbanz and Roy(2013)]). For scientific reasons it is of interest to be able to judge how well the models (which postulate particular mechanisms of growth) reflect reality. This leads naturally to the problem of goodness of fit testing for dynamic network mechanisms. At a high level, this entails determining, in some formal way, whether or not a given observed sequence of graph snapshots is more likely to have originated from some candidate growth mechanism or, alternatively from a sufficiently different one.
Related work
Regarding related work, goodness of fit testing is a classical topic in statistics, but the focus is typically on realvalued and categorical data over small alphabets [Diakonikolas et al.(2017)Diakonikolas, Gouleakis, Peebles, and Price, Wasserman(2010)], where the input to the problem is a sequence of independent, identically distributed (iid) random variables from an unknown probability distribution. This is in contrast with the setting of dynamic graph models, where what is given is a trajectory (extremely noniid) from an unknown model, and each element of the trajectory is a graph, which potentially shares a large amount of structure with its temporal neighbors.
Closer in spirit to our work is the (rather recent) literature on testing of static random graph models [Ghoshdastidar et al.(2017)Ghoshdastidar, Gutzeit, Carpentier, and von Luxburg]. Here (in the onesample case), what is given is a sequence of iid graphs (not a trajectory of an evolving graph) coming from an unknown model, and the task is to distinguish the unknown model from some candidate distribution. In works so far, the distribution class under consideration is a particular parametric family or satisfies strong independence assumptions (e.g., in [Ghoshdastidar et al.(2017)Ghoshdastidar, Gutzeit, Carpentier, and von Luxburg], all edges are assumed to be independent), which is inherently not dynamic.
There has been work on testing of dynamic graph models, such as [Jeong et al.(2003)Jeong, Néda, and Barabási], but most such methods have not come with rigorous guarantees and have proposed tests tailored to particular parameteric distributions (so they are more properly considered to deal with parameter estimation than goodness of fit testing). In contrast, we formulate our results in terms of classes of models that we prove to be distinguishable.
With regard to the specific types of models of interest, our focus in the present paper is on model classes that are given by inequalities that control the rate of change of the conditional distributions governing the evolution of the sample graphs with respect to time. This affords us some flexibility in defining tractable model classes. There exist alternative theories on which a model class could be based, such as the theory of graphexes for sparse exchangeable random graphs (described in [Borgs et al.(2017)Borgs, Chayes, Cohn, and Veitch]). To a graphex is associated a growing random graph model, and the problem akin to ours in that setting is to produce consistent estimators of the graphex from a graph trajectory. This has been done in [Veitch and Roy(2016)]. However, while the set of models that can be parameterized by a graphex is quite rich, it has limitations that make it unsuitable for some of the models that we wish to consider, such as preferential attachment and uniform attachment (according to results in [Borgs et al.(2017)Borgs, Chayes, Cohn, and Veitch], both of these converge to the same degenerate graphex). We mention also [Ryabko(2017)], which deals with hypothesis testing on infinite random graphs. The focus there is on testing properties of infinite, boundeddegree graph isomorphism classes based on random walk samples; in contrast, our concern is with graph trajectories, which fundamentally carry more information than isomorphism classes, and our sampling model is different.
Additionally, one of the goals of our paper is to analyze the particularly natural scheme of nonstationary sampling (which was inspired by the algorithm sketched, but not fully specified, in [Jeong et al.(2003)Jeong, Néda, and Barabási]), and the guarantees on it lend themselves to phrasing in terms of the sequence of conditional distributions of a model, as we have done.
Finally, we mention recent work on goodness of fit testing for Markov chains [Daskalakis et al.(2018)Daskalakis, Dikkala, and Gravin]. In that work, as in ours, what is given is a single trajectory from a Markov chain. However, they restrict to a chain of constant size and assume homogeneous transition probabilities, ergodicity, symmetry, etc. See also more recent work that drops the symmetry condition [Cherapanamjeri and Bartlett(2019), Wolfer and Kontorovich(2019)]. General hypothesis testing problems relating to finite Markov chains under these assumptions have been considered in the more distant past [Natarajan(1985), Nakagawa and Kanaya(1993), Baum and Petrie(1966)]. In the setting of our paper, none of these assumptions hold.
Our contributions
In this paper, we give a rigorous formulation of goodness of fit testing for dynamic random graph models satisfying a Markov property, including a natural distortion measure on dynamic mechanisms. We identify (at an intuitive level) the key properties of dynamic models that make universal testing (i.e., testing with provable guarantees for a broad range of models) feasible and, motivated by these, propose a test of goodness of fit for models in a natural, infinite class based on nonstationary sampling, and show that this test succeeds with high probability. Our work may also be viewed as contributing toward the theoretical understanding of the generality of the idea of nonstationary sampling. Intuitively speaking, we find that it is not completely general, because of pathological special cases, but we can carve out a class of models defined by very natural conditions for which this technique is useful.
There are several novel technical challenges that arise in the problem of testing of dynamic random graph models. In particular, the problem deals with distinguishing between a candidate model and an arbitrary unknown model from a model class, both of which take the form of Markov processes on an infinite state space, so that classical tools for finitestate, ergodic Markov chains do not apply. Furthermore, identification of appropriate metrics for measuring the distance between two dynamic models is a nontrivial philosophical problem: we argue that, for example, total variation distance is of limited applicability in this setting, because it is intuitively substantially too stringent for exploratory data analysis: one may consider two models that are, intuitively, driven by the same mechanism (e.g., preferential attachment), but that have total variation distance $1$ because of small model differences.
Having settled on some measure, identification of an appropriate model class under which our candidate test can be shown to succeed with high probability is nontrivial, due to the large number of potentially pathological models that need to be ruled out.
The initial inspiration for the present work was to explore principled techniques for model validation in order to explore the validity of the application of the algorithms in [Sreedharan et al.(2019)Sreedharan, Magner, Szpankowski, and Grama] to real networks, such as protein interaction and brain region coexcitation networks. In that work, the authors devised algorithms and informationtheoretic bounds to estimate the arrival order of nodes from a snapshot of a growing graph, assuming preferential attachment as a generative model. We regard the present paper as forming initial groundwork for subsequent developments along the lines of model validation.
1.1 Organization of the paper
In the main body of the paper, we state the problem formally and give main definitions and results and experiments. We give the proofs in Appendix A.
2 Formal problem setting
We begin by formulating the problem in general. The most basic object of study is a (discretetime) dynamic random graph model.
[Dynamic random graph model] A dynamic random graph model (or dynamic mechanism) is a graphvalued Markov process. More specifically, it is specified by a sequence of conditional distributions $\mathrm{Pr}[{G}_{0}]$, ${\{\mathrm{Pr}[{G}_{t}{G}_{t1}]\}}_{t=1}^{\mathrm{\infty}}$. The Markov assumption is a natural one, especially in light of the fact that many dynamic graph models satisfy it (including the various preferential attachment models, the CooperFrieze web graph model [Newman(2010)], the dynamic stochastic block model, the duplicationdivergence model, etc). It has additionally already appeared explicitly in works on dynamic graphs [Avin et al.(2008)Avin, Koucký, and Lotker]. However, one can imagine plausible situations in which it does not hold: for example, nodes may be nostalgic, in the sense that they may choose to connect with others that were, at some point in the past, of high degree, or with nodes to which they had been previously frequently connected. We do not deal explicitly with such situations in the present work (but it is possible that they may be accommodated by a suitable change in the definition of the network under consideration).
We next define a distortion measure on Markov processes, which will be used to define our testing problem. {definition}[Distortion measure on Markov processes] Consider two Markov processes ${X}_{0}=({X}_{0,1},\mathrm{\dots},{X}_{0,n},\mathrm{\dots})$, ${X}_{1}=({X}_{1,1},\mathrm{\dots},{X}_{1,n},\mathrm{\dots})$. We define the following distortion:
${d}_{n}({X}_{0},{X}_{1})={\displaystyle \sum _{j=1}^{n1}}{\mathbb{E}}_{Z\sim {X}_{1,j}}[{d}_{TV}([{X}_{0,j+1}{X}_{0,j}=Z],[{X}_{1,j+1}{X}_{1,j}=Z])],$  (1) 
where ${d}_{TV}$ is the total variation distance between the laws of the two random variables. We note that the proposed distortion measure is not symmetric, which is natural in our problem setting. In general, the choice of distortion measure depends on the application at hand. It implicitly encodes which models we choose to regard as distinguishable, and in subsequent work we intend to examine this issue more closely. The measure under consideration here has the following natural interpretation, coming from the interpretation of the total variation distance: consider a setting in which we observe a sample $Z$ from ${X}_{1}$ at the time step $t1$, for a uniformly randomly selected time $t\in [n]$. A fair coin $B\sim \mathrm{Bernoulli}(1/2)$ is then flipped, and we then observe a sample from ${X}_{B,t}$, conditioned on ${X}_{B,t1}=Z$. We are then asked to guess the value of $B$ (i.e., which process generated the next value conditioned on the initial value that we saw). Up to constant factors, ${d}_{n}({X}_{0},{X}_{1})/n$ gives the success probability of an optimal hypothesis test for this problem (this is folklore about total variation distance). In other words, ${d}_{n}\mathit{}\mathrm{(}\mathrm{\cdot}\mathrm{,}\mathrm{\cdot}\mathrm{)}$ measures the distinguishing power of a uniformly random timestep from a trajectory from one of the models. See Example 2 below for an illustration.
Problem statement:
Having introduced dynamic mechanisms and a measure of distortion between them, we come to our main problem statement. Fix a particular natural class $\mathcal{C}$ of models with some distinguished member ${M}_{0}$. Let $\mathcal{G}$ denote the set of all graphs (for simplicity, let us throughout only consider multigraphs with finitely many vertices and edges). Let $B\sim \mathrm{Bernoulli}(1/2)$. We wish to exhibit a test for ${M}_{0}$, which takes the form of a function $F={F}_{{M}_{0}}:{\mathcal{G}}^{n}\to \{0,1\}$ mapping sequences of graphs to $\{0,1\}$; that is, the input to the test $F$ is an observed dynamic graph trajectory with $n$ timesteps, and the output represents whether or not the test decides that the trajectory came from ${M}_{0}$. Ideally, the test should distinguish trajectories coming from ${M}_{0}$ from those coming from an arbitrary unknown ${M}_{1}\in \mathcal{C}$ satisfying ${d}_{n}({M}_{0},{M}_{1})\ge n\u03f5$ (we will find that $\u03f5$ cannot always be taken to be arbitrarily close to $0$, due to an intrinsic property of a model which we call its nonstationary sampling radius). More precisely, $F$ takes $n$ steps ${G}_{1},\mathrm{\dots},{G}_{n}$ from ${M}_{B}$ and should satisfy $F({G}_{1},\mathrm{\dots},{G}_{n})=B$ with high probability (asymptotically as $n\to \mathrm{\infty}$). In what follows, we will exhibit a class $\mathcal{C}$ and a universal test $F$ for it that succeeds with high probability under natural conditions.
The class will be inspired by (and will contain) the (linear) preferential attachment model, which has received extensive attention over several years in various communities as a simple model that produces a power law degree distribution [Albert and Barabási(2002), Bollobás et al.(2001)Bollobás, Riordan, Spencer, and Tusnády]. This model, denoted by $\mathcal{P}\mathcal{A}(m,n)$, is defined as follows: there is a parameter $m\in \mathbb{N}$. The graph ${G}_{1}$ is a single vertex (called $1$) with $m$ self loops. Conditioned on ${G}_{t1}$, ${G}_{t}$ is sampled as follows: we have ${G}_{t1}\subset {G}_{t}$, and there is an additional vertex $t$ with $m$ edges to vertices in $[t1]=\{1,\mathrm{\dots},t\}$, chosen independently as follows: the probability that a particular choice goes to vertex $v\in [t1]$ is given by $\frac{{\mathrm{deg}}_{t1}(v)}{2m(t1)}$, where ${\mathrm{deg}}_{t1}(v)$ is the degree of $v$ in ${G}_{t1}$. There are several small tweaks to this model, but they have no bearing on the analysis in this paper. In examples, we will also mention the uniform attachment model, which is similar to preferential attachment, except that the conditional probability of a given vertex $v$ being chosen at time $t$ is $1/(t1)$. We denote this model by $\mathcal{U}\mathcal{A}(m,n)$.
Consider the case of uniform attachment versus preferential attachment graphs with shared parameter $m\ge 1$. Let us consider ${d}_{n}(\mathcal{P}\mathcal{A},\mathcal{U}\mathcal{A})$. The $j$th term of the sum defining the distortion measure is an expectation with respect to a random variable $Z\sim \mathcal{U}\mathcal{A}(m,j)$; that is, $Z$ is a uniform attachment graph on $j$ vertices. Now, the conditional probability distribution of each of the choices of the $j+1$st vertex, given $Z$, in the uniform attachment model is simply the uniform distribution on the vertices $[j]=\{1,\mathrm{\dots},j\}$. Meanwhile, the conditional distribution of each choice made by the $j+1$st vertex, given $Z$, in the preferential attachment model depends on the degrees of vertices in $Z$. It is known that with high probability in the uniform attachment model, as $j\to \mathrm{\infty}$, there are $\mathrm{\Theta}(j)$ vertices with degree $m$, and so the preferential attachment distribution assigns $\mathrm{\Theta}(j)$ vertices a conditional probability equal to $\frac{1}{2(j1)}$. In particular, this implies that ${d}_{n}(\mathcal{P}\mathcal{A},\mathcal{U}\mathcal{A})=\mathrm{\Omega}(n)$. A more careful analysis, using known results from the literature, can yield precise asymptotics.
3 Main results
We will build slowly to our main results and model class definition. The main difficulty in the problem is that we are tasked with inferring information about a sequence of probability distributions, usually given only a single (or few) graph trajectory, which implies only a single sample of each conditional distribution. In general, then, we must appropriately restrict our model class $\mathcal{C}$ in order to yield a solvable problem. The key insight is that, between consecutive time steps, the network structure, and, hence, the corresponding conditional distributions, should not change significantly (note, however, that this is a nontrivial phenomenon to formalize). Our plan of attack will be to pretend that the sequence of updates to the graph immediately after a given time point are independently sampled from the same distribution and to construct an estimator of our metric from these samples. For simplicity of exposition, we restrict below to the case of growing networks, where a single vertex is added at each timestep, and it connects to some set of previous vertices. In this setting, an update (with respect to a given graph sequence) at time $t$ takes the form of a selection (a multiset) of vertices present in the graph at the previous timestep to which vertex $t$ will connect. We will denote the set of possible updates at time $t$ by ${\mathbb{D}}_{t}$. For a given update $\kappa \in {\mathbb{D}}_{t}$, we will use $t\to \kappa $ to denote the event that vertex $t$ connects to the vertices specified by $\kappa $ at time $t$. We denote by ${U}_{t}$ the update at time $t$ in a given sample graph trajectory.
Formally, we will define the test statistic as follows. Fix $C(n)$ (which we call the sample width) and $M(n)$ (the number of probe points), and, for $t\in [n]$ and $\kappa \in {\mathbb{D}}_{t}$, let ${\widehat{\mu}}_{t,\kappa}$ denote the following probability:
${\widehat{\mu}}_{t,\kappa}={\displaystyle \frac{\{h\in [t,t+C(n)):h\to \kappa \}}{\{h\in [t,t+C(n)):{U}_{h}\subseteq [t1]\}}}.$  (2) 
Let ${\widehat{\mu}}_{t}$ denote the probability distribution giving probability ${\widehat{\mu}}_{t,\kappa}$ to $\kappa $, for each possible $\kappa $. That is, ${\widehat{\mu}}_{t}$ is an empirical probability distribution over updates. We note that the sample intervals corresponding to different probe points in general can overlap substantially.
Let ${p}_{t,\kappa}^{{M}_{0}}={p}_{t,\kappa}$ denote the conditional probability given to update $\kappa $ at time $t$ by model ${M}_{0}$. For example, when ${M}_{0}$ is preferential attachment with parameter $m\ge 1$ and ${G}_{t1}$ is given, $\kappa $ is a multiset $\{{v}_{1},\mathrm{\dots},{v}_{m}\}$ of cardinality $m$ of vertices in ${G}_{t1}$ (in particular, those to which the new vertex $t$ will connect), and ${p}_{t,\kappa}$ is given by
${p}_{t,\kappa}={\displaystyle \prod _{i=1}^{m}}{\displaystyle \frac{{\mathrm{deg}}_{t1}({v}_{i})}{2m(t1)}}.$  (3) 
Given an input trajectory $G=({G}_{1},\mathrm{\dots},{G}_{n})$, the test statistic is computed by randomly sampling $M(n)$ probe points ${r}_{1}\le \mathrm{\dots}\le {r}_{M(n)}\in [n]$ and computing
$S(n):={S}_{{M}_{0}}({G}_{1},\mathrm{\dots},{G}_{n})={\displaystyle \sum _{j=1}^{M(n)}}{d}_{TV}({\widehat{\mu}}_{{r}_{j}},{p}_{{r}_{j}}^{{M}_{0}}).$  (4) 
We often shall write $S:=S(n)$ for ${S}_{{M}_{0}}({G}_{1},\mathrm{\dots},{G}_{n})$. This may be thought of as an estimate of ${d}_{n}({M}_{B},{M}_{0})$ via nonstationary sampling. Now we are ready for present our test. We will further restrict to the case where the cardinality of an update is at most some fixed $m\mathrm{\ge}\mathrm{1}$. This is natural in light of the fact that many real networks tend to be sparse.
Algorithm: TestDynamicGraph $(n,{M}_{0},M(n),C(n))$. Input: Sample trajectory $G=({G}_{1},\mathrm{\dots},{G}_{n})\sim {M}_{B}$, distance threshold $D\ge 0$. Output: An estimate $\widehat{B}\in \{0,1\}$ of $B$. 1. Select $M(n)$ probe points ${r}_{1},\mathrm{\dots},{r}_{M(n)}$ uniformly at random with replacement from $[n]$ and compute ${\widehat{\mu}}_{{r}_{j}}$ for each $j\in [M(n)]$. 2. Compute $$S(n):={S}_{{M}_{0}}({G}_{1},\mathrm{\dots},{G}_{n})=\sum _{j=1}^{M(n)}{d}_{TV}({\widehat{\mu}}_{{r}_{j}},{p}_{{r}_{j}}^{{M}_{0}}).$$ 3. Set $\alpha =\alpha (n)=Dn/2$, and compute ${\mathbb{E}}_{{M}_{0}}[{S}_{{M}_{0}}]$, where ${\mathbb{E}}_{{M}_{0}}[{S}_{{M}_{0}}]$ can be estimated by sampling ${G}^{\prime}=({G}_{1}^{\prime},\mathrm{\dots},{G}_{n}^{\prime})$ from ${M}_{0}$ (or, possibly, computed analytically). 4. If $S(n){\mathbb{E}}_{{M}_{0}}[{S}_{{M}_{0}}]>\alpha :=\alpha (n)$, set $\widehat{B}=1$, else $\widehat{B}=0$.
We note that although $S$ has the form of an estimate of ${d}_{n}({M}_{B},{M}_{0})$, it does not converge in probability to this value (indeed, it is likely that a single trajectory is insufficient to estimate $S$). However, as we will see, the above test succeeds with high probability under natural conditions.
To state our main result for this test, we need to develop some concepts related to our model class (from which both ${M}_{0}$ and ${M}_{1}$ will come). The general pattern of the analysis of the test to show that it succeeds with high probability in distinguishing two models will proceed in two steps:

•
Show that ${\mathbb{E}}_{{M}_{1}}[S]{\mathbb{E}}_{{M}_{0}}[S]$ is sufficiently large.

•
Show that $S$ is wellconcentrated under both ${M}_{0}$ and ${M}_{1}$.
Let us examine the first step more closely. We can lower bound the expected value difference as follows: let ${S}_{j}$ denote the $j$th term in the sum (4) defining the test statistic (note that it is defined with respect to ${M}_{0}$). We have
${\mathbb{E}}_{{M}_{0}}[{S}_{j}]={\mathbb{E}}_{{M}_{0}}[{d}_{TV}({\widehat{\mu}}_{{r}_{j}},{p}_{{r}_{j}}^{{M}_{0}})],$  (5) 
and
${\mathbb{E}}_{{M}_{1}}[{S}_{j}]={\mathbb{E}}_{{M}_{1}}[{d}_{TV}({\widehat{\mu}}_{{r}_{j}},{p}_{{r}_{j}}^{{M}_{0}})].$  (6) 
By the reverse triangle inequality, this becomes
${\mathbb{E}}_{{M}_{1}}[{S}_{j}]\ge \left{\mathbb{E}}_{{M}_{1}}[{d}_{TV}({\widehat{\mu}}_{{r}_{j}},{p}_{{r}_{j}}^{{M}_{1}})]{\mathbb{E}}_{{M}_{1}}[{d}_{TV}({p}_{{r}_{j}}^{{M}_{1}},{p}_{{r}_{j}}^{{M}_{0}})]\right.$  (7) 
This can be further lower bounded by
${\mathbb{E}}_{{M}_{1}}[{S}_{j}]\ge {\mathbb{E}}_{{M}_{1}}[{d}_{TV}({p}_{{r}_{j}}^{{M}_{1}},{p}_{{r}_{j}}^{{M}_{0}})]{\mathbb{E}}_{{M}_{1}}[{d}_{TV}({\widehat{\mu}}_{{r}_{j}},{p}_{{r}_{j}}^{{M}_{1}})].$  (8) 
Thus, we have
${\mathbb{E}}_{{M}_{1}}[{S}_{j}]{\mathbb{E}}_{{M}_{0}}[{S}_{j}]\ge {\mathbb{E}}_{{M}_{1}}[{d}_{TV}({p}_{{r}_{j}}^{{M}_{1}},{p}_{{r}_{j}}^{{M}_{0}})]{\mathbb{E}}_{{M}_{1}}[{d}_{TV}({\widehat{\mu}}_{{r}_{j}},{p}_{{r}_{j}}^{{M}_{1}})]{\mathbb{E}}_{{M}_{0}}[{d}_{TV}({\widehat{\mu}}_{{r}_{j}},{p}_{{r}_{j}}^{{M}_{0}})].$  (9) 
The positive term measures the contribution of the point ${r}_{j}$ to the distance between ${M}_{0}$ and ${M}_{1}$. Meanwhile, the negative terms are both intrinsic estimation errors from nonstationary sampling. In order for two models to be easy to distinguish, we desire that these terms be small in absolute value. In the sequel we call ${\mathbb{E}}_{M}[{S}_{M}]$ the nonstationary sampling radius.
We will show in Section A.1 a concentration result for the test statistic for any ${M}_{0},{M}_{1}$ in the model class $\mathcal{C}$ (inspired by the analysis of nonstationary sampling on the preferential attachment model) described below in the following definition. {definition}[Boundeddegree model class] Let $\mathcal{C}={\mathcal{C}}_{m}$, for any fixed $m\ge 1$, denote the class of dynamic random graph models $M$ taking the following form: for each time step $t$, there is a positive integervalued random variable ${\mathrm{\Gamma}}_{t}\le m$, independent of ${G}_{t1}$ and all other ${\mathrm{\Gamma}}_{{t}^{\prime}}$, denoting the number of edges to be added at timestep $t$ between a new vertex $t$ and vertices present in the graph at the previous timestep. Conditioned on ${\mathrm{\Gamma}}_{t}$ and ${G}_{t1}$, the random variable ${U}_{t}$ consists of ${\mathrm{\Gamma}}_{t}$ independent and identically distributed choices of vertices in $[t1]$, according to a probability distribution ${\{{\pi}_{t,v}\}}_{v=1}^{t1}$ (note that a vertex may be chosen multiple times in a given timestep, which would yield a multigraph). We call ${\mathcal{C}}_{m}$ the class of boundeddegree models. For instance, in preferential attachment, ${\mathrm{\Gamma}}_{t}=m$ with probability $1$, and ${\pi}_{t,v}$ is simply $\frac{{\mathrm{deg}}_{t1}(v)}{2m(t1)}$, so that ${p}_{t,{U}_{t}}={\prod}_{v\in {U}_{t}}{\pi}_{t,v}$.
We further stipulate the following conditions. As will be spelled out explicitly in Example 3, these are inspired by the basic properties of the preferential attachment model that imply concentration and tail bounds on its degree sequence.
[Further natural model class conditions]

(i)
Each ${\pi}_{t,v}$ is dependent on ${G}_{t1}$ only through a random variable ${Y}_{t,v}$, which, conditioned on ${G}_{t1}$, is independent of any other ${Y}_{{t}^{\prime},{v}^{\prime}}$ with ${t}^{\prime}\le t$ and ${v}^{\prime}$. In other words, ${G}_{t1}\leftrightarrow {Y}_{t,v}\leftrightarrow {p}_{t,v}$ forms a Markov chain (cf. [Cover and Thomas(2006)]).

(ii)
There is a positive constant $\mathrm{\Delta}$ such that, for each $t$, at most $\mathrm{\Delta}$ vertices satisfy ${Y}_{t,v}{Y}_{t1,v}\ne 0$.

(iii)
We have ${\pi}_{t,t1}=\mathrm{\Theta}(1/t)$, uniformly in $t$, with probability $1$.

(iv)
Only vertices chosen in a given timestep can increase significantly in conditional probability: there exist some constants $$, with $$, such that, for any timestep $t$, if a vertex $v$ is not chosen for connection, then
${\pi}_{t+1,v}{\pi}_{t,v}\le {c}_{1}{\pi}_{t,v}/t.$ (10) If, on the other hand, $v$ is chosen for connection, then we only require that
${\pi}_{t+1,v}{\pi}_{t,v}\le {c}_{2}(1{\pi}_{t,v})/t.$ (11)
The linear preferential attachment model is easily seen to be contained in $\mathcal{C}={\mathcal{C}}_{m}$, taking ${Y}_{t,v}={\mathrm{deg}}_{t}(v)$. The second constraint follows for this model because only at most $m$ vertices’ degrees change after a given time step. The third constraint follows because the degree of vertex $t$ immediately after it is added is $m$, the parameter of the model. That is, ${\pi}_{t,t1}=\frac{m}{2m(t1)}=\frac{1}{2(t1)}=\mathrm{\Theta}(1/t)$. The final constraint can be seen as follows. If a vertex $v$ is not chosen in timestep $t$, then the change in its conditional probability at time $t+1$ is given by
${\pi}_{t+1,v}{\pi}_{t,v}={\displaystyle \frac{{\mathrm{deg}}_{t}(v)}{2mt}}{\displaystyle \frac{{\mathrm{deg}}_{t}(v)}{2m(t1)}}={\displaystyle \frac{{\mathrm{deg}}_{t}(v)}{2m}}({\displaystyle \frac{1}{t}}{\displaystyle \frac{1}{t1}})={\displaystyle \frac{{\pi}_{t,v}}{t}}\left(1+O({t}^{2})\right).$  (12) 
On the other hand, if a vertex is chosen (say, exactly once) at timestep $t$, then
${\pi}_{t+1,v}{\pi}_{t,v}={\displaystyle \frac{{\mathrm{deg}}_{t1}(v)+1}{2mt}}{\displaystyle \frac{{\mathrm{deg}}_{t1}(v)}{2m(t1)}}={\displaystyle \frac{{\pi}_{t,v}}{t}}\left(1+O({t}^{2})\right)+{\displaystyle \frac{1}{2mt}}.$  (13) 
For another example, consider the uniform attachment model with parameter $m$. In this case, ${\pi}_{t,v}=\frac{1}{t1}$ for any $v$. We may take ${Y}_{t,v}$ to be ${\mathrm{deg}}_{t1}(v)$ (though ${\pi}_{t,v}$ is trivially independent of ${G}_{t1}$), so that conditions (i) and (ii) are trivially satisfied, as is condition (iii). Since, in any timestep, we have ${\pi}_{t+1,v}{\pi}_{t,v}=\frac{1}{t}\frac{1}{t1}=\frac{1}{t(t1)}$, condition (iv) is satisfied as well. Mixtures of preferential and uniform attachment can additionally be seen to fit into this model class.
Additionally, models involving preferential attachment to vertices based, e.g., on the number of triangles in which they participate are also in $\mathcal{C}$. While many natural models (such as nonlinear preferential attachment and the standard duplicationdivergence model) are not obviously contained in this class, similar results to ours (concerning our proposed test statistic) nonetheless may be shown to hold with a minor generalization of our model class.
We note that conditions (iii) and (iv) together imply an important property of models in the class: for a model $M$, let ${N}_{t}^{M}(q)$ denote the number of vertices $v$ satisfying ${\pi}_{t,v}^{M}=q$ (note that this is a random variable). Furthermore, let ${R}_{M,t}(q)$ denote the following set:
${R}_{M,t}(q)=\{v:{\pi}_{t,v}^{M}\ge q\}.$  (14) 
Then conditions (iii) and (iv) together imply that, for any ${M}_{0},{M}_{1}\in \mathcal{C}$, possibly with ${M}_{0}={M}_{1}$, we have that
${\int}_{q}^{1}}{\mathbb{E}}_{{M}_{1}}[{N}_{t}^{{M}_{0}}(x)]\mathit{d}x={\mathbb{E}}_{{M}_{1}}[{R}_{{M}_{0},t}(q)]\le C{(qt)}^{1+\gamma},$  (15) 
for some $$, some $C>0$, and all $q\in [0,1]$, $t\le n$. Intuitively, the function ${N}_{t}^{{M}_{0}}(q)$ is conceptually related to the degree sequence of the graph at time $t$, and, in preferential attachment, it is exactly the degree sequence. Thus, this inequality is akin to a power law degree sequence tail.
Inequality (15) can be seen using the following reasoning: we will prove Theorem 3 below, which will allow us to upper bound ${R}_{{M}_{1},t}(q)$, for any model ${M}_{1}$, in terms of ${R}_{{M}_{0},t}(q)$, where ${M}_{0}$ is some other model. In particular, we will choose ${M}_{0}$ to be preferential attachment, and so this will allow us to upper bound ${R}_{{M}_{1},t}(q)$ in terms of the degree sequence tail of preferential attachment graphs.
Consider two models ${M}_{0},{M}_{1}$ satisfying conditions (iii) and (iv) of Definition 3 with constants ${c}_{b,k}$, for $b\in \{0,1\}$ and $k\in \{0,1,2\}$. Suppose, further, that ${M}_{0}$ satisfies inequalities (10) and (11) with asymptotic equality (as $t\to \mathrm{\infty}$), and that ${c}_{1,k}\le {c}_{0,k}$ for each $k\in \{1,2\}$. Then for any sequence of vertex choices ${v}_{1},\mathrm{\dots},{v}_{t},\mathrm{\dots}$, we have that there exists some $C>0$ for which
${R}_{{M}_{1},t}(Cq)\subseteq {R}_{{M}_{0},t}(q).$  (16) 
Therefore,
${R}_{{M}_{1},t}(Cq)\le {R}_{{M}_{0},t}(q).$  (17) 
We note that if all vertices $v$ satisfy
${\pi}_{v,t}^{{M}_{1}}\le C{\pi}_{v,t}^{{M}_{0}},$  (18) 
then $v\in {R}_{{M}_{1},t}(Cq)$ implies that ${\pi}_{v,t}^{{M}_{1}}\ge Cq$, which implies that
${\pi}_{v,t}^{{M}_{0}}\ge q,$  (19) 
so that $v\in {R}_{{M}_{0},t}(q)$, and the inclusion claimed by the theorem is verified.
It thus remains to verify (18). We can do this by induction on $t$. At time $t$, when vertex $t$ appears, our initial condition says that
${\pi}_{t,t}^{{M}_{1}}={c}_{1,0}/t={\displaystyle \frac{{c}_{1,0}{c}_{0,0}}{{c}_{0,0}t}}={\displaystyle \frac{{c}_{1,0}}{{c}_{0,0}}}{c}_{0,0}/t.$  (20) 
so we can take $C={c}_{1,0}/{c}_{0,0}$, and this verifies the base case.
Now, for the inductive hypothesis, we have that for any vertex $v$,
${\pi}_{v,t}^{{M}_{1}}\le C{\pi}_{v,t}^{{M}_{0}},$  (21) 
so, for a $v\ne {v}_{t}$,
${\pi}_{v,t+1}^{{M}_{1}}\le C{\pi}_{v,t}^{{M}_{0}}+{c}_{1,1}{\pi}_{v,t}^{{M}_{1}}/t\le C{\pi}_{v,t+1}^{{M}_{0}}$  (22) 
as long as ${c}_{1,1}\le {c}_{0,1}$. Similarly, as long as ${c}_{1,2}\le {c}_{0,2}$, the same inequality holds for $v={v}_{t}$. To conclude the proof of (15), we note that the method of proof used to establish upper bounds on the expected degree sequence for preferential attachment applies for arbitrary fixed values of ${c}_{1}>0$ and ${c}_{2}\in (0,1)$.
As hinted above, conditions (iii) and (iv) are important in that they imply (15). This motivates the definition of a more general model class, this time parametrized by a model ${M}_{0}$. {definition}[More general model class] Suppose that $M$ is a boundeddegree (with degree bound $m>0$) model satisfying conditions (i) and (ii) of Definition 3, in addition to (15) for ${M}_{0}={M}_{1}=M$. We define the model class ${\mathcal{C}}_{M,m}={\mathcal{C}}_{M}$ to be the set of models ${M}^{\prime}$ again satisfying (i) and (ii) of Definition 3, and also (15) with ${M}_{0}=M,{M}_{1}={M}^{\prime}$ and ${M}_{0}={M}^{\prime},{M}_{1}=M$. In what follows, for simplicity, we will say that a pair of models $({M}_{0},{M}_{1})$ satisfies Definition 3 if ${M}_{0}$ is as in the definition and ${M}_{1}\in {\mathcal{C}}_{{M}_{0}}$.
We arrive at our main result. For a pair of models ${M}_{0}$ and ${M}_{1}$, it will be phrased in terms of ${d}_{n}({M}_{0},{M}_{1})$ as well as the sum of their nonstationary sampling radii. Intuitively, the nonstationary sampling radius of a model measures the fidelity with which nonstationary sampling of a sample trajectory from a model can estimate the transition probabilities of the model itself. Thus, to distinguish two models via nonstationary sampling, it is required that they be wellseparated and that they be estimable via nonstationary sampling. The expressions in the theorem capture this more precisely.
[Distinguishability for a natural model class] Let $\mathcal{C}$ be as in Definition 3. Let ${M}_{0},{M}_{1}\in \mathcal{C}$ be any pair of models such that
${d}_{n}({M}_{0},{M}_{1}){\mathbb{E}}_{{M}_{0}}[{S}_{{M}_{0}}]{\mathbb{E}}_{{M}_{1}}[{S}_{{M}_{1}}]>Dn,$  (23) 
where $D$ is the constant input given in the algorithm. Alternatively, let $({M}_{0},{M}_{1})$ satisfy Definition 3, again satisfying the inequality (23).
Then the test based on the statistic $S$ defined in (4), with $C(n)$ and $M(n)$ both chosen to be $\mathrm{\Theta}(n)$, succeeds with probability $1\mathrm{\Theta}({n}^{\delta})$ for some $\delta =\delta (D)>0$.
In order to estimate ${\mathbb{E}}_{M}[{S}_{M}]$, we will also show that a model’s nonstationary sampling radius can be efficiently estimated from samples, provided that it is a member of $\mathcal{C}$. {theorem}[Estimability of the nonstationary sampling radius] Let $M\in \mathcal{C}$. Then the following concentration result holds, again in the setting where $M(n)$ and $C(n)$ are $\mathrm{\Theta}(n)$: for any $c>0$, there exists some $\u03f5>0$ for which
${\mathrm{Pr}}_{M}[{S}_{M}{\mathbb{E}}_{M}[{S}_{M}]\ge cn]=O({n}^{\u03f5}).$  (24) 
This theorem implies that one may estimate the nonstationary sampling radius of $M$ with high probability up to an arbitrarily small multiplicative error by taking a single sample trajectory and computing ${S}_{M}$ on it.
3.1 Running time and sample complexity upper bounds
Here we consider the running time of the calculation of the proposed test. We stress that the focus of this paper is not on algorithmic issues, but rather on conditions under which the error probability of the test can be shown to decay to $0$. However, the running time is polynomial in all relevant parameters, provided that the conditional distributions of ${M}_{0}$ can be computed in polynomial time. {theorem}[Running time of the proposed test] Suppose that the probability distribution ${p}_{t}^{{M}_{0}}$ can be computed in time $X(t)$. Then a naive algorithm for computing ${S}_{{M}_{0}}({G}_{1},\mathrm{\dots},{G}_{n})$ works in time $\mathrm{\Theta}(nX(n)+{n}^{2})$. {proof} A simple way to perform the computation is to compute each term of the sum defining the test statistic independently of any other one. There are $M(n)=\mathrm{\Theta}(n)$ such terms, and, for each term, computing the total variation distance requires at most $X(n)+\mathrm{\Theta}(n)$ time. The result is that the running time is at most $O(nX(n)+{n}^{2})$. As an example, computing the conditional distribution at each timestep $t$ takes time $X(t)=O(t)$ under uniform and preferential attachment models. Therefore, the running time of the above algorithm for such models is $O({n}^{2})$.
Regarding sample complexity, we may consider a sample to correspond to a graph at any timestep that we use to compute the test statistic. Since the intervals corresponding to different probe points can overlap substantially, graphs corresponding to certain timesteps may appear several times in the test statistic calculation. However, these only count as one sample, and so we have a sample complexity of at most $O(n)$ (it is likely that this can be improved). We stress that our theorems remain nontrivial and valuable, because they show conditions under which the probability of error decays to $0$ – a priori, it need not be the case that this happens, even with full information about the graph trajectory.
4 Experimental results
We empirically investigate the nonstationary sampling radius for a certain subset of models. Since this quantity is crucial for our theoretical guarantees, it is of interest to build intuition about it.
We consider a mixture model interpolating between uniform and preferential attachment in the case $m=1$. Namely, at each step, the conditional probability of vertex $v\in [t1]$ is given by ${\pi}_{t,v}=\frac{\beta}{t1}+(1\beta )\frac{{\mathrm{deg}}_{t1}(v)}{2(t1)}$, for a parameter $\beta \in [0,1]$. Note that $\beta =0$ corresponds to preferential attachment, while $\beta =1$ corresponds to uniform.
We plotted estimates for the nonstationary sampling radius of several models as $\beta $ ranges from $0$ to $1$. The result is in Figure 1. We see a clear linear trend, with the quantity minimized at $\beta =0$ (preferential attachment). On this basis, and given the close relation between the empirical distribution coming from nonstationary sampling and the degrees of vertices, we have the following conjecture. {conjecture} The model in $\mathcal{C}$ with the minimum nonstationary sampling radius is preferential attachment.
We additionally have results applying our test to the case of distinguishing uniform attachment (playing the role of ${M}_{0}$) from preferential attachment. See Figure 2. The precision jumps significantly at $n=10$.
References
 [Albert and Barabási(2002)] Réka Albert and AlbertLászló Barabási. Statistical mechanics of complex networks. Rev. Mod. Phys., 74:47–97, Jan 2002. doi: 10.1103/RevModPhys.74.47. URL https://link.aps.org/doi/10.1103/RevModPhys.74.47.
 [Avin et al.(2008)Avin, Koucký, and Lotker] Chen Avin, Michal Koucký, and Zvi Lotker. How to explore a fastchanging world (cover time of a simple random walk on evolving graphs). In Automata, Languages and Programming, pages 121–132, Berlin, Heidelberg, 2008. Springer Berlin Heidelberg. ISBN 9783540705758.
 [Baum and Petrie(1966)] Leonard E. Baum and Ted Petrie. Statistical inference for probabilistic functions of finite state markov chains. Ann. Math. Statist., 37(6):1554–1563, 12 1966. doi: 10.1214/aoms/1177699147. URL https://doi.org/10.1214/aoms/1177699147.
 [Bollobás et al.(2001)Bollobás, Riordan, Spencer, and Tusnády] Béla Bollobás, Oliver Riordan, Joel Spencer, and Gábor Tusnády. The degree sequence of a scalefree random graph process. Random Structures & Algorithms, 18(3):279–290, 2001. doi: 10.1002/rsa.1009. URL https://onlinelibrary.wiley.com/doi/abs/10.1002/rsa.1009.
 [Borgs et al.(2017)Borgs, Chayes, Cohn, and Veitch] Christian Borgs, Jennifer T. Chayes, Henry Cohn, and Victor Veitch. Sampling perspectives on sparse exchangeable graphs. arXiv eprints, art. arXiv:1708.03237, Aug 2017.
 [Cherapanamjeri and Bartlett(2019)] Yeshwanth Cherapanamjeri and Peter L. Bartlett. Testing symmetric markov chains without hitting. In COLT, 2019.
 [Cover and Thomas(2006)] Thomas M. Cover and Joy A. Thomas. Elements of Information Theory (Wiley Series in Telecommunications and Signal Processing). WileyInterscience, New York, NY, USA, 2006. ISBN 0471241954.
 [Daskalakis et al.(2018)Daskalakis, Dikkala, and Gravin] Constantinos Daskalakis, Nishanth Dikkala, and Nick Gravin. Testing symmetric markov chains from a single trajectory. In Proceedings of the 31st Conference On Learning Theory, volume 75 of Proceedings of Machine Learning Research, pages 385–409. PMLR, 06–09 Jul 2018. URL http://proceedings.mlr.press/v75/daskalakis18a.html.
 [Diakonikolas et al.(2017)Diakonikolas, Gouleakis, Peebles, and Price] Ilias Diakonikolas, Themis Gouleakis, John Peebles, and Eric Price. Sampleoptimal identity testing with high probability. Electronic Colloquium on Computational Complexity (ECCC), 24:133, 2017.
 [Ghoshdastidar et al.(2017)Ghoshdastidar, Gutzeit, Carpentier, and von Luxburg] D. Ghoshdastidar, M. Gutzeit, A. Carpentier, and U. von Luxburg. Twosample hypothesis testing for inhomogeneous random graphs. preprint, 2017. arXiv preprint (arXiv:1707.00833).
 [Hofstad(2016)] Remco van der Hofstad. Random Graphs and Complex Networks, volume 1 of Cambridge Series in Statistical and Probabilistic Mathematics. Cambridge University Press, 2016. doi: 10.1017/9781316779422.
 [Jeong et al.(2003)Jeong, Néda, and Barabási] H. Jeong, Z. Néda, and A. L. Barabási. Measuring preferential attachment in evolving networks. EPL (Europhysics Letters), 61(4):567, 2003. URL http://stacks.iop.org/02955075/61/i=4/a=567.
 [Nakagawa and Kanaya(1993)] Kenji Nakagawa and Fumio Kanaya. On the converse theorem in statistical hypothesis testing for markov chains. IEEE Trans. Information Theory, 39:629–633, 1993.
 [Natarajan(1985)] S. Natarajan. Large deviations, hypotheses testing, and source coding for finite markov chains. IEEE Transactions on Information Theory, 31(3):360–365, May 1985. ISSN 00189448. doi: 10.1109/TIT.1985.1057036.
 [Newman(2010)] Mark Newman. Networks: An Introduction. Oxford University Press, Inc., New York, NY, USA, 2010. ISBN 0199206651, 9780199206650.
 [Orbanz and Roy(2013)] Peter Orbanz and Daniel Roy. Bayesian models of graphs, arrays and other exchangeable random structures. IEEE Transactions on Pattern Analysis and Machine Intelligence, 37, 12 2013. doi: 10.1109/TPAMI.2014.2334607.
 [Ryabko(2017)] Daniil Ryabko. Hypotheses testing on infinite random graphs. In ALT, 2017.
 [Sreedharan et al.(2019)Sreedharan, Magner, Szpankowski, and Grama] J.K. Sreedharan, A. Magner, W. Szpankowski, and A. Grama. Inferring temporal information from a snapshot of a dynamic network. Nature Scientific Reports, 9:3057, 2019.
 [Veitch and Roy(2016)] Victor Veitch and Daniel M. Roy. Sampling and estimation for (sparse) exchangeable graphs. ArXiv, abs/1611.00843, 2016.
 [Wasserman(2010)] Larry Wasserman. All of Statistics: A Concise Course in Statistical Inference. Springer Publishing Company, Incorporated, 2010. ISBN 1441923225, 9781441923226.
 [Wolfer and Kontorovich(2019)] Geoffrey Wolfer and Aryeh Kontorovich. Minimax testing of identity to a reference ergodic markov chain. ArXiv, abs/1902.00080, 2019.
Appendix A Proofs
A roadmap of the proof of Theorem 3 is as follows: we show that, regardless of which of ${M}_{0}$ or ${M}_{1}$ generated the observed trajectory, the test statistic $S$ is wellconcentrated around its mean (in both cases, this is typically $\mathrm{\Theta}(n)$). Furthermore, the hypothesis (23) allows us to conclude that ${\mathbb{E}}_{{M}_{0}}[S]$ and ${\mathbb{E}}_{{M}_{1}}[S]$ are wellseparated. Thus, we are able to find an appropriate decision boundary for our test. The concentration of the test statistic boils down to concentration of each of its terms, which we are able to establish by rewriting them as an appropriate double integral in terms of a counting function (${N}_{t}(p,q)$ below) which is analogous to the degree sequence in preferential attachment. We are then able to adapt techniques used to establish concentration of the degree sequence to complete the proof. The case for general $m\ge 1$ (where we recall that $m$ is an upper bound on the number of edges that may be added in a given timestep) is a corollary of the case for $m=1$, and so below we handle the case of $m=1$. This simplifies the notation somewhat: updates are now single vertices, and so we can use ${p}_{t,v}$ in place of ${\pi}_{t,v}$, etc.
A.1 Proof of Theorem 3
The analysis of the test boils down to showing concentration of the test statistic when the observed graph trajectory is from either ${M}_{0}$ or ${M}_{1}$. We will start by proving the following.
[Concentration of ${d}_{TV}({\widehat{\mu}}_{t},{p}_{t})$] We have that for any models ${M}_{0},{M}_{1}$ as in the setting of Theorem 3, there is some $C>0$ such that for any sufficiently small ${\u03f5}_{1}>0$, there exists ${\u03f5}_{2}>0$ for which
${\mathrm{Pr}}_{{M}_{1}}[{d}_{TV}({\widehat{\mu}}_{t},{p}_{t}^{{M}_{0}}){\mathbb{E}}_{{M}_{1}}[{d}_{TV}({\widehat{\mu}}_{t},{p}_{t}^{{M}_{0}})]>{t}^{{\u03f5}_{1}}]\le C{t}^{{\u03f5}_{2}}.$  (25) 
In order to show Proposition A.1, we rewrite the total variation distance as follows: in general, consider discrete random variables $X$ and $Y$. Then
${d}_{TV}(X,Y)={\displaystyle \frac{1}{2}}{\displaystyle {\int}_{0}^{1}}{\displaystyle {\int}_{0}^{1}}N(p,q)pq\mathit{d}q\mathit{d}p,$  (26) 
where $N(p,q)$ is the number of elements $x$ in the common domain of $X,Y$ for which $\mathrm{Pr}[X=x]=p$ and $\mathrm{Pr}[Y=x]=q$, and the integrals are with respect to discrete (Dirac) measures supported on the set of values for which $N\mathit{}\mathrm{(}p\mathrm{,}q\mathrm{)}$ can possibly be nonzero. We see, then, that concentration of ${d}_{TV}({\widehat{\mu}}_{t},{p}_{t}^{{M}_{0}})$ will follow from concentration of ${N}_{t}(p,q)$ (now parameterized by $t$), where, in our case, the random variables in question are distributed according to ${\widehat{\mu}}_{t}$ (which will correspond to the $p$ integrating variable) and ${p}_{t}^{{M}_{0}}={p}_{t}$ (which will correspond to the $q$ integrating variable). More explicitly, ${N}_{t}(p,q)$ is the number of vertices $v$ in the interval $[t1]$ whose empirical probability ${\widehat{\mu}}_{t,v}$ is equal to $p$ and whose conditional probability at time $t$ according to model ${M}_{0}$ is equal to $q$. Note that ${N}_{t}(p,q)$ is a random variable, since it depends on ${\widehat{\mu}}_{t}$, which itself depends on the observed trajectory. It is interesting to observe at this point that ${N}_{t}(p,q)$ is closely related, in the preferential attachment case, to the degree distribution, so ideas used in proving concentration of the degree sequence in that model can be generalized to prove concentration for ${N}_{t}(p,q)$. The next lemma gives the necessary concentration result. {lemma}[Concentration for ${N}_{t}(p,q)$] Consider a model ${M}_{1}\in \mathcal{C}$. Then
${\mathrm{Pr}}_{{M}_{1}}[{N}_{t}(p,q){\mathbb{E}}_{{M}_{1}}[{N}_{t}(p,q)]\ge x]\le 2\mathrm{exp}({\displaystyle \frac{{x}^{2}}{c\cdot C(n)}}),$  (27) 
for arbitrary $p,q\in [0,1]$, some positive constant $c$, and we recall that $C(n)=\mathrm{\Theta}(n)$. To prove this, we will use the method of bounded differences. Define the martingale ${Z}_{s}$, for $s\in \{t,t+1,\mathrm{\dots},t+C(n)\}$, as
${Z}_{s}={\mathbb{E}}_{{M}_{1}}[{N}_{t}(p,q){G}_{s}].$  (28) 
The next lemma establishes the necessary bound on the martingale differences. {lemma}[Martingale difference bound] Let $t\in [n]$, and consider the setting of Proposition A.1. Then for all $s\in [t+1,\mathrm{\dots},t+C(n)]$,
${Z}_{s}{Z}_{s1}\le 2\mathrm{\Delta},$  (29) 
where $\mathrm{\Delta}$ is the constant in the specification of $\mathcal{C}$ in Definition 3. {proof} We consider the following pair of dynamic mechanisms: ${M}_{1}$ and ${M}_{1}^{\prime}$, which are coupled as follows: at times $1,\mathrm{\dots},s1$, they are equal. At times $s$ and beyond, they evolve independently but according to ${M}_{1}$. We will show that we can rewrite the martingale differences in terms of ${M}_{1}$ and ${M}_{1}^{\prime}$ as follows:
${Z}_{s}{Z}_{s1}={\displaystyle \sum _{v=1}^{t}}({\mathrm{Pr}}_{{M}_{1}}[{\widehat{\mu}}_{t,v}=p,{p}_{t,v}=q{G}_{s}]{\mathrm{Pr}}_{{M}_{1}^{\prime}}[{\widehat{\mu}}_{t,v}=p,{p}_{t,v}=q{G}_{s}]).$  (30) 
We will let ${G}_{s}$ be the graph at time $s$ according to ${M}_{1}$ and ${G}_{s}^{\prime}$ be the graph at time $s$ according to process ${M}_{1}^{\prime}$. To prove the identity, by linearity of expectation, we have
${Z}_{s}={\displaystyle \sum _{v=1}^{t}}{\mathrm{Pr}}_{{M}_{1}}[{\widehat{\mu}}_{t,v}=p,{p}_{t,v}=q{G}_{s}].$  (31) 
An expression for ${Z}_{s1}$ can similarly be written, with the only change being in the conditioning: ${G}_{s1}$ instead of ${G}_{s}$. Now, conditioning on ${G}_{s}$ has the same effect on random variables from ${M}_{1}^{\prime}$ as conditioning on ${G}_{s1}$, since the choices made by ${M}_{1}^{\prime}$ are independent of ${G}_{s},{G}_{s+1},\mathrm{\dots}$. This gives us (30).
It remains to upper bound the righthand side of (30). We note that
${\mathrm{Pr}}_{{M}_{1}^{\prime}}[{\widehat{\mu}}_{t,v}=p,{p}_{t,v}=q{G}_{s}]={\mathbb{E}}_{{M}_{1}^{\prime}}[\mathrm{Pr}[{\widehat{\mu}}_{t,v}=p,{p}_{t,v}=q{G}_{s},{G}_{s}^{\prime}]].$  (32) 
I.e., we have conditioned on the choice at time $s$ according to ${M}_{1}^{\prime}$. We thus have
${\mathrm{Pr}}_{{M}_{1}}[{\widehat{\mu}}_{t,v}=p,{p}_{t,v}=q{G}_{s}]{\mathrm{Pr}}_{{M}_{1}^{\prime}}[{\widehat{\mu}}_{t,v}=p,{p}_{t,v}=q{G}_{s}]$  (33)  
$={\mathbb{E}}_{{M}_{1}^{\prime}}[{\mathrm{Pr}}_{{M}_{1}}[{\widehat{\mu}}_{t,v}=p,{p}_{t,v}=q{G}_{s}]{\mathrm{Pr}}_{{M}_{1}^{\prime}}[{\widehat{\mu}}_{t,v}=p,{p}_{t,v}=q{G}_{s},{G}_{s}^{\prime}]].$  (34) 
The quantity inside the expectation measures the difference in probabilities after the choice at time $s$ is made according to each mechanism. Using the conditional independence properties of the model class, at most $2\mathrm{\Delta}$ vertices $v$ are such that this difference is nonzero. More precisely, let $W,{W}^{\prime}$ be the sets of vertices $v$ in the two respective trajectories such that ${Y}_{s,v}\ne {Y}_{s1,v}$. Since all future vertex choices relating to vertices not in these sets are conditionally independent of them given ${G}_{s},{G}_{s}^{\prime}$, the above difference is only nonzero for vertices in $W$ and ${W}^{\prime}$. By the model assumptions, their cardinalities are both at most $\mathrm{\Delta}$. This completes the proof.
With Lemma A.1 in hand, we apply the AzumaHoeffding inequality to prove Lemma A.1. The probability upper bound in Lemma A.1 is given by
$2\mathrm{exp}\left({\displaystyle \frac{{x}^{2}}{{\sum}_{s=t+1}^{t+C(n)}{(2\mathrm{\Delta})}^{2}}}\right)=2\mathrm{exp}\left({\displaystyle \frac{{x}^{2}}{{(2\mathrm{\Delta})}^{2}C(n)}}\right).$ 
We are finally ready to prove Proposition A.1. {proof}[Proof of Proposition A.1] We will bound the integral representation (26) of the total variation distance.
We will start by ruling out large values of $q$. In particular, set $q=\mathrm{\Omega}({t}^{\delta})$, where $\delta =\frac{1\gamma \u03f5}{\gamma}$, for an arbitrarily small positive $\u03f5$. That is, we wish to upper bound the integral
$\left{\displaystyle {\int}_{0}^{1}}{\displaystyle {\int}_{{q}_{0}}^{1}}{N}_{t}(p,q){\mathbb{E}}_{{M}_{1}}[{N}_{t}(p,q)]dqdp\right.$  (35) 
By (15), we have
${\int}_{{q}_{0}}^{1}}{\mathbb{E}}_{{M}_{1}}[{N}_{t}(p,q)]\mathit{d}q\le {\displaystyle {\int}_{{q}_{0}}^{1}}{\mathbb{E}}_{{M}_{1}}[{N}_{{M}_{0},t}(q)]\mathit{d}q=O({(qt)}^{1+\gamma}),$  (36) 
where we recall that $$. Similarly, by Markov’s inequality, we have that for any $x>0$,
$\mathrm{Pr}[{\displaystyle {\int}_{q={q}_{0}}^{1}}{N}_{t}(p,q)dq>x]\le \mathrm{Pr}[{\displaystyle {\int}_{q={q}_{0}}^{1}}{N}_{{M}_{0},t}(q)dq>x]\le {\displaystyle \frac{{\int}_{q={q}_{0}}^{1}{\mathbb{E}}_{{M}_{1}}[{N}_{{M}_{0},t}(q)]\mathit{d}q}{x}}\le {\displaystyle \frac{O({(qt)}^{1+\gamma})}{x}}.$  (37) 
In particular, we will choose $x=\mathrm{\Theta}({(qt)}^{1+\gamma +\u03f5})$, which has the following consequence:
$\mathrm{Pr}[{\displaystyle {\int}_{q={q}_{0}}^{1}}{N}_{t}(p,q)dq>x]=O({(qt)}^{\u03f5}),$  (38) 
and since $q=\mathrm{\Theta}({t}^{\delta})$ with $\delta >1$, this tends to $0$ polynomially fast in $t$. All of this has the consequence that
$\mathrm{Pr}[{\displaystyle {\int}_{0}^{1}}{\displaystyle {\int}_{{q}_{0}}^{1}}{N}_{t}(p,q){\mathbb{E}}_{{M}_{1}}[{N}_{t}(p,q)]dqdp>{(qt)}^{1+\gamma +\u03f5}]\le O({(qt)}^{\u03f5}).$  (39) 
We can thus ignore the range where $q=\mathrm{\Omega}({t}^{\frac{1\gamma \u03f5}{\gamma}})$ for arbitrary fixed positive $\u03f5$. Now we focus on the small $q$ range: $\delta \le \frac{1\gamma \u03f5}{\gamma}$.
We will split the integral as follows:
${\int}_{0}^{{t}^{\frac{1\gamma \u03f5}{\gamma}}}}{\displaystyle {\int}_{0}^{1}}{N}_{t}(p,q){\mathbb{E}}_{{M}_{1}}[{N}_{t}(p,q)]pq\mathit{d}p\mathit{d}q$  (40)  
$={\displaystyle {\int}_{0}^{{t}^{\frac{1\gamma \u03f5}{\gamma}}}}{\displaystyle {\int}_{0}^{{p}_{0}}}{N}_{t}(p,q){\mathbb{E}}_{{M}_{1}}[{N}_{t}(p,q)]pq\mathit{d}p\mathit{d}q$  (41)  
$\mathrm{}+{\displaystyle {\int}_{0}^{{t}^{\frac{1\gamma \u03f5}{\gamma}}}}{\displaystyle {\int}_{{p}_{0}}^{1}}{N}_{t}(p,q){\mathbb{E}}_{{M}_{1}}[{N}_{t}(p,q)]pq\mathit{d}p\mathit{d}q,$  (42) 
where ${p}_{0}=(1+c){t}^{\frac{1\gamma \u03f5}{\gamma}}$, with $c$ some small positive constant. The first integral on the righthand side can be handled by noticing that $pq=O({t}^{\frac{1\gamma \u03f5}{\gamma}})$ throughout, and by Lemma A.1 (with $x={t}^{1/2+{\epsilon}_{1}}$), with probability exponentially close to $1$ (with respect to $t$), we have
${N}_{t}(p,q){\mathbb{E}}_{{M}_{1}}[{N}_{t}(p,q)]\le O({t}^{1/2+{\u03f5}_{1}}).$  (43) 
Thus, the entire first integral is $\le O({t}^{1/2+{\u03f5}_{1}\frac{1+\gamma +\u03f5}{\gamma}})$, which tends to $0$ because $$.
To handle the second integral (where $pq$ may be $\mathrm{\Theta}(1)$), we notice that $pq\le 1$, and then, with high probability (by Markov’s inequality), ${N}_{t}(p,q){\mathbb{E}}_{{M}_{1}}[{N}_{t}(p,q)]\le {\mathbb{E}}_{{M}_{1}}[{N}_{t}(p,q)]{t}^{{\u03f5}_{2}}$. This last inequality can be seen more precisely as follows: since ${N}_{t}(p,q)$ is a cardinality, it is lower bounded by $0$. Thus, if $$, the difference between the two must be at most ${\mathbb{E}}_{{M}_{1}}[{N}_{t}(p,q)]$, which is certainly less than ${\mathbb{E}}_{{M}_{1}}[{N}_{t}(p,q)]{t}^{{\u03f5}_{2}}$. On the other hand, we can see by Markov’s inequality that
$\mathrm{Pr}[{N}_{t}(p,q)>{\mathbb{E}}_{{M}_{1}}[{N}_{t}(p,q)]{t}^{{\u03f5}_{2}}]\le {\displaystyle \frac{{\mathbb{E}}_{{M}_{1}}[{N}_{t}(p,q)]}{{\mathbb{E}}_{{M}_{1}}[{N}_{t}(p,q)]{t}^{{\u03f5}_{2}}}}={t}^{{\u03f5}_{2}}.$ 
We can further upper bound by ${\mathbb{E}}_{{M}_{1}}[{N}_{t}(p,q)]\le {\mathbb{E}}_{{M}_{1}}[{N}_{{\widehat{\mu}}_{t}}(p)]$ (where ${N}_{{\widehat{\mu}}_{t}}(p)$ is the number of vertices having conditional probability $p$ according to the distribution ${\widehat{\mu}}_{t}$), and since $p\ge {p}_{0}$, ${\mathbb{E}}_{{M}_{1}}[{N}_{{\widehat{\mu}}_{t}}(p)]=O({t}^{{\u03f5}_{3}})$, which is a consequence of the model class definition. In particular, the expected number of vertices $v$ with ${p}_{t,v}^{{M}_{1}}=p$ is at most $C{t}^{\u03f5}$, because of (15) and the fact that $p\ge {p}_{0}$ (in exactly the same way that we concluded (36)). This can be used to show that ${\mathbb{E}}_{{M}_{1}}[{N}_{{\widehat{\mu}}_{t}}(p)]=O({t}^{{\u03f5}_{3}})$, using a proof analogous to the one that upper bounds the maximum degree for preferential attachment graphs.
Then, we are left with the double integral
${t}^{{\u03f5}_{3}+{\u03f5}_{2}}\cdot {\displaystyle {\int}_{0}^{{t}^{\frac{1\gamma \u03f5}{\gamma}}}}{\displaystyle {\int}_{0}^{1}}1\mathit{d}q\mathit{d}p=O({t}^{\frac{1\gamma \u03f5}{\gamma}+{\u03f5}_{2}}).$  (44) 
Recalling that $$, we can make the exponent negative by setting $\u03f5$ and ${\u03f5}_{2}$ to be small enough, so the righthand side of the above expression tends to $0$. More precisely, since $\u03f5>0$, the exponent is at most $\frac{1}{\gamma}1+{\u03f5}_{2}$. Since $$, we have $$, so the exponent is less than $1/2+{\u03f5}_{2}$. Thus, if we choose $$, the resulting exponent is negative. This yields the claimed result.
Now, we use Proposition A.1 to complete the proof of Theorem 3. We shall show that the test statistic is well concentrated. In particular, we want to show the following.
[Concentration of the test statistic] We have, for any models ${M}_{0},{M}_{1}\in \mathcal{C}$ (or ${M}_{0}$, ${M}_{1}$ as in Definition 3), and for any $b\in \{0,1\}$ and any small positive constant $c$, that
${\mathrm{Pr}}_{{M}_{b}}[{S}_{{M}_{0}}{\mathbb{E}}_{{M}_{b}}[{S}_{{M}_{0}}]>cn]\le O({n}^{{\u03f5}_{1}}),$  (45) 
for some ${\u03f5}_{1}$. {proof} We note that the terms ${S}_{j}={d}_{TV}({\widehat{\mu}}_{{r}_{j}},{p}_{{r}_{j}}^{{M}_{0}})$ of the sum defining $S$ may be heavily dependent, due to the fact that the sampling intervals are likely to overlap heavily. To circumvent this, define $X$ to be the number of probe points ${r}_{j}$ for which
${S}_{j}{\mathbb{E}}_{{M}_{b}}[{S}_{j}]>c/2,$  (46) 
where we recall that ${S}_{j}$ is the term in the sum defining $S$ corresponding to the $j$th probe point. By Markov’s inequality, for arbitrarily small ${\u03f5}_{1}>0$,
$\mathrm{Pr}[X>{n}^{1{\u03f5}_{1}}]\le {\displaystyle \frac{\mathbb{E}[X]}{{n}^{1{\u03f5}_{1}}}}.$  (47) 
We can calculate $\mathbb{E}[X]$ using linearity of expectation, and we see from Proposition A.1 that each term decays at least polynomially fast in $n$ to $0$. We thus have
$\mathrm{Pr}[X>{n}^{1{\u03f5}_{1}}]\le {n}^{{\u03f5}_{2}},$  (48) 
for some small ${\u03f5}_{1},{\u03f5}_{2}>0$. Now, if $X\le {n}^{1{\u03f5}_{1}}$, then $S\mathbb{E}[S]\le O({n}^{1{\u03f5}_{1}})+cn/2(1O({n}^{{\u03f5}_{1}}))$, which implies the desired result.
Now, to finish the analysis of the error of the test, consider first the case where the sample trajectory comes from ${M}_{0}$. Then with probability $1O({n}^{{\u03f5}_{1}})$, we have that $$ for arbitrary fixed $c>0$, so that the test correctly outputs $0$.
When the sample trajectory comes from ${M}_{1}$, note that for any small enough constant ${\u03f5}_{3}>0$, there is some ${\u03f5}_{1}>0$ such that with probability $1O({n}^{{\u03f5}_{1}})$, $$. Then, by the condition in the theorem,
${\mathbb{E}}_{{M}_{1}}[S]{\mathbb{E}}_{{M}_{0}}[S]\ge {d}_{n}({M}_{0},{M}_{1}){\mathbb{E}}_{{M}_{0}}[{S}_{{M}_{0}}]{\mathbb{E}}_{{M}_{1}}[{S}_{{M}_{1}}]\ge Dn,$  (49) 
where $D$ is the constant alluded to in the theorem statement. Then, by the reverse triangle inequality, $S{\mathbb{E}}_{{M}_{0}}[S]\ge \left{\mathbb{E}}_{{M}_{0}}[S]{\mathbb{E}}_{{M}_{1}}[S]{\mathbb{E}}_{{M}_{1}}[S]{\mathbb{E}}_{{M}_{0}}[S]\right\ge Dn{\u03f5}_{3}n$, and for small enough ${\u03f5}_{3}$, this is $\ge Dn/2$. Thus, $S{\mathbb{E}}_{{M}_{0}}[S]>\alpha (n)$ with high probability.
We note that the proof of concentration for $m\ge 1$ follows by generalizing Lemma A.1. In particular, this may be done by induction on $m$, where $m=1$ forms the base case. We introduce some convenient notation: let ${N}_{t}^{(j)}(p,q)$ denote the number of multisets $S$ of vertices from $[t1]$ of cardinality at most $j$ whose empirical probability (according to the choices of the vertices in the interval $[t,t+C(n)]$) is $p$ and for which ${\prod}_{v\in S}{\pi}_{t,v}=q$ (where the product takes into account the number of times each $v$ occurs in $S$). In particular, ${N}_{t}^{(m)}(p,q)={N}_{t}(p,q)$.
Now, we can write ${N}_{t}^{(m)}(p,q)$ by considering the conditional probability assigned to the first vertex chosen in teach timestep:
${N}_{t}^{(m)}(p,q)={\displaystyle {\int}_{{p}^{\prime}\ge p}}{\displaystyle {\int}_{{q}^{\prime}\ge q}}{N}_{t}^{(1)}({p}^{\prime},{q}^{\prime}){N}_{t}^{(m1)}(p/{p}^{\prime},q/{q}^{\prime})\mathit{d}{p}^{\prime}\mathit{d}{q}^{\prime}.$  (50) 
As above, we may neglect all but small values of ${p}^{\prime}$ and ${q}^{\prime}$ (on the order of $O(1/\sqrt{t})$), and the concentration of the remaining integral follows by induction.