arXiv:1903.09454v2 [math.CO] 12 Jun 2019 on ni esl[]adRbno 1]i 95 eundto returned 1995, in [17] Publications Robinson and function. functions index [3] generating cycle Gessel for the until explanation of down, combinatorial systemat terms which simple in [1] a digraphs Theory [16] independently Species 1970 announced the in to also started related ob much he sources, very publications is of of stron number series including a an digraphs, given of of [18], a families in with different DAGs of DAGs counting labeled unlabeled counted and Stanley digrap labeled f connected case. tool strongly unlabeled helpful for the a recurrence simpler digraph, a connected conn derived initially strongly of of number concept the for the recurrence a le deduced at first approached who the successfully families, been has digraph digraphs, important connected two of enumeration The Introduction 1 Dfiiin22,wiherce h yblcmto.Secon method. symbolic Firstl the twofold. enriches is which contribution 2.2), Our (Definition manipulate level. to coefficient allows the it at particular, In an relations. source-like function marking by digraphs and [4] sinks and sources nmrto ehd noa smttcfaeoki h fut diff the maint the in to received framework chose yet asymptotic We an not into did method. methods and similar enumeration community, this a scientific of with the body strongly problem for the same of after the function t 17] here [14, generating method papers the the Robinson’s to for discovered analogous expression method simple the a and function alphabetical generating is authors the of order The ANR-15-CE40-0014. ∗ 1 h yblcmto 1 ]i itoayta rnltsco translates that dictionary a is 2] [1, method symbolic The led aae samme fLincs of member a is Panafieu de Elie nfc,Rbno’ ae 1]fo 93ette “Counting entitled 1973 from [14] paper Robinson’s fact, In ´ keywords. family. given wh graphs a strong directed to of on number results the enumerative G on Robinson’s Wright of cover and results Robinson previous Liskovets, for of proofs and short provides It meration. eitouetearwpout ytmtcgnrtn fun generating systematic a product, arrow the introduce We yblcmto n ietdgahenumeration graph directed and method Symbolic elLb rne Nokia France, Labs Bell ietdgah irp,aayi obntrc,generat , analytic digraph, graph, directed led Panafieu de Elie ´ or pca eeaigfunctions generating special www.lincs.fr etme ,2021 4, September n egyDva sspotdb h rnhARpoetMetA project ANR French the by supported is Dovgal Sergey and IN ntttGalil´ee 13 Universit´e Institut Paris LIPN, Abstract okwsfiihdadacpe o ulcto.W r solvi are We publication. a for accepted and finished was work once irps iia oCrlay35 h uhr h authors The 3.5. Corollary to similar digraphs, connected . so hydsre u ute oli oitgaeteeex these integrate to is goal further Our deserve. they usion 1 1 ure. aee cci irps led otistento fas a of notion the contains already digraphs” acyclic labeled talwdte oeueaeDG ymarking by DAGs enumerate to them allowed It . a edsrb ntecretppr oisnas obtains also Robinson paper. current the in describe we hat l once irps hc a h culmination the was which digraphs, connected gly h eeaigfntosdrcl,aodn working avoiding directly, functions generating the ietdAylcGraphs Acyclic Directed i h ulcto,a efl hs eut r finterest of are results those felt we as publication, the ain ,w ecieanwoeain the operation, new a describe we y, s ic 99 paety twsLsoes[,10] [9, Liskovets was it Apparently, 1969. since ast rtereueain usqety rgt[19] Wright Subsequently, enumeration. their or sadLsoes[1 xeddhstcnqe to techniques his extended [11] Liskovets and hs se ntenme fdrce cci graphs acyclic directed of number the on essel fSaly nteulbldcs,hsapproach his case, unlabeled the In Stanley. of r l togycnetdcmoet belong components connected strongly all ere iklk components. sink-like d l,w rps ipepof,smlrt those to similar proofs, simple propose we dly, h eeaigfnto fsrnl connected strongly of function generating the ce irpsadas nrdcdadstudied and introduced also and digraphs ected egyDovgal Sergey nteeateueaino irpsslowed digraphs of enumeration exact the on ssteuaeo yl ne eis Robinson series. index cycle of usage the ises oisn nhsppr 1,1] counted 15], [14, papers his in Robinson, d ycnetddrce rps eas re- also We graphs. directed connected ly h rbe ihteapoc of approach the with problem the to ehiu o ietdgahenu- graph directed for technique ction andeatadaypoi eut on results asymptotic and exact tained bntra prtosit generating into operations mbinatorial n functions ing DG)adtestrongly the and (DAGs) ro product arrow ∗ graphic COnc, pecial ave act ng of [17], for the generating functions of directed acyclic digraphs (DAGs), strongly connected graphs (SCCs), and digraphs where all SCCs belong to a given family. Some variants are presented as well. Similar techniques enabled precise description of simple graphs phase transition (see e.g. [7]), so the techniques developed here might enable the study of digraphs phase transition [6, 13]. In this paper, we consider directed graphs (digraphs) with labeled vertices, without loops or multiple edges. Two vertices u, v can be simultaneously linked by both edges u → v and v → u. We also consider simple graphs which are undirected graphs with neither multiple edges nor loops.

2 The symbolic approach 2.1 Definitions ∞ Consider a sequence (an(w))n=0. Define the exponential generating function (EGF) and the graphic gener- ∞ ating function (GGF) (introduced in [3]) of the sequence (an(w))n=0 as

n n z A an(w) z A(z, w) := an(w) and (z, w) := n . n! (2) n! nX>0 nX>0 (1 + w)

To distinguish EGF from GGF, the latter are written in bold characters. The special generating functions of [17] correspond to GGFs with w =1. The nth coefficient of a series A(z) with respect to the variable z is n n n denoted by [z ]A(z), so A(z)= n>0([x ]A(x))z . n n P z z The exponential Hadamard product of two series A(z)= n>0 an n! and B(z)= n>0 bn n! is denoted by and defined as P P zn zn zn A(z) ⊙ B(z)= an ⊙ bn := anbn . n! n! n!  nX>0   nX>0  nX>0 All Hadamard products are taken with respect to the variable z. The Hadamard product can be used to convert between EGF and GGF (see Corollary 3.2). The exponential Hadamard product should not be n n n confused with the ordinary Hadamard product n([z ]A(z))([z ]B(z))z . ∞ If A is a certain family of digraphs or graphs,P we can associate to it a sequence of series (an(w))n=0, such m that [w ]an(w) is equal to the number of elements in A with n vertices and m directed edges. Consequently, we can associate both EGF and GGF to the same family of digraphs or graphs. An advantage of the symbolic method is its ability to keep track of a collection of parameters in com- binatorial objects. The two default parameters are the numbers of vertices and edges, and the arguments z and w of a generating function F (z, w) correspond to these parameters. As a generalization, we consider multivariate generating functions

n p n p z an,p(w)u z A(z, w, u) := an,p(w)u and A(z, w, u) := n , n! ( 2) n! Xn,p Xn,p (1 + w)

where u = (u1, ··· ,ud) is the vector of variables, p = (p1, ··· ,pd) denotes a vector of parameters, and the p pk notation u := k uk is used. We say that the variable uk marks its corresponding parameter pk, see [2]. Q 2.2 Combinatorial operations The next proposition recalls classic operations on EGFs (see [2]), which extend naturally to GGFs.

Proposition 2.1. Consider two digraph (or graph) families A and B. The EGF and GGF of the disjoint union of A and B are A(z, w)+B(z, w) and A(z, w)+ B(z, w). The EGF and GGF of the digraphs from A where one vertex is distinguished are z∂zA(z) and z∂zA(z, w). The EGF of sets of digraphs from A is eA(z,w). The EGF of pairs of digraphs (a,b) with a ∈ A and b ∈B (relabeled so that the vertex labels of a and b are disjoint, see [2]) is A(z, w)B(z, w). If a variable u marks the number of specific items in the EGF

2 A(z,w,u) or the GGF A(z,w,u) of the family A, then the EGF and GGF for the objects a ∈ A which have a distinguished subset of these specific items are A(z,w,u + 1) and A(z,w,u + 1). Replacing u 7→ u − 1 corresponds to an inclusion-exclusion process. The next definition and proposition translate the combinatorial interpretation of the product of GGFs, already mentioned by [17], into the symbolic method framework. Gessel also used it implicitely in several proofs (e.g. [4]) at coefficient level, but did not express it at the generating function level. However, a combinatorial interpretation of the exponential of GGFs can be found in [3, 5].

Figure 1: The arrow product. Figure 2: Symbolic method for Figure 3: Marking a subset of source- The vertex labels have been omit- DAG like SCC ted

Definition 2.2. We define the arrow product of A and B as the family C of pairs (a,b), with a ∈ A, b ∈B (relabeled so that a and b have disjoint labels), where an arbitrary number of edges oriented from vertices of a to vertices of b are added (see Figure 1). Proposition 2.3. The GGF of the arrow product of the families A and B is equal to A(z, w)B(z, w).

Proof. Consider two digraph families A and B, with associated sequences (an(w)), (bn(w)). Then the sequence associated to the GGF A(z, w)B(z, w) is

k ℓ n ak(w) z bℓ(w) z n ( 2) n kℓ cn(w) = (1+ w) n![z ] k ℓ = (1 + w) ak(w)bℓ(w).  (2) k!  (2) ℓ!  k Xk (1 + w) Xℓ (1 + w) k+Xℓ=n This series has the following combinatorial interpretation: it is the generating function (the variable w marks the edges) of digraphs with n vertices, obtained by • choosing digraphs a of size k in A, b of size ℓ in B, such that k + ℓ = n, • choosing a subset of {1,...,n} for the labels of a (and b receives the complementary for its labels), • for any vertices u in a, v in b, the oriented edge (u, v) is or not added. Hence, (cn(w)) is the sequence associated to the arrow product of A and B.

3 Generating functions from the symbolic method

We start by defining the building bricks for the symbolic method of directed graphs. Proposition 3.1. The EGF of all graphs G(z, w), GGF of all digraphs D(z, w), and GGF of sets Set(z, w) (labeled graphs that contain no edge) are

n zn 1 zn (2) G(z, w)= D(z, w)= (1 + w) and Set(z, w)= n . n! (2) n! nX>0 nX>0 (1 + w) Proof. Consider a graph with n vertices. Each unordered pair of distinct vertices is either linked by an edge, or not. Thus, the sequence of series associated to the family of graphs and its EGF are n zn n zn ( 2) (2) gn(w)=(1+ w) , G(z, w)= gn(w) = (1 + w) . n! n! nX>0 nX>0

3 In a digraph with n vertices, each ordered pair of distinct vertices is either linked by an oriented edge, or not. So the sequence of series associated to the family of digraphs and its GGF are

n n − dn(w) z n z n(n 1) D ( 2) dn(w)=(1+ w) , (z, w)= n = (1 + w) . (2) n! n! nX>0 (1 + w) nX>0 There is exactly one labeled graph without any edges, so the sequence of series associated to the set family and its GGF are 1 zn set n(w)=1, Set(z, w)= n . ( 2) n! nX>0 (1 + w)

Corollary 3.2. The EGF and GGF of a family A are linked by the relations

A(z, w) = G(z) ⊙ A(z, w) and A(z)= Set(z, w) ⊙ A(z, w).

Proof. Consider a family A with sequence of series (an(w)). By definition of the EGF, GGF and exponential Hadamard product, we have

n n n n z an(w) z z A ( 2) G(z) ⊙ (z)= (1 + w) ⊙ n = an(w) = A(z),  n!  ( 2) n! n! Xn Xn (1 + w) Xn and similarly

n n n 1 z z an(w) z Set(z) ⊙ A(z)= n ⊙ an(w) = n = A(z).  (2) n!  n! (2) n! Xn (1 + w) Xn Xn (1 + w)

3.1 Generating functions of various digraph families The next proposition comes from [4, 15, 18]. We present a proof relying on the arrow product. Proposition 3.3. The GGF of directed acyclic graphs (DAGs) with an additional variable u marking the sources (i.e. there are no oriented edge pointing to those vertices) is

Set((u − 1)z, w) DAG(z,w,u)= . Set(−z, w) Proof. The GGF of DAGs where each source is either marked, or left unmarked by the variable u, is DAG(z,w,u + 1) (see Proposition 2.1). Such a DAG is decomposed as the arrow product of a set (the marked sources) with a digraph (Figure 2), so

DAG(z,w,u +1)= Set(zu,w)DAG(z, w).

Observe that DAG(z, w, 0) is the GGF of DAGs without any source. The only DAG satisfying this property is the empty DAG, so DAG(z, w, 0)=1. Taking u = −1 gives 1= Set(−z, w)DAG(z, w), so DAG(z, w)= 1/Set(−z, w). Replacing u with u−1 gives DAG(z,w,u)= Set((u−1)z, w)/Set(−z, w). This second proof also illustrates the translation into the generating function world of the inclusion-exclusion principle. Let us recall that the condensation of a digraph is the directed acyclic graph (DAG) obtained from it by contracting each strongly connected component (SCC) to a vertex. The SCCs of the digraph corresponding to sources of the condensation are called source-like SCCs. The proof from Proposition 3.3 for expressing the generating function of DAGs with marked sources is now extended to digraphs with marked source-like components and SCCs belonging to a given family (similar proof published by [17]).

4 Theorem 3.4. Consider a nonempty family A of SCCs (the empty digraph is not strongly connected by convention, so it cannot belong to A). The GGF of digraphs where all SCCs belong to A is equal to 1 DA(z, w)= . Set(w,z) ⊙ e−A(z,w) The GGF of the same digraph family where an additional variable u marks the source-like components is

Set(w,z) ⊙ e(u−1)A(z,w) DA(z,w,u)= . Set(w,z) ⊙ e−A(z,w) Proof. The GGF of the digraph family considered, where each source-like component is either marked, or left unmarked by the variable u, is DA(z,w,u + 1) (see Proposition 2.1). Such a digraph is decomposed as the arrow product of a set of SCCs from A (the marked source-like components) with a digraph, so

uA(z,w) DA(z,w,u +1)= Set(z, w) ⊙ e DA(z, w).   Taking u = −1 gives

−1 −A(z,w) −A(z,w) 1= Set(z, w) ⊙ e DA(z, w), so DA(z, w)= Set(z, w) ⊙ e .     (u−1)A(z,w) Replacing u with u − 1 gives DA(z,w,u)= Set(z, w) ⊙ e DA(z, w).  When the family A contains only the SCC with one vertex and no edges, so A(z, w)= z, then DA(z, w) becomes the GGF of DAGs. Thus, Theorem 3.4 generalizes Proposition 3.3. Several interesting corollaries follow. The first one is our new proof for the EGF of strongly connected digraphs (original result from [11, 12, 17]). Corollary 3.5. The exponential generating function of strongly connected digraphs is equal to 1 SCC(z, w)= − log G(z, w) ⊙ .  G(z, w)  Proof. When A is the family of all SCCs, the first result of Theorem 3.4 becomes 1 D(z, w)= . Set(w,z) ⊙ e−SCC(z,w) By inversion and Hadamard product with G(z, w), we obtain 1 e−SCC(z,w) = G(z, w) ⊙ . D(z, w) Replacing D(z, w) with G(z, w) (see Proposition 3.1) and taking the logarithm gives the final result. This formula enables fast computation of the numbers of strongly connected digraphs: O(nm log(n+m)) arithmetic operations to compute the array of SCCs with at most n vertices and at most m edges, O(n log(n)) for the SCCs with at most n vertices without edge constraint. The next corollary might prove useful to investigate the birth of the giant SCC in random digraph, following [7]. Corollary 3.6. Consider a nonempty SCC family B. The GGF of digraphs with a variable u marking the number of SCCs from B is 1 . Set(w,z) ⊙ e(1−u)B(z,w)−SCC(z,w) Proof. When A is the family of all SCCs, with an additional variable u marking the SCCs from B, then A(z,w,u) = SCC(z, w) + (u − 1)B(z, w), and the first result of Theorem 3.4 finishes the proof.

5 3.2 Initially connected digraphs Initially connected digraphs are defined as digraphs where any vertex is reachable from the vertex with label 1 via an oriented path. Their analysis has been linked to the study of SCCs, so we provide or recall some results on them for completeness.

Lemma 3.7. For a given number of vertices and edges, initially connected digraphs with one distinguished vertex are in with digraphs which have a unique source-like component, and where one vertex of that component is distinguished.

Proof. Let A and B denote the two digraph families from the lemma. Consider a digraph a ∈ A. Since a is initially connected, it contains exactly one source-like SCC. If the distinguished vertex belongs to the source-like SCC, then a ∈B. Otherwise, by switching the distinguished vertex with the vertex of label 1, we obtain a digraph from B. Reciprocally, if the distinguished vertex of a digraph b ∈B is in the same SCC as the vertex 1, then b ∈ A. Otherwise, a digraph from A is obtained by switching those two vertices. The following lemma provides a relation between initially connected digraphs and connected graphs ([8], proof also available in the conclusion of [7]).

Lemma 3.8. The GGF of initially connected digraphs is equal to the EGF of connected graphs

IC(z, w)=C(z, w) = log(G(z, w)).

4 Conclusion

Many digraph families can be enumerated using the same techniques: symbolic method enriched with the arrow product, Hadamard product, inclusion-exclusion and additional marking variables. Marking sinks in DAGs and sink-like SCCs in digraphs can be achieved as well. The next challenge is the asymptotics of sparse DAGs, strongly connected graphs, and, following [7], digraphs phase transition.

Bibliographic remark. The first English version paper we found containing the elegant expression for the generating function of strongly connected digraphs recalled in Corollary 3.5 is [12]. It points to an earlier publication [11] in Russian, which contains the proof. Sadly, the authors were not aware of the existence of the general method described in [14, 17] during the writing of the current paper.

Acknowledgements. We would like to thank Cyril Banderier for pointing out the reference [12], and Vlady Ravelomanana for introducing us to the topic and for many fruitful discussions.

References

[1] Bergeron F., Labelle G. and Leroux P., and tree-like structures, Cambridge Uni- versity Press 67 (1998). [2] Flajolet P. and Sedgewick R., Analytic Combinatorics, Cambridge University Press (2009).

[3] Gessel I.M., Enumerative applications of a decomposition for graphs and digraphs, Discrete Math. 139(1) (1995), 257–271.

[4] Gessel I.M., Counting acyclic digraphs by sources and sinks, Discrete Math. 160(1–3) (1996), 253–258. [5] Gessel I.M. and Sagan B.E., The Tutte polynomial of a graph, depth-first search, and simplicial complex partitions, Electron. J. Comb. 3(2) (1996), R9.

6 [6] Goldschmidt C. and Stephenson R., The scaling limit of a critical random directed graph, arXiv preprint arXiv:1905.05397 (2019).

[7] Janson S., Knuth D.E., L uczak T., and Pittel B., The Birth of the Giant Component, Random Struct. Algor. 4(3) (1993), 233–358. [8] Liskovets V.A., Лисковец Валерий Анисимович. Подсчет корневых инициально связных ориентированных графов, Известия АН БССР 5 (1969), 23–32. [Enumeration of rooted initially connected oriented graphs, Izv. Akad. Nauk BSSR] [9] Liskovets V.A., Лисковец Валерий Анисимович. Об одном рекуррентном методе подсчета графов с отмеченными вершинами, Доклады Академии наук 184(6) (1969), 1284–1287 [On one recurrent method of counting graphs with marked vertices, DAN]. [10] Liskovets V.A., The number of strongly connected directed graphs, Math. notes of the Academy of Sciences of the USSR 8(6) (1970), 877–882. [11] Liskovets V.A., Лисковец Валерий Анисимович. К перечислению сильно связных ориентированных графов., ДАН БССР 17 (1973), 1077–1080. [A contribution to the enumeration of strongly connected digraphs, Dokl. Akad. Nauk BSSR]

[12] Liskovets V.A., Some easily derivable integer sequences, J. Integer Seq. 3(2) (2000). [13] L uczak T. and Seierstad T.G., The critical behavior of random digraphs, Random Struct. Algor. 35(3) (2009), 271–293. [14] Robinson R.W., Counting labeled acyclic digraphs, New Directions in the Theory of Graphs, Proc. Third Ann Arbor Conf., Univ. Michigan, Ann Arbor, Mich. (1973), 239–273. [15] Robinson R.W., Counting unlabeled acyclic digraphs, Combinatorial Math. V (1977), 28–43.

[16] Robinson R.W., Counting strong digraphs, J. Graph Theory 1(2) (1977), 189–190. [17] Robinson R.W., Counting digraphs with restrictions on the strong components, Combinatorics and Graph Theory, Proc. of the Summer School and Conf. 1 (1995), 343–354. [18] Stanley R.P., Acyclic orientations of graphs, Discrete Math. 5(2) (1973), 171–178. [19] Wright E.M., The number of strong digraphs, B. Lond. Math. Soc. 3(3) (1971), 348–350.

7