Uniform sampling of undirected and directed graphs with a fixed degree sequence
Many applications in network analysis require algorithms to sample uniformly at random from the set of all graphs with a prescribed degree sequence. We present a Markov chain based approach which converges to the uniform distribution of all realizati…
Authors: Annabell Berger, Matthias M"uller-Hannemann
Uniform Sampling of Undirected and Directed Graphs with a Fixed Degree Sequence ∗ Annab ell Berger and Matthias Müller-Hannemann Departmen t of Computer Science Martin-Luther-Univ ersität Halle-Wittenberg {b erger,m uellerh}@informatik.uni-halle.de Abstract Man y applications i n netw ork analysis require algo rithms to sample uniformly at random from the set of all graphs with a prescribed degree sequence. W e pres ent a Marko v chai n b ased app roac h whic h con verg es to the uniform distribution of all realizations for b oth the directed and undirected case. It remains an op en c hallenge whether these Marko v chains are rapidly mixing. F or the case of directed graphs, w e also explain in th is pap er that a p opular switc hing algorithm fails in general to sample uniformly at random because t h e state graph of th e Mark ov chain decom- p oses into different isomorphic comp onents. W e call degree sequ ences for which the state graph is strongly connected ar c swap se quenc es . T o handle arbitrary degree sequences, we develop tw o dif- feren t solutions. The first uses an add itional op eration (a reorien tation of induced directed 3-cycles) whic h makes the state graph strongly connected, the second selects randomly one of the isomor- phic components and samples inside it. Our main contribution is a precise characterizatio n of arc sw ap sequences, leading to an efficient recognition algori thm. Finally , we p oint out some interesting consequences for netw ork analysis. 1 In tro duction W e consider the problem of s ampling unifor mly at random from the set of all realizations o f a prescrib ed degree sequence as simple, labele d graphs or digraphs, r esp ectiv ely , without lo ops . Motiv ation. In complex net work analys is , one is interested in studying c ertain net work prop erties o f some obser ved r e a l gr aph in comparison with an ensemble of g r aphs with the sa me degr ee sequence to detect deviations from randomnes s [MK I + 04]. F or exa mple, this is used to s tudy the motif conten t of cla sses of net works [MIK + 04]. T o p erform such an analy s is, a uniform sampling from the s et of a ll realizations is required. A g eneral metho d to sample ra ndom elements from some set of o b jects is via rapidly mixing Mar ko v chains [Sin92, Sin93]. Every Marko v chain can be viewed as a random walk on a directed graph, the so-ca lled state gr aph . In our context, its vertices (the states) cor resp ond o ne-to-one to the set of all realizations o f prescrib ed deg ree sequences. F or a survey o n random walks, we r efer to Lovász [Lov96]. A p opular v ar iant of the Markov chain appr o ach to sample among such realizations is the so-called switching-algori t hm . It starts with a g iv en realization, a nd then p erfor ms a sequence of 2-swaps. In the undirected c ase, a 2-swap replaces t wo non-adjacent edges { a, b } , { c, d } either by { a, c } , { b, d } or b y { a, d } , { b, c } , pr ovided that b oth new edges hav e not b een contained in the g raph b efore the swap op eration. Likewise, in the directed case, given tw o arcs ( a, b ) , ( c, d ) with all vertices a, b, c, d b eing distinct, a 2-swap re pla ces these t wo arcs by ( a, d ) , ( c, b ) which are curr en tly not included in the realiza tio n (the latter is crucia l to avoid pa rallel a rcs). The switching a lgorithm is usually stopp ed heuristically after a certa in n umber of iter a tions, and then outputs the resulting rea lization as a “random element”. ∗ This work was partially supp orted by the D F G F ocus Program Algorithm Engineering, gran t Mu 1482/4-1, and b y a V olkswagenSt iftung grant f or the pro ject “ Impact on motif conte n t on dynamic f unction of complex net works”. 1 ... Figure 1: Example of digraphs where no 2-swap op e r ation can be applied. F or undirected graphs, one can prove that this switching a lgorithm conv er ges to a random stag e. The directed case, howev er, turns o ut to b e m uch more difficult. The following example demonstr a tes that the switching algor ithm do es not even conv er ge to a random stage. Example 1 . 1. Consider the fol lowing class of digr aphs D = ( V , A ) with 3 n vertic es V = { v 1 , v 2 , . . . , v 3 n } , se e Figur e 1. R oughly sp e aking, this class c onsists of induc e d dir e cte d 3-cycles C i forme d by triples V i = { v 3 i , v 3 i +1 , v 3 i +2 } of vertic es, and ar cs A i = { ( v 3 i , v 3 i +1 ) , ( v 3 i +1 , v 3 i +2 ) , ( v 3 i +2 , v 3 i ) } for i ∈ { 0 , . . . , n − 1 } . Al l vertic es of cycle C i ar e c onne cte d to al l other vertic es of cycles with lar ger index t han i . Mor e formal ly, let A ′ := { ( v , w ) | v ∈ V i , w ∈ V j , i < j } . W e set A := A ′ ∪ ( ∪ n i =1 A i ) . It is e asy to che ck that no 2-swap c an b e applie d to this digr aph. However, we c an indep endently r e orient e ach of the n induc e d 3 - cycles, le ading to 2 n/ 3 many (isomorph ic) r e alizations of t he same de gr e e se quenc e. Thus, if we use a r andom walk on the state gr aph of al l r e alizations of this de gr e e se quenc e and use only 2-swaps to defin e the p ossible tr ansitions b etwe en r e alizations, this state gr aph c onsists exactly of 2 n/ 3 many singleton c omp onents. Henc e, a “ ra n dom walk” on this gr aph wil l b e stuck in a single r e alization although exp onent ial ly many r e alizations exist. More ex amples of gra ph classes o f this type will be given in the App endix. It is interesting to note that 2-swap ope r ations suffice to sample directed gr aphs with lo ops as has b een proven b y Rys e r [Rys57] in the co n text of square matrices with { 0 , 1 } –entries which can b e in terpreted as no de-no de adjacency matrices of digraphs with lo o ps. Realizability of degree sequences. I n order to use a Ma rko v chain appro ach one needs at least one feasible rea lization. In a pplications fro m co mplex netw or k analysis, one c a n usually ta k e the degree sequence of some observed real world graph. Otherwise, one has to construct a realization. The realization pr o blem, i.e., characterizing the existence and finding at least one realization, has quite a long history . First res ults go ba c k to the se mina l work by T utte who s olved the mor e gener al f - factor pro blem [T ut5 2]. Given a simple gra ph G = ( V , E ) and a function f : V ( G ) 7→ N 0 , an f -factor is a subgra ph H o f G such that every vertex v ∈ V in this s ubgraph H has exactly deg ree d G ( v ) = f ( v ) . T utte gav e a p olynomial time transformation of the f -factor problem to the p erfect matching problem. This implies the first p olynomial time algo rithm for finding s ome f -factor [T ut54]. F or a survey on efficient algo rithms for the f -fa c tor pro blem by matching or netw o rk flow techniques, we refer to Chapter 21 of Schrijv er [Sch03]. Clea rly , if the g iven g raph G is complete, then every f -factor is a solution of the degree sequence problem. Erdős a nd Gallai [EG60] prov ed a simpler T utte-t yp e result for the degree sequence pro blem. Alre a dy in 1955 , Hav el [Hav55] develop ed a simple greedy-like algorithm to construct a realizatio n o f a given degree sequence a s a simple undirected g raph without lo ops. A few years later, Hakimi [Hak62, Hak65] studied the simpler case of undirec ted gra phs with multi ple edg es. It is also well-known ho w to test whether a pr escrib ed degr ee sequence can b e realized as a digra ph. Chen [Che66] presented necessary and sufficient conditions for the realizability of deg ree sequences which can b e chec ked in linear time. Again, the c o nstruction of a co ncrete r ealization is equiv alent to an f -factor problem on a c o rresp onding undirected bipartite gra ph. K leitman and W ang [KW7 3] found a g reedy-type algorithm generalizing previous work by Havel [Hav55] and Hakimi [Hak 62, Hak65]. This approa ch has recently b een rediscov ere d by Erdős et al. [EMT09]. Related w ork. Kannan et al. [KTV99] show ed how to sa mple bipar tite undirected graphs via Marko v chains. They proved po lynomial mixing time for r egular and nea r-regular graphs. Co op er et a l. [CDG07] extended this work to non-bipartite undirected, d - r egular gr aphs and proved a po lynomial mixing time 2 for the switching alg o rithm. More precisely , they upper b ounded the mixing time in these cas es by d 15 n 8 ( dn log ( dn ) + log( ε − 1 )) , for gra phs with | V | = n . In a bre a k-through pa per , Jerrum, Sinclair, and Vigo da [JSV0 4] presen ted a p olyno mial-time almost uniform sampling algorithm for per fect matchings in bipartite gr aphs. Their approach can b e used to sa mple arbitr a ry bipartite graphs and arbitrar y digraphs with a sp ecified deg ree sequence in O ( n 14 log 4 n ) via the above-men tioned reduction due to T utte. In the context of sampling binar y c ont ingency tables, Bezáko vá et al. [BBV07] manag e d to improv e the running time for these sampling pr oblems to O ( n 11 log 5 n ) , which is still far from practical. McKay a nd W orma ld [MW90, MW91] use a configuration model and g enerate random undir e cted graphs with deg rees b ounded by o ( n 1 / 2 ) with uniform distribution in O ( m 2 d max ) time, where d max denotes the maximum degree, and m the num b er of edges. Steger and W orma ld [SW99] int ro duced a mo dification of the co nfiguration mo del that leads to a fast alg orithm a nd s amples a s ymptotically uniform for deg rees up to o ( n 1 / 28 ) . Kim and V u [KV03] improved the ana lysis of Steger and W ormald’s algorithm, proving that the output is a symptotically uniform for degr ees up to O ( n 1 / 3 − ε ) , for any ε > 0 . Bay a ti et al. [BK S0 9] recently presented a nea rly-linear time alg orithm for counting and randomly gener ating almost uniformly simple undirected gr aphs with a given deg r ee sequence where the maximum degree is restricted to d max = O ( m 1 / 4 − τ ) , and τ is a n y po sitiv e constant. Random w alks and Mark ov c hains. Let us briefly review the basic notions of r andom walks and their r e lation to Markov chains. See [Lov96, J S9 6, Sin93] for more details. A random walk (Markov chain) on a digra ph D = ( V , A ) is a sequence of vertices v 0 , v 1 , . . . , v t , . . . where ( v i , v i +1 ) ∈ A . V er tex v 0 represents the initial state. Denote by d + D ( v ) the out-degr ee of vertex v ∈ V . At the t th step w e move to an arbitrar y neighbo r of v t with pro babilit y 1 /d + D ( v t ) or stay at v t with probability (1 − ν ( v t )) /d + D ( v t ) , where ν ( v t ) denotes the num b er of neighbors of v t . F ur ther more, w e define the distribution of V a t time t ∈ Z + as the function P t ∈ [0 , 1 ] | V | with P t ( i ) := P r ob ( v t = i ) . A well-known result [Lov96] is that P t tends to the uniform stationar y distr ibution for t → ∞ , if the digra ph is (1) non-bipartite (that means ap erio dic), (2) strong ly connected (i.e., irr educible), (3) symmetric, and (4) regular . A digr aph D is d D -r e gular if all vertices ha ve the same in- a nd out-degrees d D . In this pap er, we will view all Mar ko v chains as r andom walks on symmetric d D -regular digraphs D = ( V , A ) whos e vertices corresp ond to the state space V . The transition pr o babilit y on each arc ( v , w ) ∈ A will be the constant 1 /d D . Our con tributi on. In this pap er, we prov e the following r esults. • F or undirected graphs we analyze the well-kno wn switc hing a lgorithm. It is straight-forw a rd to translate the switching alg orithm into a r andom walk on an a ppropriately defined Mar ko v ch ain. This Ma rko v chain corr espo nds to a symmetric, r egular, strong ly connected, non-bipartite simple digraph with directed lo ops allowed. Thus, it conv er ges to the uniform distribution of all r ealiza- tions. Each realiza tion o f the degr ee se q uence is a vertex of this digraph, and tw o rea lizations ar e m utually connected by arcs if and only if their symmetric differe nce is an alternating 4-cycle (i.e., corresp onds to a 2-swap). This graph becomes regular by adding a dditional lo ops, s e e Section 2. Co op er et al. [CDG07] a lr eady show ed in the context of regular graphs that the underlying dig raph of this Marko v chain is strongly connected, but w e g ive a muc h simpler pro of of this pro per t y . Its diameter is b ounded by the num b er m of edges in the prescr ibed degree sequence. • Carefully lo o king at our Example 1 .1, we observe that in the directed case the state gra ph b ecomes strongly connected if w e add a seco nd type of op era tio n to trans form one r ealization into another: Simply r eorient the arcs of a n induced directed 3-cycle. W e ca ll this op eration 3-cycle r e orientation . W e give a graph-theoretical pro o f that 2-swaps and 3-cycle r eorientations suffice not only here, but also in general for ar bitrary pres crib e d degre e sequences. These observ ations a llow us to define a Ma rko v chain, very similar to the undirected cas e. The difference is that t wo rea lizations are m utually connected by ar cs if and o nly if their symmetric difference is either a n a lternating directed 4-cycle or 6- cycle with exactly three different v e r tices. Again, this digraph b ecomes regular by adding additional lo o ps, see Section 3. The transition probabilities a re o f order O (1 /m 2 ) , and the diameter can b e b ounded by O ( m ) , where m denotes the n um ber of ar c s in the prescrib ed degree sequence. 3 In the context o f (0 , 1) -matrices with given mar ginals (i.e., prescrib ed degree seq uences in o ur terminology), Rao e t al. [RJ B 96] similarly observed that switching op erations on s o-called “compa ct alternating hexago ns” are necessar y . A compact alternating hexag on is a 3 × 3 -submatrix, which can b e interpreted a s the adjacency matrix of a directed 3 -cycle subg raph. They define a r a ndom walk on a s eries of digra phs, sta rting with a non-reg ular state graph which is iter atively up dated tow ards re g ularity , i.e. their Mar k ov chain co n verges as ymptotically to the uniform distribution. How ever, it is unclear how fa st this pro cess conv erges and whether this is mo r e efficient than s tarting directly with a single r egular state g raph. Since Rao et al. work direc tly o n matrices, their tra ns ition probabilities a re of o r der O (1 / n 6 ) , i.e., by s e veral order s smaller than in our v ersion. V ery recently , Erdős et al. [EMT09] pro po sed a similar Markov chain appro ach us ing 2- s w aps and 3-swaps. The latter type of op eratio n exch anges a simple directed 3 -path or 3-cycle ( v 1 , v 2 ) , ( v 2 , v 3 ) , ( v 3 , v 4 ) (the firs t and last vertex may be identical) by ( v 1 , v 3 ) , ( v 3 , v 2 ) , ( v 2 , v 4 ) , but is a muc h larger set o f op erations than ours. • Although in directed g raphs 2-swaps alone do not suffice to sa mple uniformly in general, the co r- resp onding approach is still fre q uen tly used in netw ork analysis. One reason for the p opularity of this approach — in addition to its simplicity — might be that it empirica lly worked in many cases quite well [MKI + 04]. In this pa per , we study under which conditions this appr oach can b e applied and pr ov ably leads to co rrect uniform sampling. W e call such degr ee s e quences ar c-swap se quenc es , and give a gr aph-theoretical characterization which can b e chec ked in polyno mial time. More sp ecifically , we can recog nize arc-swap sequences in O ( m 2 ) time using matching techniques. Using a parallel Havel-Hakimi alg o rithm b y LaMar [LaM0 9], origina lly develop e d to r e alize Euler sequences with an o dd nu m ber of arcs, the reco gnition pro blem ca n even be solved in linear time. This algo rithm also allows us to deter mine the n um ber of induce d directed 3 -cycles which appea r in every realization. How ever, the simpler appro ach c o mes with a price: o ur b ound o n the diameter of the state graph bec o mes mn and so is by one o rder of n worse in compar ison w ith using 2- swaps and 3-cycle reorientations. Since half of the diameter is a trivial low er bo und on the mixing time and the diameter also app ears as a factor in known upp er bo unds, we co njecture that the class ical switching algorithm r equires a mixing time τ ε with an o rder of n mo r e steps as the v ar iant with 3 -cycle reorientation. In tho se cases wher e 2- s w aps do not suffice to sa mple unifor mly , the state graph deco mpos es into 2 k strongly co nnected co mponents, wher e k is the num b er of induced directed 3 -c y cles which app ear in every realiza tio n. W e can a lso efficiently determine the num b er of strongly connected co mponents of the state graph (of cour se, without e xplicitly constructing this exp onentially sized gr aph). How ever, all these comp onents are isomor phic. This ca n b e explo ited as fo llows: F or a non-arc-s wap sequence, we first determine all those induced dir ected 3 -cycles which app ear in every rea lization. By reducing the in- and out-degrees for all vertices o f these 3 - c ycles by one, we then obtain a new seq uence, now guaranteed to be a n ar c-swap s equence. On the latter we can either use the switching algorithm or our v a riant with additional 3 -cycle reo rient ations on a sma ller state graph with a reduced diameter n ( m − 3 k ) o r m − 3 k , resp ectively , yielding a n impor tant practical adv antage. Our r esults give a theoretical foundation to compute certain netw ork characteristics on unlab eled digraphs in a single comp onent using 2- swaps o nly . F or exa mple, this includes the analysis of the motif conten t [MSOI + 02]. Likewise we can still compute the average diameter among a ll realizations if we work in a single c o mpo nen t. How ever, fo r other netw ork c haracteristics, fo r example b etw eenness cen tr a lit y on edges [KLP + 05], this leads in g eneral to incorrect estimations. Ov erview. The r e ma inder o f the pap er is structured as follows. In Section 2, we start with the undi- rected case. W e intro duce appr opriately defined state graphs underlying our Mar ko v chains, and show for these gra phs crucial prop erties like reg ula rity and str ong connectivity . W e also upper bo und their diameter. The more difficult dir ected case is pres en ted in Section 3 . Afterwards, in Sec tio n 4, we c har- acterize those deg r ee se q uences for which a simpler Ma rko v chain bas ed on 2-swaps prov a bly lea ds to uniform s ampling in the directed ca se. W e also descr ibe a few consequences and applica tions. Finally , we co nclude with a short summar y and re ma rks on future work. 4 2 Sampling Undirected Graphs In this section we show how to sample undire c ted graphs with a prescr ibed degr ee s equence uniformly at r andom with a random walk. This section is structured as follows. W e fir st give a formal problem definition and introduce some no ta tion. Then we in tro duce a n appropriately defined Markov chain and prov e that it has a ll desired prop e r ties. F ormal problem definitio n. In the undirected ca se, a deg ree sequence S of order n is the o rdered set ( a 1 , a 2 , . . . , a n ) with a i ∈ Z + , a i > 0 . Let G = ( V , E ) be an undirected la beled graph G = ( V , E ) without loo ps and parallel edges and | V | = n . W e define the de gr e e-fun ct ion d : V → Z + which assigns to each vertex v i ∈ V the num b er of incident edges . W e ca ll S a gr aphic al se qu en c e if and only if there exists a t leas t one undirected lab eled gra ph G = ( V , E ) without a n y lo ops or para llel edges which satisfies d ( v i ) = a i for all v i ∈ V and i ∈ { 1 , . . . , | V |} . An y such undirected graph G is c a lled r e alization of S . W e define an alternating walk P for a graph G = ( V , E ) a s a sequence P := ( v 1 , v 2 , . . . , v ℓ ) of vertices v i ∈ V where either { v i , v i +1 } ∈ E ( G ) a nd { v i − 1 , v i } / ∈ E ( G ) or { v i , v i +1 } / ∈ E ( G ) and { v i − 1 , v i } ∈ E ( G ) for i mo d 2 = 1 . The length of a walk (or pa th, cycle, resp ectively) is the num ber of its edges. W e call an alternating walk C of ev en leng th alternating cycle if v 1 = v ℓ is fulfilled. F o r tw o realizatio ns G, G ′ , the symmetric difference of their edge sets E ( G ) and E ( G ′ ) is denoted as G ∆ G ′ := ( E ( G ) \ E ( G ′ )) ∪ ( E ( G ′ ) \ E ( G )) . A gra ph is ca lled Eulerian if every v e r tex has even degree. Note that the s ymmetric difference G ∆ G ′ of tw o rea lizations G, G ′ is Eulerian a nd hence alwa ys decomp oses into a n um ber of alterna ting cycles. The Mark ov c hain. W e denote by Ψ = ( V ψ , A ψ ) the digra ph for o ur r andom walk, the state gr aph , for sho r t. Its under lying vertex set V ψ is the set of all rea lizations of a given degree sequence S . F or a realization G , w e denote by V G the corres po nding vertex in V ψ . The arc set A ψ is defined as follows. a) W e connect t wo vertices V G , V G ′ ∈ V ψ , G 6 = G ′ with arcs ( V G , V G ′ ) and ( V G ′ , V G ) if and only if | G ∆ G ′ | = 4 is fulfilled. b) W e set fo r each pair of non- adjacent edges { v i 1 , v i 2 } , { v i 3 , v i 4 } ∈ E ( G ) , i j ∈ { 1 , . . . , n } a directed lo op ( V G , V G ) if and o nly if { v i 1 , v i 4 } ∈ E ( G ) ∨ { v i 3 , v i 2 } ∈ E ( G ) . c) W e set for ea ch pair of non-adjace nt edges { v i 1 , v i 2 } , { v i 3 , v i 4 } ∈ E ( G ) , i j ∈ { 1 , . . . , n } a directed lo op ( V G , V G ) if and o nly if { v i 1 , v i 3 } ∈ E ( G ) ∨ { v i 2 , v i 4 } ∈ E ( G ) . d) W e set one directed lo op ( V G , V G ) for all V G ∈ V ψ . Lemma 2.1. The state gr aph Ψ = ( V ψ , A ψ ) is non-bip artite, symmetric, and r e gular. Pr o of. Non-bipartiteness follows from the inser tion of directed lo o ps. Likewise, symmetry is obvious since we a lways introduce arcs in b oth directions in case a ). F or each pair of non-adjacent edges of a realization G , we introduce exactly tw o ar c s in Ψ . These arcs either co nnect tw o neigh bo ring states or ar e directed lo ops. Thus each vertex V G ∈ V ψ has an out-degree of twice the num b er o f non-adjacent edges in G plus one (for the lo op in step d)). Due to symmetry , the out-degree equals the in- deg ree. F or each realization G , the num b er of pairs of no n-adjacent edges is exactly | E | 2 − P v i ∈ V ( G ) d G ( v i ) 2 = | E | 2 − P n i =1 a i 2 , that is a constant independent of G . The next step is to s how that the state graph is strong ly conne cted. W e firs t prove the following auxiliary prop osition which asser ts that the sy mmetric difference o f t wo different realizations alwa y s contains a vertex-disjoin t pa th of leng th three. Prop osition 2.2. L et S b e a gr aphic al se quen c e and G and G ′ b e t wo differ ent r e alizations, i.e., G ∆ G ′ 6 = ∅ . Then t her e exists a vertex-disjoint alternating walk P = ( v 1 , v 2 , v 3 , v 4 ) in G ∆ G ′ with { v 1 , v 2 } , { v 3 , v 4 } ∈ E ( G ) and { v 2 , v 3 } ∈ E ( G ′ ) . Pr o of. In the pro of of this pro pos ition, w e argue only ab out edges in the symmetric difference G ∆ G ′ which is a ssumed to b e non-empt y . Therefore, there a re edges { v 1 , v 2 } , { v 2 , v 3 } with { v 1 , v 2 } ∈ E ( G ) and { v 2 , v 3 } ∈ E ( G ′ ) a nd v 1 6 = v 3 . If there is also a n edge { v 3 , v 4 } ∈ E ( G ) with v 4 6 = v 1 , we are done with 5 the vertex-disjoint alternating walk P = ( v 1 , v 2 , v 3 , v 4 ) a s des ired. Otherwise, the symmetric difference m ust contain the edge { v 3 , v 1 } ∈ E ( G ) a nd also some edge { v 1 , v 4 } ∈ E ( G ′ ) . Note that v 4 6 = v 2 and v 4 6 = v 3 . This implies the existence of another edg e { v 4 , v 5 } ∈ E ( G ) . No te also that v 5 6 = v 3 , since we are in the cas e tha t { v 3 , v 4 } do es not exist. Either v 5 = v 2 or v 5 is a new vertex disjoint fr om { v 1 , . . . , v 4 } . Therefore, in b oth ca ses P = ( v 3 , v 1 , v 4 , v 5 ) is a vertex-disjoin t alternating walk compo s ed of edges fro m the symmetric difference. Lemma 2.3 . L et S b e a gr aphic al se quenc e and let G 6 = G ′ b e two r e alizations. Then ther e exist r e aliza- tions G 0 , G 1 , . . . , G k with G 0 := G , G k := G ′ and | G i ∆ G i +1 | = 4 wher e k ≤ 1 2 | G ∆ G ′ | − 1 . Pr o of. W e prov e the lemma by induction accor ding to the cardinality of the symmetric difference | G ∆ G ′ | = 2 κ. F or κ := 2 we get | G ∆ G ′ | = 4 . The cor rectness of our claim follows with G 1 := G ′ . W e assume the correctness of our cla im for all κ ≤ ℓ. Consider | G ∆ G ′ | = 2 ℓ + 2 . According to Prop ositio n 2.2 , there exists in G ∆ G ′ an alterna ting vertex-disjoin t walk P = ( v 1 , v 2 , v 3 , v 4 ) with { v 1 , v 2 } , { v 3 , v 4 } ∈ E ( G ) and { v 3 , v 2 } ∈ E ( G ′ ) . case 1 : Ass ume { v 1 , v 4 } ∈ E ( G ′ ) \ E ( G ) . This implies { v 1 , v 4 } ∈ G ∆ G ′ . G 1 := ( G 0 \ {{ v 1 , v 2 } , { v 3 , v 4 }} ) ∪ {{ v 2 , v 3 } , { v 1 , v 4 }} is a realiza tion of S and it follows | G 0 ∆ G 1 | = 4 and | G 1 ∆ G ′ | = 2 ℓ + 2 − 4 = 2( ℓ − 1) . No te that after this step, G 1 ∆ G ′ may consist o f several co nnected comp onent s, but e ach o f them ha s s trictly sma ller cardinality . Thus, we obta in r ealizations G 1 , G 2 , . . . , G k with G k := G ′ and | G i ∆ G i +1 | = 4 where k − 1 ≤ 1 2 | G 1 ∆ G ′ | − 1 . Hence, we g et the sequence G 0 , G 1 , . . . , G k with k = 1 + 1 2 | G 1 ∆ G ′ | − 1 = 1 2 ( | G ∆ G ′ | − 4) ≤ 1 2 | G ∆ G ′ | − 1 . case 2 : Ass ume { v 1 , v 4 } ∈ E ( G ) ∩ E ( G ′ ) . This implies { v 1 , v 4 } / ∈ G ∆ G ′ . P is an alterna ting subpath of an alternating cycle C = ( v 4 , v i , . . . , v j , v 1 , v 2 , v 3 , v 4 ) with { v i , v 4 } , { v 1 , v j } ∈ A ( G ′ ) of length | C | ≥ 6 . W e construct a new a lternating cycle C ∗ := ( C \ P ) ∪{{ v 1 , v 4 }} with length | C ∗ | = | C |− 2 ≥ 4 . W e s w ap the a rcs in C ∗ and get a realization G ∗ of S with | G 0 ∆ G ∗ | = | C ∗ | ≤ 2 ℓ a nd | G ∗ ∆ G ′ | = | G ∆ G ′ | − ( | C ∗ | − 1) + 1 ≤ 2 ℓ. The symmetric difference G ∗ ∆ G ′ may consist of se veral connected comp onents, but their total leng th is b ounded b y 2 ℓ . Thus there exist sequences G 1 0 := G, G 1 1 , . . . , G 1 k 1 := G ∗ and G 2 0 := G ∗ , G 2 1 , . . . , G 2 k 2 = G ′ with k 1 ≤ 1 2 | G 0 ∆ G ∗ | − 1 = 1 2 | C ∗ | − 1 a nd k 2 ≤ 1 2 | G ∗ ∆ G ′ | − 1 = 1 2 ( | G ∆ G ′ | − ( | C ∗ | − 1) + 1) − 1 ≤ 2 ℓ . W e a rrange these sequences one after another a nd get a sequence which fulfills k = k 1 + k 2 = 1 2 | C ∗ | − 1 + 1 2 ( | G ∆ G ′ | − ( | C ∗ | − 1) + 1) − 1 = 1 2 ( | G ∆ G ′ | ) − 1 . case 3 : Ass ume { v 1 , v 4 } ∈ E ( G ) \ E ( G ′ ) . This implies { v 1 , v 4 } ∈ G ∆ G ′ . Assume first that the symmetric difference G ∆ G ′ contains an al- ternating cycle C which avoids P . Then, we can apply the induction hypo thesis to C . Swap- ping the edges o f C , we ge t a realization G ∗ of sequence S with | G 0 ∆ G ∗ | = | C ∗ | ≤ 2 ℓ and | G ∗ ∆ G ′ | = | G ∆ G ′ | − | C | ≤ 2 ℓ . According to the induction hypo thesis there exist sequenc es G 1 0 := G, G 1 1 , . . . , G 1 k 1 := G ∗ and G 2 0 := G ∗ , G 2 1 , . . . , G 2 k 2 = G ′ with k 1 ≤ 1 2 | G 0 ∆ G ∗ | − 1 and k 2 ≤ 1 2 | G ∗ ∆ G ′ | − 1 . W e arra nge these se q uences o ne after another and get a sequence which fulfills k = k 1 + k 2 ≤ 1 2 | G 0 ∆ G ∗ | − 1 + 1 2 | G ∗ ∆ G ′ | − 1 ≤ 1 2 ( | G ∆ G ′ | ) − 1 . It remains to consider the case that such a cycle C do e s no t exist. In other w ords, every alterna ting cycle in G ∆ G ′ includes edg es from P . The alternating walk P can b e extended to a n alternating cycle C ∗ = ( v 1 , v 2 , v 3 , v 4 , v 5 , . . . , v 2 t , v 1 ) , t ≥ 3 using only arcs from G ∆ G ′ . T o construct C ∗ , start with P , and k e e p adding alternating edges unt il you r each the start vertex v 1 for the firs t time with an edge { v i , v 1 } ∈ E ( G ′ ) . Since the symmetric difference is Eulerian, you will not get stuck b efor e reaching v 1 with such an edge. Note that C ∗ m ust contain the edge { v 1 , v 4 } , a s o therwise a n alter na ting cycle of t yp e C would exist. This a lso implies the existence of an alterna ting sub- w alk P 1 = ( v 4 , v 5 , . . . , v 6 , v 4 ) of C ∗ of o dd length (at lea st o f length 3), sta r ting a nd ending with edges in E ( C ∗ ) . L ik ewise, there m ust be another alternating sub-walk P 2 = { v 1 , v 7 , . . . , v 8 , v 1 } , also of o dd leng th (a t least of length 3), starting a nd ending with edges in E ( C ∗ ) . The s ituation is visualized in Figure 2. In this scenario, we hav e v 5 6 = v 7 , a s otherwise ( E ( P 1 ) \ {{ v 7 , v 1 }} ) ∪ {{ v 7 = v 5 , v 4 } , { v 4 , v 1 }} would be a n alternating cycle of the form we hav e excluded ab ov e. W e hav e four subca ses with resp ect to the existence of edge s be tw een v 5 and v 7 . 6 edges in G’ edges in G v v v v v v v v 1 2 3 4 5 6 7 8 Figure 2: Pro of of Lemma 2.3: Edges of the symmetric difference G ∆ G ′ in ca s e 3. case a ) { v 5 , v 7 } ∈ E ( G ) \ E ( G ′ ) : This would imply the existence o f the alter nating cycle C = ( v 5 , v 4 , v 1 , v 7 , v 5 ) , excluded ab ov e. case b) { v 5 , v 7 } ∈ E ( G ′ ) \ E ( G ) : This would imply the exis tence of the alternating cycle C = ( v 7 , v 5 , . . . , v 6 , v 4 , v 1 , v 8 , . . . , v 7 ) , als o excluded a bove. case c) { v 5 , v 7 } ∈ E ( G ) ∩ E ( G ′ ) : Then there is an alternating cycle C ′ = ( v 7 , v 5 , v 4 , v 1 , v 7 ) o n which we can s w ap the edges in a single step. This leads to a realization G ∗ = G 1 with | G 0 ∆ G ∗ | = 4 and | G ∗ ∆ G ′ | = 2 ℓ . case d) { v 5 , v 7 } 6∈ E ( G ) and { v 5 , v 7 } 6∈ E ( G ′ ) : As in case c), we co nsider the a lternating cy c le C ′ = ( v 7 , v 5 , P 1 \{{ v 4 , v 5 }} , { v 1 , v 4 } , P 2 \{{ v 7 , v 1 }} , v 7 ) . Swapping edges on C ′ , we get a realiza tion G ∗ = G k − 1 , but this time, | G 0 ∆ G ∗ | = | C ′ | ≤ 2 ℓ a nd | G ∗ ∆ G ′ | = | G ∆ G ′ | − ( | C ′ | − 1) + 1 ≤ 2 ℓ . According to the induction hypo thesis there exist se- quences G 1 0 := G, G 1 1 , . . . , G 1 k 1 := G ∗ and G 2 0 := G ∗ , G 2 1 , . . . , G 2 k 2 = G ′ with k 1 ≤ 1 2 | G 0 ∆ G ∗ | − 1 = 1 2 ( | G ∆ G ′ | − | C ′ | + 2) − 1 a nd k 2 ≤ 1 2 | G ∗ ∆ G ′ | − 1 = 1 2 | C ′ | − 1 . W e arra nge these sequences one after an- other and get a sequence which fulfills k = k 1 + k 2 ≤ 1 2 ( | G ∆ G ′ |− | C ′ | + 2) − 1+ 1 2 | C ′ |− 1 = 1 2 | G ∆ G ′ |− 1 . case 4 : Ass ume { v 1 , v 4 } / ∈ E ( G ) ∪ E ( G ′ ) . This implies { v 1 , v 4 } / ∈ G ∆ G ′ . It exists the a lternating cycle C := ( v 1 , v 2 , v 3 , v 4 , v 1 )) with { v 1 , v 4 } / ∈ E ( G ) . G 1 := ( G 0 \ {{ v 1 , v 2 } , { v 3 , v 4 }} ) ∪ {{ v 3 , v 2 } , { v 1 , v 4 }} is a realization of S and it follows | G 0 ∆ G 1 | = 4 and | G 1 ∆ G ′ | = 2 ℓ + 2 − 2 = 2 ℓ. A cco rding to the induction hypothesis there exist rea lizations G 1 , G 2 , . . . , G k with G k := G ′ where and k ≤ 1 2 | G ∆ G ′ | − 2 . Hence, we get the sequence G 0 , G 1 , . . . , G k with k ≤ 1 2 | G ∆ G ′ | − 1 . W e have s hown that the state gr aph Ψ = ( V ψ , A ψ ) is a d -reg ula r, s y mmetric, no n-bipartite, and strongly connected digra ph. Hence, the co rresp onding Marko v chain has the unifor m distribution as its stationa ry distribution. A rando m walk on Ψ = ( V ψ , A ψ ) can be describ ed by Algor ithm 1 . This algorithm requir e s a data structur e D S co n taining all pa irs of no n-adjacent edges in G . 3 Sampling Digraphs W e now turn the directed case. As b efore , we star t with the forma l problem definition and so me additional notation. Then, we introduce o ur Markov chain and analy z e its prop erties. F ormal problem de fini tion In the directed case , we define a degr ee seq uence S as a se q uence of 2 -tuples a 1 b 1 , a 2 b 2 , . . . , a n b n with a i , b i ∈ Z + 0 , i ∈ { 1 , . . . , n } where a i > 0 or b i > 0 . Let G = ( V , A ) b e a directed lab eled graph G = ( V , A ) without lo ops and parallel arcs and | V | = n . W e define the in-de gr e e-fun ction d + G : V → Z + 0 which as s igns to each v ertex v i ∈ V the num b er of incoming arcs and the out-de gr e e-fun ction d − G : V → Z + 0 which as signs to e ach vertex v i ∈ V the n umber of outgoing a rcs. W e denote S as gr aphic al se qu en c e if and only if there exists at least o ne directed lab eled graph G = ( V , A ) without any lo ops or pa rallel ar cs which satisfies d + G ( v i ) = b i and d − G ( v i ) = a i for all v i ∈ V a nd i ∈ { 1 , . . . , n } . Any suc h graph G is called r e alization o f S . Let H b e a sub digraph o f G. W e say that H = ( V H , A H ) is a n induc e d sub digr aph of G if every a rc of A with bo th end vertices in V H is also in A H . W e write H = G h V H i . 7 Algorithm 1 Switching Algorithm Input: sequence S , an undirected gr a ph G = ( V , E ) with d G ( v i ) = a i for all i ∈ { 1 , . . . , n } and v i ∈ V , a mixing time τ . Output: A s a mpled undirected g raph G ′ = ( V , E ′ ) with d G ( v i ) = a i for all i ∈ { 1 , . . . , n } and v i ∈ V . 1: t := 0 , G ′ := G // initializa tion 2: whil e t < τ do 3: Cho ose an elemen t p fro m D S uniformly at rando m./ / p is a p air of non-adjac ent e dges. 4: Let p be the pa ir of edg e s { v i 1 , v i 2 } , { v i 3 , v i 4 } . 5: Cho ose with pro babilit y 1 2 betw een case a) and case b). 6: if case a) then 7: if { v i 1 , v i 4 } , { v i 3 , v i 2 } / ∈ E ( G ′ ) then 8: // Either walk on to an adjac ent r e alization 9: Delete { v i 1 , v i 2 } , { v i 3 , v i 4 } in E ( G ′ ) . 10: A dd { v i 1 , v i 4 } , { v i 3 , v i 2 } to E ( G ′ ) . 11: else 12: // or walk a lo op: ‘Do nothing’ 13: end if 14: else 15: // c ase b) 16: if { v i 1 , v i 3 } , { v i 2 , v i 4 } / ∈ E ( G ′ ) then 17: // Either walk on to an adjac ent r e alization 18: Delete { v i 1 , v i 2 } , { v i 3 , v i 4 } in E ( G ′ ) . 19: A dd { v i 1 , v i 3 } , { v i 2 , v i 4 } to E ( G ′ ) . 20: else 21: // or walk a lo op: ‘Do nothing’ 22: end if 23: end if 24: update data s tr ucture D S 25: t ← t + 1 26: end whi le The symmetric difference G ∆ G ′ of tw o realiza tio ns G 6 = G ′ is defined analogous ly to the undirected case. Consider for example the realizations G and G ′ with A ( G ) := { ( v 1 , v 2 ) , ( v 3 , v 4 ) } and A ( G ′ ) := { ( v 1 , v 4 ) , ( v 3 , v 2 ) } co nsisting of ex actly tw o arcs. Then the symmetric difference is the alternating directed 4 -cycle C := ( v 1 , v 2 , v 3 , v 4 , v 1 ) where ( v i , v i +1 ) ∈ A ( G ) for i ∈ { 1 , 3 } and ( v i +1 , v i ) ∈ A ( G ′ ) taking indices i mo d 4 . W e define a n alternating dir e cte d walk P for a directed gra ph G = ( V , A ) as a s e q uence P := ( v 1 , v 2 , . . . , v l ) o f vertices v i ∈ V where either ( v i , v i +1 ) ∈ A ( G ) a nd ( v i , v i − 1 ) / ∈ A ( G ) o r ( v i , v i +1 ) / ∈ A ( G ) and ( v i , v i − 1 ) ∈ A ( G ) for i mo d 2 = 1 . W e call a n ev en alternating directed walk C alternating dir e cte d cycle if v 1 = v l is fulfilled. The symmetric difference of t wo rea lizations always decomp oses into a num b er of alternating directed cycles, see Figs. 3 and 4. The Mark ov c hain. In the directed case, we denote the state graph for our rando m w alk by Φ = ( V φ , A φ ) . Its underlying vertex set V φ is the set of all realiza tions of a given degree sequence S . F o r a realization G , w e denote by V G the corres po nding vertex in V ψ . The arc set A ψ is defined as follows. a) W e connect t wo vertices V G , V G ′ ∈ V φ , G 6 = G ′ with ar cs ( V G , V G ′ ) and ( V G ′ , V G ) if and only if o ne of the tw o following constraints is fulfilled 1. | G ∆ G ′ | = 4 2. | G ∆ G ′ | = 6 and G ∆ G ′ contains exactly three different vertices. b) W e set a directed lo op ( V G , V G ) 1. for each pa ir o f non-adjacent a r cs ( v i 1 , v i 2 ) , ( v i 3 , v i 4 ) ∈ A ( G ) , i j ∈ { 1 , . . . , n } if and only if ( v i 1 , v i 4 ) ∈ A ( G ) ∨ ( v i 3 , v i 2 ) ∈ A ( G ) in a rea lization G, 8 1 2 3 4 5 6 7 in G in G’ Figure 3: Example: T w o realizations G and G ′ . 1 4 2 3 5 4 3 2 4 5 6 7 C C 2 1 Figure 4 : Decomp osition of the sy mmetric difference G ∆ G ′ of Fig . 3 into a minimum num b er of alter- nating directed c y cles. 2. for ea ch directed 2 -path ( v i 1 , v i 2 ) , ( v i 2 , v i 3 ) ∈ A ( G ) if a nd only if o ne of the following constra in ts is true for a realization G, i) ( v i 2 , v i 1 ) ∈ A ( G ) ∨ ( v i 3 , v i 2 ) ∈ A ( G ) ∨ ( v i 1 , v i 3 ) ∈ A ( G ) , ii) ( v i 3 , v i 1 ) / ∈ A ( G ) , iii) i 3 < i 1 ∨ i 3 < i 2 . 3. if G contains no directed 2 -path. Lemma 3.1. The state gr aph Φ := ( V φ , A φ ) is non-bip artite, symmetric, and r e gular. Pr o of. In our setting we co nnect tw o vertices at each time in b oth dir ections. Hence, Φ is symmetric. F ur - thermore, if some realizatio n G contains no directed 2 - path, then each G is a realizatio n of a sequence S , only consis ting of sinks and sources. With o ur setting Φ contains for each V G ∈ V φ a directed lo op a nd is therefore non-bipartite, see item b )3 in o ur cons tr uction. Let us now assume that a r ealization G co n ta ins a directed 2 -pa th. Either there exists a third arc which co mpletes these tw o arcs to a directed 3 - cycle or not. In all ca ses we can guara ntee one dir ected lo op at V G : In the cas e of a directed 3 - cycle C we distinguish t wo cases. Either b )2 .i ) is fulfilled o r in C there exists a 2 -pa th with conditions as in b )2 .ii i ) . If w e hav e a 2 -path which is not a s ubpa th of a directed 3 -cycle then w e g et condition b )2 .ii ) . Hence, Φ is no t bipartite. F or the pr o of of regularity , note, that we consider at ea ch vertex V G the num b er of pa ir s of non-adjace nt arcs in a realization G. This is the n umber of a ll p o ssible arc pa irs min us the num b er o f adjacent arcs | A ( G ) | 2 − ( P n i =1 a i 2 + P n i =1 b i 2 + P n i =1 a i b i ) wher e P n i =1 a i 2 is the num b er o f all incoming arc pairs at each vertex, P n i =1 b i 2 is the num b e r of all outgoing arc pair s at each vertex and P n i =1 a i b i is the num b er o f directed 2 -paths in a realization G. Hence, the num b er of non-adjacent a rcs is a cons ta n t v alue for each rea lization G. F or each o f these arc pairs we either set a directed lo op or an incoming a nd an outgoing arc at each vertex V G ∈ V φ . F or each 2 -path in G we se t a lo op if it is not pa r t of a directed 3 -cycle C = ( v i 1 , v i 2 , v i 3 , v i 1 ) which is an induced sub digra ph C = G h{ v i 1 , v i 2 , v i 3 }i . If it is the c a se it exists a re a lization G ′ with | G ∆ G ′ | = 6 and G ∆ G ′ contains exactly 3 different vertices. Hence, we s e t for the 2 -path in C with i j < i j ′ and i j ′ < i j ′′ with j, j ′ , j ′′ ∈ { 1 , 2 , 3 } the dir ected ar cs ( V G , V G ′ ) and ( V G ′ , V G ) and for b oth other 2 -paths in C a directed lo op. Gener ally , we set for all 2 -paths in a realizatio n an inco ming and a n outgoing a r c a t e a ch V G . The n um b er o f 2 -paths in ea ch realization is the co ns ta n t v alue P n i =1 a i b i . Hence, the vertex degree at each v ertex is d Φ := d + Φ = d − Φ = | A ( G ) | 2 − 2 P n i =1 a i 2 . In the next section we hav e to prove that our constructed graphs are stro ng ly connected. This is sufficient to prove the reachability of each realiza tio n indep endent of the star ting realization. Fig. 5 shows an exa mple how the rea lization G from Fig . 3 can b e transfor med to the rea liza tion G ′ b y a sequence of sw a p op erations. 9 1 2 3 4 5 6 7 1 2 3 4 5 6 7 1 2 3 4 5 6 7 1 2 3 4 5 6 7 G = G 0 2 G 1 G G = G’ 3 swap arcs (5,3) and (2,4) with (2,3) and (5,4) swap arcs (1,2) and (3,4) with (3,2) and (1,4) swap arcs (6,5) and (4,7) with (6,7) and (4,5) Figure 5: T r ansforming G from Fig. 3 into G ′ b y a sequence of swap op erations . 3.1 Symmetric differences of tw o differen t realizations Prop osition 3.2. L et S b e a gr aphic al se quenc e and G and G ′ b e two differ ent r e alizations. If G ∆ G ′ is exactly one we ak c omp onent and | G ∆ G ′ | 6 = 6 then t her e exists in G ∆ G ′ a vertex-disjoint alternating 3-walk of typ e P or Q , wher e P = ( v 1 , v 2 , v 3 , v 4 ) with ( v 1 , v 2 ) , ( v 3 , v 4 ) ∈ A ( G ) and ( v 3 , v 2 ) ∈ A ( G ′ ) and Q = ( w 1 , w 2 , w 3 , w 4 ) with ( w 1 , w 2 ) , ( w 3 , w 4 ) ∈ A ( G ′ ) and ( w 3 , w 2 ) ∈ A ( G ) . Pr o of. Note that in G ∆ G ′ an a lternating cycle of le ng th tw o is not p ossible. Otherwise, there exists a n ar c ( u, v ) ∈ A ( G ) ∩ A ( G ′ ) in contradiction to our assumption that ( u, v ) ∈ G ∆ G ′ . The symmetric difference G ∆ G ′ may decomp ose into a num b er of a lternating cycles ( G ∆ G ′ ) i . W e co ns ider a decomp osition into the minimum num b er of such cycles . If one o f these alternating cycles ( G ∆ G ′ ) i contains a vertex- disjoint alternating 3 – walk P or Q as claimed, we are done. Otherwise, each vertex is rep eated at each third step in ( G ∆ G ′ ) i . Hence, we get the alternating cycles ( G ∆ G ′ ) i := ( v i 1 , v i 2 , v i 3 , v i 1 , v i 2 , v i 3 , v i 1 ) where ( v i 1 , v i 2 ) , ( v i 2 , v i 3 ) , ( v i 3 , v i 1 ) ∈ A ( G ) and ( v i 2 , v i 1 ) , ( v i 3 , v i 2 ) , ( v i 1 , v i 3 ) ∈ A ( G ′ ) . The cycle cannot be lo ng er, as the graph induced by G ∆ G ′ h{ v 1 , v 2 , v 3 }i is alrea dy complete. Since | ( G ∆ G ′ ) i | = 6 , there m ust b e ( G ∆ G ′ ) j with i 6 = j . ( G ∆ G ′ ) j shares a t leas t one vertex with ( G ∆ G ′ ) i , beca use G ∆ G ′ is weakly co nnected. Ther e must b e exa ctly one v i 1 = v j 1 , since otherwise these tw o cycles were not a r c- disjoint . The union of these t wo cycles is a n alterna ting cyc le, in c ont radiction to the minimality of the decomp osition. Note that the ab ove prop osition do es not as sert that the symmetric difference co ntains P and Q . The smallest counter-example are the rea lizations G = ( V , A ) and G ′ = ( V , A ′ ) with V = { v 1 , v 2 , v 3 , v 4 } and A = { ( v 1 , v 3 ) , ( v 3 , v 2 ) , ( v 2 , v 4 ) , ( v 4 , v 1 ) } a nd A ′ = { ( v 1 , v 2 ) , ( v 2 , v 1 ) , ( v 3 , v 4 ) , ( v 4 , v 3 ) } . Prop osition 3. 3. L et S b e a gr aphic al se quenc e and G and G ′ b e two differ ent re alizations. If | G ∆ G ′ | = 6 , then ther e ex ist a) re alizations G 0 , G 1 , G 2 with G 0 := G , G 2 := G ′ and | G i ∆ G i +1 | = 4 for i ∈ { 0 , 1 } or b) G and G ′ ar e differ ent in the orientation of exactly one dir e cte d 3 -cycle. Pr o of. First observe tha t the symmetric differe nce is weakly co nnec ted whenever | G ∆ G ′ | = 6 . W e consider the alternating 6 - cycle C := G ∆ G ′ . 10 case 1 : C contains at least four different vertices. Assume first that C contains four different vertices. The only p ossibility to realize this scenario is C = ( v 1 , v 2 , v 3 , v 1 , v 4 , v 3 , v 1 ) with ( v 1 , v 2 ) , ( v 3 , v 1 ) , ( v 4 , v 3 ) ∈ A ( G ) and ( v 3 , v 2 ) , ( v 4 , v 1 ) , ( v 1 , v 3 ) ∈ A ( G ′ ) . (A p ermutation o f { 1 , 2 , 3 } do es not influence the result.) W e get the a lternating vertex-disjoint walk P = ( v 4 , v 3 , v 1 , v 2 ) . (i): Assume ( v 4 , v 2 ) / ∈ A ( G ) . It follows ( v 4 , v 2 ) / ∈ A ( G ′ ) . Otherwise, we would get ( v 4 , v 2 ) ∈ G ∆ G ′ in co ntradiction to our assumption. W e s e t G 1 := ( G 0 \ { ( v 4 , v 3 ) , ( v 1 , v 2 ) } ) ∪ { ( v 4 , v 2 ) , ( v 1 , v 3 ) } and G 2 := ( G 1 \ { ( v 4 , v 2 ) , ( v 3 , v 1 ) } ) ∪ { ( v 4 , v 1 ) , ( v 3 , v 2 ) } . W e g et G 2 = G ′ and realiza tions G 0 , G 1 , G 2 with | G i ∆ G ′ i +1 | = 4 . (ii): Assume ( v 4 , v 2 ) ∈ A ( G ) . It follows ( v 4 , v 2 ) ∈ A ( G ′ ) . Otherwise, we would get ( v 4 , v 2 ) ∈ G ∆ G ′ in co ntradiction to our assumption. W e s e t G 1 := ( G 0 \ { ( v 4 , v 2 ) , ( v 3 , v 1 ) } ) ∪ { ( v 4 , v 1 ) , ( v 3 , v 2 ) } and G 2 := ( G 1 \ { ( v 4 , v 3 ) , ( v 1 , v 2 ) } ) ∪ { ( v 4 , v 2 ) , ( v 1 , v 3 ) } . W e g et G 2 = G ′ and realiza tions G 0 , G 1 , G 2 with | G i ∆ G ′ i +1 | = 4 . W e ca n argue analogous ly if C contains five our s ix different vertices. case 2 : C contains exactly three different vertices. Then C is the alternating cycle C = ( v 1 , v 2 , v 3 , v 1 , v 2 , v 3 , v 1 ) with ( v 1 , v 2 ) , ( v 2 , v 3 ) , ( v 3 , v 1 ) ∈ A ( G ) and ( v 3 , v 2 ) , ( v 2 , v 1 ) , ( v 1 , v 3 ) ∈ A ( G ′ ) . Hence, G and G ′ are different in the orientation of exactly one dir ected 3 - cycle. Lemma 3. 4 . L et S b e a gr aphic al se quenc e and G and G ′ b e two differ ent r e alizations. Ther e exist r e alizations G 0 , G 1 , . . . , G k with G 0 := G , G k := G ′ and 1. | G i ∆ G i +1 | = 4 or 2. | G i ∆ G i +1 | = 6 wher e k ≤ 1 2 | G ∆ G ′ | − 1 . In c ase (2) , G i ∆ G i +1 c onsists of a dir e cte d 3 -cycle and its opp osite orientation. Pr o of. W e prov e the lemma by induction accor ding to the cardinality of the symmetric difference | G ∆ G ′ | = 2 κ. F or κ := 2 we get | G ∆ G ′ | = 4 . The co rrectness o f our claim follows with G 1 := G ′ . F or κ := 3 we g e t a sequence of realizations G 0 , G 1 , G 2 with case a ) of Prop osition 3.3. In case b ) we get a directed 3 -c y cle with its o ppos ite or ie ntation. In b oth ca s es it follows k ≤ 2 . W e assume the co rrectness of our claim for all κ ≤ ℓ . L e t | G ∆ G ′ | = 2 ℓ + 2 . W e can a ssume that κ > 3 . Assume further, that the symmetric difference consists of k weakly connected comp onents ( G ∆ G ′ ) i for i ∈ { 1 , . . . , k } . Consider first the ca se that for all these comp onents | ( G ∆ G ′ ) i | = 6 and that ea ch comp onent contains exactly three distinct vertices, then each of them is a dir ected 3-cyc le a nd its reorientation. W e cho o se ( G ∆ G ′ ) 1 , per form a 3-cycle reorientation on it, and obtain rea lization G ∗ . Thus | G ∗ ∆ G ′ | = 2 ℓ − 4 . B y the induction hypo thesis, there ar e realiza tio ns G 0 = G ∗ , G 1 , . . . , G k = G ′ such that k ≤ 1 2 | G ∗ ∆ G ′ | − 1 < 1 2 | G ∆ G ′ | − 1 . Combining the first 3-cycle reorientation with this sequence of rea liza tions gives the desired bound. If there is a comp onent | ( G ∆ G ′ ) i | = 6 with at least four distinct vertices, we can a pply Prop osition 3.3, ca se a) to it and handle the remaining co mp onents by induction. Otherwise, there is a co mponent with | ( G ∆ G ′ ) i | ≥ 8 . Due to Prop osition 3 .2, we may as s ume that there is a v ertex-disjoint walk P = ( v 1 , v 2 , v 3 , v 4 ) with ( v 1 , v 2 ) , ( v 3 , v 4 ) ∈ A ( G ) and ( v 3 , v 2 ) ∈ A ( G ′ ) . Otherwise, there exists Q = ( w 1 , w 2 , w 3 , w 4 ) with ( w 1 , w 2 ) , ( w 3 , w 4 ) ∈ A ( G ′ ) and ( w 3 , w 2 ) ∈ A ( G ) . In that ca s e w e can exc hange the r oles of G and G ′ and consider G ′ ∆ G . Clear ly , a sequence of rea lizations G ′ = G ′ 0 , G ′ 1 , . . . , G ′ k = G can b e reversed and then fulfills the conditions o f the lemma. So from now on we work with P . 11 case 1 : Ass ume ( v 1 , v 4 ) ∈ A ( G ′ ) \ A ( G ) . This implies ( v 1 , v 4 ) ∈ G ∆ G ′ . G 1 := ( G 0 \ { ( v 1 , v 2 ) , ( v 3 , v 4 ) } ) ∪ { ( v 3 , v 2 ) , ( v 1 , v 4 ) } is a r ealization of S and it follows | G 0 ∆ G 1 | = 4 and | G 1 ∆ G ′ | = 2 ℓ + 2 − 4 = 2( ℓ − 1) . Note that a fter this step, G 1 ∆ G ′ may consist of several connected comp onent s, but each of them has strictly smaller cardinality . T her e- fore, w e can apply the induction hypo thesis on | G 1 ∆ G ′ | . Thus, we obtain rea lizations G 1 , G 2 , . . . , G k with G k := G ′ and | G i ∆ G i +1 | = 4 or | G i ∆ G i +1 | = 6 where k − 1 ≤ 1 2 | G 1 ∆ G ′ | − 1 . Hence, we get the sequence G 0 , G 1 , . . . , G k with k = 1 + 1 2 | G 1 ∆ G ′ | − 1 = 1 2 ( | G ∆ G ′ | − 4) ≤ 1 2 | G ∆ G ′ | − 1 which fulfills 1 . and 2 . case 2 : Ass ume ( v 1 , v 4 ) ∈ A ( G ) ∩ A ( G ′ ) . This implies ( v 1 , v 4 ) / ∈ G ∆ G ′ . Consider an alternating cycle C = ( v 4 , v i , . . . , v j , v 1 , v 2 , v 3 , v 4 ) of ( G ∆ G ′ ) i such that e a ch vertex ha s in-degree tw o o r out-degree tw o. Then P is an alter nating subpath o f C with ( v i , v 4 ) , ( v 1 , v j ) ∈ A ( G ′ ) . W e c onstruct a new alternating cycle C ∗ := ( C \ P ) ∪ { ( v 1 , v 4 ) } with length | C ∗ | = | C | − 2 . W e swap the ar c s in C ∗ and get a realization G ∗ of S with | G 0 ∆ G ∗ | = | C ∗ | ≤ 2 ℓ and | G ∗ ∆ G ′ | = | G ∆ G ′ | − ( | C ∗ | − 1 ) + 1 ≤ 2 ℓ. According to the induction h yp o thesis there ex is t sequences G 1 0 := G, G 1 1 , . . . , G 1 k 1 := G ∗ and G 2 0 := G ∗ , G 2 1 , . . . , G 2 k 2 = G ′ with k 1 ≤ 1 2 | G 0 ∆ G ∗ | − 1 a nd k 2 ≤ 1 2 | G ∗ ∆ G ′ | − 1 . W e arrange these sequence s one after another and get a sequence whic h fulfills 1 . and 2 . and k = k 1 + k 2 = 1 2 | G 0 ∆ G ∗ | − 1 + 1 2 | G ∗ ∆ G ′ | − 1 = 1 2 | G ∆ G ′ | − 1 . case 3 : Ass ume ( v 1 , v 4 ) ∈ A ( G ) \ A ( G ′ ) . This implies ( v 1 , v 4 ) ∈ G ∆ G ′ . The alterna ting walk P can b e extended to a n alternating cycle C = { v 1 , v 2 , v 3 , v 4 , v 5 , . . . , v 2 t , v 1 } , t ≥ 3 using only a rcs from G ∆ G ′ . T o c o nstruct C , start with P , and keep adding alternating arcs until you reach the start vertex v 1 for the fir st time. Obviously , you will not get s tuck be fo r e reaching v 1 . Note that the arc ( v 1 , v 4 ) do es not b elong to C . Therefore, there exists an alterna ting sub-cycle C ∗ := C ∪ { ( v 1 , v 4 ) } \ P formed by arcs in G ∆ G ′ . W e sw a p the arcs in C ∗ and get a realization G ∗ of S with | G 0 ∆ G ∗ | = | C ∗ | ≤ 2 ℓ a nd | G ∗ ∆ G ′ | = | G ∆ G ′ | − | C ∗ | ≤ 2 ℓ . According to the induction hypothesis there exist sequences G 1 0 := G, G 1 1 , . . . , G 1 k 1 := G ∗ and G 2 0 := G ∗ , G 2 1 , . . . , G 2 k 2 = G ′ with k 1 ≤ 1 2 | G 0 ∆ G ∗ | − 1 a nd k 2 ≤ 1 2 ( | G ∆ G ′ | − | C ∗ | ) − 1 . W e arra ng e these s e q uences one after ano ther and get a s equence which fulfills 1 . a nd 2 . and k = k 1 + k 2 = 1 2 | G 0 ∆ G ∗ | − 1 + 1 2 ( | G ∆ G ′ | − | C ∗ | ) − 1 = 1 2 ( | G ∆ G ′ | ) − 2 . case 4 : Ass ume ( v 1 , v 4 ) / ∈ A ( G ) ∪ A ( G ′ ) . This implies ( v 1 , v 4 ) / ∈ G ∆ G ′ . It ex ists the alternating cycle C := ( P, ( v 1 , v 4 )) with ( v 1 , v 4 ) / ∈ A ( G ) . G 1 := ( G 0 \ { ( v 1 , v 2 ) , ( v 3 , v 4 ) } ) ∪ { ( v 3 , v 2 ) , ( v 1 , v 4 ) } is a realization of S and it follows | G 0 ∆ G 1 | = 4 a nd | G 1 ∆ G ′ | = 2 ℓ + 2 − 2 = 2 ℓ. According to the induction h y p othesis there ex ist rea lizations G 1 , G 2 , . . . , G k with G k := G ′ which fulfill 1 . ) and 2 . ) where k 1 := 1 and k 2 := k − 1 ≤ 1 2 | G 1 ∆ G ′ | − 1 . Hence, we get the sequence G 0 , G 1 , . . . , G k with k = k 1 + k 2 = 1 + 1 2 | G 1 ∆ G ′ | − 1 = 1 2 ( | G ∆ G ′ | − 3 + 1) = 1 2 | G ∆ G ′ | − 1 which fulfills 1 . and 2 . Corollary 3 . 5. State gr aph Φ is a st r ongly c onne cte d dir e cte d gr aph. 3.2 Random W alks A random walk on Φ = ( V φ , A φ ) can b e describ ed by Algorithm 2. W e now require a data structure D S containing all pairs of non-adjacent arcs and all directed 2 - paths in the current realization. Theorem 3.6. Algorithm 2 is a r andom walk on state gr aph Φ which samples uniformly at r andom a dir e cte d gr aph G ′ = ( V , A ) as a re alization of se quen c e S for τ → ∞ . Pr o of. Algorithm 2 chooses elements in D S with the same constant probability . F or a vertex V G ∈ V φ there exist for all these pa irs of arcs in A ( G ′ ) either incoming and outgo ing a rcs on V G ′ in Φ or a lo o p. Let d φ := | A ( G ) | 2 − 2 P n i =1 a i 2 . W e get a transition matrix M for Φ with p ij = 1 d φ for i, j ∈ A (Φ) , i 6 = j , p ij = 1 − P { i | ( i,j ) ∈ A (Φ) , i 6 = j } 1 d φ for i, j ∈ V φ , i = j , otherwise w e set p ij = 0 . Since, Φ is a re g ular, s tr ongly connected, s ymmetrical and non-bipartite directed graph, the distribution of all rea lizations in a t th step conv erg es a s ymptotically to the uniform distribution. 12 Algorithm 2 Sa mpling realizatio n digr aphs Input: sequence S , a directed graph G = ( V , A ) with d + G ( v i ) d − G ( v i ) = a i b i ∀ i ∈ { 1 , . . . , n } and v i ∈ V , a mixing time τ . Output: A s a mpled directed gr aph G ′ = ( V , A ′ ) with d + G ′ ( v i ) d − G ′ ( v i ) = a v i b v i ∀ i ∈ { 1 , . . . , n } and v i ∈ V . 1: t := 0 , G ′ := G // initializa tion 2: whil e t < τ do 3: Cho ose an element p from D S uniformly a t random.// p is a p air of n on-adjac ent ar cs or a dir e cte d 2 -p ath. 4: if p is a pair of non- a djacent arcs ( v i 1 , v i 2 ) , ( v i 3 , v i 4 ) then 5: if ( v i 1 , v i 4 ) , ( v i 3 , v i 2 ) / ∈ A ( G ′ ) then 6: // Either walk on Φ to an adjac ent r e alization G ′ 7: Delete ( v i 1 , v i 2 ) , ( v i 3 , v i 4 ) in A ( G ′ ) . 8: A dd ( v i 1 , v i 4 ) , ( v i 3 , v i 2 ) to A ( G ′ ) . 9: else 10: // or walk a lo op: ‘Do nothing’ 11: end if 12: else 13: // p is a dir e cte d 2 -p ath P = ( v i 1 , v i 2 , v i 3 ) 14: if (( v i 3 , v i 1 ) ∈ A ( G ′ )) ∧ (( v i 2 , v i 1 ) , ( v i 3 , v i 2 ) , ( v i 1 , v i 3 ) / ∈ A ( G ′ )) ∧ ( i 3 > i 1 ) ∧ ( i 3 > i 2 ) then 15: // W alk on Φ t o an adjac ent r e alization G ′ with a r e oriente d dir e cte d 3 -cycle 16: Delete ( v i 1 , v i 2 ) , ( v i 2 , v i 3 ) , ( v i 3 , v i 1 ) in A ( G ′ ) . 17: A dd ( v i 2 , v i 1 ) , ( v i 3 , v i 2 ) , ( v i 1 , v i 3 ) to A ( G ′ ) . 18: else 19: // W alk a lo op: ‘Do not hing’ 20: end if 21: end if 22: update data s tr ucture D S 23: t ← t + 1 24: end whi le 4 Arc-Sw ap Sequences In this sectio n, we study under which conditions the simple switching algorithm works corr ectly for digraphs. The Mar ko v ch ain used in the switching algorithm works on the following simpler state graph Φ = ( V φ , A φ ) . W e define A φ as follows. a) W e connect t wo vertices V G , V G ′ ∈ V φ , G 6 = G ′ with arcs ( V G , V G ′ ) and ( V G ′ , V G ) if and only if | G ∆ G ′ | = 4 is fulfilled. b) W e set for each pair of non-adjacent arcs ( v i 1 , v i 2 ) , ( v i 3 , v i 4 ) ∈ A ( G ) , i j ∈ { 1 , . . . , n } a directed lo op ( V G , V G ) if and only if ( v i 1 , v i 4 ) ∈ A ( G ) ∨ ( v i 3 , v i 2 ) ∈ A ( G ) . c) W e set one dire c ted lo op ( V G , V G ) for all V G ∈ V φ . Lemma 4.1. The state digr aph Φ = ( V φ , A φ ) is non-bip artite, symmetric, and r e gular. Pr o of. Since each vertex V G ∈ V φ contains a lo op, Φ is not bipa r tite. A t each time we set a n arc we also do this for its o ppos ite direction. Hence, Φ is symmetric. The num b er of inco ming and outgo ing arcs at each V G equals the n umber o f no n-adjacent a rcs in G , which is the co nstant v alue | A ( G ) | 2 − P n i =1 a i 2 + P n i =1 b i 2 + P n i =1 a i b i . Thus, we get the re g ularity of Φ . 4.1 Characterization of Arc -Swap Sequences As shown in Example 1.1 in the Introduction, Φ decompo ses into several comp onents, but we are a ble to characterize sequences S for which strong connectivity is fulfilled in Φ . In fact, we will show that there 13 are numerous sequences which only re q uire switching by 2-swaps. In the fo llowin g w e give necessa r y and sufficient conditions allowing to identify such seq uences in po lynomial running time. Definition 4.1. L et S b e a gr aphic al se quen c e and let G = ( V , A ) b e an arbitr ary r e alization. W e denote a vertex su bset V ′ ⊆ V wi t h | V ′ | = 3 as an induced cycle set V ′ if and only if for e ach r e alization G ∗ = ( V , A ∗ ) the induc e d sub digr aph G ∗ h V ′ i is a dir e cte d 3 -cycle. Definition 4.2. L et S b e a gr aphic al se quenc e and G = ( V , A ) an arbitr ary r e alization. W e c al l S an arc-swap-sequence if and only if e ach subset V ′ ⊆ V of vertic es with | V ′ | = 3 is not an induc e d cycle set. This definition enables us to use a simpler sta te gr aph for s a mpling a r ealization G for a rc-swap- sequences. In Theo rem 4.5, we will show show that in these cas es we have o nly to switch the ends of tw o non-adjacent a r cs. Before, we study how to recog nize ar c-swap sequences efficiently . Clearly , we may not determine all realizations to iden tify a sequence as an a rc-swap-sequence. F or tunately , we are able to give a characteri- zation of sequences a llowing us to iden tify an arc-swap-sequence in o nly considering one r e alized digraph. W e need a further definition for a sp ecial ca se of sy mmetric differences. Definition 4. 3. L et S b e a gr aphic al se quen c e and G = ( V , A ) and G ∗ = ( V , A ∗ ) arbitr ary r e alizations. W e c al l G ∆ G ∗ simple symmetric cycle if and only if e ach vertex v ∈ V ( G ∆ G ∗ ) p ossesses vertex in-de gr e e d − G ∆ G ∗ ( v ) ≤ 2 and vertex out- de gr e e d + G ∆( v ) G ∗ ≤ 2 , and if G ∆ G ∗ is an alternating dir e cte d cycle. Note that the a lternating directed cycle C 1 in Fig . 4 is not a simple symmetric cycle, bec ause d + C 1 (4) = 4 . Cycle C 1 decomp oses into t wo simple symmetric cy cles C ′ 1 = { v 1 , v 2 , v 3 , v 4 , v 1 } and C ′′ 1 = { v 2 , v 3 , v 5 , v 4 , v 2 } . Theorem 4.2 . A gr aphic al se quenc e S is an ar c-swap-se quenc e if and only if for any re alization G = ( V , A ) the fol lowing pr op erty is true: F or e ach induc e d, dir e cte d 3 -cycle G h V ′ i of G ther e exists a r e alization G ∗ = ( V , A ∗ ) so that G ∆ G ∗ is a simple symmetric cycle and that the induc e d su b digr aph G ∗ h V ′ i is not a dir e cte d 3 -cycle. Pr o of. ⇒ : Let S b e a graphical arc-swap s e q uence and G = ( V , A ) b e an arbitrary realization. Wit h Definition 4.2 it follows that each subse t V ′ ⊂ V with | V ′ | = 3 is not a n induced cycle set. Hence, there exists for each induced, directed 3 -c ycle G h V ′ i of G a realiza tion G ′ = ( V , A ′ ) with symmetric difference G ∆ G ′ where the induced s ubdigr aph G ′ h V ′ i is not a directed cycle. If the symmetric difference G ∆ G ′ is not a simple s y mmetric cycle we delete a s long alternating cycles in G ∆ G ′ as we get an directed alterna ting cycle C ∗ where each vertex in C ∗ has at mos t vertex in-deg ree tw o and a t most vertex out-degree tw o. F urthermore, C ∗ shall con tain at least one a rc ( v , v ′ ) ∈ V ′ × V ′ . This is p ossible, be c ause G ∆ G ′ contains at least one such arc. On the other hand the alter na ting cycle C ∗ do es not contain all poss ible six of such arcs. Otherwise, the induced sub digraph G ′ h V ′ i is a dire c ted cycle. Now, we construct the r ealization G ∗ = ( V , A ∗ ) with A ∗ := ( A ( G ) \ ( A ( C ∗ ) ∩ A ( G ))) ∪ ( A ( C ∗ ) ∩ A ( G ′ )) . It follows G ∆ G ∗ = C ∗ is a simple symmetric difference. ⇐ : Let G b e any rea lization of sequence S. W e only have to c o nsider 3 -tuples of vertices V ′ inducing directed 3 -cycles in G. With o ur a ssumption there exists for each V ′ a realization G ∗ so that G ∗ h V ′ i is not a directed 3 -cycle. Hence, we find for each subset V ′ ⊂ V of vertices with | V ′ | = 3 a rea lization G ∗ = ( V , A ) , so that the induced sub digraph G ∗ h V ′ i is not a directed 3 -cycle. W e conclude that S is a n arc-swap se q uence. This c haracteriza tion allows us to give a simple p olynomial-time algorithm to r ecognize arc-swap- sequences. All we have to do is to chec k for each induced 3-cycle of the given realiza tion, if it for ms an induced cycle s et. Ther efore, we chec k for each arc ( v , w ) in an induced 3 -cycle whether there is an alternating walk from v to w (not using arc ( v , w ) ) which do es not include all five remaining arcs o f the 3-cycle and its reo rient ation. Mo reov er , each no de on this walk ha s at most in-degr ee 2 and at most out-degree 2. Such an alter nating walk can b e found in linea r time by using a reduction to a n f -factor problem in a bipar tite gra ph. In this g raph we search for an undirected alternating path by gr owing alternating trees (similar to ma tc hing a lgorithms in bipartite gra phs, no complications with blossoms will o ccur), see for example [Sch03]. The tr ic k to ensure that not all five arcs will app ear in the alternating cycle is to iterate ov er these fiv e a rcs and exclude exactly one of them from the alternating path search 14 betw een v and w . Of course, this lo op stops a s so on as one alternating path is found. Otherwis e , no suc h alternating path exists. As mentioned in the Intro duction, a linear -time recog nition is p ossible with a parallel Hav el- Hakimi algorithm of LaMar [LaM09]. Next, we are g oing to pr ov e that Φ is strongly co nnected for arc-swap-sequences. The structure of the pro o f is similar to the ca se of Φ , but technically slightly more inv o lved. Lemma 4.3. L et S b e a gr aphic al ar c-swap-se quenc e and G and G ∗ b e t wo differ ent r e alizations. Assume that V ′ := { v 1 , v 2 , v 3 } ⊆ V such that G h V ′ i is an induc e d dir e cte d 3-cycle but G ∗ h V ′ i is not an induc e d dir e cte d 3-cycle. Mor e over, assume that G ∆ G ∗ is a simple symmetric cycle. Then ther e ar e r e alizations G 0 , G 1 , . . . , G k with G 0 := G, G k := G ∗ , | G i ∆ G i +1 | = 4 and k ≤ 1 2 | G ∆ G ∗ | . Pr o of. W e prove this lemma by induction on the ca r dinalit y o f G ∆ G ∗ . T he base c a se | G ∆ G ∗ | = 4 is trivial. Consider next the case | G ∆ G ∗ | = 6 . W e distinguish betw een tw o s ubca s es. case a ) G ∆ G ∗ consists o f at least four different v e r tices. By Prop osition 3.3, case a), there are realiza tions G = G 0 , G 1 , G 2 = G ∗ with | G i ∆ G i +1 | = 4 . case b) G ∆ G ∗ consists o f exactly three vertices v 4 , v 5 , v 6 . Observe that G ∆ G ∗ contains at leas t one arc from G h V ′ i or its reorientation but not all three ver- tices V ′ as otherwise G ∗ h V ′ i would b e a n induced 3 -cycle. In fact, it turns out that G ∆ G ∗ contains exactly one arc, say ( v 2 , v 3 ) , from G h V ′ i and its opp osite arc ( v 3 , v 2 ) , b ecause G ∆ G ∗ is the directed alternating c ycle C := ( v 2 , v 3 , v 4 , v 2 , v 3 , v 4 , v 2 ) with v 4 6 = v 1 . W e hav e tw o sub cases. Assume first that ( v 1 , v 4 ) 6∈ A ( G ) ∩ A ( G ∗ ) . So we can swap the directed alter nating cycle ( v 1 , v 2 , v 3 , v 4 , v 1 ) in a single step. W e then obtain the directed alternating 6 -cycle ( v 2 , v 3 , v 4 , v 2 , v 1 , v 4 , v 2 ) whic h consists of four different vertices. B y Prop os itio n 3.3, case a), we can swap the ar cs o f this cycle in tw o steps, thus in total in three steps as claimed. Otherwise, ( v 1 , v 4 ) ∈ A ( G ) ∩ A ( G ∗ ) . Then we obtain the directed a lternating cycle ( v 1 , v 4 , v 2 , v 3 , v 1 ) which ca n b e sw app e d in a sing le step. By that, we o btain a new cycle ( v 1 , v 3 , v 4 , v 2 , v 3 , v 4 , v 1 ) which consists of four different vertices. By Prop o- sition 3.3, case a), we ca n swap the arcs of this cycle in tw o steps, thus in total in three steps as claimed. F or the induction step, let us consider | G ∆ G ∗ | = 2 ℓ + 2 ≥ 8 . Then G ∆ G ∗ contains b etw een one and five arcs from G h V ′ i and its reorientation. By Prop osition 3.2, ther e is a vertex-disjoint alternating directed walk P = ( w 1 , w 2 , w 3 , w 4 ) in G ∆ G ∗ with ( w 1 , w 2 ) ∈ A ( G ) \ A ( G ∗ ) or ( w 1 , w 2 ) ∈ A ( G ∗ ) \ A ( G ) . Suppos e that P contains no ar c from G h V ′ i and its reor ien tation. W e consider the ca s e ( w 1 , w 2 ) ∈ A ( G ) \ A ( G ∗ ) . If ( w 1 , w 4 ) ∈ A ( G ) ∩ A ( G ∗ ) , then we consider C = ( G ∆ G ∗ ) ∪ { ( w 1 , w 4 ) } \ P . W e swap the arc s of C and obtain a s rea lization G ∗∗ . Clear ly , G ∆ G ∗∗ contains an arc from G h V ′ i or its reorientation, a nd is a simple symmetric cycle. As | G ∆ G ∗∗ | = 2 ℓ , we can apply the induction h yp o thesis. W e obta in a sequence of realizations G = G 0 , G 1 , . . . , G k = G ∗∗ with | G i ∆ G i +1 | = 4 and k ≤ 1 2 | G ∆ G ∗∗ | ≤ 1 2 ( | G ∆ G ∗ | − 2) . Finally , we a pply a last swap o n the cycle ( w 1 , w 2 , w 3 , w 4 , w 1 ) and thereby tr ansform G ∗∗ to G ∗ . In total, the num b er of swap ope r ations is k ≤ 1 2 | G ∆ G ∗ | . The case ( w 1 , w 4 ) 6∈ A ( G ) ∩ A ( G ∗ ) is similar. This time, we start with a single swap on the cy- cle ( w 1 , w 2 , w 3 , w 4 , w 1 ) and a fterwards a pply induction to the remaining cycle. W e can treat the case ( w 1 , w 2 ) ∈ A ( G ∗ ) \ A ( G ) analogo usly . Thus we can exclude the existence of any vertex-disjoint direc ted alternating 3 -walk which do es not contain at leas t one arc from G h V ′ i and its reo rient ation. It rema ins to consider the case that ther e is a vertex-disjoin t directed a lternating 3 -walk P = ( w 1 , w 2 , w 3 , w 4 ) in G ∆ G ∗ with ( w 1 , w 2 ) ∈ A ( G ) \ A ( G ∗ ) or ( w 1 , w 2 ) ∈ A ( G ∗ ) \ A ( G ) but at least one arc of P is from G h V ′ i and its reo rient ation, say ( v 1 , v 2 ) . Recall that G ∆ G ∗ contains betw een one and fiv e a r cs from G h V ′ i and its reor ien tation. W e distinguish betw een three ca ses: case I: G ∆ G ∗ contains exactly one of these arcs, say ( v 1 , v 2 ) ∈ A ( G ) \ A ( G ∗ ) . (The case that ( v 2 , v 1 ) ∈ A ( G ∗ ) \ A ( G ) is this sp ecial arc can be treated a na logously .) W e claim that the cycle G ∆ G ∗ m ust have the form ( v 1 , v 2 , v 4 , v 5 , v 6 , v 4 , v 5 , v 6 , v 1 ) . Note that v 4 , v 5 , v 6 are rep e ated ev ery third step, as otherwise we would obtain a vertex-disjoint alter nat- ing cycle a s excluded above. The cycle cannot b e longer than e ight , since then we would either obtain a vertex-disjoint 3-walk ( v 4 , v 5 , v 6 , v 7 ) , also excluded ab ov e, or if v 4 = v 7 we would violate 15 simplicit y of the symmetric difference. It might be that v 5 = v 3 , but v 4 , v 6 6 = v 3 as otherwise the symmetric difference would c o n tain mor e than one a rc fr om G h V ′ i and its reorientation. If ( v 1 , v 4 ) ∈ A ( G ) ∩ A ( G ∗ ) there is the alterna ting directed 4-cycle ( v 1 , v 4 , v 5 , v 6 , v 1 ) whic h can be swapped. In the remaining 6-cycle the ar c ( v 1 , v 2 ) is contained, so the induction hypothesis can be a pplied. Otherwise, if ( v 1 , v 4 ) 6∈ A ( G ) ∩ A ( G ∗ ) , we first a pply the induction hypothesis to the 6-cycle ( v 1 , v 2 , v 4 , v 5 , v 6 , v 4 , v 1 ) , and afterwards we swap the rema ining 4-cycle ( v 1 , v 4 , v 5 , v 6 , v 1 ) . case I I: G ∆ G ∗ contains exa ctly tw o o f these a r cs. Suppos e first that these tw o arcs ar e adjac e nt, say ( v 1 , v 2 ) , ( v 3 , v 2 ) . Consider the following ar cs ( v 3 , v 4 ) , ( v 5 , v 4 ) , ( v 5 , v 6 ) alo ng the symmetric difference. No w v 5 = v 2 as otherwis e there is an alternating dir ected walk ( v 2 , v 3 , v 4 , v 5 ) . Dep ending whether ( v 5 , v 2 ) ∈ A ( G ) ∩ A ( G ∗ ) or no t, we can either swap the alternating 4-cyc le ( v 3 , v 4 , v 5 , v 2 , v 3 ) or the r emaining part of the s ymmetric difference to g ether with ( v 5 , v 2 ) by the induction hypothesis. Moreov er, v 6 = v 3 , a s otherwise there would be the vertex-disjoint alternating directed 3-walk ( v 3 , v 4 , v 5 , v 6 ) excluded a bove. But then ( v 3 , v 2 ) is also in the symmetric difference, a contradiction. Thus, the tw o arcs from G h V ′ i and its reorientation a re no t adjacent. T hen, there are a t leas t tw o other arcs b et ween them (o therwise the one ar c b etw een them would a lso b e from G h V ′ i and its r e orientation). By our a s sumption, there is a vertex-disjoint alternating directed 3-walk P = ( w 1 , w 2 , w 3 , w 4 ) with at lea s t o ne a rc from G h V ′ i and its reo rientation. In our scenario it m ust b e exactly one s uc h a rc. Dep ending whether ( w 1 , w 4 ) ∈ A ( G ) ∩ A ( G ∗ ) or not, we ca n either sw ap the alternating 4-cycle ( w 1 , w 2 , w 3 , w 4 , w 1 ) or the remaining part of the symmetric difference together with ( w 1 , w 4 ) b y the induction hypothesis. case I I I: G ∆ G ∗ contains b etw een three and five o f these a rcs. Suppos e fir s t all of them follow consecutively on the alter nating directed cycle. Consider the last t wo of these arcs, and app end the nex t ar c whic h must end in a vertex v 4 6∈ V ′ . Then we hav e a vertex-disjoin t alternating directed 3-walk which contains tw o arcs from G h V ′ i and its reorie ntation, and the remaining part of the symmetric difference has also such an ar c . Thus we can apply the induction hypothesis and ar e done. O therwise the three to five arcs from G h V ′ i and its reorie ntation are se pa rated. So no alternating directed 3- w alk may con tain all of them, in par ticular not P . W e can pro ceed as in case I I). Prop osition 4. 4. L et S b e a gr aphic al ar c-swap-se quenc e and G and G ′ b e two differ ent r e alizations. If | G ∆ G ′ | = 6 and G ∆ G ′ c onsists of exactly t hr e e vertic es V ′ := { v 1 , v 2 , v 3 } , then ther e exist r e alizations G 0 , G 1 , . . . , G k with G 0 := G, G k := G ′ , | G i ∆ G i +1 | = 4 and k ≤ 2 n + 2 . Pr o of. Since S is an ar c-swap-sequence, Theo rem 4.2 implies the existence of a realiza tion G ∗ such that G ∆ G ∗ is a simple symmetric cycle a nd G ∗ h V ′ i is not a directed 3 -cy cle. By Lemma 4.3, there are realizations G 0 , G 1 , . . . , G k ′ := G ∗ with | G i ∆ G i +1 | = 4 and k ′ ≤ 1 2 | G ∆ G ∗ | ≤ n , since G ∆ G ∗ is simple. Moreov er, we hav e | G ∗ ∆ G ′ | ≤ | G ∆ G ∗ | + 4 ≤ 2 n + 4 s ince G a nd G ′ differ only in their orient ation of the 3 -cycle induced by V ′ . The symmetric difference G ∗ ∆ G ′ is no t necessa rily a s imple s ymmetric cycle, but can b e decomp osed int o s imple symmetric cycles, each co n ta i ning a t least one arc from G h V ′ i and its reorientation. On each of these simple symmetric cycles we a pply our auxilia ry Lemma 4.3. W e o btain a sequence G ∗ := G ′ 0 , . . . , G ′ k ′′ := G ′ with | G i ∆ G i +1 | = 4 and k ′′ ≤ n + 2 . C o m bining both sequences we obtain a sequence with k = k ′ + k ′′ ≤ 2 n + 2 . Lemma 4.5 . L et S b e a gr aphic al ar c-swap-se quenc e, and G and G ′ b e two differ ent r e alizations. Then ther e exist r e alizations G 0 , G 1 , . . . , G k with G 0 := G , G k := G ′ and | G i ∆ G i +1 | = 4 , wher e k ≤ 1 2 | G ∆ G ′ | − 1 · ( n + 1) . Pr o of. W e prov e the lemma by induction accor ding to the cardinality of the symmetric difference | G ∆ G ′ | = 2 κ. F or κ := 2 we get | G ∆ G ′ | = 4 . The correctness of our claim follo ws with G 1 := G ′ . F or κ := 3 we distinguish tw o ca ses. If G ∆ G ′ consists of exa ctly three vertices, then by Pro po sition 4.4 we get a sequence o f r ealizations G 0 , G 1 , . . . , G k and k ≤ 2 n + 2 = 2( n + 1) , as claimed. Otherwise, the symmetric difference G ∆ G ′ consists o f more tha n three vertices. By Prop osition 3 .3, ca se a), there ar e realizations G 0 , G 1 , G 2 = G ′ . W e assume the corr ectness of our induction hypo thesis for all κ ≤ ℓ. Let | G ∆ G ′ | = 2 ℓ + 2 . W e ca n assume that κ > 3 . Suppose first that the sy mmetric difference G ∆ G ′ decomp oses in to t simple s ymmetric 16 cycles | ( G ∆ G ′ ) i | = 6 . Supp ose further that a ll these ( G ∆ G ′ ) i consist of exactly three vertices. Clearly , | G ∆ G ′ | = 6 t . W e apply our Prop osition 4.4 to each of these t cycles one after another and get a sequence of realiza tions G 0 , G 1 , . . . , G k = G ′ with k ≤ 2 t ( n + 1) ≤ (3 t − 1)( n + 1) = 1 2 | G ∆ G ′ | − 1 · ( n + 1) . Otherwise, there is a ( G ∆ G ′ ) 1 which co ntains at least four vertices. Swapping the ar cs in ( G ∆ G ′ ) 1 leads to a realization G ∗ . By Prop osition 3.3, there are realiza tions G = G 0 , G 1 , G 2 = G ∗ with | G i ∆ G i +1 | = 4 . W e can apply the induction h yp othesis on the remaining part o f the symmetric dif- ference. Obviously , w e obtain the desired b ound in this ca se. It remains the case that there exists a simple symmetric cycle ( G ∆ G ′ ) 1 of G ∆ G ′ with | ( G ∆ G ′ ) 1 | 6 = 6 . If | ( G ∆ G ′ ) 1 | = 4 , we use a single swap o n ( G ∆ G ′ ) 1 and obtain a realiza tion G ∗ , where | G ∗ ∆ G ′ | = | G ∆ G ′ | − 4 . By the induction hypo thesis, there is a sequence of r ealizations G ∗ = G 1 , G 2 . . . , G k = G ′ with k − 1 ≤ 1 2 | G ∗ ∆ G ′ | − 1 · ( n + 1) = 1 2 | G ∆ G ′ | − 3 · ( n + 1) . Otherwise, | ( G ∆ G ′ ) 1 | ≥ 8 . Using Prop osition 3.2, we may assume that there exists a vertex-disjoin t directed alternating walk P = ( v 1 , v 2 , v 3 , v 4 ) in ( G ∆ G ′ ) 1 with ( v 1 , v 2 ) , ( v 3 , v 4 ) ∈ A ( G ) and ( v 3 , v 2 ) ∈ A ( G ′ ) , for the sa me rea sons as in the pro o f of Lemma 3 .4. case 1 : Ass ume ( v 1 , v 4 ) ∈ A ( G ′ ) \ A ( G ) . This implies ( v 1 , v 4 ) ∈ G ∆ G ′ . G 1 := ( G \ { ( v 1 , v 2 ) , ( v 3 , v 4 ) } ) ∪ { ( v 3 , v 2 ) , ( v 1 , v 4 ) } is a realization of S and it follows | G ∆ G 1 | = 4 and | G 1 ∆ G ′ | = 2 ℓ + 2 − 4 = 2( ℓ − 1) . Therefore, we can apply the induction h y p othesis o n | G 1 ∆ G ′ | . Thus, we obtain realizations G 1 , G 2 , . . . , G k with G k := G ′ and | G i ∆ G i +1 | = 4 . where k − 1 ≤ 1 2 | G 1 ∆ G ′ | − 1 · ( n + 1) = 1 2 | G ∆ G ′ | − 3 · ( n + 1) . case 2 : Ass ume ( v 1 , v 4 ) ∈ A ( G ) ∩ A ( G ′ ) . This implies ( v 1 , v 4 ) / ∈ G ∆ G ′ . W e cons truct a new alternating cycle C ∗ := (( G ∆ G ′ ) 1 \ P ) ∪ { ( v 1 , v 4 ) } with length | C ∗ | = | ( G ∆ G ′ ) 1 | − 2 . W e s wap the arcs in C ∗ and get a realization G ∗ of S with | G 0 ∆ G ∗ | = | C ∗ | ≤ 2 ℓ and | G ∗ ∆ G ′ | = | G ∆ G ′ | − ( | C ∗ | − 1 ) + 1 ≤ 2 ℓ. According to the induction h yp o thesis there ex is t sequences G 1 0 := G, G 1 1 , . . . , G 1 k 1 := G ∗ and G 2 0 := G ∗ , G 2 1 , . . . , G 2 k 2 = G ′ with k 1 ≤ 1 2 | G 0 ∆ G ∗ | − 1 · ( n + 1) and k 2 ≤ 1 2 | G ∗ ∆ G ′ | − 1 · ( n + 1) . W e arrang e these sequences o ne after another and get a s equence with k = k 1 + k 2 = 1 2 | G 0 ∆ G ∗ | − 1 + 1 2 | G ∗ ∆ G ′ | − 1 · ( n + 1) = 1 2 | G ∆ G ′ | − 1 · ( n + 1) . case 3 : Ass ume ( v 1 , v 4 ) ∈ A ( G ) \ A ( G ′ ) . This implies ( v 1 , v 4 ) ∈ G ∆ G ′ . Note that the ar c ( v 1 , v 4 ) do es no t b elong to ( G ∆ G ′ ) 1 . There- fore, there exists an alter na ting sub-cycle C ∗ := ( G ∆ G ′ ) 1 ∪ { ( v 1 , v 4 ) } \ P formed by arcs in G ∆ G ′ . W e swap the arcs in C ∗ and get a r ealization G ∗ of S with | G 0 ∆ G ∗ | = | C ∗ | ≤ 2 ℓ and | G ∗ ∆ G ′ | = | G ∆ G ′ | − | C ∗ | ≤ 2 ℓ . According to the induction h ypo thesis there exist seq uences G 1 0 := G, G 1 1 , . . . , G 1 k 1 := G ∗ and G 2 0 := G ∗ , G 2 1 , . . . , G 2 k 2 = G ′ with k 1 ≤ 1 2 | G 0 ∆ G ∗ | − 1 · ( n + 1) and k 2 ≤ 1 2 ( | G ∆ G ′ | − | C ∗ | ) − 1 · ( n + 1) . W e arra nge these sequences one a fter ano ther and get a sequence with k = k 1 + k 2 = 1 2 | G 0 ∆ G ∗ | − 1 + 1 2 ( | G ∆ G ′ | − | C ∗ | ) − 1 · ( n + 1) = 1 2 ( | G ∆ G ′ | ) − 2 · ( n + 1) . case 4 : Ass ume ( v 1 , v 4 ) / ∈ A ( G ) ∪ A ( G ′ ) . This implies ( v 1 , v 4 ) / ∈ G ∆ G ′ . It ex ists the alternating cycle C := ( P, ( v 1 , v 4 )) with ( v 1 , v 4 ) / ∈ A ( G ) . G 1 := ( G 0 \ { ( v 1 , v 2 ) , ( v 3 , v 4 ) } ) ∪ { ( v 3 , v 2 ) , ( v 1 , v 4 ) } is a r ealization o f S and it follows | G 0 ∆ G 1 | = 4 and | G 1 ∆ G ′ | = 2 ℓ + 2 − 2 = 2 ℓ. According to the induction h yp o thesis there exist re a lizations G 1 , G 2 , . . . , G k with G k := G ′ where k 1 := 1 and k 2 := k − 1 ≤ 1 2 | G 1 ∆ G ′ | − 1 · ( n + 1) . Hence, w e get the sequence G 0 , G 1 , . . . , G k with k = k 1 + k 2 = 1 + 1 2 | G 1 ∆ G ′ | − 1 · ( n + 1) ≤ 1 2 | G ∆ G ′ | − 1 · ( n + 1) . Corollary 4.6. State gr aph Φ is a str ongly c onne cte d dir e cte d gr aph if and only if a given se quenc e S is an ar c-swap-se quenc e. An arc-swap-sequence implies the connectedness of the simple realizatio n graph Φ . Therefore, for such seq uence s we are able to ma ke ra ndom walks on the simple sta te g raph Φ whic h ca n b e implemen ted easily . W e simplify the ra ndom walk Algorithm 2 for arc-s wap-sequences in us ing realiza tion graph Φ . Hence, our data structure D S only contains pa irs of non-adjacent arcs . W e c a n ignore lines 12 to 20 in Algorithm 2. W e denote this mo dified algor ithm as the Ar c-S wap-R e alization-Sample Algorithm 3 . 17 Theorem 4.7. Algo rithm 3 is a r andom walk on the state gr aph Φ which u niformly samples a dir e cte d gr aph G ′ = ( V , A ) as a r e alization of an ar c- swap-se quenc e S for τ → ∞ . Pr o of. Algorithm 3 cho oses all elements in DS with the same co nstant probability . F o r a vertex V G ∈ V Φ there ex ist for all these pairs of a rcs in A ( G ′ ) either inco ming and outgoing arcs on V G ′ ∈ V Φ or a lo op. W e g et a transition ma trix M for Φ with p ij = 1 d for i, j ∈ A Φ , i 6 = j , p ij = 1 − P { i | ( i,j ) ∈ A Φ } 1 d for i, j ∈ V φ , i = j, otherwise we set p ij = 0 where d := | A ( G ) | 2 − 2 P n i =1 a i 2 − P n i =1 a i b i . Since, Φ is a re g ular, strongly connected, symmetric, and non-bipa r tite directed gr aph, the distribution o f all r ealizations in a t th step co n verges as y mptotically to the uniform distr ibution, see Lov asz [Lov96 ]. 4.2 Practical Insigh t s And A pplications As mentioned in the Introduction, many “ pr actitioners” use the switching a lgorithm for the pur pos e of net work analysis, regar dless whether the corresp onding de gree seq uence is an ar c-swap-sequence or not. In this section we would like to discuss under which circumstances this co mmon pra ctice can be well justified and when it may lead to wro ng conclusions. What would happen if we sa mple using the state graph Φ for a s e q uence S which is not an arc- swap-sequence? Cle a rly , we get the insig h t that Φ ha s several connected comp onents, but as we will see Φ co nsists of a t most 2 ⌊ | V | 3 ⌋ isomorphic comp onent s containing ex actly the sa me r e a lizations up to the orientation o f directed 3 - cycles each co nsisting of a n induced cycle set V ′ . F o r tunately , we can ident ify all induced cycle sets using our r e sults in Theo rem 4.2 b y only co nsidering an ar bitrary realiza tio n G . Prop osition 4. 8. Le t S b e a gr aphic al se qu enc e which is not an ar c-swap-se quenc e and has at le ast two differ ent induc e d cycle sets V ′ and V ′′ . Then it fol lows V ′ ∩ V ′′ = ∅ . Pr o of. Without lo s s o f generality we can lab el the vertices in V ′ with v ′ 1 , v ′ 2 , v ′ 3 and in V ′′ with v ′′ 1 , v ′′ 2 , v ′′ 3 . Let G be a r ealization wher e { ( v ′ 1 , v ′ 2 ) , ( v ′ 2 , v ′ 3 ) , ( v ′ 3 , v ′ 1 ) , ( v ′′ 1 , v ′′ 2 ) , ( v ′′ 2 , v ′′ 3 ) , ( v ′′ 3 , v ′′ 1 ) } ⊂ A ( G ) . W e distinguish betw een tw o cases. a): Assume | V ′ ∩ V ′′ | = 1 wher e v ′ 1 = v ′′ 1 . If it exists arc ( v ′′ 3 , v ′ 3 ) ∈ A ( G ) w e find the alternating 4 - cycle ( v ′′ 3 , v ′ 3 , v ′ 1 , v ′′ 2 , v ′′ 3 ) which implies a new realiza tion G ∗ where G ∗ h V ′ i is not a directed cycle in contradiction to our assumption that V ′ is a n induced cyc le set. Hence, it follows ( v ′′ 3 , v ′ 3 ) / ∈ A ( G ) . In this case we find the alternating cycle ( v ′′ 3 , v ′ 1 , v ′ 2 , v ′ 3 , v ′′ 3 ) . b): Assume | V ′ ∩ V ′′ | = |{ v ′ 1 , v ′ 2 }| = 2 wher e v ′ 1 = v ′′ 1 and v ′ 2 = v ′′ 2 . If a rc ( v ′′ 3 , v ′ 3 ) / ∈ A ( G ) exists we find the alternating 4 -c ycle ( v ′ 1 , v ′′ 3 , v ′ 3 , v ′ 2 , v ′ 1 ) which implies a new realization G ∗ where G ∗ h V ′ i is not a directed cycle in co ntradiction to our assumption that V ′ is an induced cycle set. Hence, it follows ( v ′′ 3 , v ′ 3 ) ∈ A ( G ) . In this case we find the alternating cyc le ( v ′′ 3 , v ′ 3 , v ′ 1 , v ′ 2 , v ′′ 3 ) . As the induced 3 -cycles which app ear in every realizatio n a re vertex-disjoint, we can reduce the in- and out-degrees of a ll vertices in these cycles by one, and obtain a new degree sequence which must b e an arc - swap sequence. Theorem 4.9 . L et S b e a se qu en c e. Then the state gr aph Φ c onsists of at most 2 ⌊ | V | 3 ⌋ isomorphi c c omp onents. Pr o of. W e assume tha t S is not a n arc-swap-sequence, other wis e we a pply Theorem 4.6 and get a stro ngly connected digra ph Φ . With Prop osition 4.8 it follows the existence o f at most ⌊ | V | 3 ⌋ induced cycle sets for S. Consider all realizations G j po ssessing a fixed orientation of these induced 3 -cycles whic h implies G j h V i i = G j ′ h V i i for all such realiza tions. W e pick out one of these or ien tation scenarios and consider the symmetric difference G j ∆ G j ′ of tw o such r ealizations. Since, a ll induced 3 -cycles a re identical in G j and G j ′ , we can delete each ar c o f these induced cycle sets V ′ and get the reduced gr aphs G j c and G j ′ c . Both are realizations o f an arc-swap-sequence S ′ . Applying Theorem 4.5 w e o btain, that there exist realizations G 0 := G j c , . . . , G k := G j ′ c | G i ∆ G i +1 | = 4 and k ≤ | G j c ∆ G j ′ c | . Hence, each induced subdig raph Φ D { V G j | V G j ∈ V φ and G j is a realization for one fixed orientation s cenario } E is s tr ongly connected. On the other hand, we get for each fixed o rient ation scenario exa ctly the sa me rea lizations G j . Since, a ll 18 induced 3 - c ycles are isomo rphic, it follows that all realizations which are only different in the orientation o f such directed 3 - cycles a r e isomorphic. By Theorem 4.2, there do es not exist an alterna ting cy cle destroying an induced 3 -cycle. Hence, the state gr aph Φ co ns is ts of exac tly 2 k strongly co nnected isomorphic comp onent s where k is the num b er of induced cycle sets V ′ . Applications in Ne t work Analysis Since the switching alg orithm samples o nly in one s ingle comp o- nen t of Φ , one has to be car e ful to get the cor rect estimations for certain netw ork statistics. F or netw ork statistics on unlabeled g raphs, it suffices to sa mple in a sing le comp onent which reduces the s ize of V Φ b y a facto r 2 k , the num b er o f co mponents in Φ , where k is the num b er o f induced cy c le s e ts o f the prescrib ed degree sequence. Examples wher e this appro ach is feasible ar e netw or k statistics like the average diameter or the mo tif conten t over a ll realizations . F or lab elled graphs, howev er, the random walk on V Φ systematically ov er- and under-samples the probability that an arc is present. Suppos e that the r a ndom walk starts with a realization G = ( V , A ) . If an arc ( v 1 , v 2 ) ∈ A ( G ) b elongs to an induced cycle set, it app ear s with probability 1 in all realizations of the ra ndom w alk. The opp osite a rc ( v 2 , v 1 ) 6∈ A ( G ) , will never o ccur. In a n unbiased sampling ov er all rea lizations, each of these ar cs, howev er, o ccurs with pro babilit y 1 / 2 . All other a rcs o ccur with the same pro babilit y in a sing le comp onent o f V Φ as in the whole sta te graph. This obse r v ation can b e us e d to compute correct proba bilities for all arcs. 5 Concluding Remarks In this pap er, we hav e presented Markov chains for sa mpling uniformly at ra ndom undirected a nd directed graphs with a prescrib ed degr ee sequence. The key op en problem remains to ana ly ze whether these Marko v chains are rapidly mixing or not. References [BBV07] I. Bezáková, N. Bhatnagar, and E. Vigo da, Sampling binary c ontingency tables with a gr e e dy start , Random Structures a nd Algorithms, 30 (2007), 168 –205. [BKS09] M. Bay ati, J. H. Kim, and A. Sab eri, A se quential algorithm for gener ating r andom gr aphs , Algorithmica, do i 10.100 7/s004 53-009-9340-1 (2 009). [CDG07] C. Co o per , M. Dyer, and C. Greenhill, Sampling r e gular gr aphs and a p e er-to-p e er network , Combinatorics, Probabilit y and Computing 16 (2007), 557– 593. [Che66] W.K. Chen, On the r e alization of a ( p, s ) -digr aph with pr escrib e d de gr e es , J. F ranklin Institute 281 (19 66), 406–4 22. [EG60] P . Erdős and T. Gallai, Gr áfok előírt fokú p ontokkal (Gr aphs with pr escrib e d de gr e e of ver- tic es) , Ma t. Lapo k 11 (1 960), 26 4–274 , (in Hungar ian). [EMT09] P . L. Erdős, I. Miklós, and Z. T o ro czk ai, A simple Havel-Hakimi typ e algori thm to r e alize gr aphic al de gr e e se quenc es of dir e cte d gr aphs , a rXiv:0905 .4 913 v1, 2009. [Hak62] S.L. Hakimi, On the r e alizabil ity of a set of inte gers as de gr e es of t he vertic es of a simple gr aph , SIAM J. Appl. Math 10 (1962), 49 6–506 . [Hak65] S.L. Hakimi, O n the de gr e es of the vertic es of a dir e cte d gr aph , J. F ra nklin Institute 2 79 (1965), 290 –308. [Hav55] V. Hav el, A r emark on the existen c e of finite gr aphs. (cze ch) , Časopis Pěst. Mat. 80 (1955), 477–4 80. [JS96] M. Jerrum and A. Sinclair, The Markov chain Monte Carlo metho d: An appr o ach t o ap- pr oximate c ounting and inte gr ation , Approximation Algor ithms for NP-hard Problems (D.S. Ho c h baum, ed.), PWS Publishing, Boston, 19 9 6, pp. 482 – 520. 19 [JSV04] M. Jerrum, A. Sinclair a nd E. Vigo da, A p olynomial-time appr oximation algorithm for the p ermanent of a matrix with nonne gative entries , Journal of the A CM 51 (2004 ), pp. 671 –697. [KLP + 05] D. Kosch ützki, K. A. Lehmann, L. Peeters, S. Rich ter, D. T enfelde-Podehl, and O. Zlo- towski, Centr ality indic es , Net work Analysis: Metho dolo gical F oundations (U. Brandes and T. Erlebach, eds.), Lecture Notes in Computer Scie nce , vol. 3418, Springer, 2005, pp. 16–61. [KTV99] R. Ka nnan, P . T etali, and S. V empala , Simple Markov-cha in algorithms for gener ating bip ar- tite gr aphs and tournaments , Random Structure s and Algorithms 14 (1999), 293– 308. [KV03] J.H. K im and V.H. V u, Gener ating r andom r e gular gr aphs , STOC 200 3, 2003, pp. 213– 2 22. [KW73] D.J. Kleitman and D.L. W ang, A lgorithm for c onstru cting gr aphs and digr aphs with given valenc es and factors , Discrete Math. 6 (197 3) 79–88 . [LaM09] M. D. LaMar, Alg orithms for r e alizing de gr e e se quenc es for dir e cte d gr aphs , arXiv.org :0906.0 3 43v1 (20 09). [Lov96] L. Lovász, Ra ndom walks on gr aphs: A su rvey , Co m binatorics, Paul Erdős is Eight y (D. Mik- lós et al., ed.), v ol. 2, J ános Bo ly ai Mathematical So ciety ., 1996, pp. 353– 397. [MIK + 04] R. Milo, S. Itzk ovitz, N. Kas h ta n, R. Levitt, S. Shen-Orr, I. A yzenshtat, M. Sheffer, and U. Alon, Sup erfamilies of evolve d and designe d networks , Science 303 (2 0 04), 1538 –1542 . [MKI + 04] R. Milo, N. Kashtan, S. Itzko vitz, M.E.J. Newman, and U. Alon, On the uniform gener ation of r andom gr aphs with arbitr ary de gr e e se quenc es , ar Xiv:cond-mat/031 2028 v2, 30 May 20 04, 2004. [Moh91] B. Mo har, Eigenvalues, diameter and me an distanc e in gr aphs , Graphs a nd Combinatorics 7 (1991), 53– 64. [MSOI + 02] R. Milo, S. Shen-Orr , S. Itzko vitz, N. K ashtan, D. Chklovskii, and U. Alon, Network motifs: simple building blo cks of c omplex networks , Science 298 (20 02), 82 4–827 . [MW90] B. McKay and N.C. W ormald, U niform gener ation of r andom r e gular gr aphs of mo der ate de gr e e , J. Algorithms 11 (1990 ), 5 2–67. [MW91] B. McK ay and N.C. W ormald, Asymptotic enu mer ation by de gr e e se quenc e of gr aphs with de gr e es o ( n 1 / 2 ) , Combinatorica 11 (1 991), 369– 382. [RJB96] A.R. Rao , R. J a na, a nd S. Ba ndy opadhy ay , A Markov chain Monte Carlo metho d for gener- ating r andom (0,1)–matric es with given mar ginals , Sankhy a: The Indian J ournal of Statistics 58 (199 6), 225 – 242. [Rys57] H. J. Ryser, Combinatorial pr op erties of matric es of zer o es and ones , Ca nadian J. Math 9 (1957), 371 –377. [Sch 03] A. Schrijv er , Combinatori al optimization: Polyhe dr a and efficiency , Springer , 2003 . [Sin92] A. Sinclair, Impr ove d b ounds for mixing r ates of Markov chai ns and multic ommo dity flow , Combinatorics, Probabilit y & Computing 1 (1992), 351– 370. [Sin93] A. Sinclair, Al gorithms for r andom gener ation and c ounting: A Markov chain appr o ach , Birkhäuser, 19 93. [SW99] A. Steger and N. W ormald, Gener ating r andom r e gular gr aphs quickly , Com bina torics, Prob- ability , a nd Computing 8 (1999), 377 – 396. [T ut52] W.T. T utte, The factors of gr aphs , Canadia n J. of Mathematics 4 (1952), 3 14–32 8. [T ut54] W.T. T utte, A short pr o of of t he factors the or em for fin ite gr aphs , Canadian J. O f Mathematic 6 (1 9 54), 347– 352. 20 App endix A F urther Examples Where Switc hing F a ils As we hav e seen in Example 1.1, the switc hing algorithm will fail in genera l. Her e w e g iv e further non- trivial clas ses of graphs where it a lso fails. All problematic insta nces a re realiza tions whic h a r e different in at least one dir ected 3 - cycle but not all of them ar e no t changeable with alter na ting 4 -cycles. Consider the following Fig ures 6 and 7. Both exa mples cannot be changed to a r ealization which is only different in the orientation of the dir ected 3 -cycle b y a sequence of alter nating 4 -cycles. arbitrary digraph incident to each vertex Figure 6: All vertices in a 3 -c y cle are incident in o ne direction with vertices in an arbitrary sub digraph. directed clique incident to each vertex empty induced subdigraph arbitrary arc set Figure 7: All vertices in a 3 -cycle are incident in b o th directions with a directed clique. An indep endent set of vertices is arbitrar ily incident with the directed clique. 21
Original Paper
Loading high-quality paper...
Comments & Academic Discussion
Loading comments...
Leave a Comment