Enumeration of bipartite graphs and bipartite blocks

Using the theory of combinatorial species, we compute the cycle index for bipartite graphs, which we use to count unlabeled bipartite graphs and bipartite blocks.


Introduction
A bicolored graph is a graph of which each vertex has been assigned one of two colors so that each edge connects vertices of different colors. A bipartite graph is a graph that admits such a coloring. Given j white and k black vertices, there are 2 jk ways to join vertices of different colors. Thus the number of (labeled) bicolored graphs on n vertices is Bipartite graphs are not so easy to count directly. Every connected bicolored graph has exactly two colorings in white and black, so we can count bipartite graphs by relating them to connected bipartite graphs. To do this, we use the exponential formula [17, section 5.1], which implies that if f (x) = ∞ n=1 f n x n /n! is the exponential generating function for a class C of (labeled) connected graphs then e f (x) is the exponential generating function for graphs all of whose connected components belong to C. Conversely, if we know the exponential generating function g(x) for graphs all of whose connected components belong to C, then the exponential generating function for C is log g (x).
It follows that with B(x) = ∞ n=0 b n x n /n!, where b n is given by equation (1), the exponential generating function for connected bicolored graphs is log B(x), the exponential generating function for connected bipartite graphs is 1 2 log B(x), and the exponential generating function for bipartite graphs is e log B(x)/2 = B(x). Just as arbitrary graphs may be decomposed into their connected components, arbitrary connected graphs may be decomposed into "blocks"-maximal 2-connected (or "nonseparable") subgraphs. Techniques developed by Ford and Uhlenbeck [6] were applied by Harary and Robinson [11] to show that the exponential generating function N (x) for labeled 2-connected bipartite graphs is related to the exponential generating function P (x) = 1 2 log B(x) for connected bipartite graphs by the equation log P ′ (x) = N ′ (xP ′ (x)). This equation suffices to compute the number of labeled bipartite blocks on n vertices and their asymptotics.
To count unlabeled bipartite graphs we can take a similar approach. It is not too difficult to find the generating function for bicolored graphs from first principles, in a way that is very similar to counting unlabeled graphs (see, e.g., [9]). There is an analogue of the exponential formula for unlabeled graphs (see, for example, [8, equation (3.1.1)], [1, p. 46, equation (20b) and p. 55, equation (60 ii)], and [5, p. 29, equation (25) and p. 89, theorem I.5]) so we can easily relate the generating function for all bicolored graphs to that for connected bicolored graphs and the generating function for connected bipartite graphs to that for all bipartite graphs. The difficult step is relating connected bicolored graphs to connected bipartite graphs: some unlabeled connected bipartite graphs can be bicolored in two different ways, and some in only one way, as shown in Figure 1.
(a) A connected bipartite graph with two distinct bicolorings, one of which is shown (b) A connected bipartite graph with just one distinct bicoloring Figure 1: Some connected unlabeled bipartite graphs have two distinct bicolorings, but some have only one So instead of simply dividing the number of connected bicolored graphs by 2, as in the labeled case, we must do something more complicated. To deal with this problem, we consider the two-element group S 2 acting on bicolored graphs by interchanging the colors. We want to count orbits of this group acting on connected bicolored graphs. To do this using Burnside's lemma, we would need to know the number of connected bicolored graphs fixed by each of the elements of S 2 . This is not so easy to compute directly; however, it is not hard to compute the corresponding information for the action of S 2 on all bicolored graphs, and by using an extension of the "unlabeled exponential formula" we can transfer this information to connected bicolored graphs. Formulas for generating functions for unlabeled bipartite graphs are given in Section 3.4.
In addition to counting unlabeled bipartite graphs, which were counted earlier by Harary and Prins [10] and by Hanlon [7], we wish to count unlabeled blocks, which have not been previously counted. To accomplish this, we need more than just an enumeration of unlabeled bipartite graphs; we need to compute the cycle index for connected bipartite graphs, a power series in infinitely many variables that generalizes both the labeled and unlabeled enumeration. From the cycle index for connected bipartite graphs, we can use methods developed by Robinson [15] and simplified by Bergeron, Labelle, and Leroux [1, section 4.2] to count unlabeled bipartite blocks.
To compute the cycle index for connected bipartite graphs we use Henderson's [12] extension of Joyal's theory of combinatorial species [1], which allows us to take account of the S 2 -action on bicolored graphs. Our Theorem 3.8 gives a formula for the species of bipartite blocks, from which the cycle index for bipartite blocks, and then the ordinary generating function for unlabeled bipartite graphs can be computed.
At the end of their paper on counting labeled bipartite blocks [11], Harary and Robinson stated, "It is planned to present the counting of unlabeled bipartite blocks in a later communication. Although this is far more difficult than the above labeled enumeration, the cycle index sum methods of [15] can be modified appropriately." However, this later communication does not seem to have appeared.
The number of unlabeled bipartite blocks with n vertices for n ≤ 24 is given in Table 1. (Colbourn and Huybrechts [3] computed the number of bipartite blocks with at most 14 vertices by generating all connected bipartite graphs and counting those which are 2-connected. ) We would like to thank an anonymous referee for suggestions that improved the presentation of this paper.

Introduction
André Joyal [13] introduced the notion of "species of structures", which places the idea of a "class of labeled objects" (e.g., trees or permutations) in a categorical setting. A species is a functor from the category FinBij of finite sets with bijections to the category FinSet of finite sets with set maps 1 . We write F [A] for the image of the set A under the species F ; for example, if F is the species of bipartite graphs then F [A] is the set of bipartite graphs whose vertices are the elements of the set A. We refer the reader to Bergeron, Labelle, and Leroux [1, §1.2] for details; we give here only a brief summary of the facts that we will need from the theory of species.
If F is a species, then for any bijection σ : Classical enumerative methods frequently use the algebra of generating functions, which record the number of structures of a given size as the coefficients of a formal power series. To achieve the same goal in species-theoretic analysis, we define an analogous algebraic object which records information related to the action of the permutation groups. This object is the "cycle index" of the species, a symmetric function defined in terms of the power sum symmetric functions p i = j x i j . (In some accounts of the theory the p i are taken simply as independent indeterminates.) Definition 2.1. For a species F , we define its cycle index series to be the symmetric function where fix(F [σ]) := |{s ∈ F [n] : F [σ](s) = s}|, σ i is the number of i-cycles of σ, and p σ = p σ1 1 p σ2 2 . . . . It is easy to see 2 that fix(F [σ]) depends only on the cycle type of σ. The cycle types of permutations σ ∈ S n are in natural bijective correspondence with integer partitions λ ⊢ n (that is, weakly decreasing sequences (λ 1 , λ 2 , . . .) such that i λ i = n), and the number of permutations in S n of cycle type λ is n!/z λ , where if λ has l i parts equal to i for each i, then z λ is 1 l1 l 1 ! 2 l2 l 2 ! · · · . Thus the contribution to the inner sum in (2) from permutations of cycle type λ is (n!/z λ ) fix(F [λ]), where fix(F [λ]) = fix F ([σ]) for any permutation σ of cycle type λ, and we may write the sum over permutations in equation (2) as a sum over partitions: where p λ = p λ1 p λ2 · · · . The cycle index series Z F of the species F captures enough of its structure that we may recover from it both labeled and unlabeled enumerations, though we are concerned here only with unlabeled enumeration, which is given by the following formula: The algebra of cycle indices directly mirrors the combinatorial calculus of species. Addition, multiplication, and composition of species have natural combinatorial interpretations and correspond directly to addition, multiplication, and plethystic composition of their associated cycle indices. This last operation is of particular importance: Definition 2.3. For two species F and G with G[∅] = ∅, we define their composition to be the species In other words, the composition F • G is the species of F -structures of collections of G-structures. Definition 2.4. Let f and g be cycle indices. Then the plethysm f • g is the cycle index where f (a, b, . . .) denotes the cycle index f with a substituted for p 1 , b substituted for p 2 , and so on. This is the same as the definition of plethysm of symmetric functions (see, e.g., Stanley [17, p. 447]). Plethysm of cycle indices then corresponds exactly to species composition: where • in the right-hand side is as in equation (5).
Many combinatorial structures admit natural descriptions as compositions of species. For example, every graph admits a unique decomposition as a (possibly empty) set of (nonempty) connected graphs, so we have the species identity G = E • G C where E is the species of sets, G the species of graphs, and G C is the species of connected graphs.
The theory of species may be extended to virtual species, which are formal differences of species. All of the operations for species that we have discussed extend in a straightforward way to virtual species. We refer the reader to [1, §2.5] for details. In particular, two virtual species F and G are compositional inverses

Γ-species and quotient species
Burnside's lemma (also known as the Cauchy-Frobenius lemma) is a powerful enumerative tool for counting orbits under a group action. In this section we prove an analogous result for species. Definition 2.6. For Γ a finite group, a Γ-species F is a combinatorial species F together with an action of Γ on F -structures which commutes with isomorphisms of those structures.
For a motivating example, consider the species kCG of k-colored graphs; the action of S k on the colors commutes with relabelings of graphs, so kCG is a S k -species with respect to this action.
From a Γ-species, we can construct a quotient under the action of Γ: For F a Γ-species, define F /Γ, the quotient species of F under the action of Γ, to be the species of Γ-orbits of F -structures.
A brief exposition of quotient species may be found in [1, §3.6], and a more thorough exposition in [2]. Just as with classical species, we may associate a cycle index to a Γ-species, following Henderson [12].
with p σ as in equation (2).
We will call such an object (formally a map from Γ to the ring Q[[p 1 , p 2 , . . .]] of symmetric functions with rational coefficients in the p-basis) a Γ-cycle index even when it is not explicitly the Γ-cycle index of a Γ-species. So the coefficients in the power series count the fixed points of the combined action of a permutation and the group element γ. Note that, in particular, the classical ("ordinary") cycle index may be recovered as Z F = Z Γ F (e) for any Γ-species F .
The algebraic relationships between ordinary species and their cycle indices generally extend to the Γspecies context. The actions on cycle indices of Γ-species addition and multiplication are exactly as in the ordinary species case considered Γ-componentwise. The action of composition, which in ordinary species corresponds to plethysm of cycle indices, can also be extended: Definition 2.9. For two Γ-species F and G, define their composition to be the Γ-species F •G with structures given by where P (A) is the set of partitions of A and where γ ∈ Γ acts on a (F • G)-structure by acting on the F -structure and the G-structures independently.
A formula similar to that of Theorem 2.5 requires a definition of the plethysm of Γ-symmetric functions, here taken from Henderson [12, §3].
This definition of Γ-cycle index plethysm is then indeed the correct operation to pair with the composition of Γ-species: Recall from equation (2) that, to compute the cycle index of a species, we need to enumerate the fixed points of each σ ∈ S n . To count fixed points in the quotient species F /Γ we need to count the fixed Γ-orbits of σ in F under commuting actions of S n and Γ (that is, under an (S n × Γ)-action). This may be accomplished by the following generalization of Burnside's lemma [16].
We will use the notation Z Γ F for 1 |Γ| γ∈Γ Z Γ F (γ). When Γ is a symmetric group S n , as in our applications, we may represent the Γ-cycle index as a symmetric function in two sets of variables which is homogeneous of degree n in the second set of variables; with this approach, Γ-cycle index plethysm corresponds to the operation of "inner plethysm in y" studied by Travis [19].

Introduction
Definition 3.1. A bicolored graph is a graph, each vertex of which has been assigned one of two colors (here, black and white) such that each edge connects vertices of different colors. A bipartite graph (sometimes called bicolorable) is a graph which admits such a coloring.
There is an extensive literature about bicolored and bipartite graphs, including enumerative results for bicolored graphs [9], bipartite graphs both allowing [7] and prohibiting [10] isolated points, and bipartite blocks [11]. However, the enumeration of bipartite blocks has been accomplished previously only in the labeled case. By considering the problem in light of the theory of Γ-species, we develop a more systematic understanding of the structural relationships between these various classes of graphs, which allows us, in particular, to enumerate all of them in their unlabeled forms.
Throughout this chapter, we denote by BC the species of bicolored graphs and by BP the species of bipartite graphs. The prefix C will indicate the connected analogue of such a species, so CBP is the species of connected bipartite graphs.
We are motivated by the graph-theoretic fact that each connected bipartite graph has exactly two bicolorings, and may be identified with an orbit of connected bicolored graphs under the action of S 2 where the nontrivial element τ reverses all vertex colors. We will hereafter treat all the various species of bicolored graphs as S 2 -species with respect to this action and use the theory developed in Section 2.2 to pass to bipartite graphs.

Bicolored graphs
We begin our investigation by directly computing the S 2 -cycle index for the species BC of bicolored graphs with the color-reversing S 2 -action described previously. We will then use various methods from the species algebra of Section 2 to pass to other related species. To compute the S 2 -cycle index Z S2 BC we compute separately Z S2 BC (e) and Z S2 BC (τ ).

Computing Z S2
BC (e) For each n > 0 and each permutation π ∈ S n , we must count bicolored graphs on [n] for which π is a color-preserving automorphism. To simplify some future calculations, we omit empty graphs and define BC[∅] = ∅. We note that the number of such graphs in fact depends only on the cycle type λ ⊢ n of the permutation π, so we can use the cycle index formula in equation (3) interpreted as a Γ-cycle index identity.
Fix some n ≥ 0 and let λ ⊢ n. We wish to count bicolored graphs for which a chosen permutation π of cycle type λ is a color-preserving automorphism. Each cycle of the permutation must correspond to a monochromatic subset of the vertices, so we may construct graphs by drawing bicolored edges into a given colored vertex set. If we draw some particular bicolored edge, we must also draw every other edge in its orbit under π if π is to be an automorphism of the graph. Moreover, every bicolored graph for which π is an automorphism may be constructed in this way. Therefore, we direct our attention first to counting these edge orbits for a fixed coloring; we will then count colorings with respect to these results to get our total cycle index.
Consider an edge connecting two cycles of lengths m and n; the length of its orbit under the permutation is lcm(m, n), so the number of such orbits of edges between these two cycles is mn/ lcm(m, n) = gcd(m, n). For an example in the case m = 4, n = 2, see Figure 2. The number of orbits for a fixed coloring is then gcd(m, n) where the sum is over the multisets of all cycle lengths m of white cycles and n of black cycles in the permutation π. We may then construct any possible graph fixed by our permutation by making a choice of a subset of these cycles to fill with edges, so the total number of such graphs is 2 gcd(m,n) for a fixed coloring. We now turn our attention to the possible colorings of the graph which are compatible with a permutation of specified cycle type λ. We split our partition into two subpartitions, writing λ = µ ∪ ν, where partitions are treated as multisets and ∪ is the multiset union, and µ corresponds to the white cycles and ν the black. Then the total number of graphs fixed by such a permutation with a specified decomposition is where the product is over the elements of µ and λ taken as multisets. Suppose that the multiplicities of the part i in the partitions λ, µ, and ν are l i , m i , and n i , respectively. Then the l i i-cycles of a permutation of cycle type λ can be colored so that m i are white and n i are black in l i !/(m i ! n i !) ways. So in all there are colorings associated with µ and ν, and Thus we obtain a formula for Z S2 BC (e). Theorem 3.2. Let BC denote the S 2 -species of bicolored graphs with the color-switching action of S 2 . Then the element of the S 2 -cycle index Z S2 BC associated to e is given by Explicit formulas for the generating function for unlabeled bicolored graphs were obtained by Harary [9] using conventional Pólya-theoretic methods. Conceptually, our enumeration largely mirrors his. Harary uses the classical cycle index of the line group 3 of the complete bicolored graph of which any given bicolored graph is a spanning subgraph. He then enumerates orbits of edges under these groups using the Pólya enumeration theorem.

Calculating Z S2
BC (τ ) Recall that the nontrivial element of τ ∈ S 2 acts on bicolored graphs by reversing all colors.
We again consider the cycles in the vertex set [n] induced by a permutation π ∈ S n and use the partition λ corresponding to the cycle type of π for bookkeeping. We then wish to count bicolored graphs on [n] for which τ · π is an automorphism, which is to say that π itself is a color-reversing automorphism. The number of bicolored graphs for which π is a color-reversing automorphism depends only on the cycle type λ. Each cycle of vertices must be color-alternating and hence of even length, so the partition λ must have only even parts. Once this condition is satisfied, edges may be drawn either within a single cycle or between two cycles, and as before if we draw in any edge we must draw in its entire orbit under π (since π is to be an automorphism of the underlying graph). Moreover, all graphs for which π is a color-reversing automorphism with a fixed coloring may be constructed in this way, so it suffices to count such edge orbits and then consider how colorings may be assigned.
We first determine the number of orbits of edges within a cycle of length 2n; we hereafter describe such a cycle as having semilength n. There are exactly n 2 possible white-black edges in such a cycle. If n is even, then every edge lies in an orbit of size 2n, so there are n 2 /(2n) = n/2 orbits of edges. If n is odd, there are n edges joining diametrically opposed vertices, which have oppositive colors. These n edges are all in the same orbit. (See Figure 3a for an illustration of these edges.) The remaining n 2 − n edges are in orbits of size 2n, so there are (n 2 − n)/(2n) = (n − 1)/2 of these orbits. (See Figure 3b for an illustration of these edges.) Thus the total number of orbits for n odd is (n + 1)/2. In either case, the number of orbits is ⌈n/2⌉.  All together, then, the number of orbits for a fixed coloring of a permutation of cycle type 2λ (the partition obtained by doubling every part of λ) is i ⌈λ i /2⌉ + i<j gcd(λ i , λ j ). All valid bicolored graphs for a fixed coloring for which π is a color-preserving automorphism may be obtained uniquely by making some choice of a subset of this collection of orbits, just as in Section 3.2.1. Thus, the total number of possible graphs for a given vertex coloring is independent of the choice of coloring. For a partition 2λ with l(λ) cycles, there are then 2 l(λ) colorings compatible with our requirement that each cycle is color-alternating, which we multiply by (13) to obtain the total number of graphs for all permutations π with cycle type 2λ. Thus, we obtain a formula for Z S2 BC (τ ): Theorem 3.3. Let BC denote the S 2 -species of bicolored graphs with the color-switching action of S 2 . Then the element of the S 2 -cycle index Z S2 BC associated to τ is given by

Connected bicolored graphs
As noted in the introduction to this section, to pass from bicolored graphs to bipartite graphs by taking a quotient under the color-reversing action of S 2 , we must work in the connected case. Thus, we must first pass from the S 2 -species BC of bicolored graphs to the S 2 -species CBC of connected bicolored graphs. Every graph may be decomposed uniquely into (and thus species-theoretically identified with) the set of its connected components. Thus, at the species level, we have that where BC is the species of nonempty bicolored graphs, CBC is the species of nonempty connected bicolored graphs, and E + = E − 1 is the species of nonempty sets.
Reversing the colors of a bicolored graph is done simply by reversing the colors of each of its connected components independently; this action has no effect on the structure of the collection of these components. We may extend E + to an S 2 -species by applying the trivial action; then equation (15) may be interpreted as an isomorphism of S 2 -species.
To use the decomposition in equation (15) to derive the S 2 -cycle index for CBC, we must invert the S 2 -species composition into E + . We write Ω := (E + ) −1 to denote the virtual species that is the inverse of E + with respect to composition of species, following the notation of [14]; we also let Ω denote the virtual S 2 -species which is the compositional inverse of the S 2 -species E + with the trivial action.
We can derive from [1, §2.5, equation (58c)] a formula for the cycle index Z Ω of this virtual species. It is then straightforward to show (by consideration of equation (8)) that each term of Z S2 Ω is equal to Z Ω . Thus, we have that for each γ ∈ S 2 , where µ is the integer Möbius function. (This cycle index series is sometimes known as the "combinatorial logarithm".) We can then rewrite equation (15) as Translating equation (17) then gives us a formula for the S 2 -cycle index of CBC.

Theorem 3.4.
Let BC denote the S 2 -species of bicolored graphs and CBC the S 2 -species of connected bicolored graphs, both with the color-switching action of S 2 . Additionally, let Z S2 Ω denote the combinatorial logarithm series given in equation (16). Then the S 2 -cycle indices of BC and CBC are related by Note that we could have avoided the use of virtual species by performing the inversion at the level of cycle indices.

Bipartite graphs
As we previously observed, connected bipartite graphs are naturally identified with orbits of connected bicolored graphs under the color-reversing action of S 2 . Thus, CBP = CBC S 2 . By application of Theorem 2.13, we can then directly compute the cycle index of CBP in terms of previous results.
Theorem 3.5. Let CBP denote the species of connected bipartite graphs and CBC the S 2 -species of connected bicolored graphs. Their cycle indices are related by Since a bipartite graph is a set of connected bipartite graphs, we have BP = E • CBP, and this gives the formula for the cycle index for bipartite graphs.
Theorem 3.6 allows us to compute the number of unlabeled bipartite graphs with n vertices. However, we can find a computationally more efficient formula for bipartite graphs using only ordinary generating functions, rather than cycle indices. Specifically, let Then c(x) is the ordinary generating function for connected bipartite graphs and b(x) is the ordinary generating function for bipartite graphs. We have formulas for f e (x) and f τ (x) as sums over partitions, and g e (x) and g τ (x) are related to f e (x) and f τ (x) by which may be inverted to give where µ is the Möbius function. Finally, c(x) = 1 2 (g e (x) + g τ (x)) and b(x) = exp ∞ k=1 c(x k )/k . These calculations are essentially the same as Hanlon's [7], though he does not have our equation (21). Unlabeled bipartite graphs were first counted, using a different approach, by Harary and Prins [10].
In order to count bipartite blocks, which we accomplish in the next section, we do need the entire cycle index.

Nonseparable graphs
We now turn our attention to the notions of block decomposition and nonseparable graphs. A graph is said to be nonseparable if it is vertex-2-connected (that is, if there exists no vertex whose removal disconnects the graph); every connected graph then has a canonical "decomposition" 4 into maximal nonseparable subgraphs, often shortened to blocks. In the spirit of our previous notation, we we will denote by NBP the species of nonseparable bipartite graphs, our object of study.
The basic principles of block enumeration in terms of automorphisms and cycle indices of permutation groups were first identified and exploited by Robinson [15]. In [1, §4.2], a theory relating a species B of nonseparable graphs to the species C B of connected graphs whose blocks are in B is developed using similar principles.
We Theorem 3.7. Let B be a species of nonseparable graphs and let C denote the species of connected graphs whose blocks are in B. Then and It is apparent that the class of nonseparable bipartite graphs is itself exactly the class of blocks that occur in block decompositions of connected bipartite graphs. We can therefore apply Theorem 3.7 to the species BP of bipartite blocks. Theorem 3.8. Let NBP denote the species of 2-connected bipartite graphs ("bipartite blocks"), CBP the species of connected bipartite graphs, X the species of singletons, and Ω the combinatorial logarithm species. Then NBP is determined by where We have already calculated the cycle index for the species CBP, so the calculation of the cycle index of NBP is now simply a matter of algebraic expansion.
A generating function for labeled bipartite blocks was given by Harary and Robinson [11], where their analogue of equation (23) for the labeled exponential generating function for blocks comes from [6]. However, we could locate no corresponding unlabeled enumeration in the literature. The numbers of unlabeled nonseparable bipartite graphs for n ≤ 24 as calculated using our method are given in Table 1, and the Sage code used to compute them is given in Listing 1.

B. Code listing
The functional equation (23) characterizes the cycle index of the species NBP of bipartite blocks. In this section we have used the the computer algebra system Sage [18] to adapt the theory into practical algorithms for computing the actual numbers of such structures. Python/Sage code to compute the coefficients of the ordinary generating function NBP(x) of unlabeled bipartite blocks explicitly follows in Listing 1. 53 # Define the cycle index for BC # First we compute the number of graphs fixed under e by permutations of cycle 55 # types µ and ν in accordance with equation (11).