Sampling Unlabeled Chordal Graphs in
Expected Polynomial Time
Abstract
We design an algorithm that generates an -vertex unlabeled chordal graph uniformly at random in expected polynomial time. Along the way, we develop the following two results: (1) an algorithm for counting and sampling labeled chordal graphs with a given automorphism , parameterized by the number of moved points of , and (2) a proof that the probability that a random -vertex labeled chordal graph has a given automorphism is at most , where is the number of moved points of and is a constant. Our algorithm for sampling unlabeled chordal graphs calls the aforementioned algorithm as a black box with potentially large values of the parameter , but the probability of calling this algorithm with a large value of is exponentially small.
Keywords and phrases:
Chordal graphs, graph sampling, graph counting, unlabeled graphsFunding:
Úrsula Hébert-Johnson: Supported by NSF grant CCF-2147094.Copyright and License:
![[Uncaptioned image]](x1.png)
2012 ACM Subject Classification:
Theory of computation Generating random combinatorial structures ; Theory of computation Graph algorithms analysisAcknowledgements:
We would like to thank Eric Vigoda for discussions that led to a concise proof of an important step in the running time analysis.Editors:
Olaf Beyersdorff, Michał Pilipczuk, Elaine Pimentel, and Nguyễn Kim ThắngSeries and Publisher:

1 Introduction
A graph is chordal if it has no induced cycles of length at least 4. The term was coined by Gavril in 1972 [12], more than fifty years ago, but the notion of chordal graphs in fact goes as far back as 1958 [13]. In the early papers, chordal graphs were referred to by other names, such as triangulated graphs. By now, many structural results have been proved about chordal graphs, and there are many algorithms that take a chordal graph as input. Thus it would be useful to have an efficient algorithm for generating random chordal graphs, both for the practical purpose of software testing, as well as the more mathematical purpose of testing conjectures.
In [14], Hébert-Johnson et al. designed an algorithm that generates -vertex labeled chordal graphs uniformly at random. This algorithm runs in polynomial time, using at most arithmetic operations for the first sample and arithmetic operations for each subsequent sample. However, when discussing the performance of an algorithm that is being tested, the correct output typically does not depend on the labeling of the vertices. If we use a labeled-graph sampling algorithm to generate random test cases, then asymmetric graphs will be given too much weight/probability compared to those that happen to have many automorphisms. This naturally leads to the question of efficiently generating unlabeled chordal graphs uniformly at random. In this paper, we present an algorithm that solves this problem and runs in expected polynomial time.
Theorem 1.
There is a randomized algorithm that given , generates a graph uniformly at random from the set of all unlabeled chordal graphs on vertices. This algorithm uses arithmetic operations in expectation.
It is worth mentioning the difference between the running times for labeled vs. unlabeled chordal graph sampling. The sampling algorithm of Hébert-Johnson et al. generates a random -vertex labeled chordal graph in polynomial time, even in the worst case. However, obtaining a worst-case polynomial-time algorithm for sampling unlabeled chordal graphs – or an expected-polynomial-time counting algorithm for such graphs – appears to be very difficult since these questions remain open even for general graphs. This is relevant because the class of chordal graphs is known to be -complete. While there exist classes of graphs (which we discuss below) for which efficient unlabeled sampling algorithms are known, we are not aware of any -complete graph class with such an algorithm.
Our algorithm for sampling unlabeled chordal graphs builds upon an algorithm of Wormald that generates -vertex unlabeled graphs uniformly at random in expected time [20]. This in turn builds upon a related algorithm by Dixon and Wilf [7] that solves the same problem but assumes that the exact number of -vertex unlabeled graphs has already been computed. In [20], the algorithm of Wormald follows a somewhat similar structure but removes that assumption. As mentioned above, the question of computing the exact number of -vertex unlabeled graphs in expected polynomial time remains open to this day.
It often happens that we wish to sample from a particular graph class (e.g., chordal graphs). For unlabeled trees, there is a uniform sampling algorithm that runs in polynomial time [19]. One can also count the exact number of unlabeled trees on vertices in polynomial time [17, A000055]. On the topic of counting, an algorithm for counting unlabeled -trees is presented in [9], but the running time is not stated. An expected-polynomial-time algorithm for uniform sampling of -connected unlabeled planar graphs was presented by Bodirsky et al. in 2005 [4], followed by the same result for connected unlabeled cubic planar graphs in 2008 [6]. For the class of connected unlabeled bipartite permutation graphs, a uniform sampling algorithm was designed by Saitoh et al. that runs in time [18].
Although extensive research has been done on the topic of labeled graph sampling [5, 8, 10, 11], to the best of our knowledge, the literature on sampling unlabeled graphs from a given graph class is relatively sparse. As is the case for chordal graphs, the corresponding labeled sampling problem tends to be solved first for a given graph class, and then perhaps one can address the problem of efficiently sampling unlabeled graphs from the same graph class.
1.1 Methods
The sampling algorithm of Wormald [20] is based on the fact that unlabeled graphs correspond to orbits of the following group action: the symmetric group acts on the set of labeled graphs by permuting the vertex labels. This correspondence follows from the Frobenius-Burnside lemma. Therefore, to sample a random unlabeled graph, it is enough to sample a random orbit of this group action.
To make this approach work for chordal graphs, we need two ingredients: (1) an algorithm for counting and sampling labeled chordal graphs with a given automorphism , and (2) a proof that the probability that a random -vertex labeled chordal graph has a given automorphism is at most , where is the number of moved points of and is a constant.
For (1), we design an (fixed-parameter tractable) counting algorithm that is parameterized by , the number of moved points of . This algorithm uses arithmetic operations. Using the standard sampling-to-counting reduction of [15], we also obtain a corresponding sampling algorithm with the same running time. Our main algorithm (for sampling unlabeled chordal graphs) calls each of these algorithms as a black box with potentially large values of the parameter . Nevertheless, using the bound from (2), we are able to show that the probability of using a large value of is exponentially small, so the expected running time is not significantly affected.
To design the counting algorithm for (1), we rewrite each of the recurrences from the algorithm of Hébert-Johnson et al., now carrying around information about the automorphism and its moved points. The original algorithm is a dynamic-programming algorithm in which there is a constant number of types of vertices (, , etc.) in each graph that we wish to count. In our updated version, we now keep track of the type of each vertex that is moved by .
To prove the bound for (2), we distinguish between the cases when is small and is large ( is either less than or greater than , where is a constant). When is small, we use the fact that almost every chordal graph is a split graph [1], and we strengthen this by showing that in fact, almost every chordal graph is a balanced split graph. For the case of balanced split graphs, the argument is easy and is similar to the proof of the bound for general graphs [16]. When is large, the argument is more complicated. We observe that the vast majority of -vertex labeled chordal graphs have maximum clique size close to . Along the way, we also use the fact that for every chordal graph , there exists a PEO (perfect elimination ordering) of such that some maximum clique appears at the tail end of that PEO.
2 Preliminaries
Let be the set of natural numbers, not including 0. For , we use the notation . For a graph and vertex subsets , we say sees all of if .
Definition 2.
Let and be finite subsets of such that , where the elements and are listed in increasing order. We define as the bijection that maps to for all .
2.1 Permutations and labeled graphs
For , let denote the group of all permutations of . For a permutation , we define to be the set of points moved by . For , denotes the set of all possible values of for .
Suppose , . We write to denote the image of under . We say is invariant under if for all . For a set that is invariant under , we write to denote the permutation restricted to the domain .
A labeled graph is a pair , where the vertex set is a finite subset of and the edge set is a set of two-element subsets of . For a permutation and a labeled graph such that is invariant under , we say is an automorphism of if for all , and are adjacent if and only if and are adjacent.
2.2 Chordal graphs and related notions
A vertex in a graph is simplicial if its neighborhood is a clique. A perfect elimination ordering (PEO) of a graph is an ordering of the vertices of such that for all , is simplicial in the subgraph induced by the vertices . A graph is chordal if and only if it has a perfect elimination ordering [3]. The following two lemmas are well-known facts about chordal graphs. The proof of the first can be found in [3].
Lemma 3.
Every chordal graph contains a simplicial vertex. If is not a complete graph, then contains two non-adjacent simplicial vertices.
Lemma 4.
A chordal graph on vertices has at most maximal cliques.
Proof.
Let be a maximal clique in , and let be the leftmost vertex of in a given perfect elimination ordering of . We claim that is equal to the closed neighborhood to the right of , i.e., . It is clear that is contained in since has no other neighbors to its right, so we indeed have by maximality of . Therefore, there are at most maximal cliques.
Definition 5.
Let , be two graphs, and suppose is a clique in both and . When we say we glue and together at to obtain , this means is the union of and : the vertex set is , and the edge set is .
As is shown in [14], if and are both chordal, then the resulting graph is chordal.
2.3 Evaporation sequences
Our algorithm for counting the number of labeled chordal graphs with a given automorphism will use the notion of evaporation sequences from [14].
Suppose we are given a chordal graph and a clique . The evaporation sequence of with exception set is defined as follows: If , then the evaporation sequence of is the empty sequence. If , then let be the set of all simplicial vertices in , and let . Suppose is the evaporation sequence of (with exception set ). Then is the evaporation sequence of . As is shown in [14], the fact that is a clique implies that all vertices outside of eventually evaporate, so this is well-defined.
If the evaporation sequence of has length , then we say evaporates at time with exception set , and is called the evaporation time. We define to be the last set in the evaporation sequence of , and we let if the sequence is empty. Similarly, we define the evaporation time of a vertex subset. Suppose has evaporation sequence with exception set , and suppose is a nonempty vertex subset. Let be the largest index such that . We say evaporates at time in with exception set .
3 Sampling unlabeled chordal graphs
In [20], Wormald presented an algorithm that generates an -vertex unlabeled graph uniformly at random in expected time . In this paper, we achieve a similar result for chordal graphs:
See 1
The sampling algorithm of Wormald makes use of the fact that unlabeled graphs correspond to orbits of a particular group action. Since our algorithm will follow a similar outline, we begin by discussing some of the ideas behind the algorithm of Wormald.
Suppose we have been given as input, and let be the set of all labeled graphs with vertex set . The symmetric group acts on in the following way: For each and , is the graph that results from permuting the vertex labels of according to . The orbits of under the action of are the isomorphism classes of labeled graphs, each of which corresponds to an unlabeled graph. Let
Suppose we fix an -vertex unlabeled graph , and let the corresponding isomorphism class of labeled graphs be . As is shown in [20], the number of pairs such that is equal to . This follows from the Frobenius-Burnside lemma. Therefore, if we sample a random pair uniformly at random, and then we forget the labels on the graph , this amounts to sampling an -vertex unlabeled graph uniformly at random.
In the case of chordal graphs, the same statements hold true. Let be the set of all labeled chordal graphs with vertex set . The symmetric group acts on in the same way as above, by permuting the vertex labels. The set of orbits of this group action corresponds to the set of unlabeled chordal graphs. Let
Let be an unlabeled chordal graph, and let be the corresponding isomorphism class of labeled graphs. Applying the Frobenius-Burnside lemma to the orbit corresponding to shows that the number of pairs such that is equal to .
In [20], Wormald describes an algorithm for sampling a random pair in order to sample a random unlabeled graph. The same outline can be used to sample a random pair . However, there are two key points where some difficulty arises. First of all, in one of the steps of the algorithm that samples from , it is necessary to count the number of -vertex labeled graphs with a given automorphism (and sample from the set of such graphs). This is easy to do for general graphs but becomes more complicated for chordal graphs (see Section 4). Second, the algorithm of Wormald uses the fact that the number of labeled graphs with a given automorphism is at most , where is the number of moved points of . To transform this into an algorithm for sampling unlabeled chordal graphs, it is necessary to prove similar bounds on the number of labeled chordal graphs with a given automorphism. These will be the bounds in our algorithm.
3.1 Algorithm for sampling unlabeled chordal graphs
Let stand for the counting algorithm in [14] that computes the number of -vertex labeled chordal graphs. In the full version of the paper, we prove the following two theorems.
Theorem 6.
There is a deterministic algorithm that given and , computes the number of labeled chordal graphs with vertex set for which is an automorphism. This algorithm uses arithmetic operations, where .
Theorem 7.
There is a randomized algorithm that given and , generates a graph uniformly at random from the set of all labeled chordal graphs with vertex set for which is an automorphism. This algorithm uses arithmetic operations, where .
See Section 4 for the details of the counting algorithm of Theorem 6 along with some intuition behind the proof of correctness. In our algorithm for sampling unlabeled chordal graphs, stands for the algorithm of Theorem 6 and stands for the algorithm of Theorem 7.
Recall that . For , let be the set of permutations with exactly moved points. For , let denote the set of -vertex labeled chordal graphs such that is an automorphism of . To follow the same approach as the algorithm of Wormald, for each , we need an upper bound that satisfies for all . Let be the number of -vertex labeled chordal graphs, which is exactly equal to . For , let
(1) |
and for , let
(2) |
where . In Section 3.2, we will prove that we indeed have for all , when is sufficiently large. Let .
Our algorithm for sampling a random -vertex unlabeled chordal graph is given in Algorithm 1. The general idea is as follows. For , let . We choose such that the probability of each value of is , which is approximately equal to . (We do not know how to efficiently compute the exact value of since we do not know the exact number of unlabeled chordal graphs.) Since is not exactly equal to , we adjust for this by restarting with a certain probability in Step 11. We then proceed to select a random pair , and we output the graph without labels.
Step 10 can easily be implemented in time in the following way. If , let . For , we can repeatedly choose a random permutation of until we obtain a derangement. The expected number of trials for this is a constant (see [20]).
In Step 11, to compute , we observe that and for . Here is the number of derangements of . We compute using the formula for , which can be derived using the inclusion-exclusion principle.
3.2 Correctness of Algorithm 1
The correctness of and is proved in the full version of the paper.
We need to show that the output graph is chosen uniformly at random. One “iteration” refers to one run of Steps 9 to 11 or 9 to 14. In a given iteration, we say the pair was “chosen” if was chosen from and was chosen by . We claim that for all , in any given iteration, the probability that is chosen is . Indeed, this probability is equal to
where , since the probability of choosing in Step 12 is . Therefore, we output all -vertex unlabeled chordal graphs with equal probability.
Next, we need to show that for all to verify that the probability in Step 11 is at most 1. When this is an equality, so suppose . Clearly , so we just need to prove that the number of -vertex labeled chordal graphs with automorphism is at most for all with moved points.
In the case when is defined according to Equation 2, this follows from Theorem 8. The proof this theorem can be found in the full version of the paper. (The bound in Theorem 8 is in fact true for all values of – the reason why we define differently for smaller values of will become clear when we discuss the running time in Section 3.3.)
Theorem 8.
Let , , and let . The number of labeled chordal graphs with vertex set for which is an automorphism is at most
where .
For the other case, suppose , and suppose is a permutation with moved points. We need to show that the number of -vertex labeled chordal graphs with automorphism is at most . We begin by reducing to the case of split graphs. A split graph is a graph whose vertex set can be partitioned into a clique and an independent set, with arbitrary edges between the two parts. It is easy to see that every split graph is chordal. Furthermore, the following result by Bender et al. [1] shows that a random -vertex labeled chordal graph is a split graph with probability .
Proposition 9 (Bender et al. [1]).
If , is sufficiently large, and is a random -vertex labeled chordal graph, then
Applying this proposition with tells us that the number of -vertex labeled chordal graphs that are not split is at most . To bound the number of -vertex labeled split graphs with automorphism , we consider two cases: balanced split graphs and unbalanced split graphs. We say a partition of the vertex set of a split graph is a split partition if it partitions into a clique and an independent set; i.e., a split partition is a partition that demonstrates that is split. We denote a split partition that consists of the clique and the independent set by the ordered pair . We say an -vertex split graph is balanced if and for every split partition of . It is easy to bound the number of unbalanced split graph as follows.
Lemma 10.
The number of labeled split graphs on vertices that are not balanced is at most .
Proof.
Suppose is a partition of into two parts such that or . The number of labeled split graphs with this particular split partition is at most . Therefore, the number of unbalanced labeled split graphs on vertices is at most since there are at most possible partitions.
The following lemma will be useful for bounding the number of balanced split graphs.
Lemma 11.
Let , and let be an -vertex labeled split graph. If is an automorphism of , then there exists a split partition of such that and are invariant under .
Proof.
Let be the set of vertices that belong to the clique in every split partition of , let be the set of vertices that belong to the independent set in every split partition of , and let . By Observation 7.3 in [14], every vertex in is adjacent to every vertex in and is non-adjacent to every vertex in . By Lemma 7.4 in [14], is either a clique or an independent set. Suppose is an automorphism of . If is a clique, then the split partition has the desired property. If is an independent set, then the split partition has the desired property.
Lemma 12.
Let , and suppose . The number of balanced labeled split graphs on vertices such that is an automorphism of is at most
Proof.
Suppose is a partition of into two parts. Let and . The number of labeled split graphs with this particular split partition is . Therefore, the number of labeled split graphs with automorphism for which has the property from Lemma 11 is at most . Let be the number of such graphs. Whenever two vertices (resp. ) belong to the same cycle in the cycle decomposition of , and must have the same relationship as each other to each of the vertices in (resp. ). Therefore, we in fact have an upper bound of on , since has at least two moved points. If and , then we have .
By Lemma 11, every balanced labeled split graph on vertices with automorphism has a split partition such that and are invariant under . Furthermore, this split partition is balanced (i.e., both parts have size at least ). Therefore, the number of balanced labeled split graphs on vertices with automorphism is at most
since the number of partitions with is certainly at most .
Putting together Propositions 9, 10, and 12, we can see that
is an upper bound on when is sufficiently large.
Let be the cutoff such that this works for . To be precise, when implementing this algorithm, we would solve the problem by brute force if (by generating all possible -vertex chordal graphs and then selecting one at random), and we would run Algorithm 1 as written if .
3.3 Running time of Algorithm 1
The running time of Steps 1-6 is arithmetic operations since that is the running time of . In this section, we will show that the rest of the algorithm uses only arithmetic operations in expectation.
If we choose in Step 9 of Algorithm 1, then the algorithm is guaranteed to terminate in that iteration. Thus the expected number of iterations is at most . Let be the expected running time of Algorithm 1 after completing Step 6 (this is where we choose at random and the loop begins). In Lemma 13, we show that is at most the product of and the expected running time of one iteration.
Let be the number of iterations of Algorithm 1, and let be the time spent in iteration for each . We have .
Lemma 13.
We have .
Proof.
Clearly is finite since the expected number of iterations is finite and the procedures and have worst-case running time bounds. Therefore, we can solve for in the following way.
The steps that we run in one iteration (Steps 9-14) do not depend on – they are always the same, regardless of how many iterations have happened so far. Thus we have , which implies . Therefore, we have
For , let be an upper bound on the time it takes to run one iteration, assuming we have chosen this particular value of in Step 9. By the running time of and , we can assume . We have
To prove a bound on , we will start by proving a bound on for all . Since , it is sufficient to prove a bound on for all . The following lemma gives us a lower bound on .
Lemma 14.
For , the number of -vertex labeled chordal graphs is at least
Proof.
It is enough to just consider -vertex labeled split graphs with a split partition such that . Since for , the number of such graphs is at least
We divide by in the first expression since each split graph can have up to distinct split partitions in which is of a given size [2].
Lemma 15.
Suppose . If , then
Proof.
Let , , and be the three terms that are added together in Equation 1, in order, so that . We have
and we claim that this is at most . Since , it is sufficient to show , which is true when .
For the next term, by Lemma 14 we have
To see that this is at most , it is sufficient to show since . This is indeed true for .
For the third term, by Lemma 14 we have
To see that this is at most , it is sufficient to show , which is true when . Adding together these three terms, we obtain .
Lemma 16.
For sufficiently large , if , then
Proof.
Lemma 14 implies for , so we have
where . We claim that this expression is at most . Since , it is sufficient to show . When is sufficiently large,111This holds for . we have . Since , this implies
(3) |
When is sufficiently large,222This holds for . we also have . Since , this implies
(4) |
Multiplying Equations 3 and 4 gives us the desired bound of .
By Lemmas 15 and 16, the above summation for is at most since is certainly at most . For an iteration in which we have chosen , when counting and sampling -vertex labeled chordal graphs with automorphism , we can simply run the counting and sampling algorithms of [14], rather than passing in as an input. Thus the expected running time of one iteration is at most arithmetic operations. Lemmas 15 and 16 also immediately give us a bound on , since we have
Therefore, by Lemma 13, the overall running time is at most arithmetic operations in expectation.
4 Counting labeled chordal graphs with a given automorphism
In this section, we describe the algorithm for , which counts the number of labeled chordal graphs with a given automorphism. In the full version of the paper, we prove correctness, analyze the running time, and derive the corresponding sampling algorithm (Theorem 7).
See 6
There is a known dynamic-programming algorithm for computing the number -vertex labeled chordal graphs that uses arithmetic operations, if we do not require the graphs to have a particular automorphism [14]. Our algorithm is closely based on that one, but we add more arguments and more details to each of the recurrences to keep track of the behavior of the automorphism. As was done in [14], we evaluate the recurrences top-down using memoization.
4.1 Reducing from counting chordal graphs to counting connected chordal graphs
For , let denote the number of labeled chordal graphs with vertex set , and let denote the number of connected labeled chordal graphs with vertex set . The algorithm of [14] begins by reducing from counting chordal graphs to counting connected chordal graphs via the following recurrence, which appears as Lemma 3.13 in [14]. (We omit the “-colorable” requirement since we will not need that here.)
Lemma 17 ([14]).
The number of labeled chordal graphs with vertex set is given by
for all .
Here stands for the number of vertices in the connected component that contains the label 1. The remaining connected components have a total of vertices. Since this recurrence is relatively simple, most of the difficulty in the algorithm of [14] lies in the recurrences for counting connected chordal graphs. However, when counting graphs with a given automorphism, the step of reducing to connected graphs is already quite a bit more involved.
Suppose we are given and as input. From now on, whenever we refer to or , we mean these particular values from the input.
We will first define and , which are variations of and that only count graphs for which is an automorphism (see Definition 18). Here stands for to the power , i.e., the permutation that arises from applying a total of times. The reason for raising to a power will be apparent in the recurrence for . In the initial, highest-level recursive call, we will have and thus .
In [14], when counting the number of possibilities for a subgraph of size (for example, a connected component), the authors essentially relabel that subgraph to have vertex set , so that one can count the number of possibilities using, for example, . In our algorithm, we want to relabel the vertices of each subgraph in a similar way. However, this time, we do not relabel the vertices that are moved by . This ensures that the automorphism in each later recursive call will still be , or a permutation closely related to .
As a consequence, the vertex sets of the subgraphs that we wish to count become slightly more complicated. For example, suppose we wish to count the number of possibilities for a 5-vertex subgraph that originally contains the moved vertices . Since we do not relabel the moved vertices, the resulting vertex set after relabeling is rather than . More formally, suppose we have been given and , where . Let be the set of the first natural numbers in . We define . For example, if and , then . Intuitively, is the label set of size whose intersection with is and that otherwise contains labels that are as small as possible.
For and , recall that is invariant under if for all . For , we write to indicate that and is invariant under . Intuitively, is a subset of that respects the cycles of by taking all or nothing of each cycle.
Definition 18.
Suppose and suppose , where . Let (resp. ) denote the number of labeled chordal graphs (resp. connected labeled chordal graphs) with vertex set for which is an automorphism.
Our algorithm returns . This is precisely the number of labeled chordal graphs with vertex set and automorphism since .
Suppose we have been given fixed values of the arguments of . Let be the smallest label in the vertex set . For , let be the family of sets such that and such that the following condition holds: if , then , and otherwise, . This last condition will ensure that belongs to the connected component of size in the recurrence for .
Suppose , . For an element , we say the period of with respect to is the smallest positive integer such that . Let be the family of sets such that all elements of have the same period with respect to , and such that . For a set , we write to denote the period of the elements of (with respect to ), and we let denote the union of the sets that is mapped to by powers of , where .
To compute , we use the following recurrence. The dot in front of the curly braces denotes multiplication. Note that we have and by the definition of .
Lemma 19.
Let and suppose , where . We have
For some intuition, suppose is a graph counted by , and let be the connected component of that contains . The first line of the recurrence for covers the case when is invariant under . This case is analogous to Lemma 17. In the first summation, stands for and stands for the set of vertices in that can be moved by . If , then in addition to the vertices in , we need to choose additional vertices for so that . For these, we must choose non-moved vertices, so there are possible vertices to choose from. If , then we subtract 1 from each of the numbers in the binomial coefficient since we already know that is a non-moved vertex in .
The second line covers the case when is not invariant under , which means all of is mapped to some other connected component of by . In this case, we have components of size that are all isomorphic to , and the rest of the graph has vertices. We do not need a binomial coefficient in this case because all of the vertices in are moved. There are possibilities for the edges of since is an automorphism of . As an example, suppose . If we apply to the vertices of a total of times, then the image is equal to , although these two sets might not match up pointwise. To ensure that the image matches up with the edges of , we require that is an automorphism of . This is why we need the argument in and .
Note that for a graph counted by , we have since . This means no vertex in is moved by , so we are free to relabel these vertices in the proof of Lemma 19 without changing the automorphism. In the initial recursive call , we have and , so . Later on in the algorithm, it is possible that some vertices in are not actually moved by . For example, in the previous paragraph, it could happen that is the identity on (and then becomes the new value of ). However, we always have by the definition of , so if , then . This fact will be useful for the running time analysis.
The proof of Lemma 19, along with the proofs of all of the following recurrences, can be found in the full version of the paper.
4.2 Recurrences for counting connected chordal graphs
To compute , we will define various counter functions that are analogous to those in [14]. First, we recall the counter functions from [14]. We refer to functions 1-4 in Definition 20 as -functions, and we refer to the others as -functions. See Figure 1 in [14] for an illustration of all of these functions.
Definition 20 ([14]).
The following functions count various subclasses of chordal graphs. The arguments are nonnegative integers, where , , for -functions, and for -functions. These also satisfy the domain requirements listed below.
-
1.
is the number of labeled connected chordal graphs with vertex set that evaporate in time at most with exception set , where is a clique, with the following property: every connected component of (if any) has at least one neighbor in . Domain: , , .
-
2.
is the same as , except every connected component of (if any) evaporates at time exactly in . Note: A graph with would be counted because in that case, is the same as . Domain: , , .
-
3.
is the same as , except no connected component of sees all of . Domain: , , .
-
4.
and are the same as , except every connected component of sees all of (hence we no longer require every component of to have a neighbor in ), and furthermore, for we require that has exactly one connected component, and for we require that has at least two components. Domain for : , . Domain for : , .
-
5.
is the number of labeled connected chordal graphs with vertex set that evaporate at time exactly with exception set , such that is connected, , and is a clique. Domain: , , .
-
6.
is the same as , except every connected component of evaporates at time exactly in , and there exists at least one such component, i.e., . Domain: , , .
-
7.
is the same as , except no connected component of sees all of . Domain: , , .
-
8.
is the same as , except rather than requiring that is connected, we require that is connected. Domain: , , , .
The counter functions for our algorithm will be similar to these, except we only want to count graphs with a particular automorphism. Therefore, we will have several more arguments in addition to the usual ones from Definition 20. As above, the argument will indicate that is the current automorphism. We also introduce the arguments , , , and , each of which is a subset of . Roughly, these sets specify which vertices – in , , , and the rest of the graph, respectively – can be moved by the current permutation (but the sets , , and will be modified slightly).
In Definition 20, the -functions count graphs with vertex set , and the -functions count graphs with vertex set . For our algorithm, we will make some adjustments to these vertex sets to ensure that the vertices moved by the current permutation still appear in the graph. This is similar to how we defined above. To do so, we define several symbols for these vertex sets and vertex subsets (, etc.). Each of these depends on the list of arguments of the function in question, which we denote by . For example, when defining , we have (see Definition 21).
First, suppose comes from one of the -functions in Definition 21. Let be the set of the first natural numbers in , and let be the set of the first natural numbers in . We define and . Also, if is included in , then let be the set of the first natural numbers in . In this case, we define .
For the other case, suppose comes from one of the -functions. Let be the set of the first natural numbers in , let be the set of the first natural numbers in , and let be the set of the first natural numbers in . We define , , and . Also, if is included in , then let be the set of the first natural numbers in . In this case, we again define .
These vertex subsets still have the same sizes as they did in the original algorithm: the size of is or , , , the rest of the graph has size , and . Just as we had in the original algorithm, we now have . This is because we require in Definition 21, and we also require , which implies .
For -functions, we have , and for -functions, we have , by the definition of . We are now ready to define our new counter functions.
Definition 21.
The following functions count various subclasses of chordal graphs. The arguments are nonnegative integers with the same domains as in Definition 20. We have , and the arguments are subsets of . All other requirements for their domains are specified below.
-
1.
, , ,
, and are the same as , , , , and , respectively, except we only count graphs for which is an automorphism, and we make the following changes to the vertices of the graph: the vertex set is rather than , the exception set is rather than , and is replaced by .Domain: , , , , , , and .
-
2.
, , , and
are the same as , , , and , respectively, except we only count graphs for which is an automorphism, and we make the following changes to the vertices of the graph: the vertex set is rather than , the exception set is rather than , the last set to evaporate is rather than , and is replaced by .Domain: , , , , , , , , and .
For a graph counted by one of these functions, is indeed a permutation of since and (and if needed) are invariant under .
To compute , we consider all possibilities for the evaporation time. In the following recurrence, (with those particular arguments) counts the number of labeled connected chordal graphs with vertex set and automorphism that evaporate at time exactly with empty exception set.
Lemma 22.
Let and suppose , where . We have
To compute , we consider all possibilities for the size of . The set in the inner sum stands for the set of vertices in that can be moved by . Note that we have and by the definition of . For and all of the following functions, we recommend reading the analogous recurrences in [14] for further insight into what is happening with the arguments in each recursive call.
Lemma 23.
For , we have
where .
To compute , we consider all possibilities for the set of labels that appear in connected components of that evaporate at time exactly . These components correspond to the recursive call to . The set stands for the set of vertices in components that evaporate at time exactly that can be moved by . Note that we have and by the definition of . Since , we also have , which is required by the domain of .
Lemma 24.
For , we have
where .
To compute , we consider all possibilities for the set of labels that appear in connected components of that evaporate at time exactly . These components correspond to the recursive call to . The set stands for the set of vertices in components that evaporate at time exactly that can be moved by .
Lemma 25.
For , we have
where .
For the next recurrence, we will need a few more definitions. Suppose we have been given fixed values of the arguments of . Let be the smallest label in . For , let be the family of sets such that and such that the following condition holds: if , then , and otherwise, . For , let .
Let be the family of pairs , where and , such that all elements of have the same period with respect to , such that , and such that is invariant under . For a set from such a pair, we let , where .
To compute , we consider all possibilities for the label set of the connected component of that contains . In the definition of , the components of are similar enough (since they all evaporate at time ) that they can potentially be mapped to one another by . Thus we consider two cases: either is invariant under , or is mapped to some other component of by . We add together the summations from these two cases, in a similar way to the recurrence for . In the recurrence for , stands for , and stands for . The set stands for the set of vertices in that can be moved by , and stands for the set of vertices in that can be moved by .
Lemma 26.
For , we have
To compute , we consider three cases: either no component of sees all of , exactly one component sees all of , or at least two components see all of . The recursive calls to and correspond to the component/components that see all of . In the second and third cases, the set stands for the set of vertices that can be moved by in components that see all of .
Lemma 27.
For , we have
where .
For the next recurrence, suppose we have been given fixed values of the arguments of . Let be the smallest label in , and let be defined as it was in the recurrence for . Let be the family of sets such that all elements of have the same period with respect to , and such that . For a set , we let , where .
Lemma 28.
For , we have
To compute , all we need to do is make a slight adjustment to the recurrence for .
Lemma 29.
The recurrence for is exactly the same as the recurrence for in Lemma 26, except for the two sums over : In both summations, rather than summing over such that , we sum over such that .
To compute , we first observe that when , requiring to be connected is the same as requiring to be connected.
Lemma 30.
We have .
For the next recurrence, we need one last round of definitions. Suppose we have been given fixed values of the arguments of , including and . Let be the smallest label in . For , let be the family of sets such that and such that the following condition holds: if , then , and otherwise, . For , let . Also, for , let .
Let be the family of triples , where , , and , such that all elements of have the same period with respect to , such that , and such that is invariant under . For a set from such a triple, we let , where .
Lemma 31.
For with the argument , we have
See the full version of the paper for more intuition behind the recurrences for and . The base cases for all of these counter functions are the same as in [14] since they only depend on the arguments .
5 Conclusion
We built upon the algorithm of Wormald for generating random unlabeled graphs to design an algorithm that, given , generates a random unlabeled chordal graph on vertices in expected polynomial time. This serves as a proof of concept that one can obtain a sampling algorithm for unlabeled graphs from a -complete graph class using the following two ingredients: (1) an algorithm for counting labeled graphs in with a given automorphism parameterized by the number of moved points of and (2) a bound on the probability that a labeled graph in has a given automorphism. A few potential candidates for this are bipartite graphs, strongly chordal graphs, and chordal bipartite graphs, all of which are -complete. An additional open problem would be to design a uniform, or approximately uniform, sampling algorithm – either for unlabeled chordal graphs or general unlabeled graphs – that runs in expected polynomial time even when we condition on the output graph.
References
- [1] Edward A. Bender, L. Bruce Richmond, and Nicholas C. Wormald. Almost all chordal graphs split. Journal of the Australian Mathematical Society, 38(2):214–221, 1985.
- [2] Vladislav Bína and Jiří Přibil. Note on enumeration of labeled split graphs. Commentationes Mathematicae Universitatis Carolinae, 56(2):133–137, 2015.
- [3] Jean R.S. Blair and Barry Peyton. An introduction to chordal graphs and clique trees. In Graph theory and sparse matrix computation, pages 1–29. Springer, 1993.
- [4] Manuel Bodirsky, Clemens Gröpl, and Mihyun Kang. Sampling unlabeled biconnected planar graphs. In Algorithms and Computation: 16th International Symposium, ISAAC 2005, Sanya, Hainan, China, December 19-21, 2005. Proceedings 16, pages 593–603. Springer, 2005. doi:10.1007/11602613_60.
- [5] Manuel Bodirsky, Clemens Gröpl, and Mihyun Kang. Generating labeled planar graphs uniformly at random. Theoretical Computer Science, 379(3):377–386, 2007. doi:10.1016/J.TCS.2007.02.045.
- [6] Manuel Bodirsky, Clemens Gröpl, and Mihyun Kang. Generating unlabeled connected cubic planar graphs uniformly at random. Random Structures & Algorithms, 32(2):157–180, 2008. doi:10.1002/RSA.20206.
- [7] John D. Dixon and Herbert S. Wilf. The random selection of unlabeled graphs. Journal of Algorithms, 4(3):205–213, 1983. doi:10.1016/0196-6774(83)90021-4.
- [8] Éric Fusy. Uniform random sampling of planar graphs in linear time. Random Structures & Algorithms, 35(4):464–522, 2009. doi:10.1002/RSA.20275.
- [9] Andrew Gainer-Dewar and Ira M. Gessel. Counting unlabeled -trees. Journal of Combinatorial Theory, Series A, 126:177–193, 2014. doi:10.1016/J.JCTA.2014.05.002.
- [10] Pu Gao and Nicholas Wormald. Uniform generation of random regular graphs. SIAM Journal on Computing, 46:1395–1427, 2017. doi:10.1137/15M1052779.
- [11] Pu Gao and Nicholas Wormald. Uniform generation of random graphs with power-law degree sequences. In Proceedings of the 29th Annual ACM-SIAM Symposium on Discrete Algorithms (SODA), pages 1741–1758, 2018. doi:10.1137/1.9781611975031.114.
- [12] Fănică Gavril. Algorithms for minimum coloring, maximum clique, minimum covering by cliques, and maximum independent set of a chordal graph. SIAM Journal on Computing, 1(2):180–187, 1972. doi:10.1137/0201013.
- [13] András Hajnal and János Surányi. Über die auflösung von graphen in vollständige teilgraphen. Ann. Univ. Sci. Budapest, Eötvös Sect. Math, 1:113–121, 1958.
- [14] Úrsula Hébert-Johnson, Daniel Lokshtanov, and Eric Vigoda. Counting and sampling labeled chordal graphs in polynomial time, 2023. doi:10.48550/arXiv.2308.09703.
- [15] Mark R. Jerrum, Leslie G. Valiant, and Vijay V. Vazirani. Random generation of combinatorial structures from a uniform distribution. Theoretical Computer Science, 43:169–188, 1986. doi:10.1016/0304-3975(86)90174-X.
- [16] Walter Oberschelp. Kombinatorische anzahlbestimmungen in relationen. Mathematische Annalen, 174:53–78, 1967.
- [17] OEIS Foundation Inc. Entry A058862 in the On-Line Encyclopedia of Integer Sequences, 2024. Published electronically at http://oeis.org.
- [18] Toshiki Saitoh, Yota Otachi, Katsuhisa Yamanaka, and Ryuhei Uehara. Random generation and enumeration of bipartite permutation graphs. Journal of Discrete Algorithms, 10:84–97, 2012. doi:10.1016/J.JDA.2011.11.001.
- [19] Herbert S. Wilf. The uniform selection of free trees. Journal of Algorithms, 2(2):204–207, 1981. doi:10.1016/0196-6774(81)90021-3.
- [20] Nicholas C. Wormald. Generating random unlabelled graphs. SIAM Journal on Computing, 16(4):717–727, 1987. doi:10.1137/0216048.