Modularity of regular and treelike graphs

Modularity of regular and treelike graphs Abstract Clustering algorithms for large networks typically use modularity values to test which partitions of the vertex set better represent structure in the data. The modularity of a graph is the maximum modularity of a partition. We consider the modularity of two kinds of graphs. For $$r$$-regular graphs with a given number of vertices, we investigate the minimum possible modularity, the typical modularity, and the maximum possible modularity. In particular, we see that for random cubic graphs the modularity is usually in the interval $$(0.666, 0.804)$$, and for random $$r$$-regular graphs with large $$r$$ it usually is of order $$1/\sqrt{r}$$. These results help to establish baselines for statistical tests on regular graphs. The modularity of cycles and low degree trees is known to be close to 1: we extend these results to ‘treelike’ graphs, where the product of treewidth and maximum degree is much less than the number of edges. This yields for example the (deterministic) lower bound $$0.666$$ mentioned above on the modularity of random cubic graphs. 1. Introduction and statement of results The recently greater availability of data on large networks in many fields has led to increasing interest in techniques to discover network structure. In the analysis of these networks, clusters or communities found using modularity optimization have become a focus of study. Thus we need benchmarks to assess the statistical significance of observed community structure [1]. Further, the popularity of modularity-based clustering techniques [2, 3] and the link to the Potts model in statistical physics [4] have prompted much research into the modularity of graphs from various classes. The asymptotic value of the modularity of each of the following graph classes has been shown to approach the maximum value 1; cycles [5], low degree trees [6, 7] and lattices [8]. In this article, we focus on the (maximum) modularity $$q^*(G)$$ of a graph $$G$$ (precise definitions are given later) from one of two natural related and contrasting areas, namely regular graphs and treelike graphs. We think of a graph as treelike if by deleting a few edges we may obtain a graph with low treewidth (treewidth measures how much we have to ‘fatten’ a tree to contain the graph). We show that if a graph $$G$$ with many edges has low maximum degree, and by deleting a small proportion of its edges we may obtain a graph with low treewidth, then $$G$$ has high modularity. This result much extends the results mentioned earlier about cycles and trees; it shows that random planar graphs have modularity asymptotically 1; and it shows that every cubic (3-regular) graph has modularity at least about $$2/3$$. For $$r$$-regular graphs with a given number $$n$$ of vertices, we investigate the minimum possible modularity, the typical modularity, and the maximum possible modularity. For example, consider a random cubic graph $$G_{n,3}$$. Locally, looking out a fixed distance from a random vertex, it is a tree with high probability (whp), though globally it is far from treelike. We shall see that $$q^*(G_{n,3}) \leq 0.804$$ whp, and simulations suggest that the value may typically not be much above the deterministic lower bound of about $$2/3$$. In fact, we consider random $$r$$-regular graphs $$G_{n,r}$$ for each $$r$$ from 3 to 12 (see Table 1); and also show that when $$r$$ is large $$q^*(G_{n,r})$$ is contained whp in an interval that scales with $$1/\sqrt{r}$$. Table 1 Upper rows: lower and upper whp bounds on the modularity of random regular graphs $$G_{n,r}$$, for Theorem 1.6. Lower rows: average modularity found in simulations on randomly generated $$r$$-regular graphs with $$10000$$ nodes, using the Louvain method [17] and a method ‘Reshuffle’ from [18], seeSection 2.    $$r=$$     3  4  5  6  7  8  9  10  11  12  Bounds  $$q^*(G_{n,r}) >$$     0.666  0.499  0.399  0.333  0.285  0.249  0.226  0.214  0.204  0.196     $$q^*(G_{n,r}) <$$     0.804  0.684  0.603  0.544  0.499  0.463  0.433  0.408  0.388  0.370  Simulations  Louvain     0.679  0.531  0.440  0.380  0.343  0.312  0.284  0.262  0.244  0.230     Reshuffle     0.677  0.531  0.446  0.391  0.353  0.326  0.303  0.285  0.269  0.256     $$r=$$     3  4  5  6  7  8  9  10  11  12  Bounds  $$q^*(G_{n,r}) >$$     0.666  0.499  0.399  0.333  0.285  0.249  0.226  0.214  0.204  0.196     $$q^*(G_{n,r}) <$$     0.804  0.684  0.603  0.544  0.499  0.463  0.433  0.408  0.388  0.370  Simulations  Louvain     0.679  0.531  0.440  0.380  0.343  0.312  0.284  0.262  0.244  0.230     Reshuffle     0.677  0.531  0.446  0.391  0.353  0.326  0.303  0.285  0.269  0.256  Table 1 Upper rows: lower and upper whp bounds on the modularity of random regular graphs $$G_{n,r}$$, for Theorem 1.6. Lower rows: average modularity found in simulations on randomly generated $$r$$-regular graphs with $$10000$$ nodes, using the Louvain method [17] and a method ‘Reshuffle’ from [18], seeSection 2.    $$r=$$     3  4  5  6  7  8  9  10  11  12  Bounds  $$q^*(G_{n,r}) >$$     0.666  0.499  0.399  0.333  0.285  0.249  0.226  0.214  0.204  0.196     $$q^*(G_{n,r}) <$$     0.804  0.684  0.603  0.544  0.499  0.463  0.433  0.408  0.388  0.370  Simulations  Louvain     0.679  0.531  0.440  0.380  0.343  0.312  0.284  0.262  0.244  0.230     Reshuffle     0.677  0.531  0.446  0.391  0.353  0.326  0.303  0.285  0.269  0.256     $$r=$$     3  4  5  6  7  8  9  10  11  12  Bounds  $$q^*(G_{n,r}) >$$     0.666  0.499  0.399  0.333  0.285  0.249  0.226  0.214  0.204  0.196     $$q^*(G_{n,r}) <$$     0.804  0.684  0.603  0.544  0.499  0.463  0.433  0.408  0.388  0.370  Simulations  Louvain     0.679  0.531  0.440  0.380  0.343  0.312  0.284  0.262  0.244  0.230     Reshuffle     0.677  0.531  0.446  0.391  0.353  0.326  0.303  0.285  0.269  0.256  1.1 Modularity of a graph The definition of modularity was first introduced by Newman and Girvan in [9]. Many or indeed most popular algorithms used to search for clusterings on large data sets are based on finding partitions with high modularity [2, 3]. See [10, 11] for surveys on community detection including modularity based methods. In order to define the modularity of a graph $$G$$, we first define the modularity $$q_\mathcal A(G)$$ for a partition $${\mathcal A}$$ of its vertex set. This is a measure designed to score highly when most edges fall within the parts, but to be penalized when some parts have large sums of degrees. Denote the number of edges in the subgraph induced by vertex set $$A$$ by $$e(A)$$, and let the volume $${\rm vol} (A)$$ of $$A$$ be the sum of the degrees (in the whole graph $$G$$) of the vertices in $$A$$. Let $$G$$ be a graph with $$m\geq 1$$ edges. For a vertex partition $$\mathcal A$$ of $$G$$, we define   \[\begin{split} q_\mathcal A(G) & = \frac{1}{2m}\sum_{A \in \mathcal A} \sum_{u, v \in A} \left( {\mathbf 1}_{uv\in E} - \frac{\deg(u) \deg(v)}{2m} \right)\\ &= \frac{1}{m}\sum_{A \in \mathcal A} e(A) - \frac{1}{4m^2}\sum_{A \in \mathcal A} {\rm vol} (A)^2 \; = \; q_\mathcal A^E(G) - q_\mathcal A^D(G), \end{split}\] where the edge-contribution (or coverage) $$q_\mathcal A^E(G)$$ and the degree-tax$$q_\mathcal A^D(G)$$ are given by   \[q_\mathcal A^E(G) = \frac{1}{m}\sum_{A \in \mathcal A} e(A) \;\;\; \mbox{ and } \;\;\; q_\mathcal A^D(G) = \frac{1}{4m^2}\sum_{A \in \mathcal A} {\rm vol} (A)^2.\] The modularity$$q^*(G)$$ of the graph $$G$$ is defined by $$q^*(G)=\max_{\mathcal A}(G)$$, where the maximum is over all partitions $$\mathcal A$$ of the vertex set. By definition, we have $$0 \leq q^*(G) <1$$ for each non-trivial graph $$G$$. For example, complete graphs, stars and more generally all complete multipartite graphs have modularity 0 (as noted in [5, 7] and [12, 13], respectively); and it was shown recently in [14, 15] that near-complete graphs also have modularity 0. At the other extreme, the $$n$$-cycle $$C_n$$ has modularity near 1, see (1) below. A graph $$G$$ with no edges is defined to have modularity $$1$$ for any partition $$\mathcal A$$ [5]. 1.2 Modularity of regular graphs Let $$\mathcal G(n,r)$$ denote the set of all $$r$$-regular graphs with $$n$$ vertices, say with vertex set $$\{1,\ldots,n\}$$. It is easy to see that this set is non-empty if and only if $$n \geq r+1$$ and $$rn$$ is even. Assume that this condition holds (as we shall often do implicitly). Define $$q_r^-(n)$$ to be the minimum modularity $$q^*(G)$$ for an $$n$$-vertex $$r$$-regular graph $$G$$, that is   \[q_r^-(n) = \min \{ q^*(G) : G \in \mathcal G(n,r) \}\] and similarly let   \[q_r^+(n) = \max \{ q^*(G) : G \in \mathcal G(n,r) \}.\] Also let $$G_{n,r}$$ denote a random graph sampled uniformly from $$\mathcal G(n,r)$$. We shall be particularly interested in the behaviour of the random variable $$q^*(G_{n,r})$$. When an event holds with probability tending to 1 as $$n\rightarrow \infty,$$ we say that it holds with high probability (whp). Our main results on regular graphs are Theorems 1.5, 1.6 and 1.7. Let us consider first $$q_r^-(n)$$ and $$q^*(G_{n,r})$$, which are closely related, and then $$q_r^+(n)$$. To introduce the results, we start with the simpler cases $$r=1$$ and $$r=2$$. The case $$r=1$$ is trivial, as an $$n$$-vertex 1-regular graph $$G$$ must consist of $$n/2$$ disjoint edges. Since each part in an optimal partition must induce a connected graph, it is easy to check that the unique optimal partition has one part for each edge, and $$q^*(G)= 1-2/n$$. The case $$r=2$$ is not trivial, though it is simpler than for $$r \geq 3$$: we give it a separate subsection. 1.2.1 2-regular graphs For the minimum modularity $$q_2^-(n)$$, note first that $$\tfrac{5}{\sqrt{6}} \approx 2.041$$. Proposition 1.1 The minimum modularity $$q_2^-(n)$$ satisfies $$q_2^-(n) = 1- \tfrac{5}{\sqrt{6n}} +O(\tfrac1{n})$$. Proposition 1.2 The random 2-regular graph $$G_{n,2}$$ satisfies   \[q^*(G_{n,2}) = 1- \tfrac{2}{\sqrt{n}} + o \left(\tfrac{\log^2n}{n}\right) \;\; \mbox{ whp}.\] For the $$n$$-cycle $$C_n$$, by [5, Theorem 6.7] (see also the comments following Proposition 1.10 below), we have   \begin{equation} \label{eqn.Cn} q^*(C_n) = 1- \tfrac{2}{\sqrt{n}} + O\left(\frac1{n}\right)\!. \end{equation} (1) Thus whp $$q^*(G_{n,2})$$ is extremely close to $$q^*(C_n)$$. Propositions 1.1 and 1.2 show that whp $$q^*(G_{n,2})$$ is very close to the minimum possible value $$q_2^-(n)$$, indeed whp   \[q^*(G_2) - q_2^-(n) \sim \tfrac{2}{\sqrt{n}} - \tfrac{5}{\sqrt{6n}} \approx \tfrac{0.04}{\sqrt{n}}.\] It is easier to determine the maximum modularity $$q_2^+(n)$$. For example, $$q_2^+(n) = 1-\tfrac{3}{n}$$ when $$n$$ is divisible by 3, and is attained by $$n/3$$ disjoint triangles. Indeed we have a full story: Proposition 1.3 For each $$n \geq 3$$  \begin{equation}\label{eq.maxq2} q_2^+(n) = \begin{cases} 1-\tfrac{3}{n} & \mbox{ if } n \equiv 0 \mod{3}\\ 1-\tfrac{3}{n} - \frac{4}{n^2} & \mbox{ if } n \equiv 1 \mod{3}\\ 1-\tfrac{3}{n} - \frac{8}{n^2} & \mbox{ if } n \equiv 2 \mod{3}. \end{cases} \end{equation} (2) For $$n \geq 3$$, the maximum value is attained if and only if: $$G$$ is a disjoint union of $$n/3$$ copies of $$C_3$$ when $$n \equiv 0 \mod{3}$$; $$G$$ is a disjoint union of one $$C_4$$ and $$(n-4)/3$$$$C_3$$’s when $$n \equiv 1 \mod{3}$$; and $$G$$ is a disjoint union of two $$C_4$$’s and $$(n-4)/3$$$$C_3$$’s when $$n \equiv 2 \mod{3}$$ and $$n \geq 8$$, and $$G$$ is a five cycle $$C_5$$ when $$n=5$$. 1.2.2 Minimum possible modularity $$q_r^-(n)$$ For $$r=3,\ldots,8$$, the following deterministic result gives the best lower bound we know to hold whp for $$q^*(G_{n,r})$$. (These lower bounds were originally proved in [16] to hold whp using a Hamilton cycle construction.) It will follow quickly from Theorem 1.11 on treewidth and maximum degree. Proposition 1.4 For each $$r\geq 2$$,   \[q_r^-(n) \geq \frac2{r} - 2 \sqrt{\frac6{n}}\] for each possible value of $$n$$. Now consider large $$r$$. Theorem 1.5 There is a constant $$c>0$$ such that, for each positive integer $$r$$,   \[q_r^-(n) \geq c/\sqrt{r}\] for each sufficiently large $$n$$ (with $$rn$$ even). For each $$r \geq 3$$, our best upper bounds on $$q_r^-(n)$$ will come from $$q^*(G_{n,r})$$. 1.2.3 Random modularity $$q^*(G(n,r))$$ How should we assess the statistical significance of clusters observed in regular networks? There has been recent interest in estimating the modularity of random graphs [1, 14, 15, 19]. In order to tell if a given partition shows statistically significant clustering in a network, it is natural to compare the modularity score to that of a corresponding random graph model [1, 2]. We give results which bound the modularity of random $$r$$-regular graphs. In Theorem 1.6, we consider small values of $$r$$; and improve results in [16]. After that, in Theorem 1.7 we consider larger values of $$r$$. Theorem 1.6 For $$r=3,\ldots, 12$$, the modularity of a random $$r$$-regular graph $$G_{n,r}$$ whp lies in the range indicated in Table 1 (see also Fig. 1). In particular, $$0.666< q^*(G_{n,3}) < 0.804$$ whp. Fig. 1. View largeDownload slide Simulation results for $$n=10000$$ nodes and proven theoretical bounds for random $$r$$-regular graphs with degrees $$r=3,\ldots,10$$. Each cross indicates the better computed modularity returned by two methods (see Section 2), averaged over ten sampled graphs with $$10000$$ nodes. Theorem 1.6 says that the modularity of a random regular graph $$G_{n,r}$$ whp lies in the interval shown. Fig. 1. View largeDownload slide Simulation results for $$n=10000$$ nodes and proven theoretical bounds for random $$r$$-regular graphs with degrees $$r=3,\ldots,10$$. Each cross indicates the better computed modularity returned by two methods (see Section 2), averaged over ten sampled graphs with $$10000$$ nodes. Theorem 1.6 says that the modularity of a random regular graph $$G_{n,r}$$ whp lies in the interval shown. The lower bounds given for $$r=3$$ to 8 in Table 1 (and Fig. 1) are deterministic bounds from Proposition 1.4. Theorem 1.7 For each (fixed) integer $$r \geq 3$$, the random $$r$$-regular graph $$G_{n,r}$$ satisfies   \[q^*(G_{n,r}) < 2/\sqrt{r} \; \mbox{ whp};\] and there is a constant $$r_0$$ such that for each $$r \geq r_0$$  \[q^*(G_{n,r}) > 0.7631/\sqrt{r} \; \mbox{ whp}.\] For large $$r$$, the theorem shows that the modularity of a random $$r$$-regular graph $$q^*(G_{n,r})$$ whp tracks the minimum modularity $$q^-_r(n)$$, in the sense that both are of order $$\Theta(1/\sqrt{r})$$. For each given $$r\geq 3$$, it is an interesting open question how close $$q^*(G_{n,r})$$ typically is to $$q_r^-(n)$$. Can we construct $$r$$-regular graphs with modularity less than that for random graphs $$G_{n,r}$$? 1.2.4 Maximum possible modularity $$q_r^+(n)$$ The maximum possible modularity $$q_r^+(n)$$ is easier to handle than $$q_r^-(n)$$ and $$q^*(G_{n,r})$$, though it may be less important than them. We have already discussed the much easier case $$r=2$$, and in Proposition 1.3 we gave a full story for this case. In Proposition 1.8 below, we see that in general we have $$q^+_r(n) \leq 1-\frac{r+1}{n}$$, and we define a function $$g_r(n)$$ such that $$g_r(n) = 1 - \frac{r+1}{n} - O(1/n^2)$$, and $$q^+_r(n) = g_r(n)$$ for sufficiently large $$n$$. Also, we identify the most modular $$r$$-regular graphs on $$n$$ vertices (apart from some small values). Proposition 1.8 contains and extends Proposition 1.3 except for the ‘$$n$$ sufficiently large’ qualification. These results complement the extremal results in [15, 20]. The most modular connected graphs with a given number of edges were discussed in [20]; and later [15] investigated the most ‘$$k$$-modular’ connected graphs parameterized by the number $$m$$ of edges and the number $$k$$ of parts, as well as the most 2-modular graphs parameterized by $$m$$ and the number $$n$$ of vertices. Proposition 1.8 Let $$r \geq 2$$ be an integer. (a) The maximum modularity $$q^+_r(n)$$ of any $$r$$-regular graph on $$n$$ vertices satisfies   $$q^+_r(n) \leq 1-\frac{r+1}{n}$$ with equality achieved if and only if $$r+1$$ divides $$n$$; and for this case the unique way to attain the optimum is for the graph to consist of $$n/(r+1)$$ disjoint copies of $$K_{r+1}$$, with the connected components partition $$\mathcal C$$. (b) Given a positive integer $$n$$, write $$n$$ as $$a(r+1)+b$$ where $$a$$ is a non-negative integer and $$0 \leq b \leq r$$, and let   \begin{equation} \label{eqn.qplus} {g_r}(n) = 1 - {{r + 1} \over n} - {{b{\kern 1pt} (r + 2 + {{\bf{1}}_{r\quad {\rm{odd}}}})} \over {{n^2}}}. \end{equation} (3) If $$rn$$ is even and $$n$$ is sufficiently large (e.g. if $$n \geq 9 r (r+1)^2$$) then $$q^+_r(n) = g_r(n)$$, and this value is attained exactly for the graphs described in the proof, with the connected components partition $$\mathcal C$$. It will follow easily from the above result and its proof—see the comment following (12)—that for each $$n\geq r(r+2)$$ we have   \begin{equation}\label{eq.approxbestmod} q^+_r(n)\geq 1- \frac{r+2}{n}, \end{equation} (4) so the upper bound (from part (a)) and the lower bound differ by at most $$1/n$$. Perhaps, the upper bound holds for a much wider range of graphs? It seems likely that it holds for graphs with minimum degree at least $$r$$. We go further, and make a plausible but more speculative conjecture. Conjecture 1.9 For each integer $$r \geq 1$$, if an $$n$$-vertex graph has average degree at least $$r$$, then $$q^*(G) \leq 1 - \frac{r+1}{n}$$. The maximum modularity is considerably smaller if we consider only connected graphs. Proposition 1.10 Let the graph $$G$$ have $$m \geq 1$$ edges. If $$G$$ is connected then   \[q^*(G) \leq 1 - \tfrac{2}{\sqrt{m}} +\tfrac1{m} ,\] and if $$G$$ is 2-edge-connected then   \[q^*(G) \leq 1 - \tfrac{2}{\sqrt{m}}.\] The last result can be tight. Since $$C_n$$ is 2-connected, it gives $$q^*(C_n) \leq 1- 2/\sqrt{n}$$. If $$n=t^2$$ for an integer $$t \geq 2$$, then partitioning into $$t$$ paths of $$t$$ vertices shows that $$q^*(C_n) = 1- 2/\sqrt{n}$$. In general, partitioning into $$t= \lceil \sqrt{n} \rceil$$ paths each with $$t-1$$ or $$t$$ vertices yields equation (1). 1.3 Treewidth and maximum degree Bagrow makes a study of the modularity of some trees and treelike graphs in [6]. He shows that Galton–Watson trees and $$k$$-ary trees have modularity tending to one. In [7], it is shown that any tree with maximum degree $$\Delta(G)=o(n^{1/5})$$ has asymptotic modularity one. We shall see that this result extends to all trees with $$\Delta(G)=o(n)$$; and indeed it extends to all low-degree graphs which are ‘treelike’, in that they are ‘close’ to graphs with low treewidth. This forms Theorem 1.11, our main result in this section. Treewidth is a central notion in the study of graphs and the design of algorithms [21]: see [22] for a survey. Let us recall the definitions. A tree-decomposition of a graph $$G=(V,E)$$ is a pair consisting of a tree $$T=(I, F)$$ and a family $$( X_i : i \in I ) $$ of subsets of $$V$$ (‘bags’), one for each node $$i$$ of $$T$$, such that 1. $$\cup_{i \in I} X_i = V$$ 2. for each edge $$vw \in E$$ there is a node $$i \in I$$ such that $$v, w\in X_i$$ 3. for all nodes $$i,j,k\in I$$, if $$j$$ is on the path between $$i$$ and $$k$$ in $$T$$, then $$X_i \mathcal Ap X_k \subseteq X_j$$. The width of a tree decomposition is $$\max_{i \in I} |X_i| - 1$$; and the treewidth$${\rm tw}(G)$$ of a graph $$G$$ is the minimum width over all tree decompositions of $$G$$. Thus trees have treewidth 1, and indeed they are exactly the connected graphs with treewidth 1. Cycles have treewidth 2; and the graphs with treewidth at most 2 are exactly the series-parallel graphs. The following result is our key tool for lower bounding the modularity of graphs which have small degrees, and which have small treewidth or can can be made so by deleting a few edges. Theorem 1.11 Let $$G$$ be a graph with $$m\geq 1$$ edges and maximum degree $$\Delta=\Delta(G)$$, and let $$E'$$ be a subset of the edges such that $${\rm tw}(G\backslash E')\leq t$$. Then the modularity $$q^*(G)$$ satisfies   $$q^*(G) \geq 1- 2((t+1)\Delta/m)^{1/2}-|E'|/m.$$ Proposition 1.4 on $$q_r^-(n)$$ is a corollary which we shall deduce quickly from Theorem 1.11. Our second corollary of Theorem 1.11 is immediate. Corollary 1.12 For $$m=1,2, \ldots$$ let $$G_m$$ be a graph with $$m$$ edges. If $${\rm tw}(G_m) \cdot \Delta(G_m) = o(m)$$ then $$q^*(G_m) \to 1$$ as $$m \to \infty$$. This result is best possible, in that we cannot replace $$o(m)$$ by $$O(m)$$: here are two examples. (a) If $$G$$ is the star $$K_{1,m}$$ (with treewidth 1 and maximum degree m) then $${\rm tw}(G) \cdot \Delta(G) = 1 \cdot m = m$$ and $$q^*(G)=0$$ [7]. (b) For the random cubic graph $$G = G_{n,3}$$ on $$n$$ vertices (with $$m=3n/2$$) we have $${\rm tw}(G) \cdot \Delta(G) = 3 \, {\rm tw}(G) = O(m)$$. However, by Theorem 1.6, $$q^*(G_{n,3}) \leq 0.804$$ whp. Corollary 1.12 shows that a random planar graph $$G_n$$ with $$n$$ vertices whp has modularity near 1. For $${\rm tw}(G_n)=O(\sqrt{n})$$ by [23, 24], whp $$\Delta(G_n)=O(\log n)$$ [25], and whp $$m=\Theta(n)$$; and so whp $$q^*(G_n) \geq 1 - O((\log n)^{\frac12}/n^{\frac14}) \; = 1-o(1).$$ The same also holds for random graphs on any fixed surface. Plan of the article In the next section we briefly discuss our simulations. In the following section, we prove Propositions 1.1, 1.2 and 1.3 which concern 2-regular graphs. After that, in Section 4, we prove Theorem 1.11 on treelike graphs and show that this implies Proposition 1.4. Theorem 1.5 on minimum modularity $$q_r^-(n)$$, and Theorems 1.6 and 1.7 on random modularity $$q^*(G_{n,r})$$ are all proven in Section 5. Then in Section 6, we prove our results on maximum modularity. Finally, in Section 7 we make some concluding remarks. 2. Simulations For each $$r =3,\ldots,12$$ we generated ten instances of a random $$r$$-regular graph on $$10000$$ nodes. The graphs were generated using a variant of the configuration model which was shown to converge to the uniform distribution in [26]. Modularity was optimized using two different methods, with Table 1 recording the averages for each method. Both methods start with each node in its own part (community). The Louvain method [17] as implemented in [27] considers the nodes in turn, and reshuffles a node into a different part if that increases the modularity (choosing a part which leads to the greatest increase). It then forms a weighted reduced graph with a node for each part, and the process is repeated on the reduced graph. The other method, ‘Reshuffle’, follows Algorithm 1 of [18]. It has the same first phase. The second phase considers each part and merges it with a different part if that increases the modularity (again, choosing the part which leads to the greatest increase). It then returns to the node shuffling phase, with the same nodes (we do not form a reduced graph, which would freeze earlier decisions). There are no guarantees on the performance of these modularity optimizing heuristics. In Fig. 1, we mark with an ‘X’ the average value of the larger (better) of the output values of the two algorithms (which, with figures rounded to three decimal places as here, is the same as the larger of the averages), together with the theoretical interval for the modularity given in Theorem 1.6. 3. Proofs for 2-regular graphs We first prove Proposition 1.2 concerning the modularity $$q^*(G_{n,2})$$ of a random 2-regular graph, using two preliminary lemmas; and then give the longer proof of Proposition 1.1, which concerns $$q_2^-(n)$$ and the least modular 2-regular graphs. Finally, we prove Proposition 1.3 on $$q_2^+(n)$$: it turns out to be easier to prove this result directly than to deduce it from Proposition 1.8 (because of the ‘$$n$$ sufficiently large’ qualification in the latter result). Lemma 3.1 Let $$G=(V,E)$$ and $$G'=(V,E')$$ be two graphs each with vertex set $$V$$ and $$m$$ edges, and with the same vertex degrees. Then   \[| q^*(G)-q^*(G')| \leq |E \Delta E'|/(2m).\] Proof. Let $$\mathcal A$$ be a partition of $$V$$. Then $$q_{\mathcal A}^E(G) - q_{\mathcal A}^E(G') \leq |E \setminus E'|/m = |E \Delta E'|/(2m)$$ and $$q_{\mathcal A}^D(G) = q_{\mathcal A}^D(G')$$, so $$q_{\mathcal A}(G) - q_{\mathcal A}(G') \leq |E \Delta E'|/(2m)$$. Hence $$q_{\mathcal A}(G) - q^*(G') \leq |E \Delta E'|/(2m)$$. But this holds for each partition $$\mathcal A$$, so $$q^*(G) - q^*(G') \leq |E \Delta E'|/(2m)$$; and the lemma follows. □ Lemma 3.2 For $$n$$ sufficiently large, the expected number of cycles in a random 2-regular $$n$$-vertex graph is at most $$\log n$$. Proof. We use the configuration model, see for example [28]. Let $$f(n)$$ be the number of perfect matchings on a set of $$n$$ vertices. Then $$f(2n) = (2n-1)!! = (2n-1)(2n-3) \cdots 3 \cdot 1$$. Let $$M_n$$ be a random 2-regular $$n$$-vertex multigraph. For each integer $$k$$ with $$3 \leq k \leq n$$, the expected number $$g(k,n)$$ of $$k$$-cycles in $$M_n$$ equals   \begin{eqnarray*} \binom{n}{k} \frac{(k-1)!}{2} \, 2^{k-1} \frac{f(n-2k)}{f(2n)} & = & \frac{1}{4k} \, \frac{(n)_k 2^k}{\prod_{i=0}^{k-1} (2n-(2i+1))} \\ & = & \frac{1}{4k} \, \frac{\prod_{i=0}^{k-1} (2n-2i)}{\prod_{i=0}^{k-1} (2n-(2i+1))}. \end{eqnarray*} Hence, by comparing factors, $$g(k,n) \leq \frac1{4k} \frac{2n}{2n-(2k-1)}$$ (and $$g(k,n) \geq \frac1{4k} $$). Since $$\sum_{k >n/t} g(k,n) < t$$, taking $$t=\sqrt{\log n}$$ say, we see that $$\sum_{k=3}^{n} g(k,n) \leq (1/4 +o(1)) \log n$$. But the probability that $$M_n$$ is simple tends to $$e^{-3/4}$$, see for example Corollary 9.7 of [28]. Hence, the expected number of cycles in $$G_2$$ is at most $$(e^{3/4}/4 +o(1)) \log n$$, and the lemma follows. □ Proof of Proposition 1.2. Let $$\omega(n) \to \infty$$ as $$n \to \infty$$. By the last lemma and Markov’s inequality, whp $$G_2$$ has at most $$\omega(n) \log n$$ cycles, and so there is a copy of $$C_n$$ such that the symmetric difference of the edge sets has size at most $$4 \omega(n) \log n$$. Thus by Lemma 3.1, whp $$|q^*(G_2)-q^*(C_n)| \leq 2 \omega(n) \log n /n$$. Hence, by the result on $$q^*(C_n)$$, whp $$q^*(G_2) = 1-2/\sqrt{n} + O(\omega(n) \log n /n)$$. Choosing $$\omega(n)=o(\log n)$$ completes the proof. □ Proof of Proposition 1.1. We may and shall restrict our attention to partitions into connected parts (as noted earlier). Suppose we are given a (large) integer $$n$$. The $$n$$-{cost} $$f(t,{\mathcal A})$$ of a partition $$\mathcal A$$ of $$C_t$$ into $$k>1$$ parts with $$t_1,\ldots,t_k$$ vertices is   \[f(t,{\mathcal A})= \tfrac{k}{n} + \tfrac{\sum_i t_i^2}{n^2}.\] Here the $$n$$-cost refers to the contribution to $$1-q^*(G)$$. For a given $$k$$, this cost is minimized when the $$t_i$$ are balanced (i.e. differ by at most 1), so there is essentially just one partition to consider. Let $$F_k(t)$$ be the $$n$$-cost of a balanced $$k$$-partition of $$C_t$$. Of course $$F_1(t)= \tfrac{t^2}{n^2}$$. Write $$t$$ as $$ak+b$$ with $$0 \leq b \leq a-1$$ (where $$a=\lfloor t/k\rfloor$$). Then $$t=(k-b)a +b(a+1)$$, so for $$2 \leq k \leq t$$  \[F_k(t)= \tfrac{k}{n} + \tfrac{(k-b)a^2 + b(a+1)^2}{n^2}.\] Let $$f_k(t)$$ be defined for real $$t$$ with $$0<t \leq n$$, and be the natural approximation to $$F_k(t)$$, namely $$f_1(t)= \tfrac{t^2}{n^2}$$, and $$f_k(t)= \tfrac{k}{n} + \tfrac{t^2}{kn^2}$$ for $$k \geq 2$$. Then $$F_k(t) \geq f_k(t)$$ by convexity. Also   \begin{eqnarray} \notag F_k(t)-f_k(t) & = & \tfrac1{n^2} ((k-b)a^2+b(a+1)^2 - \tfrac{t^2}{k}\\ \label{eq.approxcost} & = & \tfrac{b(k-b)}{ k n^2} \;\; \leq \tfrac{k}{4n^2}. \end{eqnarray} (5) The approximate ‘unit $$n$$-cost’ $$g_k(t)=f_k(t)/t$$ is given by $$g_1(t)= \tfrac{t}{n^2}$$ and $$g_k(t)= \tfrac{k}{nt} + \tfrac{t}{kn^2}$$ for $$k \geq 2$$. Let $$F_*(t)$$ be the minimum over $$k$$ of $$F_k(t)$$, let $$f_*(t)$$ be the minimum over $$k$$ of $$f_k(t)$$ and let $$g_*(t)$$ be the minimum over $$k$$ of $$g_k(t)$$ (so $$f_*(t)=g_*(t)\, t$$). Let $$\gamma = \sqrt{2/3}+ \sqrt{3/2}=5/\sqrt{6}$$. We shall establish five claims A,$$\ldots$$,E (with Claim C being used only to prove Claim D). Claim A. For all $$0<t \leq n$$ we have   \begin{equation} \label{eqn.h} g_*(t) \leq g_*(\sqrt{6n})= \gamma n^{-3/2}. \end{equation} (6) Proof of Claim A. Consider the minima of the functions $$g_k(t)$$ for $$k=2,3,\ldots$$; and the crossings of the graphs of the functions $$g_k(t)$$ for $$k=1,2,\ldots$$. We restrict attention to $$t>0$$. For $$k \geq 2$$, $$g_k(t)$$ is strictly convex and has minimum value $$2n^{-3/2}$$, achieved at $$t=k \sqrt{n}$$. The graphs of $$g_1(t)$$ and $$g_2(t)$$ meet when $$t=2\sqrt{n}$$ with common value $$2n^{-3/2}$$. For $$k \geq 2$$, the graphs of $$g_k(t)$$ and $$g_{k+1}(t)$$ meet at $$t=\sqrt{k(k+1)n}$$, with common value $$\gamma_{k} n^{-3/2}$$, where $$\gamma_{k}= \sqrt{\tfrac{k}{k+1}}+\sqrt{\tfrac{k+1}{k}}$$. Observe that $$\max_{k\geq 2} \gamma_k=\gamma_2=\gamma$$. Hence   \[g_*(t) \leq g_*(\sqrt{6n}) =g_2(\sqrt{6n})=g_3(\sqrt{6n})=\gamma n^{-3/2},\] as required. □ Claim B. Let $$\varepsilon>0$$. Then there is a constant $$c_0$$ such that if $$c_0 \sqrt{n} \leq t \leq n$$ then (a) $$F_*(t) \leq (1+\varepsilon) 2n^{-3/2} t$$, and (b) a balanced collection of about $$t/\sqrt{6n}$$ cycles of with combined number of vertices $$t$$ gives a total $$n$$-cost $$\geq (1-\varepsilon) (5/\sqrt{6}) n^{-3/2} t$$. Proof of Claim B. (a). Let $$k= \lceil \tfrac{t}{\sqrt{n}}\rceil$$. Then the corresponding $$n$$-cost is at most   \[\tfrac{k}{n} + \tfrac{k(\sqrt{n})^2}{n^2} = \tfrac{2k}{n} < \tfrac{2t}{n^{3/2}} + \tfrac{2}{n}= \tfrac{2t}{n^{3/2} } \, (1+ \tfrac{\sqrt{n}}{t}) \leq \tfrac{2t}{n^{3/2} } (1+ \varepsilon) \,\] if $$t \geq (1/\varepsilon) \sqrt{n}$$. (b). There exists $$\eta>0$$ such that if $$(1-\eta)\sqrt{6n} \leq t_i \leq (1+\eta)\sqrt{6n}$$ then $$g_*(t_i) \geq (1-\varepsilon) \tfrac{5}{\sqrt{6}} n^{-3/2}$$, and so $$f_*(t_i) \geq (1-\varepsilon) \tfrac{5}{\sqrt{6}} n^{-3/2}t_i$$. If $$c_0$$ is sufficiently large then each cycle in the balanced collection will have size $$t_i$$ in this range. Hence the total $$n$$-cost will satisfy   \[\sum_i f_*(t_i) \geq (1-\varepsilon) \tfrac{5}{\sqrt{6}} n^{-3/2} \sum_i t_i =(1-\varepsilon) \tfrac{5}{\sqrt{6}} n^{-3/2}t,\] as required. □ Claim C. If $$t$$ is an integer $$\leq 2 \sqrt{n}$$, then $$F_*(t)=F_1(t)$$. Proof of Claim C. For $$t \geq 3$$ and $$2 \leq k \leq t$$,   \[F_k(t)-F_1(t) \geq \tfrac{k}{n} +\tfrac{k(2t/k)^2}{4n^2} - \tfrac{t^2}{n^2} = \tfrac{k}{n} - \tfrac{t^2}{n^2} (1-\tfrac1{k}).\] Thus $$F_2(t)-F_1(t) \geq \tfrac{2}{n} - \tfrac{t^2}{2n^2} \geq 0$$, $$F_3(t)-F_1(t) \geq \tfrac{3}{n} - \tfrac{2t^2}{3n^2} > 0$$, and for $$k \geq 4$$  \[F_k(t)-F_1(t) > \tfrac{4}{n} - \tfrac{t^2}{n^2} \geq 0.\] This completes the proof. □ Claim D. In an $$n$$-vertex 2-regular graph $$G$$ minimizing $$q^*(G)$$, at most one component $$C_t$$ has size $$\leq \sqrt{n}$$. Proof of Claim D. Suppose $$G$$ has two components $$C_{t_1}$$, $$C_{t_2}$$ with $$t_1,t_2 \leq \sqrt{n}$$. Replace these two components by one component $$C_{t_1+t_2}$$. By Claim C, $$F_*(t_1+t_2)= F_1(t_1+t_2)$$: hence the increase in $$n$$-cost is at least   \[F_1(t_1+t_2) - F_1(t_1)-F_1(t_2) = \tfrac{t_1t_2}{2n^2} >0,\] which completes the proof. □ Claim E. Let $$c_0 \geq \sqrt{2}$$, and let $$t \leq c_0 \sqrt{n}$$. Let $$\mathcal A$$ be a partition of $$C_t$$ minimizing the $$n$$-cost. Then $$\mathcal A$$ has $$k \leq k_0= 1 + \sqrt{2} c_0$$ parts. Proof of Claim E. Since $$k_0 \geq 3$$, we may assume that $$k \geq 3$$. Suppose that $$\mathcal A$$ has two parts of sizes $$t_1, t_2 < \sqrt{n/2}$$. Replace these two parts by a single part of size $$t_1+t_2$$ (where each part corresponds to a path). The $$n$$-cost decreases by   \[\tfrac1{n} - \tfrac{(2(t_1+t_2))^2 - (2t_1)^2-(2t_2)^2}{4n^2}= \tfrac1{n} -\tfrac{2t_1t_2}{n^2} >0\] since $$t_1t_2 <n/2$$, a contradiction. Hence $$\mathcal A$$ has at most one part of size $$< \sqrt{n/2}$$. It follows that the number of parts is less than $$1+\tfrac{t}{\sqrt{n/2}} \leq k_0$$. □ We can now use Claims B, D, E and A to prove the upper bound on $$1-q_*(n)$$. Let $$G=G_n$$ minimize $$q^*(G)$$ over $$n$$-vertex graphs. By Claim B, with $$\varepsilon>0$$ sufficiently small that $$(1+\varepsilon) \, 2 < (1-\varepsilon) \, 5/\sqrt{6}$$, each component of $$G$$ has size at most $$c_0 \sqrt{n}$$. By Claim D, $$G$$ has $$s \leq 1+\sqrt{n}$$ components. Thus $$G$$ has components $$C_{t_1},\ldots,C_{t_s}$$ where $$t_1+\ldots t_s=n$$ and each $$t_i \leq c_0 \sqrt{n}$$. Also, by Claim E, for each component $$C_t$$ we need only to consider partitions with at most a constant $$k_0$$ parts. Then by (5) and Claim A   \begin{eqnarray*} 1-q^*(G) & = & \sum_i F_*(t_i) \; \leq \; \sum_i f_*(t_i) \, + s \tfrac{k_0}{4n^2} \\ & = & \sum_i g_*(t_i) t_i + s \tfrac{k_0}{4n^2} \; \leq \gamma n^{-3/2} \sum_i t_i + \tfrac{sk_0}{4n^2} \\ & = & \gamma /\sqrt{n} + \tfrac{s k_0}{4n^2} = \gamma / \sqrt{n} + O(n^{-3/2}). \end{eqnarray*} We have now seen that $$1-q_*^{(2)}(n) \leq \gamma / \sqrt{n} + O(n^{-3/2})$$. To show the reverse inequality, consider a graph $$G$$ formed from $$\lceil \sqrt{n/6}\rceil$$ components, where each component is $$C_{t_i}$$ with $$t_i = \sqrt{6n} + O(1)$$. For $$x=O(1)$$, $$g'_2(\sqrt{6n}+x) \sim \tfrac1{6n^2}$$ and $$g'_3(\sqrt{6n}+x) \sim -\tfrac1{6n^2}$$. Thus for $$k=2,3$$ we have $$g_k(t_i)= g_k(\sqrt{6n}) + O(n^{-2}) = \gamma n^{-3/2} + O(n^{-2})$$; and so $$g_*(t_i) = \gamma n^{-3/2} + O(n^{-2})$$. Hence the total $$n$$-cost is   \[\sum_i g_*(t_i) t_i = (\gamma n^{-3/2} + O(n^{-2})) \sum_i t_i= \gamma n^{-1/2} + O(n^{-1}),\] as required. This completes the proof of Proposition 1.1. □ Proof of Proposition 1.3. The result is easy to check when $$n=3,4,5$$. Let $$n \geq 6$$ and let $$G$$ be a 2-regular $$n$$-vertex graph such that $$q^*(G)=q_2^+(n)$$. Clearly each component cycle of $$G$$ has order at most 5, since we could split a larger cycle to obtain a 2-regular $$G'$$ with $$q^*(G')>q^*(G)$$. Further there cannot be a component $$C_5$$. For, if there is another component $$C_5$$ we could replace two $$C_5$$’s by one $$C_4$$ and two $$C_3$$’s; if there is a component $$C_4$$ we could replace $$C_5$$ and $$C_4$$ by three $$C_3$$’s, and if there is a component $$C_3$$ we could replace $$C_5$$ and $$C_3$$ by two $$C_4$$’s: in each case we would strictly increase the modularity. Thus the only possible components in $$G$$ are $$C_3$$ and $$C_4$$. Further there can be at most two $$C_4$$’s, as we could replace three $$C_4$$’s by four $$C_3$$’s. It now follows easily that the optimal configurations are as claimed. Finally it is now easy to check that we have the correct formulae for $$q_2^+(n)$$. □ 4. Proofs for treewidth and maximum degree To prove Theorem 1.11 (the ‘treewidth lower bound’) we need one preliminary lemma. Given a graph and a partition of its vertex set, a cross-edge is an edge with its end vertices in different parts of the partition. Lemma 4.1 Let the graph $$G$$ have $$m$$ edges and maximum degree at most $$d$$, and let the set $$E'\subset E(G)$$ be such that the subgraph $$H=G\backslash E'$$ satisfies $${\rm tw}(H) \leq t$$. Let $$s$$ satisfy $$d<s \leq 2m-d$$. Then by deleting from $$H$$ the edges incident with at most $$t+1$$ vertices, thus forming the subgraph $$H'$$, we can find a partition $$V(G) =U_0 \cup \cdots \cup U_{k}$$ with $$k\geq 2$$, no cross-edges in $$H'$$, and such that $${\rm vol}(U_0) \leq 2m-s$$ and $${\rm vol}(U_j) <s$$ for each $$j=1,\ldots,k$$. (We allow $$U_0=\emptyset$$.) Proof. The first step is to introduce a weight function which remembers information about the edges in $$E'$$: for a vertex $$v\in H$$ let $$w(v)=\deg_G(v)$$, and for a set $$U$$ of vertices let $$w(U)=\sum_{v\in U}w(v)$$. The proof will take a tree-decomposition of $$H$$, choose one bag $$X_i$$, and delete all edges of $$H$$ incident to the vertices in $$X_i$$. We want a suitably well-behaved tree-decomposition, see for example [22]. It is well known that (by adding nodes if necessary) we can guarantee a tree decomposition $$T$$ of width at most $$t$$ such that if $$ij$$ is an edge of $$T$$ then the symmetric difference $$X_i \triangle X_j$$ has exactly one element. If distinct nodes $$i$$ and $$j$$ have the same bag (i.e. if $$X_i=X_j$$) and have a common neighbour, then we can replace the nodes $$i$$ and $$j$$ by a single new node with the same bag: thus we may assume that if nodes $$i$$ and $$j$$ have a common neighbour in $$T$$ then $$X_i\neq X_j$$. Finally, again by adding nodes if necessary, we may assume that each leaf $$i$$ of $$T$$ has bag $$X_i$$ of size 1. Fix such a tree decomposition, and fix a leaf to be the root vertex. Recall that deleting any edge in a tree leaves exactly two connected components. Let us recall also one simple standard fact about tree-decompositions (as introduced in Section 1.3). Fact 4.2 If $$e= ij$$ is an edge of the tree $$T$$, $$k$$ and $$k'$$ are nodes of $$T$$ in different components of $$T \backslash e$$, and vertices $$v \in X_{k}$$ and $$v' \in X_{k'}$$ are adjacent in $$G$$, then at least one of $$v$$, $$v'$$ is in $$X_i \mathcal Ap X_j$$. For any edge $$e$$ in $$T$$ let $$T_e$$ denote the non-root component of $$T \backslash e$$, and let $$V_e$$ be the set of vertices contained in the bags of $$T_e$$. If $$w(V_e) <s$$, then orient $$e$$ toward the root vertex, otherwise orient $$e$$ away from the root vertex (see Fig. 2 for an illustration). Fig. 2. View largeDownload slide An illustration of the construction in the Proof of Lemma 4.1 applied to a toy graph $$G$$ with removed edge set $$E'$$ (dashed) and $$s=12$$. Graph $$G$$ has treewidth 3 but after removing the dashed edges graph $$H$$ has treewidth 2. A tree-decomposition for $$H$$ is shown and the leaf node at the top chosen to be the root. For each edge $$h$$ in the tree-decomposition the number $$w(V_h)$$ is shown, and the edge oriented toward the root if $$w(V_h)<12$$. The rooted tree-decomposition and threshold $$s$$ define node $$i$$, edge $$e$$, component $$T_e$$, and partition $$V=U_0 \cup U_1 \cup U_2$$ as shown. Fig. 2. View largeDownload slide An illustration of the construction in the Proof of Lemma 4.1 applied to a toy graph $$G$$ with removed edge set $$E'$$ (dashed) and $$s=12$$. Graph $$G$$ has treewidth 3 but after removing the dashed edges graph $$H$$ has treewidth 2. A tree-decomposition for $$H$$ is shown and the leaf node at the top chosen to be the root. For each edge $$h$$ in the tree-decomposition the number $$w(V_h)$$ is shown, and the edge oriented toward the root if $$w(V_h)<12$$. The rooted tree-decomposition and threshold $$s$$ define node $$i$$, edge $$e$$, component $$T_e$$, and partition $$V=U_0 \cup U_1 \cup U_2$$ as shown. At least one node in $$T$$ has out-degree zero: fix such a node $$i$$. Notice that $$i$$ is not the root (since $$s \leq 2m-d$$), and $$i$$ is not a leaf (since then $$|X_i|=1$$ and so $$w(X_i) \leq d<s$$). We delete the edges of $$H$$ incident with the vertices in the bag $$X_i$$. Thus, we delete at most $$(t+1)d$$ edges from $$H$$ to form $$H'$$. Let $$e$$ be the edge incident with node $$i$$ which lies on the path from the root vertex to node $$i$$. Let $$U_0= V(G) \setminus V_e$$. Since $$w(V_e) \geq s$$ we have $$w(U_0) \leq 2m-s$$. Since $$i$$ is not a leaf in $$T$$, other than its neighbour along edge $$e$$, $$i$$ has neighbours $$j_1, \ldots, j_h$$ for some $$h \geq 1$$. Suppose first that $$h=1$$, so there is exactly one such neighbour $$j_1$$ (not along the edge $$e$$). Since the edge $$ij_1$$ is oriented towards $$i$$, we have $$w(V_{i j_1})<s \leq w(V_e)$$, and so we cannot have $$X_{j_1} \supseteq X_i$$: hence $$X_{j_1}= X_i \setminus \{v\}$$ for some $$v \in X_i$$. Let $$U_1=V_{ij_1}$$ and $$U_2 = X_i \setminus U_1=\{v\}$$. Then $$w(U_1)<s$$ and $$w(U_2) =w(v) \leq d < s$$, and $$V(G)$$ is partitioned into $$U_0 \cup U_1 \cup U_2$$. Further, by Fact 4.2, any cross-edges in $$H$$ must be incident to vertices in $$X_i$$, and so there are no cross-edges in $$H'$$. Now suppose that $$h \geq 2$$, so node $$i$$ has multiple neighbours. Let $$U_1=V_{ij_1}, U_2=V_{ij_2}\setminus U_1,$$$$\ldots, U_{h} = V_{ij_h} \setminus (U_1 \cup \ldots \cup U_{h-1}) $$. As before, the orientations of the edges incident with node $$i$$ shows that $$w(U_j)<s$$ for each $$j =1,\ldots,h$$. Discard any empty sets amongst these sets $$U_j$$. Finally, note that $$X_{j_1}\cup X_{j_2}\supseteq X_i$$, since if neither of $$X_{j_1}$$ and $$X_{j_2}$$ contains $$X_i$$ then $$X_{j_1}=X_i\setminus \{v_1\}$$ and $$X_{j_2}=X_i\setminus \{v_2\}$$ for some $$v_1\neq v_2$$ in $$X_i$$. Hence $$U_1\cup U_2\supseteq X_i$$ and so $$\cup_{j=0}^{h} U_j=V(G)$$. Further, as before, by Fact 4.2 any cross-edges in $$H$$ must be incident to vertices in $$X_i$$, and so there are no cross-edges in $$H'$$. □ Proof of Theorem 1.11. Write $$d$$ for the maximum degree $$\Delta$$ of $$G$$ (note that $$G$$ will shrink during the proof but $$d$$ stays unchanged). Since $$q^*(G) \geq 0$$ for any graph $$G$$ we need to consider only the case where $$m \geq 4(t+1)d$$. Let $$s= 2((t+1)dm)^{\frac12}$$. Note that $$s \geq 4(t+1)d$$. Set $$\tilde{G}=G$$ and $$\tilde{m}=e(\tilde{G})$$. Observe that $$s>d$$, indeed $$s \geq 2d$$. As long as $$2\tilde{m} \geq s+d,$$ we use the last lemma repeatedly to ‘break off parts’ $$U_1, U_2, \ldots$$ and replace $$\tilde{G}$$ by its induced subgraph on $$U_0$$, where $${\rm vol}(U_0)\leq 2\tilde{m}-s$$. Suppose that we stop after $$j$$ steps, with $$2\tilde{m}=x$$ where $$0 \leq x <s+d$$. Since at each step the degree sum of $$\tilde{G}$$ decreases by at least $$s$$, we must have $$x \leq 2m - js$$, so $$js \leq 2m-x$$. At this stage, we have lost at most $$j(t+1) d$$ edges, and each of the parts ‘broken off’ from $$G$$ has degree sum $$< s$$. We claim that we can refine the current partition of $$V(G)$$ to a partition $$\mathcal A$$ such that each part has degree sum $$<s$$ and the number of cross-edges in $$G\setminus E'$$ (edges lost) is at most $$\frac{2m}{s} (t+1)d$$. There are two cases. Suppose first that $$x<s$$: then we have finished in $$j$$ steps, $$j \leq 2m/s$$, and we have lost at most $$\frac{2m}{s} (t+1)d$$ edges in $$G \setminus E'$$, as required. Suppose instead that $$x \geq s$$. Then $$js \leq 2m-x \leq 2m-s$$, so $$j +1 \leq 2m/s$$. We take one more step, with reduced threshold $$s'=s-d$$. Note that $$d< s' \leq 2\tilde{m} -d$$ (where $$2\tilde{m}=x$$). Thus we can apply Lemma 4.1 with the value $$s'$$, to complete the proof of the claim, since   \[2\tilde{m}-s' < s+d-(s-d) = 2d \leq s,\] and so we stop after $$j+1$$ steps. Now $$q^E_\mathcal A(G) \geq 1 - |E'|/m - 2(t+1)d/s$$. Also $$0\leq x_i < s$$ and $$\sum_i x_i \leq 2m$$ together imply $$\sum_i x_i^2 < 2ms$$; and so   \begin{equation}\label{eq.son2m} q_\mathcal A^D(G) \leq \frac{2ms}{4m^2}= \frac{s}{2m}. \end{equation} (7) Hence, by our choice of $$s$$,   \[1-|E'|/m - q_\mathcal A(G) \leq \tfrac{2(t+1)d}{s} + \tfrac{s}{2m} = 2 \left( \tfrac{(t+1)d}{m}\right)^{\frac12},\] which completes the proof. □ We may deduce Proposition 1.4 quickly from Theorem 1.11. Proof of Proposition 1.4. For each connected component $$H$$ of $$G$$, do the following. In $$H$$ choose a spanning tree together with one extra edge (observe that $$H$$ is not a tree since $$r \geq 2$$), and let $$E'_H$$ be the set of edges not chosen. Each unicyclic graph has treewidth 2, so $${\rm tw}(H\setminus E'_H)=2$$. Define $$E'=\cup_H E'_H$$, and note that $${\rm tw}(G\setminus E')=2$$ and $$|E'|=m-n$$, where $$G$$ has $$m=r n/2$$ edges. Hence by Theorem 1.11   \[q^*(G) \geq 1-2\left(\frac{3r}{m}\right)^{\frac12}- \left(1-\frac{n}{m}\right) = \frac{2}{r} - 2 \left(\frac{6}{n}\right)^{\frac12} \] as required. □ 5. Proofs for minimum and random modularity, $$\boldsymbol{q^-_r(n)}$$ and $$\boldsymbol{q^*(G_{n,r})}$$ In this section we prove Theorem 1.5, giving a lower bound on $$q_r^-(n)$$; and Theorems 1.6 and 1.7 giving lower and upper bounds which hold whp on $$q^*(G_{n,r})$$, the former for small $$r$$ ($$r=3,\ldots,12$$) and the latter for large $$r$$. The lower bound proofs are all centred around bisection width, and the upper bound proofs around edge-expansion. It is thus natural and convenient to prove all the lower bounds in the theorems first and then the upper bounds. 5.1 Bisection width and lower bounds on modularity Define the bisection width$${\rm bw}(G)$$ of an $$n$$-vertex graph $$G$$ to be   \[{\rm bw}(G) = \min_{|U| = \lfloor \frac{n}{2} \rfloor} e(U, \bar{U}),\] where the minimum is over all sets $$U$$ of $$\lfloor \frac{n}{2} \rfloor$$ vertices, and $$\bar{U}$$ denotes $$V(G)\setminus U$$. A corresponding minimizing partition shows that, for an $$r$$-regular graph $$G$$,   \begin{equation}\label{eqn.qbw} q^*(G) \geq \frac{1}{2} - \frac{2{\rm bw}(G)}{rn} - \frac1{2n^2}, \end{equation} (8) where we do not need the last (small) term if $$n$$ is even. Proof of Theorem 1.5. Now consider general $$r$$. By Theorem 1.1 of Alon [29], there is a constant $$c>0$$ such that, for all $$r$$ and all sufficiently large $$n$$, all $$n$$-vertex $$r$$-regular graphs $$G$$ satisfy   \[{\rm bw}(G)/n \leq r/4 - c \sqrt{r}.\] Hence, for each such graph $$G$$, using also (8) we have   \[q^*(G) \geq 2c/ \sqrt{r} - \frac1{2n^2} \geq c/ \sqrt{r}\] for $$n$$ sufficiently large. □ Proof of lower bounds in Theorem 1.6. Lower bounds for $$r=3$$ to $$8$$ are directly from the about $$2/r$$ bound in Proposition 1.4, so consider larger $$r$$. It was shown in [30] that whp the bisection width of a random 12-regular graph is at most 1.823n. By (8), this implies that whp $$q^*(G_{n,12})>0.196$$, as given in Theorem 1.6 (Table 1). Similar calculations apply for $$r=9,10,11$$ which have bisection widths at most 1.2317, 1.4278, 1.624 times $$n$$ respectively [30]. (Currently known results on bisection width do not improve on the $$2/r$$ lower bound from Proposition 1.4.) □ Proof of lower bound in Theorem 1.7. For large $$r$$, Dembo et al. [31, Theorem 1.5] show that whp $${\rm bw}(G_{n,r})/n = r/4-c'\sqrt{r}/2+o(\sqrt{r})$$, where the $$o(\sqrt{r})$$ error term is as $$r\to \infty$$ and $$c'=0.76321\pm 0.00003$$. By (8) this provides the lower bound in Theorem 1.7. □ 5.2 Edge-expansion and upper bounds on modularity In this subsection, we introduce graph parameters $$\beta(G)$$, $$\lambda(G)$$, $$i_u(G)$$, $$\alpha(G)$$ and $$\beta'(G)$$ related to edge-expansion; and give two lemmas concerning them, in preparation for proving the upper bounds on $$q^*(G)$$ in Theorems 1.6 and 1.7. First, we introduce a useful quantity $$\beta(G)$$ for a regular graph $$G$$, related to edge expansion. For a non-empty set $$S$$ of vertices in a graph $$G$$, let $$\bar{d}(S)$$ denote the average degree of the induced subgraph on $$S$$, so $$\bar{d}(S) = 2e(S)/|S|$$. Now let $$r \geq 2$$ and suppose that $$G$$ is $$r$$-regular and has $$n$$ vertices. Let   \[\beta(G) = \max_{S \neq \emptyset} \left\{\frac{\bar{d}(S)}{r} - \frac{|S|}{n} \right\}\] where the maximum is over all non-empty sets $$S$$ of vertices. Also, given an $$n$$-vertex graph $$G$$ such that the adjacency matrix has eigenvalues $$\lambda_ 1 \geq \cdots \geq \lambda_n$$, let   \[\lambda(G) = \max_{i>1} |\lambda_i| \;\;\; (\: =\max\{|\lambda_2|,|\lambda_n|\} \: ).\] The following lemma is the key to our upper bounds on $$q^*$$ for random regular graphs. A more general result implying that $$q^*(G) \leq \lambda/r$$ appeared earlier in [32] statement (18), phrased in terms of the ‘modularity matrix’ of $$G$$, which has largest eigenvalue equal to $$\lambda(G)$$ when $$G$$ is regular. We introduce $$\beta(G)$$ and give a short and straightforward proof. Lemma 5.1 Let $$G$$ be an $$r$$-regular graph, let $$\beta=\beta(G)$$, and let $$\lambda= \lambda(G)$$. Then   \[q^*(G) \leq \beta \leq \lambda/r.\] Proof. Let $$G$$ have $$n$$ vertices, let $$S$$ be a non-empty set of vertices, and let $$u=|S|/n$$. By Corollary 9.2.6 of Alon and Spencer [33] (see also Lemma 2.3 of Alon and Chung [34])   \[|e(S)-\frac12 r u^2n| \leq \frac12 \lambda un.\] Hence   \[\left| \frac{\bar{d}(S)}{r} - u \right| = \frac{|e(S)-\frac12 r u^2n|}{\frac12 run} \leq \lambda/r;\] and so $$\beta \leq \lambda/r$$. Now consider any partition $$\mathcal A=\{A_1, \ldots, A_k\}$$ of $$V(G)$$. Letting $$u_j=|A_j| / n$$, we have   \begin{eqnarray*} q_\mathcal A(G) &=& \sum_j \left(\frac{2e(A_j)}{r n} - \frac{(u_j r n)^2}{(rn)^2} \right) \\[-4pt] &=& \sum_j u_j \left( \frac{\bar{d}(A_j)}{r} - u_j\right)\\[-4pt] & \leq & \beta \, \sum_j u_j \;\; = \; \beta. \end{eqnarray*} Hence $$q^*(G) \leq \beta$$, as required. □ Now we relate $$\beta(G)$$ to edge expansion and the quantity $$\alpha(G)$$ defined below, so that we can use calculations from [35]. Following the notation of [35], for $$0<u\leq \frac{1}{2}$$ we define the $$u$$-edge-expansion$$i_u(G)$$ of an $$n$$-vertex graph $$G$$ by setting   $$ i_u(G)= \min_{0<|S|\leq un} \frac{e(S, \bar{S})}{|S|}, $$ where the minimum is over non-empty sets $$S$$ of at most $$un$$ vertices (and the value is taken to be $$\infty$$ if $$un<1$$). Observe that $$i_{1/2}(G)$$ is the usual edge expansion or isoperimetric number of $$G$$. Also, set   \[\alpha(G) = \min_{0<u \leq \frac12} \{u+i_u(G)/r \}.\] It is easy to see that we can also write $$\alpha(G)$$ as   \[\alpha(G) = \min_{0<|S| \leq \frac12 n} \left\{\frac{|S|}{n}+ \frac{e(S, \bar{S})}{r|S|} \right\}.\] Now consider a quantity $$\beta'$$ like $$\beta$$ but which at first sight might be smaller: let   \[\beta'(G) = \max_{0<|S| \leq \frac12 n} \left\{\frac{\bar{d}(S)}{r} - \frac{|S|}{n} \right\}.\] Lemma 5.2 For each regular graph $$G$$,   \[\beta(G) = \beta'(G) = 1-\alpha(G).\] Proof. Note first that $$\tfrac{\bar{d}(S)}{r} = \tfrac{r|S| - e(S,\bar{S})}{r|S|} = 1- \tfrac{e(S,\bar{S})}{r|S|}$$, so   \[\frac{\bar{d}(S)}{r} -\frac{|S|}{n} = 1- \left(\frac{|S|}{n} + \frac{e(S,\bar{S})}{r|S|} \right).\] It follows directly that $$\beta'(G) = 1- \alpha(G)$$. Now write $$\beta'$$ for $$\beta'(G)$$: we shall show that $$\beta'= \beta(G)$$. Let $$S$$ be a set of vertices with $$|S|/n=u > \frac12$$. We must show that $$\frac{\bar{d}(S)}{r} -u \leq \beta'$$. Since $$2e(S)=r|S| - e(S,\bar{S})$$ and similarly $$2e(\bar{S})=r(n-|S|) - e(S,\bar{S})$$, we have   \[ 2e(S) = 2e(\bar{S}) +r un-r(1\!-\!u)n = 2e(\bar{S}) + (2u\!-\!1)rn. \] Also $$\frac{2e(\bar{S})}{r(1- u) n} - (1-u) \leq \beta'$$, so $$2e(\bar{S}) \leq r (1-u)n \, (1-u+\beta')$$. Hence   \begin{eqnarray*} \frac{\bar{d}(S)}{r} -u \; &=& \; \frac{2e(S)}{r un} - u \;\; = \;\; \frac{2e(\bar{S})+(2u-1)rn}{r un} -u\\ & \leq & \frac{r(1-u)n (1-u+\beta') +(2u-1)rn}{run} -u\\ &=& \frac{(1-u) \beta'}{u} \; \leq \beta' \end{eqnarray*} since $$u \geq \frac12$$. This completes the proof. □ Proof of upper bounds in Theorem 1.6. Fix an integer $$r \geq 3$$. By Lemmas 5.1 and 5.2, $$1- q^*(G) \geq \alpha(G) = \min_{u\in (0,1/2]} f(u)$$ where $$f(u)=u+ i_u(G)/r$$. Thus, we want a lower bound on $$\alpha(G)$$. Let $$0 \leq u_0<u_1\leq 1/2$$. Since $$i_u(G)$$ is non-increasing in $$u$$, for $$u\in (u_0,u_1]$$ we have   \[f(u) = u+ \frac{i_u(G)}{r} \geq u + \frac{i_{u_1}(G)}{r} > f(u_1)-|u_1-u_0|.\] Fix $$\varepsilon >0$$, and let $$n=\lceil 1/\varepsilon \rceil$$. Then by considering the intervals $$((i-1)/2n, i/2n]$$ for $$i=1,\ldots n$$, we see that   \[\alpha(G) > \min_{i=1,\ldots,n} f(i/2n) \; - \varepsilon/2,\] and so we need lower bound at most $$n$$ values $$i_u(G)$$. Now consider a random $$r$$-regular graph $$G_{n,r}$$. For each particular $$u\in (0,1/2]$$, by Theorem 1.3 in [35] and the discussion in Section 7 of that article, we see that whp $$i_u(G_{n,r})\geq y/u$$ for each $$0<y< ru(1-u)$$ with $$\hat{f}_r(u,y)<0$$, where   \[\hat{f}_r(u,y)=\log \frac{r^{r/2}u^{(r-1)u}(1-u)^{(r-1)(u-1)}}{y^y(ru-y)^{(ru-y)/2}(r-ru+y)^{(r-ru+y)/2} }.\] (It is known [35] that $$\hat{f}_r(u,y)$$ is strictly concave in $$y$$, positive at $$y= ru(1-u)$$ and negative for sufficiently small $$y>0$$.) For a random cubic graph $$G_{n,3}$$, by finding appropriate values $$y$$, we deduce that whp $$\alpha(G_{n,3}) > 0.196$$, and so whp $$q^*(G_{n,3})< 0.804$$. Repeating for other values of $$r$$ yields the upper bounds given in Table 1. This completes the Proof of Theorem 1.6 (which first appeared in the thesis of the second author [36]). □ Proof of upper bound in Theorem 1.7. Let $$G_{n,r}$$ be a random $$r$$-regular graph (with $$r$$ fixed). Friedman [37] showed that, for each $$\varepsilon>0$$, whp $$\lambda(G_{n,r}) \leq 2\sqrt{r-1} + \varepsilon$$. Thus, by taking $$\varepsilon< 2\sqrt{r}-2\sqrt{r-1}$$, we see that whp $$\lambda(G_{n,r}) < 2\sqrt{r}$$. Hence by Lemma 5.1, whp $$q^*(G_{n,r}) < 2/ \sqrt{r}$$. This completes the Proof of Theorem 1.7. 6. Proofs for maximum modularity $$\boldsymbol{q_r^+(n)}$$ In this section, our main task is to prove Proposition 1.8. But first let us deal with Proposition 1.10, which has a short and easy proof, see [20] equation (11), or see for example [38] Lemma 2.1. We prove it here as we want the exact result. Proof of Proposition 1.10. Let the graph $$G$$ have $$m \geq 1$$ edges (we do not yet assume that $$G$$ is connected). Consider a partition $$\mathcal A=\{A_1, \ldots, A_k\}$$ of $$V(G)$$ into $$k \geq 2$$ parts, where $$A_j$$ has degree sum $$d_j$$ (and so $$\, \sum_j d_j =2m$$). Then   \begin{equation} \label{eqn.degtaxreg} q_{\mathcal A}^{D}(G) = \frac1{4m^2} \sum_j d_j^2 \geq \frac1{k} \end{equation} (9) since $$(1/k) \sum_j d_j^2 \geq (2m/k)^2$$ by convexity. If $$G$$ is connected, then there must be at least $$k-1$$ cross-edges; and then, since $$k/m + 1/k \geq 1/2\sqrt{m}$$,   \[q_{\mathcal A}(G) \leq 1- \frac{k-1}{m} - \frac1{k} \leq 1+\frac1{m} - \frac2{\sqrt{m}}.\] Similarly, if $$G$$ is 2-edge-connected, there must be at least $$k$$ cross-edges, and   \[ q_{\mathcal A}(G) \leq 1- \frac{k}{m} - \frac1{k} \leq 1- \frac2{\sqrt{m}}, \] which completes the proof. □ To prepare for the proof of Proposition 1.8, we first give an equivalent expression for the modularity of a regular graph, and give a preliminary lemma. Observe that for $$r$$-regular $$n$$-vertex graphs $$G$$ we have   \begin{equation}\label{eq.modis} q_\mathcal A(G)= 1-\sum_{A \in \mathcal A} \frac{|A|}{n} \left(\frac{e(A, \bar{A})}{r|A|} + \frac{|A|}{n} \right)\!, \end{equation} (10) where $$\bar{A}$$ denotes $$V(G)\backslash A$$. Here, the first term in the sum double counts the edges between the parts (and divides by twice the number of edges), and the second term takes care of the degree tax, which is now simply a function of the part sizes since $$G$$ is regular. For $$\emptyset \neq A \subseteq V(G)$$ let $$f_r(A,G) = e(A, \bar{A})/(r|A|)+ |A|/n$$ and write $$G[A]$$ for the subgraph of $$G$$ induced by $$A$$. We shall see that the unique minimizer of $$f$$ over $$r$$-regular graphs is the graph $$K_{r+1}$$. More fully, assuming that $$n \geq r+1$$ and $$rn$$ is even (so that the set $$\mathcal G(n,r)$$ of $$r$$-regular $$n$$-vertex graphs is non-empty), let $$f_r^*(n) := \min_{G\in \mathcal G(n,r)} \min_{\emptyset \neq A \subseteq V(G)} f_r(A, G)$$. Lemma 6.1 For $$n \geq r+1$$ with $$rn$$ even; $$f_r^*(n) = \frac{r+1}{n}$$, and $$f_r(A,G)$$ achieves this minimum exactly when $$G[A]=K_{r+1}$$ (and this is a component of $$G$$). Proof. Firstly note that if $$G[A]=K_{r+1}$$ then clearly $$f_r(A,G)=(r+1)/n$$. Now fix an $$r$$-regular graph $$G$$ on $$n$$ vertices, and let $$A$$ be a subset of the vertices such that $$G[A]\neq K_{r+1}$$. To prove the claim it will suffice to show that   \begin{equation}\label{eq.exactlywhat} \frac{e(A, \bar{A}) n }{r|A|} + |A| > r+1. \end{equation} (11) If $$|A|>r+1$$ then it is easy to see that (11) holds. Similarly if $$|A|=r+1$$ then there must be edges from $$A$$ to the rest of the graph as we assumed $$G[A]\neq K_{r+1}$$, but $$e(A,\bar{A})>0$$ and $$|A|=r+1$$ together imply that (11) holds, so we can assume that $$|A|<r+1$$. Set $$|A|=r+1-\ell$$ for some $$\ell>0$$. Observe that because $$G$$ is $$r$$-regular we have $$e(A, \bar{A})\geq (r+1-\ell)\ell$$. This is because each of the $$|A|=r+1-\ell$$ vertices can have at most $$r-\ell$$ of their incident edges within the part $$A$$ and so at least $$\ell$$ must be external. Hence,   $$\frac{e(A, \bar{A}) n }{r|A|} + |A| \geq \frac{(r+1-\ell)\ell n}{r(r+1-\ell)} +r+1-\ell = r+1 + \ell\Big(\frac{n}{r}-1\Big) \, > r+1$$ since $$n>r$$. This completes the proof of the lemma. □ Proof of Proposition 1.8 part (a). The sum in the expression for modularity in (10) is a weighted average of terms $$f_r(A,G)$$ and so   $$q^+_r (n) = 1- \min_{G \in \mathcal G(n,r) } \min_{\mathcal A} \sum_{A \in \mathcal A} \frac{|A|}{n} f_r(A,G) \leq 1-f_r^*(n)$$ with equality iff there is an $$r$$-regular graph $$G$$ with a vertex partition $$\mathcal A$$ such that $$\forall A\in \mathcal A$$, $$f_r(A,G)=f_r^*(n)$$. By the claim this means that a graph achieves the bound iff there is a vertex partition into disjoint copies of $$K_{r+1}$$. Hence if $$(r+1)|n$$, then $$q^+_r(n) = 1-\frac{r+1}{n}$$ with unique optimum graph the disjoint union of copies of $$K_{r+1}$$. Finally, for the case when $$(r+1)$$ does not divide $$n$$, for any graph on $$n$$ vertices there must be some part $$A$$ with $$|A|\neq r+1$$, and by the claim $$f_r(A,G)>(r+1)/n$$; and because modularity is a weighted average of such terms over all parts, we have $$q^+_r(n)<1-(r+1)/n$$. □ Proof of Proposition 1.8 part (b). First we show that $$g_r(n)$$ (defined in 3) is a lower bound on $$q_r^+(n)$$ for certain values of $$n$$. We see that if $$r$$ is even and $$n \geq r(r+1)$$, or if $$r$$ is odd and $$n \geq (r-1)(r+3)/2$$ (and $$rn$$ is even), then we have $$q^+_r(n) \geq g_r(n)$$. Consider the subcase when $$r$$ is even. Recall that we write $$n$$ as $$a(r+1)+b$$ where $$a$$ is a non-negative integer and $$0 \leq b \leq r$$. Assume that $$a \geq b$$, which must hold when $$n \geq r(r+1)$$. Let $$H_{r+2}$$ be $$K_{r+2}$$ less a perfect matching, which is an $$r$$-regular graph on $$r+2$$ vertices. Think of $$n$$ as $$b(r+2)+(a-b)(r+1)$$. Let $$G^*_n$$ be the $$n$$-vertex graph consisting of $$b$$ copies of $$H_{r+2}$$ and $$a-b$$ copies of $$K_{r+1}$$, all disjoint. Then with connected components partitions $$\mathcal C$$,   \begin{eqnarray*} q_{\mathcal C}^D(G^*_n) & = & \frac1{n^2} \left( b(r+2)^2 + (a-b) (r+1)^2 \right)\\[-3pt] & = & \frac1{n^2} \left( b(r+2)(r+1) + b(r+2) + (a-b) (r+1)^2 \right)\\[-3pt] & = & \frac1{n^2} ( (r+1)n + b(r+2)) \; = \; 1 - g_r(n). \end{eqnarray*} Hence $$q^+_r(n) \geq q_{\mathcal C}(G^*_n) = g_r(n)$$, as required. Now consider the subcase when $$r \geq 3$$ is odd. Observe $$b$$ must be even (and so $$b \leq r-1$$). Assume that $$a \geq b/2$$, which must hold when $$n \geq (r-1)(r+1)/2$$. Let $$H_{r+3}$$ be $$K_{r+3}$$ less a 2-factor (i.e. a spanning subgraph with each vertex degree 2, e.g. a Hamilton cycle), which is an $$r$$-regular graph on $$r+3$$ vertices. (There is no $$r$$-regular graph with $$r+2$$ nodes, since $$r+2$$ is odd.)Think of $$n$$ as $$(r+3)b/2 + (r+1)(a-b/2)$$. Let $$H_n^*$$ be the $$n$$-vertex graph consisting of $$b/2$$ copies of $$H_{r+3}$$ and $$a-b/2$$ copies of $$K_{r+1}$$, all disjoint. Then   \begin{eqnarray*} q_{\mathcal C}^D(H^*_n) & = & \frac1{n^2} \left( (b/2)(r+3)^2 + (a\!- b/2) (r+1)^2 \right)\\ & = & \frac1{n^2} \left( (b/2)(r+3)(r+1) + b(r+3) + (a\!- b/2) (r+1)^2 \right)\\ & = & \frac1{n^2} ( (r+1)n + b(r+3) ) \; = \; 1 - g_r(n). \end{eqnarray*} Hence $$q^+_r(n) \geq q_{\mathcal C}(H^*_n) = g_r(n)$$, as required. We have now shown in both cases that $$q^+_r(n) \geq g_r(n)$$ when claimed. Observe thatif $$r$$ is even, then $$\frac{b(r+2)}{n^2} \leq \frac{r(r+2)}{n^2}$$; and if $$r$$ is odd, then $$\frac{b(r+3)}{n^2} \leq \frac{(r-1)(r+3)}{n^2} \leq \frac{r(r+2)}{n^2}$$. Hence we always have   \begin{equation} \label{eqn.grngeq} g_r(n) \geq 1- \frac{r+1}{n} - \frac{r(r+2)}{n^2}. \end{equation} (12) The inequality (4) follows from inequality (12), since $$q^+_r(n) \geq g_r(n)$$ for $$n \geq r(r+1)$$, as we have seen. Next, we use the above result to show that we need only to consider regular graphs with ‘small’ connected components, and thus we need only to consider the connected components partition $$\mathcal C$$. Let $$G \in \mathcal G(n,r)$$, and let $$\mathcal A$$ be any vertex partition with a part $$A'$$ of size $$a =|A'| \geq 2(r+1)$$. Observe that $$f_r(A',G) \geq a/n$$, and for the other parts $$A \in \mathcal A$$, $$f_r(A,G) \geq (r+1)/n$$ by the claim in the previous proof. Thus   \begin{eqnarray*} 1- q_{\mathcal A}(G) &=& \sum_{A \in \mathcal A} \frac{|A|}{n} f_r(A,G) \; \geq \; \frac{n-a}{n} \left(\frac{r+1}{n} \right) + \frac{a}{n} \cdot \frac{a}{n}\\ &=& \frac{r+1}{n} + \frac{a}{n} \, \frac{a-(r+1)}{n} \; \geq \; \frac{r+1}{n} + \frac{2(r+1)^2}{n^2}. \end{eqnarray*} Hence, by (12) and the first part of the proposition,   \[q_{\mathcal A}(G) \leq 1- \frac{r+1}{n} - \frac{2(r+1)^2}{n^2} < g_r(n) \leq q_r^+(n)\] if $$n \geq r(r+1)$$. Therefore, for such $$n$$, if $$q_{\mathcal A}(G) = q^+_r(n)$$, then each part of $$\mathcal A$$ must have size at most $$2r+1 < 2(r+1)$$. Now let $$G$$ have a connected component $$H$$ of size $$s \geq 6 (r+1)$$. Suppose that $$\mathcal A$$ is a partition for $$G$$ with $$q_{\mathcal A}(G) = q_r^+(n)$$. Then, by the above, $$\mathcal A$$ must break $$G$$ into at least $$s/(2(r+1))$$ parts, and so there are at least $$s/(2(r+1)) -1$$ cross-edges for $$\mathcal A$$. Hence   \[1- q_{\mathcal A}(G) \geq \left(\frac{s}{2(r+1)}-1\right) \frac2{rn} + \frac{n-s}{n} \frac{r+1}{n} = \frac{r+1}{n} + \frac{s}{n} \left(\frac1{r(r+1)} - \frac{r+1}{n} \right) - \frac2{rn}.\] Now suppose that $$n \geq 2r(r+1)^2$$. Then   \[1- q_{\mathcal A}(G) \geq \frac{r+1}{n} + \frac{s}{n} \left(\frac1{2r(r+1)} \right) - \frac2{rn} \geq \frac{r+1}{n} + \frac1{rn}.\] But $$\frac1{rn} > \frac{r(r+2)}{n^2}$$ (since $$n > r^2(r+2)$$), so by (12) we have$$1- q_{\mathcal A}(G) > 1-g_r(n)$$, and so $$q_{\mathcal A}(G) < g_r(n) \leq q^+_r(n)$$. Thus we need only to consider regular graphs with all components of size less than $$6(r+1)$$. For an $$r$$-regular graph with a connected component $$H$$ on $$h$$ vertices, if $$h< 2 \sqrt{n/r}$$ (the ‘resolution limit’ [20]) then no optimal partition breaks up this component. For, if some optimal partition breaks $$H$$ into $$i \geq 2$$ parts, then   \begin{eqnarray*} 0 & \leq & \frac{(hr)^2-i(hr/i)^2}{(nr)^2} - \frac{i-1}{nr/2} \; = \; \frac{i-1}{n} \left(\frac{h^2}{i n} - \frac2{r} \right), \end{eqnarray*} so $$h^2 \geq 2i n/r \geq 4n/r$$. Thus for graphs with maximum component size $$h$$ and $$n > rh^2/4$$ vertices, the partition into connected components is the unique optimal partition. Hence, for $$n \geq 9 r (r+1)^2$$, we need only to consider graphs with the connected components partition $$\mathcal C$$. But now by the strict convexity of $$f(x)=x^2$$, we see that each graph with the maximum modularity must have at most two sizes of components, differing by one if $$r$$ is even and by 2 if $$r$$ is odd; and then it is easy to see that these must be the smallest two such sizes. Hence the graphs $$G^*_n$$ and $$H^*_n$$ constructed earlier achieve the maximum modularity, and any graph achieving the maximum modularity must be of this form. The only flexibility is in the choice of the missing 2-factor in the graphs $$H_{r+3}$$. This completes the proof of part (b), and thus of the whole of Proposition 1.8. □ In Proposition 1.8 part (b), it is not hard to improve the bound $$n \geq 9 r (r+1)^2$$ by a constant factor, though possibly our bound is very pessimistic and $$n \geq r(r+1)$$ may suffice. 7. Concluding remarks Two main contributions of this article are (a) the numerical bounds for the typical modularity of random regular graphs $$G_{n,r}$$ for $$3 \leq r \leq 12$$, which can be used to investigate the significance of observed clustering, together with determining the asymptotic behaviour for large $$r$$; and (b) showing high modularity for graphs in families such as the low degree treelike graphs, and thus for example for random planar graphs. We also investigated the minimum modularity $$q_r^-(n)$$, and the maximum modularity $$q_r^+(n)$$. Proposition 1.4 shows that the modularity of any large cubic graph is at least $$2/3 -o(1)$$; and in our simulations the highest modularity value of a partition found for a random cubic graph was about $$0.68$$ (though there is no guarantee this is close to optimal). Does the minimum modularity $$q_3^{-}(n) \to \tfrac23$$ as $$n \to \infty$$? Perhaps we even have $$q^*(G_{n,3}) \to \frac23$$ in probability as $$n \to \infty$$? If so, then random cubic graphs would give extremal examples for low modularity, but is it the case? The opposite conjecture was presented by the first author at the Bellairs workshop on Probability, Combinatorics and Geometry in April 2016. Conjecture 7.1 There exists $$\delta>0$$ such that $$q^*(G_{n,3}) \geq 2/3 + \delta$$ whp. Our results on cubic graphs highlight the importance of choosing the right baseline for modularity to assess significance. For suppose we have a cubic network $$G$$ with $$n$$ vertices, where $$n$$ is large. We have seen in Corollary 1.4 and Theorem 1.6 that $$q^*(G) > 0.66$$, just because $$G$$ is cubic. Hence, unless $$q_0>0.66$$, the fact that a partition $${\mathcal A}$$ has $$q_{\mathcal A}(G) =q_0$$ should certainly not be considered as evidence that $$\mathcal A$$ shows community structure. We have discussed the modularity of random regular graphs, $$q^*(G_{n,r})$$. This is very different from considering the modularity of a random partition of a fixed graph. For let $$G$$ be any fixed graph (with at least one edge). Fix $$k \geq 2$$, and suppose that we generate a random partition $$\mathcal A$$ of the vertices by placing each vertex into one of $$k$$ parts independently with probability $$1/k$$. Then   \begin{equation} \label{eqn.randpart} {\mathbb E}[q_{\mathcal A}(G)] < 0. \end{equation} (13) Thus comparing the modularity of a partition which we find to that of a random partition is likely to give a false positive! To see why (13) holds, observe that for an edge $$e$$ in $$G$$ the probability that both endpoints are placed in the same part is $$1/k$$, so $${\mathbb E}[q_{\mathcal A}^E(G)]=1/k$$; and by (9) the degree tax is always at least $$1/k$$, and sometimes larger. In a companion paper [14] (see also [36]) we prove that there is a phase transition for the modularity of Erdős-Rényi random graphs. Additionally we show in [39] that large subgraphs of lattices, and more generally all large graphs which embed in space with ‘small distortion’, have high modularity. Acknowledgements Thanks to Michael Krivelevich for comments at the meeting Combinatorics Downunder in Melbourne in 2016, which led us to Lemma 5.1. References 1. Reichardt J. & Bornholdt S. ( 2006) When are networks truly modular? Phys. D , 224, 20– 26. Google Scholar CrossRef Search ADS   2. Fortunato S. & Hric D. ( 2016) Community detection in networks: a user guide. Phys. Rep. , 659, 1– 44. Google Scholar CrossRef Search ADS   3. Lancichinetti A. & Fortunato S. ( 2011) Limits of modularity maximization in community detection. Phys. Rev. E. , 84, 066122. Google Scholar CrossRef Search ADS   4. Reichardt J. & Bornholdt S. ( 2006) Statistical mechanics of community detection. Phys. Rev. E. , 74, 016110. Google Scholar CrossRef Search ADS   5. Brandes U., Delling D., Gaertler M., Gorke R., Hoefer M., Nikoloski Z. & Wagner D. ( 2008) On modularity clustering. IEEE Trans Knowl. Data Eng.,  20, 172– 188. Google Scholar CrossRef Search ADS   6. Bagrow J. P. ( 2012) Communities and bottlenecks: trees and treelike networks have high modularity. Phys. Rev. E. , 85, 066118 Google Scholar CrossRef Search ADS   7. De Montgolfier Montgolfier., Soto M. & Viennot L. ( 2011) Asymptotic modularity of some graph classes. Algorithms Comput. , 435– 444. Google Scholar CrossRef Search ADS   8. Guimerà R., Sales-Pardo M. & Amaral L. A. N. ( 2004) Modularity from fluctuations in random graphs and complex networks. Phys. Rev. E. , 70, 025101. Google Scholar CrossRef Search ADS   9. Newman M. E. J. & Girvan M. ( 2004) Finding and evaluating community structure in networks. Phys. Rev. E. , 69, 026113. Google Scholar CrossRef Search ADS   10. Fortunato S. ( 2010) Community detection in graphs. Phys. Rep. , 486, 75– 174. Google Scholar CrossRef Search ADS   11. Porter M. A., Onnela J. K. & Mucha P. J. ( 2009) Communities in networks. Notices Amer. Math. Soc. , 56, 1082– 1097. 12. Bolla M., Bullins B., Chaturapruek S., Chen S. & Friedl K. ( 2015) Spectral properties of modularity matrices. Linear Alg. Appl. , 473: 359– 76. Google Scholar CrossRef Search ADS   13. Majstorović S. & Stevanović D. ( 2014) A note on graphs whose largest eigenvalues of the modularity matrix equals zero. Electron. J. Linear Algebra , 27, 256. Google Scholar CrossRef Search ADS   14. McDiarmid C. & Skerman F. ( 2017) Modularity of Erdős-Rényi random graphs. preprint. 15. Trajanovski S., Wang H. & Van Mieghem P. ( 2012) Maximum modular graphs. Eur. Phys. J. B , 85, 1– 14. Google Scholar CrossRef Search ADS   16. McDiarmid C. & Skerman F. ( 2013) Modularity in random regular graphs and lattices. Electron. Notes Discrete Math. , 43, 431– 437. Google Scholar CrossRef Search ADS   17. Blondel V. D., Guillaume J. L., Lambiotte R. & Lefebvre E. ( 2008) Fast unfolding of communities in large networks. J. Stat. Mech. Theory Exp. , 10, P10008. Google Scholar CrossRef Search ADS   18. Le Martelot E. & Hankin C. ( 2013) Fast multi-scale detection of relevant communities in large-scale networks. Comput. J. , 56, 1136– 1150. Google Scholar CrossRef Search ADS   19. Franke B. & Wolfe P. J. ( 2016) Network modularity in the presence of covariates. preprint arXiv:1603.01214 . 20. Fortunato S. & Barthémy M. ( 2007) Resolution limit in community detection. Proc. Natl. Proc. Natl. Acad. Sci. USA , 104, 36– 41. Google Scholar CrossRef Search ADS   21. Kleinberg J. & Tardos E. ( 2005) Algorithm Design . Boston, Massachusetts, United States: Addison Wesley. 22. Bodlaender H. L. ( 1998) A partial $$k$$-arboretum of graphs with bounded treewidth. Theoret. Comput. Sci. , 209, 1– 45. Google Scholar CrossRef Search ADS   23. Dvořák Z. & Norin S. ( 2014) Treewidth of graphs with balanced separations. preprint arXiv:1408.3869 . 24. Gilbert J. R., Hutchinson J. P. & Tarjan R. E. ( 1984) A separator theorem for graphs of bounded genus. J. Algorithms , 5, 391– 407. Google Scholar CrossRef Search ADS   25. McDiarmid C. & Reed B. ( 2008) On the maximum degree of a random planar graph. Combin. Probab. Comput. , 17, 591– 601. Google Scholar CrossRef Search ADS   26. Steger A. & Wormald N. C. ( 1999) Generating random regular graphs quickly. Combin. Probab. Comput. , 8, 377– 396. Google Scholar CrossRef Search ADS   27. Jeub L. G. S., Bazzi M., Jutla I. S. & Mucha P. J. ( 2011) A generalized louvain method for community detection implemented in MATLAB. http://netwiki.amath.unc.edu/GenLouvain ( 2011– 2017). 28. Janson S., Łuczak T. & Ruciński A. ( 2011) Random Graphs , vol. 45. Hoboken, New Jersey, United States: John Wiley. 29. Alon N. ( 1997) On the edge-expansion of graphs. Combin. Probab. Comput. , 6, 145– 152. Google Scholar CrossRef Search ADS   30. Díaz J., Serna M. J. & Wormald N. ( 2007) Bounds on the bisection width for random $$d$$-regular graphs. Theoret. Comput. Sci. , 382, 120– 130. Google Scholar CrossRef Search ADS   31. Dembo A., Montanari A. & Sen S. ( 2017) Extremal cuts of sparse random graphs. Ann. Probab.  45, 1190– 1217. Google Scholar CrossRef Search ADS   32. Van Mieghem Mieghem., Ge X., Schumm P., Trajanovski S. & Wang H. ( 2010) Spectral graph analysis of modularity and assortativity. Phys. Rev. E. , 82, 056113. Google Scholar CrossRef Search ADS   33. Alon N. & Spencer J. H. ( 2000) The probabilistic method. Wiley Ser. Discrete Math. Optim. , second edn. p. 140. 34. Alon N. & Chung F. R. K. ( 1988) Explicit construction of linear sized tolerant networks. Ann. Discrete Math. , 38, 15– 19. Google Scholar CrossRef Search ADS   35. Kolesnikm B. & Wormald N. ( 2014) Lower bounds for the isoperimetric numbers of random regular graphs. SIAM J. Discrete Math. , 28, 553– 575. Google Scholar CrossRef Search ADS   36. Skerman F. ( 2016) Modularity of Networks . Ph.D. thesis. 37. Friedman J. ( 2008) A Proof of Alon’s Second Eigenvalue Conjecture and Related Problems , vol. 195, No. 910. Memoirs of the American Mathematical Society. Providence, Rhode Island, United States: American Mathematical Society, pp. viii+ 100. 38. DasGupta B. & Desai D. ( 2013) On the complexity of Newman’s community finding approach for biological and social networks. J. Comput. System Sci. , 79, 50– 67. Google Scholar CrossRef Search ADS   39. McDiarmid C. & Skerman F. ( 2017+) Modularity of lattices and other well-embeddable graphs. preprint . 40. Prokhorenkova L. O., Prałat P. & Raigorodskii A. ( 2017) Modularity of models of complex networks. preprint arXiv:1701.03141 . © The authors 2017. Published by Oxford University Press. All rights reserved. http://www.deepdyve.com/assets/images/DeepDyve-Logo-lg.png Journal of Complex Networks Oxford University Press

Modularity of regular and treelike graphs

Loading next page...
 
/lp/ou_press/modularity-of-regular-and-treelike-graphs-kNBwpHcaPV
Publisher
Oxford University Press
Copyright
© The authors 2017. Published by Oxford University Press. All rights reserved.
ISSN
2051-1310
eISSN
2051-1329
D.O.I.
10.1093/comnet/cnx046
Publisher site
See Article on Publisher Site

Abstract

Abstract Clustering algorithms for large networks typically use modularity values to test which partitions of the vertex set better represent structure in the data. The modularity of a graph is the maximum modularity of a partition. We consider the modularity of two kinds of graphs. For $$r$$-regular graphs with a given number of vertices, we investigate the minimum possible modularity, the typical modularity, and the maximum possible modularity. In particular, we see that for random cubic graphs the modularity is usually in the interval $$(0.666, 0.804)$$, and for random $$r$$-regular graphs with large $$r$$ it usually is of order $$1/\sqrt{r}$$. These results help to establish baselines for statistical tests on regular graphs. The modularity of cycles and low degree trees is known to be close to 1: we extend these results to ‘treelike’ graphs, where the product of treewidth and maximum degree is much less than the number of edges. This yields for example the (deterministic) lower bound $$0.666$$ mentioned above on the modularity of random cubic graphs. 1. Introduction and statement of results The recently greater availability of data on large networks in many fields has led to increasing interest in techniques to discover network structure. In the analysis of these networks, clusters or communities found using modularity optimization have become a focus of study. Thus we need benchmarks to assess the statistical significance of observed community structure [1]. Further, the popularity of modularity-based clustering techniques [2, 3] and the link to the Potts model in statistical physics [4] have prompted much research into the modularity of graphs from various classes. The asymptotic value of the modularity of each of the following graph classes has been shown to approach the maximum value 1; cycles [5], low degree trees [6, 7] and lattices [8]. In this article, we focus on the (maximum) modularity $$q^*(G)$$ of a graph $$G$$ (precise definitions are given later) from one of two natural related and contrasting areas, namely regular graphs and treelike graphs. We think of a graph as treelike if by deleting a few edges we may obtain a graph with low treewidth (treewidth measures how much we have to ‘fatten’ a tree to contain the graph). We show that if a graph $$G$$ with many edges has low maximum degree, and by deleting a small proportion of its edges we may obtain a graph with low treewidth, then $$G$$ has high modularity. This result much extends the results mentioned earlier about cycles and trees; it shows that random planar graphs have modularity asymptotically 1; and it shows that every cubic (3-regular) graph has modularity at least about $$2/3$$. For $$r$$-regular graphs with a given number $$n$$ of vertices, we investigate the minimum possible modularity, the typical modularity, and the maximum possible modularity. For example, consider a random cubic graph $$G_{n,3}$$. Locally, looking out a fixed distance from a random vertex, it is a tree with high probability (whp), though globally it is far from treelike. We shall see that $$q^*(G_{n,3}) \leq 0.804$$ whp, and simulations suggest that the value may typically not be much above the deterministic lower bound of about $$2/3$$. In fact, we consider random $$r$$-regular graphs $$G_{n,r}$$ for each $$r$$ from 3 to 12 (see Table 1); and also show that when $$r$$ is large $$q^*(G_{n,r})$$ is contained whp in an interval that scales with $$1/\sqrt{r}$$. Table 1 Upper rows: lower and upper whp bounds on the modularity of random regular graphs $$G_{n,r}$$, for Theorem 1.6. Lower rows: average modularity found in simulations on randomly generated $$r$$-regular graphs with $$10000$$ nodes, using the Louvain method [17] and a method ‘Reshuffle’ from [18], seeSection 2.    $$r=$$     3  4  5  6  7  8  9  10  11  12  Bounds  $$q^*(G_{n,r}) >$$     0.666  0.499  0.399  0.333  0.285  0.249  0.226  0.214  0.204  0.196     $$q^*(G_{n,r}) <$$     0.804  0.684  0.603  0.544  0.499  0.463  0.433  0.408  0.388  0.370  Simulations  Louvain     0.679  0.531  0.440  0.380  0.343  0.312  0.284  0.262  0.244  0.230     Reshuffle     0.677  0.531  0.446  0.391  0.353  0.326  0.303  0.285  0.269  0.256     $$r=$$     3  4  5  6  7  8  9  10  11  12  Bounds  $$q^*(G_{n,r}) >$$     0.666  0.499  0.399  0.333  0.285  0.249  0.226  0.214  0.204  0.196     $$q^*(G_{n,r}) <$$     0.804  0.684  0.603  0.544  0.499  0.463  0.433  0.408  0.388  0.370  Simulations  Louvain     0.679  0.531  0.440  0.380  0.343  0.312  0.284  0.262  0.244  0.230     Reshuffle     0.677  0.531  0.446  0.391  0.353  0.326  0.303  0.285  0.269  0.256  Table 1 Upper rows: lower and upper whp bounds on the modularity of random regular graphs $$G_{n,r}$$, for Theorem 1.6. Lower rows: average modularity found in simulations on randomly generated $$r$$-regular graphs with $$10000$$ nodes, using the Louvain method [17] and a method ‘Reshuffle’ from [18], seeSection 2.    $$r=$$     3  4  5  6  7  8  9  10  11  12  Bounds  $$q^*(G_{n,r}) >$$     0.666  0.499  0.399  0.333  0.285  0.249  0.226  0.214  0.204  0.196     $$q^*(G_{n,r}) <$$     0.804  0.684  0.603  0.544  0.499  0.463  0.433  0.408  0.388  0.370  Simulations  Louvain     0.679  0.531  0.440  0.380  0.343  0.312  0.284  0.262  0.244  0.230     Reshuffle     0.677  0.531  0.446  0.391  0.353  0.326  0.303  0.285  0.269  0.256     $$r=$$     3  4  5  6  7  8  9  10  11  12  Bounds  $$q^*(G_{n,r}) >$$     0.666  0.499  0.399  0.333  0.285  0.249  0.226  0.214  0.204  0.196     $$q^*(G_{n,r}) <$$     0.804  0.684  0.603  0.544  0.499  0.463  0.433  0.408  0.388  0.370  Simulations  Louvain     0.679  0.531  0.440  0.380  0.343  0.312  0.284  0.262  0.244  0.230     Reshuffle     0.677  0.531  0.446  0.391  0.353  0.326  0.303  0.285  0.269  0.256  1.1 Modularity of a graph The definition of modularity was first introduced by Newman and Girvan in [9]. Many or indeed most popular algorithms used to search for clusterings on large data sets are based on finding partitions with high modularity [2, 3]. See [10, 11] for surveys on community detection including modularity based methods. In order to define the modularity of a graph $$G$$, we first define the modularity $$q_\mathcal A(G)$$ for a partition $${\mathcal A}$$ of its vertex set. This is a measure designed to score highly when most edges fall within the parts, but to be penalized when some parts have large sums of degrees. Denote the number of edges in the subgraph induced by vertex set $$A$$ by $$e(A)$$, and let the volume $${\rm vol} (A)$$ of $$A$$ be the sum of the degrees (in the whole graph $$G$$) of the vertices in $$A$$. Let $$G$$ be a graph with $$m\geq 1$$ edges. For a vertex partition $$\mathcal A$$ of $$G$$, we define   \[\begin{split} q_\mathcal A(G) & = \frac{1}{2m}\sum_{A \in \mathcal A} \sum_{u, v \in A} \left( {\mathbf 1}_{uv\in E} - \frac{\deg(u) \deg(v)}{2m} \right)\\ &= \frac{1}{m}\sum_{A \in \mathcal A} e(A) - \frac{1}{4m^2}\sum_{A \in \mathcal A} {\rm vol} (A)^2 \; = \; q_\mathcal A^E(G) - q_\mathcal A^D(G), \end{split}\] where the edge-contribution (or coverage) $$q_\mathcal A^E(G)$$ and the degree-tax$$q_\mathcal A^D(G)$$ are given by   \[q_\mathcal A^E(G) = \frac{1}{m}\sum_{A \in \mathcal A} e(A) \;\;\; \mbox{ and } \;\;\; q_\mathcal A^D(G) = \frac{1}{4m^2}\sum_{A \in \mathcal A} {\rm vol} (A)^2.\] The modularity$$q^*(G)$$ of the graph $$G$$ is defined by $$q^*(G)=\max_{\mathcal A}(G)$$, where the maximum is over all partitions $$\mathcal A$$ of the vertex set. By definition, we have $$0 \leq q^*(G) <1$$ for each non-trivial graph $$G$$. For example, complete graphs, stars and more generally all complete multipartite graphs have modularity 0 (as noted in [5, 7] and [12, 13], respectively); and it was shown recently in [14, 15] that near-complete graphs also have modularity 0. At the other extreme, the $$n$$-cycle $$C_n$$ has modularity near 1, see (1) below. A graph $$G$$ with no edges is defined to have modularity $$1$$ for any partition $$\mathcal A$$ [5]. 1.2 Modularity of regular graphs Let $$\mathcal G(n,r)$$ denote the set of all $$r$$-regular graphs with $$n$$ vertices, say with vertex set $$\{1,\ldots,n\}$$. It is easy to see that this set is non-empty if and only if $$n \geq r+1$$ and $$rn$$ is even. Assume that this condition holds (as we shall often do implicitly). Define $$q_r^-(n)$$ to be the minimum modularity $$q^*(G)$$ for an $$n$$-vertex $$r$$-regular graph $$G$$, that is   \[q_r^-(n) = \min \{ q^*(G) : G \in \mathcal G(n,r) \}\] and similarly let   \[q_r^+(n) = \max \{ q^*(G) : G \in \mathcal G(n,r) \}.\] Also let $$G_{n,r}$$ denote a random graph sampled uniformly from $$\mathcal G(n,r)$$. We shall be particularly interested in the behaviour of the random variable $$q^*(G_{n,r})$$. When an event holds with probability tending to 1 as $$n\rightarrow \infty,$$ we say that it holds with high probability (whp). Our main results on regular graphs are Theorems 1.5, 1.6 and 1.7. Let us consider first $$q_r^-(n)$$ and $$q^*(G_{n,r})$$, which are closely related, and then $$q_r^+(n)$$. To introduce the results, we start with the simpler cases $$r=1$$ and $$r=2$$. The case $$r=1$$ is trivial, as an $$n$$-vertex 1-regular graph $$G$$ must consist of $$n/2$$ disjoint edges. Since each part in an optimal partition must induce a connected graph, it is easy to check that the unique optimal partition has one part for each edge, and $$q^*(G)= 1-2/n$$. The case $$r=2$$ is not trivial, though it is simpler than for $$r \geq 3$$: we give it a separate subsection. 1.2.1 2-regular graphs For the minimum modularity $$q_2^-(n)$$, note first that $$\tfrac{5}{\sqrt{6}} \approx 2.041$$. Proposition 1.1 The minimum modularity $$q_2^-(n)$$ satisfies $$q_2^-(n) = 1- \tfrac{5}{\sqrt{6n}} +O(\tfrac1{n})$$. Proposition 1.2 The random 2-regular graph $$G_{n,2}$$ satisfies   \[q^*(G_{n,2}) = 1- \tfrac{2}{\sqrt{n}} + o \left(\tfrac{\log^2n}{n}\right) \;\; \mbox{ whp}.\] For the $$n$$-cycle $$C_n$$, by [5, Theorem 6.7] (see also the comments following Proposition 1.10 below), we have   \begin{equation} \label{eqn.Cn} q^*(C_n) = 1- \tfrac{2}{\sqrt{n}} + O\left(\frac1{n}\right)\!. \end{equation} (1) Thus whp $$q^*(G_{n,2})$$ is extremely close to $$q^*(C_n)$$. Propositions 1.1 and 1.2 show that whp $$q^*(G_{n,2})$$ is very close to the minimum possible value $$q_2^-(n)$$, indeed whp   \[q^*(G_2) - q_2^-(n) \sim \tfrac{2}{\sqrt{n}} - \tfrac{5}{\sqrt{6n}} \approx \tfrac{0.04}{\sqrt{n}}.\] It is easier to determine the maximum modularity $$q_2^+(n)$$. For example, $$q_2^+(n) = 1-\tfrac{3}{n}$$ when $$n$$ is divisible by 3, and is attained by $$n/3$$ disjoint triangles. Indeed we have a full story: Proposition 1.3 For each $$n \geq 3$$  \begin{equation}\label{eq.maxq2} q_2^+(n) = \begin{cases} 1-\tfrac{3}{n} & \mbox{ if } n \equiv 0 \mod{3}\\ 1-\tfrac{3}{n} - \frac{4}{n^2} & \mbox{ if } n \equiv 1 \mod{3}\\ 1-\tfrac{3}{n} - \frac{8}{n^2} & \mbox{ if } n \equiv 2 \mod{3}. \end{cases} \end{equation} (2) For $$n \geq 3$$, the maximum value is attained if and only if: $$G$$ is a disjoint union of $$n/3$$ copies of $$C_3$$ when $$n \equiv 0 \mod{3}$$; $$G$$ is a disjoint union of one $$C_4$$ and $$(n-4)/3$$$$C_3$$’s when $$n \equiv 1 \mod{3}$$; and $$G$$ is a disjoint union of two $$C_4$$’s and $$(n-4)/3$$$$C_3$$’s when $$n \equiv 2 \mod{3}$$ and $$n \geq 8$$, and $$G$$ is a five cycle $$C_5$$ when $$n=5$$. 1.2.2 Minimum possible modularity $$q_r^-(n)$$ For $$r=3,\ldots,8$$, the following deterministic result gives the best lower bound we know to hold whp for $$q^*(G_{n,r})$$. (These lower bounds were originally proved in [16] to hold whp using a Hamilton cycle construction.) It will follow quickly from Theorem 1.11 on treewidth and maximum degree. Proposition 1.4 For each $$r\geq 2$$,   \[q_r^-(n) \geq \frac2{r} - 2 \sqrt{\frac6{n}}\] for each possible value of $$n$$. Now consider large $$r$$. Theorem 1.5 There is a constant $$c>0$$ such that, for each positive integer $$r$$,   \[q_r^-(n) \geq c/\sqrt{r}\] for each sufficiently large $$n$$ (with $$rn$$ even). For each $$r \geq 3$$, our best upper bounds on $$q_r^-(n)$$ will come from $$q^*(G_{n,r})$$. 1.2.3 Random modularity $$q^*(G(n,r))$$ How should we assess the statistical significance of clusters observed in regular networks? There has been recent interest in estimating the modularity of random graphs [1, 14, 15, 19]. In order to tell if a given partition shows statistically significant clustering in a network, it is natural to compare the modularity score to that of a corresponding random graph model [1, 2]. We give results which bound the modularity of random $$r$$-regular graphs. In Theorem 1.6, we consider small values of $$r$$; and improve results in [16]. After that, in Theorem 1.7 we consider larger values of $$r$$. Theorem 1.6 For $$r=3,\ldots, 12$$, the modularity of a random $$r$$-regular graph $$G_{n,r}$$ whp lies in the range indicated in Table 1 (see also Fig. 1). In particular, $$0.666< q^*(G_{n,3}) < 0.804$$ whp. Fig. 1. View largeDownload slide Simulation results for $$n=10000$$ nodes and proven theoretical bounds for random $$r$$-regular graphs with degrees $$r=3,\ldots,10$$. Each cross indicates the better computed modularity returned by two methods (see Section 2), averaged over ten sampled graphs with $$10000$$ nodes. Theorem 1.6 says that the modularity of a random regular graph $$G_{n,r}$$ whp lies in the interval shown. Fig. 1. View largeDownload slide Simulation results for $$n=10000$$ nodes and proven theoretical bounds for random $$r$$-regular graphs with degrees $$r=3,\ldots,10$$. Each cross indicates the better computed modularity returned by two methods (see Section 2), averaged over ten sampled graphs with $$10000$$ nodes. Theorem 1.6 says that the modularity of a random regular graph $$G_{n,r}$$ whp lies in the interval shown. The lower bounds given for $$r=3$$ to 8 in Table 1 (and Fig. 1) are deterministic bounds from Proposition 1.4. Theorem 1.7 For each (fixed) integer $$r \geq 3$$, the random $$r$$-regular graph $$G_{n,r}$$ satisfies   \[q^*(G_{n,r}) < 2/\sqrt{r} \; \mbox{ whp};\] and there is a constant $$r_0$$ such that for each $$r \geq r_0$$  \[q^*(G_{n,r}) > 0.7631/\sqrt{r} \; \mbox{ whp}.\] For large $$r$$, the theorem shows that the modularity of a random $$r$$-regular graph $$q^*(G_{n,r})$$ whp tracks the minimum modularity $$q^-_r(n)$$, in the sense that both are of order $$\Theta(1/\sqrt{r})$$. For each given $$r\geq 3$$, it is an interesting open question how close $$q^*(G_{n,r})$$ typically is to $$q_r^-(n)$$. Can we construct $$r$$-regular graphs with modularity less than that for random graphs $$G_{n,r}$$? 1.2.4 Maximum possible modularity $$q_r^+(n)$$ The maximum possible modularity $$q_r^+(n)$$ is easier to handle than $$q_r^-(n)$$ and $$q^*(G_{n,r})$$, though it may be less important than them. We have already discussed the much easier case $$r=2$$, and in Proposition 1.3 we gave a full story for this case. In Proposition 1.8 below, we see that in general we have $$q^+_r(n) \leq 1-\frac{r+1}{n}$$, and we define a function $$g_r(n)$$ such that $$g_r(n) = 1 - \frac{r+1}{n} - O(1/n^2)$$, and $$q^+_r(n) = g_r(n)$$ for sufficiently large $$n$$. Also, we identify the most modular $$r$$-regular graphs on $$n$$ vertices (apart from some small values). Proposition 1.8 contains and extends Proposition 1.3 except for the ‘$$n$$ sufficiently large’ qualification. These results complement the extremal results in [15, 20]. The most modular connected graphs with a given number of edges were discussed in [20]; and later [15] investigated the most ‘$$k$$-modular’ connected graphs parameterized by the number $$m$$ of edges and the number $$k$$ of parts, as well as the most 2-modular graphs parameterized by $$m$$ and the number $$n$$ of vertices. Proposition 1.8 Let $$r \geq 2$$ be an integer. (a) The maximum modularity $$q^+_r(n)$$ of any $$r$$-regular graph on $$n$$ vertices satisfies   $$q^+_r(n) \leq 1-\frac{r+1}{n}$$ with equality achieved if and only if $$r+1$$ divides $$n$$; and for this case the unique way to attain the optimum is for the graph to consist of $$n/(r+1)$$ disjoint copies of $$K_{r+1}$$, with the connected components partition $$\mathcal C$$. (b) Given a positive integer $$n$$, write $$n$$ as $$a(r+1)+b$$ where $$a$$ is a non-negative integer and $$0 \leq b \leq r$$, and let   \begin{equation} \label{eqn.qplus} {g_r}(n) = 1 - {{r + 1} \over n} - {{b{\kern 1pt} (r + 2 + {{\bf{1}}_{r\quad {\rm{odd}}}})} \over {{n^2}}}. \end{equation} (3) If $$rn$$ is even and $$n$$ is sufficiently large (e.g. if $$n \geq 9 r (r+1)^2$$) then $$q^+_r(n) = g_r(n)$$, and this value is attained exactly for the graphs described in the proof, with the connected components partition $$\mathcal C$$. It will follow easily from the above result and its proof—see the comment following (12)—that for each $$n\geq r(r+2)$$ we have   \begin{equation}\label{eq.approxbestmod} q^+_r(n)\geq 1- \frac{r+2}{n}, \end{equation} (4) so the upper bound (from part (a)) and the lower bound differ by at most $$1/n$$. Perhaps, the upper bound holds for a much wider range of graphs? It seems likely that it holds for graphs with minimum degree at least $$r$$. We go further, and make a plausible but more speculative conjecture. Conjecture 1.9 For each integer $$r \geq 1$$, if an $$n$$-vertex graph has average degree at least $$r$$, then $$q^*(G) \leq 1 - \frac{r+1}{n}$$. The maximum modularity is considerably smaller if we consider only connected graphs. Proposition 1.10 Let the graph $$G$$ have $$m \geq 1$$ edges. If $$G$$ is connected then   \[q^*(G) \leq 1 - \tfrac{2}{\sqrt{m}} +\tfrac1{m} ,\] and if $$G$$ is 2-edge-connected then   \[q^*(G) \leq 1 - \tfrac{2}{\sqrt{m}}.\] The last result can be tight. Since $$C_n$$ is 2-connected, it gives $$q^*(C_n) \leq 1- 2/\sqrt{n}$$. If $$n=t^2$$ for an integer $$t \geq 2$$, then partitioning into $$t$$ paths of $$t$$ vertices shows that $$q^*(C_n) = 1- 2/\sqrt{n}$$. In general, partitioning into $$t= \lceil \sqrt{n} \rceil$$ paths each with $$t-1$$ or $$t$$ vertices yields equation (1). 1.3 Treewidth and maximum degree Bagrow makes a study of the modularity of some trees and treelike graphs in [6]. He shows that Galton–Watson trees and $$k$$-ary trees have modularity tending to one. In [7], it is shown that any tree with maximum degree $$\Delta(G)=o(n^{1/5})$$ has asymptotic modularity one. We shall see that this result extends to all trees with $$\Delta(G)=o(n)$$; and indeed it extends to all low-degree graphs which are ‘treelike’, in that they are ‘close’ to graphs with low treewidth. This forms Theorem 1.11, our main result in this section. Treewidth is a central notion in the study of graphs and the design of algorithms [21]: see [22] for a survey. Let us recall the definitions. A tree-decomposition of a graph $$G=(V,E)$$ is a pair consisting of a tree $$T=(I, F)$$ and a family $$( X_i : i \in I ) $$ of subsets of $$V$$ (‘bags’), one for each node $$i$$ of $$T$$, such that 1. $$\cup_{i \in I} X_i = V$$ 2. for each edge $$vw \in E$$ there is a node $$i \in I$$ such that $$v, w\in X_i$$ 3. for all nodes $$i,j,k\in I$$, if $$j$$ is on the path between $$i$$ and $$k$$ in $$T$$, then $$X_i \mathcal Ap X_k \subseteq X_j$$. The width of a tree decomposition is $$\max_{i \in I} |X_i| - 1$$; and the treewidth$${\rm tw}(G)$$ of a graph $$G$$ is the minimum width over all tree decompositions of $$G$$. Thus trees have treewidth 1, and indeed they are exactly the connected graphs with treewidth 1. Cycles have treewidth 2; and the graphs with treewidth at most 2 are exactly the series-parallel graphs. The following result is our key tool for lower bounding the modularity of graphs which have small degrees, and which have small treewidth or can can be made so by deleting a few edges. Theorem 1.11 Let $$G$$ be a graph with $$m\geq 1$$ edges and maximum degree $$\Delta=\Delta(G)$$, and let $$E'$$ be a subset of the edges such that $${\rm tw}(G\backslash E')\leq t$$. Then the modularity $$q^*(G)$$ satisfies   $$q^*(G) \geq 1- 2((t+1)\Delta/m)^{1/2}-|E'|/m.$$ Proposition 1.4 on $$q_r^-(n)$$ is a corollary which we shall deduce quickly from Theorem 1.11. Our second corollary of Theorem 1.11 is immediate. Corollary 1.12 For $$m=1,2, \ldots$$ let $$G_m$$ be a graph with $$m$$ edges. If $${\rm tw}(G_m) \cdot \Delta(G_m) = o(m)$$ then $$q^*(G_m) \to 1$$ as $$m \to \infty$$. This result is best possible, in that we cannot replace $$o(m)$$ by $$O(m)$$: here are two examples. (a) If $$G$$ is the star $$K_{1,m}$$ (with treewidth 1 and maximum degree m) then $${\rm tw}(G) \cdot \Delta(G) = 1 \cdot m = m$$ and $$q^*(G)=0$$ [7]. (b) For the random cubic graph $$G = G_{n,3}$$ on $$n$$ vertices (with $$m=3n/2$$) we have $${\rm tw}(G) \cdot \Delta(G) = 3 \, {\rm tw}(G) = O(m)$$. However, by Theorem 1.6, $$q^*(G_{n,3}) \leq 0.804$$ whp. Corollary 1.12 shows that a random planar graph $$G_n$$ with $$n$$ vertices whp has modularity near 1. For $${\rm tw}(G_n)=O(\sqrt{n})$$ by [23, 24], whp $$\Delta(G_n)=O(\log n)$$ [25], and whp $$m=\Theta(n)$$; and so whp $$q^*(G_n) \geq 1 - O((\log n)^{\frac12}/n^{\frac14}) \; = 1-o(1).$$ The same also holds for random graphs on any fixed surface. Plan of the article In the next section we briefly discuss our simulations. In the following section, we prove Propositions 1.1, 1.2 and 1.3 which concern 2-regular graphs. After that, in Section 4, we prove Theorem 1.11 on treelike graphs and show that this implies Proposition 1.4. Theorem 1.5 on minimum modularity $$q_r^-(n)$$, and Theorems 1.6 and 1.7 on random modularity $$q^*(G_{n,r})$$ are all proven in Section 5. Then in Section 6, we prove our results on maximum modularity. Finally, in Section 7 we make some concluding remarks. 2. Simulations For each $$r =3,\ldots,12$$ we generated ten instances of a random $$r$$-regular graph on $$10000$$ nodes. The graphs were generated using a variant of the configuration model which was shown to converge to the uniform distribution in [26]. Modularity was optimized using two different methods, with Table 1 recording the averages for each method. Both methods start with each node in its own part (community). The Louvain method [17] as implemented in [27] considers the nodes in turn, and reshuffles a node into a different part if that increases the modularity (choosing a part which leads to the greatest increase). It then forms a weighted reduced graph with a node for each part, and the process is repeated on the reduced graph. The other method, ‘Reshuffle’, follows Algorithm 1 of [18]. It has the same first phase. The second phase considers each part and merges it with a different part if that increases the modularity (again, choosing the part which leads to the greatest increase). It then returns to the node shuffling phase, with the same nodes (we do not form a reduced graph, which would freeze earlier decisions). There are no guarantees on the performance of these modularity optimizing heuristics. In Fig. 1, we mark with an ‘X’ the average value of the larger (better) of the output values of the two algorithms (which, with figures rounded to three decimal places as here, is the same as the larger of the averages), together with the theoretical interval for the modularity given in Theorem 1.6. 3. Proofs for 2-regular graphs We first prove Proposition 1.2 concerning the modularity $$q^*(G_{n,2})$$ of a random 2-regular graph, using two preliminary lemmas; and then give the longer proof of Proposition 1.1, which concerns $$q_2^-(n)$$ and the least modular 2-regular graphs. Finally, we prove Proposition 1.3 on $$q_2^+(n)$$: it turns out to be easier to prove this result directly than to deduce it from Proposition 1.8 (because of the ‘$$n$$ sufficiently large’ qualification in the latter result). Lemma 3.1 Let $$G=(V,E)$$ and $$G'=(V,E')$$ be two graphs each with vertex set $$V$$ and $$m$$ edges, and with the same vertex degrees. Then   \[| q^*(G)-q^*(G')| \leq |E \Delta E'|/(2m).\] Proof. Let $$\mathcal A$$ be a partition of $$V$$. Then $$q_{\mathcal A}^E(G) - q_{\mathcal A}^E(G') \leq |E \setminus E'|/m = |E \Delta E'|/(2m)$$ and $$q_{\mathcal A}^D(G) = q_{\mathcal A}^D(G')$$, so $$q_{\mathcal A}(G) - q_{\mathcal A}(G') \leq |E \Delta E'|/(2m)$$. Hence $$q_{\mathcal A}(G) - q^*(G') \leq |E \Delta E'|/(2m)$$. But this holds for each partition $$\mathcal A$$, so $$q^*(G) - q^*(G') \leq |E \Delta E'|/(2m)$$; and the lemma follows. □ Lemma 3.2 For $$n$$ sufficiently large, the expected number of cycles in a random 2-regular $$n$$-vertex graph is at most $$\log n$$. Proof. We use the configuration model, see for example [28]. Let $$f(n)$$ be the number of perfect matchings on a set of $$n$$ vertices. Then $$f(2n) = (2n-1)!! = (2n-1)(2n-3) \cdots 3 \cdot 1$$. Let $$M_n$$ be a random 2-regular $$n$$-vertex multigraph. For each integer $$k$$ with $$3 \leq k \leq n$$, the expected number $$g(k,n)$$ of $$k$$-cycles in $$M_n$$ equals   \begin{eqnarray*} \binom{n}{k} \frac{(k-1)!}{2} \, 2^{k-1} \frac{f(n-2k)}{f(2n)} & = & \frac{1}{4k} \, \frac{(n)_k 2^k}{\prod_{i=0}^{k-1} (2n-(2i+1))} \\ & = & \frac{1}{4k} \, \frac{\prod_{i=0}^{k-1} (2n-2i)}{\prod_{i=0}^{k-1} (2n-(2i+1))}. \end{eqnarray*} Hence, by comparing factors, $$g(k,n) \leq \frac1{4k} \frac{2n}{2n-(2k-1)}$$ (and $$g(k,n) \geq \frac1{4k} $$). Since $$\sum_{k >n/t} g(k,n) < t$$, taking $$t=\sqrt{\log n}$$ say, we see that $$\sum_{k=3}^{n} g(k,n) \leq (1/4 +o(1)) \log n$$. But the probability that $$M_n$$ is simple tends to $$e^{-3/4}$$, see for example Corollary 9.7 of [28]. Hence, the expected number of cycles in $$G_2$$ is at most $$(e^{3/4}/4 +o(1)) \log n$$, and the lemma follows. □ Proof of Proposition 1.2. Let $$\omega(n) \to \infty$$ as $$n \to \infty$$. By the last lemma and Markov’s inequality, whp $$G_2$$ has at most $$\omega(n) \log n$$ cycles, and so there is a copy of $$C_n$$ such that the symmetric difference of the edge sets has size at most $$4 \omega(n) \log n$$. Thus by Lemma 3.1, whp $$|q^*(G_2)-q^*(C_n)| \leq 2 \omega(n) \log n /n$$. Hence, by the result on $$q^*(C_n)$$, whp $$q^*(G_2) = 1-2/\sqrt{n} + O(\omega(n) \log n /n)$$. Choosing $$\omega(n)=o(\log n)$$ completes the proof. □ Proof of Proposition 1.1. We may and shall restrict our attention to partitions into connected parts (as noted earlier). Suppose we are given a (large) integer $$n$$. The $$n$$-{cost} $$f(t,{\mathcal A})$$ of a partition $$\mathcal A$$ of $$C_t$$ into $$k>1$$ parts with $$t_1,\ldots,t_k$$ vertices is   \[f(t,{\mathcal A})= \tfrac{k}{n} + \tfrac{\sum_i t_i^2}{n^2}.\] Here the $$n$$-cost refers to the contribution to $$1-q^*(G)$$. For a given $$k$$, this cost is minimized when the $$t_i$$ are balanced (i.e. differ by at most 1), so there is essentially just one partition to consider. Let $$F_k(t)$$ be the $$n$$-cost of a balanced $$k$$-partition of $$C_t$$. Of course $$F_1(t)= \tfrac{t^2}{n^2}$$. Write $$t$$ as $$ak+b$$ with $$0 \leq b \leq a-1$$ (where $$a=\lfloor t/k\rfloor$$). Then $$t=(k-b)a +b(a+1)$$, so for $$2 \leq k \leq t$$  \[F_k(t)= \tfrac{k}{n} + \tfrac{(k-b)a^2 + b(a+1)^2}{n^2}.\] Let $$f_k(t)$$ be defined for real $$t$$ with $$0<t \leq n$$, and be the natural approximation to $$F_k(t)$$, namely $$f_1(t)= \tfrac{t^2}{n^2}$$, and $$f_k(t)= \tfrac{k}{n} + \tfrac{t^2}{kn^2}$$ for $$k \geq 2$$. Then $$F_k(t) \geq f_k(t)$$ by convexity. Also   \begin{eqnarray} \notag F_k(t)-f_k(t) & = & \tfrac1{n^2} ((k-b)a^2+b(a+1)^2 - \tfrac{t^2}{k}\\ \label{eq.approxcost} & = & \tfrac{b(k-b)}{ k n^2} \;\; \leq \tfrac{k}{4n^2}. \end{eqnarray} (5) The approximate ‘unit $$n$$-cost’ $$g_k(t)=f_k(t)/t$$ is given by $$g_1(t)= \tfrac{t}{n^2}$$ and $$g_k(t)= \tfrac{k}{nt} + \tfrac{t}{kn^2}$$ for $$k \geq 2$$. Let $$F_*(t)$$ be the minimum over $$k$$ of $$F_k(t)$$, let $$f_*(t)$$ be the minimum over $$k$$ of $$f_k(t)$$ and let $$g_*(t)$$ be the minimum over $$k$$ of $$g_k(t)$$ (so $$f_*(t)=g_*(t)\, t$$). Let $$\gamma = \sqrt{2/3}+ \sqrt{3/2}=5/\sqrt{6}$$. We shall establish five claims A,$$\ldots$$,E (with Claim C being used only to prove Claim D). Claim A. For all $$0<t \leq n$$ we have   \begin{equation} \label{eqn.h} g_*(t) \leq g_*(\sqrt{6n})= \gamma n^{-3/2}. \end{equation} (6) Proof of Claim A. Consider the minima of the functions $$g_k(t)$$ for $$k=2,3,\ldots$$; and the crossings of the graphs of the functions $$g_k(t)$$ for $$k=1,2,\ldots$$. We restrict attention to $$t>0$$. For $$k \geq 2$$, $$g_k(t)$$ is strictly convex and has minimum value $$2n^{-3/2}$$, achieved at $$t=k \sqrt{n}$$. The graphs of $$g_1(t)$$ and $$g_2(t)$$ meet when $$t=2\sqrt{n}$$ with common value $$2n^{-3/2}$$. For $$k \geq 2$$, the graphs of $$g_k(t)$$ and $$g_{k+1}(t)$$ meet at $$t=\sqrt{k(k+1)n}$$, with common value $$\gamma_{k} n^{-3/2}$$, where $$\gamma_{k}= \sqrt{\tfrac{k}{k+1}}+\sqrt{\tfrac{k+1}{k}}$$. Observe that $$\max_{k\geq 2} \gamma_k=\gamma_2=\gamma$$. Hence   \[g_*(t) \leq g_*(\sqrt{6n}) =g_2(\sqrt{6n})=g_3(\sqrt{6n})=\gamma n^{-3/2},\] as required. □ Claim B. Let $$\varepsilon>0$$. Then there is a constant $$c_0$$ such that if $$c_0 \sqrt{n} \leq t \leq n$$ then (a) $$F_*(t) \leq (1+\varepsilon) 2n^{-3/2} t$$, and (b) a balanced collection of about $$t/\sqrt{6n}$$ cycles of with combined number of vertices $$t$$ gives a total $$n$$-cost $$\geq (1-\varepsilon) (5/\sqrt{6}) n^{-3/2} t$$. Proof of Claim B. (a). Let $$k= \lceil \tfrac{t}{\sqrt{n}}\rceil$$. Then the corresponding $$n$$-cost is at most   \[\tfrac{k}{n} + \tfrac{k(\sqrt{n})^2}{n^2} = \tfrac{2k}{n} < \tfrac{2t}{n^{3/2}} + \tfrac{2}{n}= \tfrac{2t}{n^{3/2} } \, (1+ \tfrac{\sqrt{n}}{t}) \leq \tfrac{2t}{n^{3/2} } (1+ \varepsilon) \,\] if $$t \geq (1/\varepsilon) \sqrt{n}$$. (b). There exists $$\eta>0$$ such that if $$(1-\eta)\sqrt{6n} \leq t_i \leq (1+\eta)\sqrt{6n}$$ then $$g_*(t_i) \geq (1-\varepsilon) \tfrac{5}{\sqrt{6}} n^{-3/2}$$, and so $$f_*(t_i) \geq (1-\varepsilon) \tfrac{5}{\sqrt{6}} n^{-3/2}t_i$$. If $$c_0$$ is sufficiently large then each cycle in the balanced collection will have size $$t_i$$ in this range. Hence the total $$n$$-cost will satisfy   \[\sum_i f_*(t_i) \geq (1-\varepsilon) \tfrac{5}{\sqrt{6}} n^{-3/2} \sum_i t_i =(1-\varepsilon) \tfrac{5}{\sqrt{6}} n^{-3/2}t,\] as required. □ Claim C. If $$t$$ is an integer $$\leq 2 \sqrt{n}$$, then $$F_*(t)=F_1(t)$$. Proof of Claim C. For $$t \geq 3$$ and $$2 \leq k \leq t$$,   \[F_k(t)-F_1(t) \geq \tfrac{k}{n} +\tfrac{k(2t/k)^2}{4n^2} - \tfrac{t^2}{n^2} = \tfrac{k}{n} - \tfrac{t^2}{n^2} (1-\tfrac1{k}).\] Thus $$F_2(t)-F_1(t) \geq \tfrac{2}{n} - \tfrac{t^2}{2n^2} \geq 0$$, $$F_3(t)-F_1(t) \geq \tfrac{3}{n} - \tfrac{2t^2}{3n^2} > 0$$, and for $$k \geq 4$$  \[F_k(t)-F_1(t) > \tfrac{4}{n} - \tfrac{t^2}{n^2} \geq 0.\] This completes the proof. □ Claim D. In an $$n$$-vertex 2-regular graph $$G$$ minimizing $$q^*(G)$$, at most one component $$C_t$$ has size $$\leq \sqrt{n}$$. Proof of Claim D. Suppose $$G$$ has two components $$C_{t_1}$$, $$C_{t_2}$$ with $$t_1,t_2 \leq \sqrt{n}$$. Replace these two components by one component $$C_{t_1+t_2}$$. By Claim C, $$F_*(t_1+t_2)= F_1(t_1+t_2)$$: hence the increase in $$n$$-cost is at least   \[F_1(t_1+t_2) - F_1(t_1)-F_1(t_2) = \tfrac{t_1t_2}{2n^2} >0,\] which completes the proof. □ Claim E. Let $$c_0 \geq \sqrt{2}$$, and let $$t \leq c_0 \sqrt{n}$$. Let $$\mathcal A$$ be a partition of $$C_t$$ minimizing the $$n$$-cost. Then $$\mathcal A$$ has $$k \leq k_0= 1 + \sqrt{2} c_0$$ parts. Proof of Claim E. Since $$k_0 \geq 3$$, we may assume that $$k \geq 3$$. Suppose that $$\mathcal A$$ has two parts of sizes $$t_1, t_2 < \sqrt{n/2}$$. Replace these two parts by a single part of size $$t_1+t_2$$ (where each part corresponds to a path). The $$n$$-cost decreases by   \[\tfrac1{n} - \tfrac{(2(t_1+t_2))^2 - (2t_1)^2-(2t_2)^2}{4n^2}= \tfrac1{n} -\tfrac{2t_1t_2}{n^2} >0\] since $$t_1t_2 <n/2$$, a contradiction. Hence $$\mathcal A$$ has at most one part of size $$< \sqrt{n/2}$$. It follows that the number of parts is less than $$1+\tfrac{t}{\sqrt{n/2}} \leq k_0$$. □ We can now use Claims B, D, E and A to prove the upper bound on $$1-q_*(n)$$. Let $$G=G_n$$ minimize $$q^*(G)$$ over $$n$$-vertex graphs. By Claim B, with $$\varepsilon>0$$ sufficiently small that $$(1+\varepsilon) \, 2 < (1-\varepsilon) \, 5/\sqrt{6}$$, each component of $$G$$ has size at most $$c_0 \sqrt{n}$$. By Claim D, $$G$$ has $$s \leq 1+\sqrt{n}$$ components. Thus $$G$$ has components $$C_{t_1},\ldots,C_{t_s}$$ where $$t_1+\ldots t_s=n$$ and each $$t_i \leq c_0 \sqrt{n}$$. Also, by Claim E, for each component $$C_t$$ we need only to consider partitions with at most a constant $$k_0$$ parts. Then by (5) and Claim A   \begin{eqnarray*} 1-q^*(G) & = & \sum_i F_*(t_i) \; \leq \; \sum_i f_*(t_i) \, + s \tfrac{k_0}{4n^2} \\ & = & \sum_i g_*(t_i) t_i + s \tfrac{k_0}{4n^2} \; \leq \gamma n^{-3/2} \sum_i t_i + \tfrac{sk_0}{4n^2} \\ & = & \gamma /\sqrt{n} + \tfrac{s k_0}{4n^2} = \gamma / \sqrt{n} + O(n^{-3/2}). \end{eqnarray*} We have now seen that $$1-q_*^{(2)}(n) \leq \gamma / \sqrt{n} + O(n^{-3/2})$$. To show the reverse inequality, consider a graph $$G$$ formed from $$\lceil \sqrt{n/6}\rceil$$ components, where each component is $$C_{t_i}$$ with $$t_i = \sqrt{6n} + O(1)$$. For $$x=O(1)$$, $$g'_2(\sqrt{6n}+x) \sim \tfrac1{6n^2}$$ and $$g'_3(\sqrt{6n}+x) \sim -\tfrac1{6n^2}$$. Thus for $$k=2,3$$ we have $$g_k(t_i)= g_k(\sqrt{6n}) + O(n^{-2}) = \gamma n^{-3/2} + O(n^{-2})$$; and so $$g_*(t_i) = \gamma n^{-3/2} + O(n^{-2})$$. Hence the total $$n$$-cost is   \[\sum_i g_*(t_i) t_i = (\gamma n^{-3/2} + O(n^{-2})) \sum_i t_i= \gamma n^{-1/2} + O(n^{-1}),\] as required. This completes the proof of Proposition 1.1. □ Proof of Proposition 1.3. The result is easy to check when $$n=3,4,5$$. Let $$n \geq 6$$ and let $$G$$ be a 2-regular $$n$$-vertex graph such that $$q^*(G)=q_2^+(n)$$. Clearly each component cycle of $$G$$ has order at most 5, since we could split a larger cycle to obtain a 2-regular $$G'$$ with $$q^*(G')>q^*(G)$$. Further there cannot be a component $$C_5$$. For, if there is another component $$C_5$$ we could replace two $$C_5$$’s by one $$C_4$$ and two $$C_3$$’s; if there is a component $$C_4$$ we could replace $$C_5$$ and $$C_4$$ by three $$C_3$$’s, and if there is a component $$C_3$$ we could replace $$C_5$$ and $$C_3$$ by two $$C_4$$’s: in each case we would strictly increase the modularity. Thus the only possible components in $$G$$ are $$C_3$$ and $$C_4$$. Further there can be at most two $$C_4$$’s, as we could replace three $$C_4$$’s by four $$C_3$$’s. It now follows easily that the optimal configurations are as claimed. Finally it is now easy to check that we have the correct formulae for $$q_2^+(n)$$. □ 4. Proofs for treewidth and maximum degree To prove Theorem 1.11 (the ‘treewidth lower bound’) we need one preliminary lemma. Given a graph and a partition of its vertex set, a cross-edge is an edge with its end vertices in different parts of the partition. Lemma 4.1 Let the graph $$G$$ have $$m$$ edges and maximum degree at most $$d$$, and let the set $$E'\subset E(G)$$ be such that the subgraph $$H=G\backslash E'$$ satisfies $${\rm tw}(H) \leq t$$. Let $$s$$ satisfy $$d<s \leq 2m-d$$. Then by deleting from $$H$$ the edges incident with at most $$t+1$$ vertices, thus forming the subgraph $$H'$$, we can find a partition $$V(G) =U_0 \cup \cdots \cup U_{k}$$ with $$k\geq 2$$, no cross-edges in $$H'$$, and such that $${\rm vol}(U_0) \leq 2m-s$$ and $${\rm vol}(U_j) <s$$ for each $$j=1,\ldots,k$$. (We allow $$U_0=\emptyset$$.) Proof. The first step is to introduce a weight function which remembers information about the edges in $$E'$$: for a vertex $$v\in H$$ let $$w(v)=\deg_G(v)$$, and for a set $$U$$ of vertices let $$w(U)=\sum_{v\in U}w(v)$$. The proof will take a tree-decomposition of $$H$$, choose one bag $$X_i$$, and delete all edges of $$H$$ incident to the vertices in $$X_i$$. We want a suitably well-behaved tree-decomposition, see for example [22]. It is well known that (by adding nodes if necessary) we can guarantee a tree decomposition $$T$$ of width at most $$t$$ such that if $$ij$$ is an edge of $$T$$ then the symmetric difference $$X_i \triangle X_j$$ has exactly one element. If distinct nodes $$i$$ and $$j$$ have the same bag (i.e. if $$X_i=X_j$$) and have a common neighbour, then we can replace the nodes $$i$$ and $$j$$ by a single new node with the same bag: thus we may assume that if nodes $$i$$ and $$j$$ have a common neighbour in $$T$$ then $$X_i\neq X_j$$. Finally, again by adding nodes if necessary, we may assume that each leaf $$i$$ of $$T$$ has bag $$X_i$$ of size 1. Fix such a tree decomposition, and fix a leaf to be the root vertex. Recall that deleting any edge in a tree leaves exactly two connected components. Let us recall also one simple standard fact about tree-decompositions (as introduced in Section 1.3). Fact 4.2 If $$e= ij$$ is an edge of the tree $$T$$, $$k$$ and $$k'$$ are nodes of $$T$$ in different components of $$T \backslash e$$, and vertices $$v \in X_{k}$$ and $$v' \in X_{k'}$$ are adjacent in $$G$$, then at least one of $$v$$, $$v'$$ is in $$X_i \mathcal Ap X_j$$. For any edge $$e$$ in $$T$$ let $$T_e$$ denote the non-root component of $$T \backslash e$$, and let $$V_e$$ be the set of vertices contained in the bags of $$T_e$$. If $$w(V_e) <s$$, then orient $$e$$ toward the root vertex, otherwise orient $$e$$ away from the root vertex (see Fig. 2 for an illustration). Fig. 2. View largeDownload slide An illustration of the construction in the Proof of Lemma 4.1 applied to a toy graph $$G$$ with removed edge set $$E'$$ (dashed) and $$s=12$$. Graph $$G$$ has treewidth 3 but after removing the dashed edges graph $$H$$ has treewidth 2. A tree-decomposition for $$H$$ is shown and the leaf node at the top chosen to be the root. For each edge $$h$$ in the tree-decomposition the number $$w(V_h)$$ is shown, and the edge oriented toward the root if $$w(V_h)<12$$. The rooted tree-decomposition and threshold $$s$$ define node $$i$$, edge $$e$$, component $$T_e$$, and partition $$V=U_0 \cup U_1 \cup U_2$$ as shown. Fig. 2. View largeDownload slide An illustration of the construction in the Proof of Lemma 4.1 applied to a toy graph $$G$$ with removed edge set $$E'$$ (dashed) and $$s=12$$. Graph $$G$$ has treewidth 3 but after removing the dashed edges graph $$H$$ has treewidth 2. A tree-decomposition for $$H$$ is shown and the leaf node at the top chosen to be the root. For each edge $$h$$ in the tree-decomposition the number $$w(V_h)$$ is shown, and the edge oriented toward the root if $$w(V_h)<12$$. The rooted tree-decomposition and threshold $$s$$ define node $$i$$, edge $$e$$, component $$T_e$$, and partition $$V=U_0 \cup U_1 \cup U_2$$ as shown. At least one node in $$T$$ has out-degree zero: fix such a node $$i$$. Notice that $$i$$ is not the root (since $$s \leq 2m-d$$), and $$i$$ is not a leaf (since then $$|X_i|=1$$ and so $$w(X_i) \leq d<s$$). We delete the edges of $$H$$ incident with the vertices in the bag $$X_i$$. Thus, we delete at most $$(t+1)d$$ edges from $$H$$ to form $$H'$$. Let $$e$$ be the edge incident with node $$i$$ which lies on the path from the root vertex to node $$i$$. Let $$U_0= V(G) \setminus V_e$$. Since $$w(V_e) \geq s$$ we have $$w(U_0) \leq 2m-s$$. Since $$i$$ is not a leaf in $$T$$, other than its neighbour along edge $$e$$, $$i$$ has neighbours $$j_1, \ldots, j_h$$ for some $$h \geq 1$$. Suppose first that $$h=1$$, so there is exactly one such neighbour $$j_1$$ (not along the edge $$e$$). Since the edge $$ij_1$$ is oriented towards $$i$$, we have $$w(V_{i j_1})<s \leq w(V_e)$$, and so we cannot have $$X_{j_1} \supseteq X_i$$: hence $$X_{j_1}= X_i \setminus \{v\}$$ for some $$v \in X_i$$. Let $$U_1=V_{ij_1}$$ and $$U_2 = X_i \setminus U_1=\{v\}$$. Then $$w(U_1)<s$$ and $$w(U_2) =w(v) \leq d < s$$, and $$V(G)$$ is partitioned into $$U_0 \cup U_1 \cup U_2$$. Further, by Fact 4.2, any cross-edges in $$H$$ must be incident to vertices in $$X_i$$, and so there are no cross-edges in $$H'$$. Now suppose that $$h \geq 2$$, so node $$i$$ has multiple neighbours. Let $$U_1=V_{ij_1}, U_2=V_{ij_2}\setminus U_1,$$$$\ldots, U_{h} = V_{ij_h} \setminus (U_1 \cup \ldots \cup U_{h-1}) $$. As before, the orientations of the edges incident with node $$i$$ shows that $$w(U_j)<s$$ for each $$j =1,\ldots,h$$. Discard any empty sets amongst these sets $$U_j$$. Finally, note that $$X_{j_1}\cup X_{j_2}\supseteq X_i$$, since if neither of $$X_{j_1}$$ and $$X_{j_2}$$ contains $$X_i$$ then $$X_{j_1}=X_i\setminus \{v_1\}$$ and $$X_{j_2}=X_i\setminus \{v_2\}$$ for some $$v_1\neq v_2$$ in $$X_i$$. Hence $$U_1\cup U_2\supseteq X_i$$ and so $$\cup_{j=0}^{h} U_j=V(G)$$. Further, as before, by Fact 4.2 any cross-edges in $$H$$ must be incident to vertices in $$X_i$$, and so there are no cross-edges in $$H'$$. □ Proof of Theorem 1.11. Write $$d$$ for the maximum degree $$\Delta$$ of $$G$$ (note that $$G$$ will shrink during the proof but $$d$$ stays unchanged). Since $$q^*(G) \geq 0$$ for any graph $$G$$ we need to consider only the case where $$m \geq 4(t+1)d$$. Let $$s= 2((t+1)dm)^{\frac12}$$. Note that $$s \geq 4(t+1)d$$. Set $$\tilde{G}=G$$ and $$\tilde{m}=e(\tilde{G})$$. Observe that $$s>d$$, indeed $$s \geq 2d$$. As long as $$2\tilde{m} \geq s+d,$$ we use the last lemma repeatedly to ‘break off parts’ $$U_1, U_2, \ldots$$ and replace $$\tilde{G}$$ by its induced subgraph on $$U_0$$, where $${\rm vol}(U_0)\leq 2\tilde{m}-s$$. Suppose that we stop after $$j$$ steps, with $$2\tilde{m}=x$$ where $$0 \leq x <s+d$$. Since at each step the degree sum of $$\tilde{G}$$ decreases by at least $$s$$, we must have $$x \leq 2m - js$$, so $$js \leq 2m-x$$. At this stage, we have lost at most $$j(t+1) d$$ edges, and each of the parts ‘broken off’ from $$G$$ has degree sum $$< s$$. We claim that we can refine the current partition of $$V(G)$$ to a partition $$\mathcal A$$ such that each part has degree sum $$<s$$ and the number of cross-edges in $$G\setminus E'$$ (edges lost) is at most $$\frac{2m}{s} (t+1)d$$. There are two cases. Suppose first that $$x<s$$: then we have finished in $$j$$ steps, $$j \leq 2m/s$$, and we have lost at most $$\frac{2m}{s} (t+1)d$$ edges in $$G \setminus E'$$, as required. Suppose instead that $$x \geq s$$. Then $$js \leq 2m-x \leq 2m-s$$, so $$j +1 \leq 2m/s$$. We take one more step, with reduced threshold $$s'=s-d$$. Note that $$d< s' \leq 2\tilde{m} -d$$ (where $$2\tilde{m}=x$$). Thus we can apply Lemma 4.1 with the value $$s'$$, to complete the proof of the claim, since   \[2\tilde{m}-s' < s+d-(s-d) = 2d \leq s,\] and so we stop after $$j+1$$ steps. Now $$q^E_\mathcal A(G) \geq 1 - |E'|/m - 2(t+1)d/s$$. Also $$0\leq x_i < s$$ and $$\sum_i x_i \leq 2m$$ together imply $$\sum_i x_i^2 < 2ms$$; and so   \begin{equation}\label{eq.son2m} q_\mathcal A^D(G) \leq \frac{2ms}{4m^2}= \frac{s}{2m}. \end{equation} (7) Hence, by our choice of $$s$$,   \[1-|E'|/m - q_\mathcal A(G) \leq \tfrac{2(t+1)d}{s} + \tfrac{s}{2m} = 2 \left( \tfrac{(t+1)d}{m}\right)^{\frac12},\] which completes the proof. □ We may deduce Proposition 1.4 quickly from Theorem 1.11. Proof of Proposition 1.4. For each connected component $$H$$ of $$G$$, do the following. In $$H$$ choose a spanning tree together with one extra edge (observe that $$H$$ is not a tree since $$r \geq 2$$), and let $$E'_H$$ be the set of edges not chosen. Each unicyclic graph has treewidth 2, so $${\rm tw}(H\setminus E'_H)=2$$. Define $$E'=\cup_H E'_H$$, and note that $${\rm tw}(G\setminus E')=2$$ and $$|E'|=m-n$$, where $$G$$ has $$m=r n/2$$ edges. Hence by Theorem 1.11   \[q^*(G) \geq 1-2\left(\frac{3r}{m}\right)^{\frac12}- \left(1-\frac{n}{m}\right) = \frac{2}{r} - 2 \left(\frac{6}{n}\right)^{\frac12} \] as required. □ 5. Proofs for minimum and random modularity, $$\boldsymbol{q^-_r(n)}$$ and $$\boldsymbol{q^*(G_{n,r})}$$ In this section we prove Theorem 1.5, giving a lower bound on $$q_r^-(n)$$; and Theorems 1.6 and 1.7 giving lower and upper bounds which hold whp on $$q^*(G_{n,r})$$, the former for small $$r$$ ($$r=3,\ldots,12$$) and the latter for large $$r$$. The lower bound proofs are all centred around bisection width, and the upper bound proofs around edge-expansion. It is thus natural and convenient to prove all the lower bounds in the theorems first and then the upper bounds. 5.1 Bisection width and lower bounds on modularity Define the bisection width$${\rm bw}(G)$$ of an $$n$$-vertex graph $$G$$ to be   \[{\rm bw}(G) = \min_{|U| = \lfloor \frac{n}{2} \rfloor} e(U, \bar{U}),\] where the minimum is over all sets $$U$$ of $$\lfloor \frac{n}{2} \rfloor$$ vertices, and $$\bar{U}$$ denotes $$V(G)\setminus U$$. A corresponding minimizing partition shows that, for an $$r$$-regular graph $$G$$,   \begin{equation}\label{eqn.qbw} q^*(G) \geq \frac{1}{2} - \frac{2{\rm bw}(G)}{rn} - \frac1{2n^2}, \end{equation} (8) where we do not need the last (small) term if $$n$$ is even. Proof of Theorem 1.5. Now consider general $$r$$. By Theorem 1.1 of Alon [29], there is a constant $$c>0$$ such that, for all $$r$$ and all sufficiently large $$n$$, all $$n$$-vertex $$r$$-regular graphs $$G$$ satisfy   \[{\rm bw}(G)/n \leq r/4 - c \sqrt{r}.\] Hence, for each such graph $$G$$, using also (8) we have   \[q^*(G) \geq 2c/ \sqrt{r} - \frac1{2n^2} \geq c/ \sqrt{r}\] for $$n$$ sufficiently large. □ Proof of lower bounds in Theorem 1.6. Lower bounds for $$r=3$$ to $$8$$ are directly from the about $$2/r$$ bound in Proposition 1.4, so consider larger $$r$$. It was shown in [30] that whp the bisection width of a random 12-regular graph is at most 1.823n. By (8), this implies that whp $$q^*(G_{n,12})>0.196$$, as given in Theorem 1.6 (Table 1). Similar calculations apply for $$r=9,10,11$$ which have bisection widths at most 1.2317, 1.4278, 1.624 times $$n$$ respectively [30]. (Currently known results on bisection width do not improve on the $$2/r$$ lower bound from Proposition 1.4.) □ Proof of lower bound in Theorem 1.7. For large $$r$$, Dembo et al. [31, Theorem 1.5] show that whp $${\rm bw}(G_{n,r})/n = r/4-c'\sqrt{r}/2+o(\sqrt{r})$$, where the $$o(\sqrt{r})$$ error term is as $$r\to \infty$$ and $$c'=0.76321\pm 0.00003$$. By (8) this provides the lower bound in Theorem 1.7. □ 5.2 Edge-expansion and upper bounds on modularity In this subsection, we introduce graph parameters $$\beta(G)$$, $$\lambda(G)$$, $$i_u(G)$$, $$\alpha(G)$$ and $$\beta'(G)$$ related to edge-expansion; and give two lemmas concerning them, in preparation for proving the upper bounds on $$q^*(G)$$ in Theorems 1.6 and 1.7. First, we introduce a useful quantity $$\beta(G)$$ for a regular graph $$G$$, related to edge expansion. For a non-empty set $$S$$ of vertices in a graph $$G$$, let $$\bar{d}(S)$$ denote the average degree of the induced subgraph on $$S$$, so $$\bar{d}(S) = 2e(S)/|S|$$. Now let $$r \geq 2$$ and suppose that $$G$$ is $$r$$-regular and has $$n$$ vertices. Let   \[\beta(G) = \max_{S \neq \emptyset} \left\{\frac{\bar{d}(S)}{r} - \frac{|S|}{n} \right\}\] where the maximum is over all non-empty sets $$S$$ of vertices. Also, given an $$n$$-vertex graph $$G$$ such that the adjacency matrix has eigenvalues $$\lambda_ 1 \geq \cdots \geq \lambda_n$$, let   \[\lambda(G) = \max_{i>1} |\lambda_i| \;\;\; (\: =\max\{|\lambda_2|,|\lambda_n|\} \: ).\] The following lemma is the key to our upper bounds on $$q^*$$ for random regular graphs. A more general result implying that $$q^*(G) \leq \lambda/r$$ appeared earlier in [32] statement (18), phrased in terms of the ‘modularity matrix’ of $$G$$, which has largest eigenvalue equal to $$\lambda(G)$$ when $$G$$ is regular. We introduce $$\beta(G)$$ and give a short and straightforward proof. Lemma 5.1 Let $$G$$ be an $$r$$-regular graph, let $$\beta=\beta(G)$$, and let $$\lambda= \lambda(G)$$. Then   \[q^*(G) \leq \beta \leq \lambda/r.\] Proof. Let $$G$$ have $$n$$ vertices, let $$S$$ be a non-empty set of vertices, and let $$u=|S|/n$$. By Corollary 9.2.6 of Alon and Spencer [33] (see also Lemma 2.3 of Alon and Chung [34])   \[|e(S)-\frac12 r u^2n| \leq \frac12 \lambda un.\] Hence   \[\left| \frac{\bar{d}(S)}{r} - u \right| = \frac{|e(S)-\frac12 r u^2n|}{\frac12 run} \leq \lambda/r;\] and so $$\beta \leq \lambda/r$$. Now consider any partition $$\mathcal A=\{A_1, \ldots, A_k\}$$ of $$V(G)$$. Letting $$u_j=|A_j| / n$$, we have   \begin{eqnarray*} q_\mathcal A(G) &=& \sum_j \left(\frac{2e(A_j)}{r n} - \frac{(u_j r n)^2}{(rn)^2} \right) \\[-4pt] &=& \sum_j u_j \left( \frac{\bar{d}(A_j)}{r} - u_j\right)\\[-4pt] & \leq & \beta \, \sum_j u_j \;\; = \; \beta. \end{eqnarray*} Hence $$q^*(G) \leq \beta$$, as required. □ Now we relate $$\beta(G)$$ to edge expansion and the quantity $$\alpha(G)$$ defined below, so that we can use calculations from [35]. Following the notation of [35], for $$0<u\leq \frac{1}{2}$$ we define the $$u$$-edge-expansion$$i_u(G)$$ of an $$n$$-vertex graph $$G$$ by setting   $$ i_u(G)= \min_{0<|S|\leq un} \frac{e(S, \bar{S})}{|S|}, $$ where the minimum is over non-empty sets $$S$$ of at most $$un$$ vertices (and the value is taken to be $$\infty$$ if $$un<1$$). Observe that $$i_{1/2}(G)$$ is the usual edge expansion or isoperimetric number of $$G$$. Also, set   \[\alpha(G) = \min_{0<u \leq \frac12} \{u+i_u(G)/r \}.\] It is easy to see that we can also write $$\alpha(G)$$ as   \[\alpha(G) = \min_{0<|S| \leq \frac12 n} \left\{\frac{|S|}{n}+ \frac{e(S, \bar{S})}{r|S|} \right\}.\] Now consider a quantity $$\beta'$$ like $$\beta$$ but which at first sight might be smaller: let   \[\beta'(G) = \max_{0<|S| \leq \frac12 n} \left\{\frac{\bar{d}(S)}{r} - \frac{|S|}{n} \right\}.\] Lemma 5.2 For each regular graph $$G$$,   \[\beta(G) = \beta'(G) = 1-\alpha(G).\] Proof. Note first that $$\tfrac{\bar{d}(S)}{r} = \tfrac{r|S| - e(S,\bar{S})}{r|S|} = 1- \tfrac{e(S,\bar{S})}{r|S|}$$, so   \[\frac{\bar{d}(S)}{r} -\frac{|S|}{n} = 1- \left(\frac{|S|}{n} + \frac{e(S,\bar{S})}{r|S|} \right).\] It follows directly that $$\beta'(G) = 1- \alpha(G)$$. Now write $$\beta'$$ for $$\beta'(G)$$: we shall show that $$\beta'= \beta(G)$$. Let $$S$$ be a set of vertices with $$|S|/n=u > \frac12$$. We must show that $$\frac{\bar{d}(S)}{r} -u \leq \beta'$$. Since $$2e(S)=r|S| - e(S,\bar{S})$$ and similarly $$2e(\bar{S})=r(n-|S|) - e(S,\bar{S})$$, we have   \[ 2e(S) = 2e(\bar{S}) +r un-r(1\!-\!u)n = 2e(\bar{S}) + (2u\!-\!1)rn. \] Also $$\frac{2e(\bar{S})}{r(1- u) n} - (1-u) \leq \beta'$$, so $$2e(\bar{S}) \leq r (1-u)n \, (1-u+\beta')$$. Hence   \begin{eqnarray*} \frac{\bar{d}(S)}{r} -u \; &=& \; \frac{2e(S)}{r un} - u \;\; = \;\; \frac{2e(\bar{S})+(2u-1)rn}{r un} -u\\ & \leq & \frac{r(1-u)n (1-u+\beta') +(2u-1)rn}{run} -u\\ &=& \frac{(1-u) \beta'}{u} \; \leq \beta' \end{eqnarray*} since $$u \geq \frac12$$. This completes the proof. □ Proof of upper bounds in Theorem 1.6. Fix an integer $$r \geq 3$$. By Lemmas 5.1 and 5.2, $$1- q^*(G) \geq \alpha(G) = \min_{u\in (0,1/2]} f(u)$$ where $$f(u)=u+ i_u(G)/r$$. Thus, we want a lower bound on $$\alpha(G)$$. Let $$0 \leq u_0<u_1\leq 1/2$$. Since $$i_u(G)$$ is non-increasing in $$u$$, for $$u\in (u_0,u_1]$$ we have   \[f(u) = u+ \frac{i_u(G)}{r} \geq u + \frac{i_{u_1}(G)}{r} > f(u_1)-|u_1-u_0|.\] Fix $$\varepsilon >0$$, and let $$n=\lceil 1/\varepsilon \rceil$$. Then by considering the intervals $$((i-1)/2n, i/2n]$$ for $$i=1,\ldots n$$, we see that   \[\alpha(G) > \min_{i=1,\ldots,n} f(i/2n) \; - \varepsilon/2,\] and so we need lower bound at most $$n$$ values $$i_u(G)$$. Now consider a random $$r$$-regular graph $$G_{n,r}$$. For each particular $$u\in (0,1/2]$$, by Theorem 1.3 in [35] and the discussion in Section 7 of that article, we see that whp $$i_u(G_{n,r})\geq y/u$$ for each $$0<y< ru(1-u)$$ with $$\hat{f}_r(u,y)<0$$, where   \[\hat{f}_r(u,y)=\log \frac{r^{r/2}u^{(r-1)u}(1-u)^{(r-1)(u-1)}}{y^y(ru-y)^{(ru-y)/2}(r-ru+y)^{(r-ru+y)/2} }.\] (It is known [35] that $$\hat{f}_r(u,y)$$ is strictly concave in $$y$$, positive at $$y= ru(1-u)$$ and negative for sufficiently small $$y>0$$.) For a random cubic graph $$G_{n,3}$$, by finding appropriate values $$y$$, we deduce that whp $$\alpha(G_{n,3}) > 0.196$$, and so whp $$q^*(G_{n,3})< 0.804$$. Repeating for other values of $$r$$ yields the upper bounds given in Table 1. This completes the Proof of Theorem 1.6 (which first appeared in the thesis of the second author [36]). □ Proof of upper bound in Theorem 1.7. Let $$G_{n,r}$$ be a random $$r$$-regular graph (with $$r$$ fixed). Friedman [37] showed that, for each $$\varepsilon>0$$, whp $$\lambda(G_{n,r}) \leq 2\sqrt{r-1} + \varepsilon$$. Thus, by taking $$\varepsilon< 2\sqrt{r}-2\sqrt{r-1}$$, we see that whp $$\lambda(G_{n,r}) < 2\sqrt{r}$$. Hence by Lemma 5.1, whp $$q^*(G_{n,r}) < 2/ \sqrt{r}$$. This completes the Proof of Theorem 1.7. 6. Proofs for maximum modularity $$\boldsymbol{q_r^+(n)}$$ In this section, our main task is to prove Proposition 1.8. But first let us deal with Proposition 1.10, which has a short and easy proof, see [20] equation (11), or see for example [38] Lemma 2.1. We prove it here as we want the exact result. Proof of Proposition 1.10. Let the graph $$G$$ have $$m \geq 1$$ edges (we do not yet assume that $$G$$ is connected). Consider a partition $$\mathcal A=\{A_1, \ldots, A_k\}$$ of $$V(G)$$ into $$k \geq 2$$ parts, where $$A_j$$ has degree sum $$d_j$$ (and so $$\, \sum_j d_j =2m$$). Then   \begin{equation} \label{eqn.degtaxreg} q_{\mathcal A}^{D}(G) = \frac1{4m^2} \sum_j d_j^2 \geq \frac1{k} \end{equation} (9) since $$(1/k) \sum_j d_j^2 \geq (2m/k)^2$$ by convexity. If $$G$$ is connected, then there must be at least $$k-1$$ cross-edges; and then, since $$k/m + 1/k \geq 1/2\sqrt{m}$$,   \[q_{\mathcal A}(G) \leq 1- \frac{k-1}{m} - \frac1{k} \leq 1+\frac1{m} - \frac2{\sqrt{m}}.\] Similarly, if $$G$$ is 2-edge-connected, there must be at least $$k$$ cross-edges, and   \[ q_{\mathcal A}(G) \leq 1- \frac{k}{m} - \frac1{k} \leq 1- \frac2{\sqrt{m}}, \] which completes the proof. □ To prepare for the proof of Proposition 1.8, we first give an equivalent expression for the modularity of a regular graph, and give a preliminary lemma. Observe that for $$r$$-regular $$n$$-vertex graphs $$G$$ we have   \begin{equation}\label{eq.modis} q_\mathcal A(G)= 1-\sum_{A \in \mathcal A} \frac{|A|}{n} \left(\frac{e(A, \bar{A})}{r|A|} + \frac{|A|}{n} \right)\!, \end{equation} (10) where $$\bar{A}$$ denotes $$V(G)\backslash A$$. Here, the first term in the sum double counts the edges between the parts (and divides by twice the number of edges), and the second term takes care of the degree tax, which is now simply a function of the part sizes since $$G$$ is regular. For $$\emptyset \neq A \subseteq V(G)$$ let $$f_r(A,G) = e(A, \bar{A})/(r|A|)+ |A|/n$$ and write $$G[A]$$ for the subgraph of $$G$$ induced by $$A$$. We shall see that the unique minimizer of $$f$$ over $$r$$-regular graphs is the graph $$K_{r+1}$$. More fully, assuming that $$n \geq r+1$$ and $$rn$$ is even (so that the set $$\mathcal G(n,r)$$ of $$r$$-regular $$n$$-vertex graphs is non-empty), let $$f_r^*(n) := \min_{G\in \mathcal G(n,r)} \min_{\emptyset \neq A \subseteq V(G)} f_r(A, G)$$. Lemma 6.1 For $$n \geq r+1$$ with $$rn$$ even; $$f_r^*(n) = \frac{r+1}{n}$$, and $$f_r(A,G)$$ achieves this minimum exactly when $$G[A]=K_{r+1}$$ (and this is a component of $$G$$). Proof. Firstly note that if $$G[A]=K_{r+1}$$ then clearly $$f_r(A,G)=(r+1)/n$$. Now fix an $$r$$-regular graph $$G$$ on $$n$$ vertices, and let $$A$$ be a subset of the vertices such that $$G[A]\neq K_{r+1}$$. To prove the claim it will suffice to show that   \begin{equation}\label{eq.exactlywhat} \frac{e(A, \bar{A}) n }{r|A|} + |A| > r+1. \end{equation} (11) If $$|A|>r+1$$ then it is easy to see that (11) holds. Similarly if $$|A|=r+1$$ then there must be edges from $$A$$ to the rest of the graph as we assumed $$G[A]\neq K_{r+1}$$, but $$e(A,\bar{A})>0$$ and $$|A|=r+1$$ together imply that (11) holds, so we can assume that $$|A|<r+1$$. Set $$|A|=r+1-\ell$$ for some $$\ell>0$$. Observe that because $$G$$ is $$r$$-regular we have $$e(A, \bar{A})\geq (r+1-\ell)\ell$$. This is because each of the $$|A|=r+1-\ell$$ vertices can have at most $$r-\ell$$ of their incident edges within the part $$A$$ and so at least $$\ell$$ must be external. Hence,   $$\frac{e(A, \bar{A}) n }{r|A|} + |A| \geq \frac{(r+1-\ell)\ell n}{r(r+1-\ell)} +r+1-\ell = r+1 + \ell\Big(\frac{n}{r}-1\Big) \, > r+1$$ since $$n>r$$. This completes the proof of the lemma. □ Proof of Proposition 1.8 part (a). The sum in the expression for modularity in (10) is a weighted average of terms $$f_r(A,G)$$ and so   $$q^+_r (n) = 1- \min_{G \in \mathcal G(n,r) } \min_{\mathcal A} \sum_{A \in \mathcal A} \frac{|A|}{n} f_r(A,G) \leq 1-f_r^*(n)$$ with equality iff there is an $$r$$-regular graph $$G$$ with a vertex partition $$\mathcal A$$ such that $$\forall A\in \mathcal A$$, $$f_r(A,G)=f_r^*(n)$$. By the claim this means that a graph achieves the bound iff there is a vertex partition into disjoint copies of $$K_{r+1}$$. Hence if $$(r+1)|n$$, then $$q^+_r(n) = 1-\frac{r+1}{n}$$ with unique optimum graph the disjoint union of copies of $$K_{r+1}$$. Finally, for the case when $$(r+1)$$ does not divide $$n$$, for any graph on $$n$$ vertices there must be some part $$A$$ with $$|A|\neq r+1$$, and by the claim $$f_r(A,G)>(r+1)/n$$; and because modularity is a weighted average of such terms over all parts, we have $$q^+_r(n)<1-(r+1)/n$$. □ Proof of Proposition 1.8 part (b). First we show that $$g_r(n)$$ (defined in 3) is a lower bound on $$q_r^+(n)$$ for certain values of $$n$$. We see that if $$r$$ is even and $$n \geq r(r+1)$$, or if $$r$$ is odd and $$n \geq (r-1)(r+3)/2$$ (and $$rn$$ is even), then we have $$q^+_r(n) \geq g_r(n)$$. Consider the subcase when $$r$$ is even. Recall that we write $$n$$ as $$a(r+1)+b$$ where $$a$$ is a non-negative integer and $$0 \leq b \leq r$$. Assume that $$a \geq b$$, which must hold when $$n \geq r(r+1)$$. Let $$H_{r+2}$$ be $$K_{r+2}$$ less a perfect matching, which is an $$r$$-regular graph on $$r+2$$ vertices. Think of $$n$$ as $$b(r+2)+(a-b)(r+1)$$. Let $$G^*_n$$ be the $$n$$-vertex graph consisting of $$b$$ copies of $$H_{r+2}$$ and $$a-b$$ copies of $$K_{r+1}$$, all disjoint. Then with connected components partitions $$\mathcal C$$,   \begin{eqnarray*} q_{\mathcal C}^D(G^*_n) & = & \frac1{n^2} \left( b(r+2)^2 + (a-b) (r+1)^2 \right)\\[-3pt] & = & \frac1{n^2} \left( b(r+2)(r+1) + b(r+2) + (a-b) (r+1)^2 \right)\\[-3pt] & = & \frac1{n^2} ( (r+1)n + b(r+2)) \; = \; 1 - g_r(n). \end{eqnarray*} Hence $$q^+_r(n) \geq q_{\mathcal C}(G^*_n) = g_r(n)$$, as required. Now consider the subcase when $$r \geq 3$$ is odd. Observe $$b$$ must be even (and so $$b \leq r-1$$). Assume that $$a \geq b/2$$, which must hold when $$n \geq (r-1)(r+1)/2$$. Let $$H_{r+3}$$ be $$K_{r+3}$$ less a 2-factor (i.e. a spanning subgraph with each vertex degree 2, e.g. a Hamilton cycle), which is an $$r$$-regular graph on $$r+3$$ vertices. (There is no $$r$$-regular graph with $$r+2$$ nodes, since $$r+2$$ is odd.)Think of $$n$$ as $$(r+3)b/2 + (r+1)(a-b/2)$$. Let $$H_n^*$$ be the $$n$$-vertex graph consisting of $$b/2$$ copies of $$H_{r+3}$$ and $$a-b/2$$ copies of $$K_{r+1}$$, all disjoint. Then   \begin{eqnarray*} q_{\mathcal C}^D(H^*_n) & = & \frac1{n^2} \left( (b/2)(r+3)^2 + (a\!- b/2) (r+1)^2 \right)\\ & = & \frac1{n^2} \left( (b/2)(r+3)(r+1) + b(r+3) + (a\!- b/2) (r+1)^2 \right)\\ & = & \frac1{n^2} ( (r+1)n + b(r+3) ) \; = \; 1 - g_r(n). \end{eqnarray*} Hence $$q^+_r(n) \geq q_{\mathcal C}(H^*_n) = g_r(n)$$, as required. We have now shown in both cases that $$q^+_r(n) \geq g_r(n)$$ when claimed. Observe thatif $$r$$ is even, then $$\frac{b(r+2)}{n^2} \leq \frac{r(r+2)}{n^2}$$; and if $$r$$ is odd, then $$\frac{b(r+3)}{n^2} \leq \frac{(r-1)(r+3)}{n^2} \leq \frac{r(r+2)}{n^2}$$. Hence we always have   \begin{equation} \label{eqn.grngeq} g_r(n) \geq 1- \frac{r+1}{n} - \frac{r(r+2)}{n^2}. \end{equation} (12) The inequality (4) follows from inequality (12), since $$q^+_r(n) \geq g_r(n)$$ for $$n \geq r(r+1)$$, as we have seen. Next, we use the above result to show that we need only to consider regular graphs with ‘small’ connected components, and thus we need only to consider the connected components partition $$\mathcal C$$. Let $$G \in \mathcal G(n,r)$$, and let $$\mathcal A$$ be any vertex partition with a part $$A'$$ of size $$a =|A'| \geq 2(r+1)$$. Observe that $$f_r(A',G) \geq a/n$$, and for the other parts $$A \in \mathcal A$$, $$f_r(A,G) \geq (r+1)/n$$ by the claim in the previous proof. Thus   \begin{eqnarray*} 1- q_{\mathcal A}(G) &=& \sum_{A \in \mathcal A} \frac{|A|}{n} f_r(A,G) \; \geq \; \frac{n-a}{n} \left(\frac{r+1}{n} \right) + \frac{a}{n} \cdot \frac{a}{n}\\ &=& \frac{r+1}{n} + \frac{a}{n} \, \frac{a-(r+1)}{n} \; \geq \; \frac{r+1}{n} + \frac{2(r+1)^2}{n^2}. \end{eqnarray*} Hence, by (12) and the first part of the proposition,   \[q_{\mathcal A}(G) \leq 1- \frac{r+1}{n} - \frac{2(r+1)^2}{n^2} < g_r(n) \leq q_r^+(n)\] if $$n \geq r(r+1)$$. Therefore, for such $$n$$, if $$q_{\mathcal A}(G) = q^+_r(n)$$, then each part of $$\mathcal A$$ must have size at most $$2r+1 < 2(r+1)$$. Now let $$G$$ have a connected component $$H$$ of size $$s \geq 6 (r+1)$$. Suppose that $$\mathcal A$$ is a partition for $$G$$ with $$q_{\mathcal A}(G) = q_r^+(n)$$. Then, by the above, $$\mathcal A$$ must break $$G$$ into at least $$s/(2(r+1))$$ parts, and so there are at least $$s/(2(r+1)) -1$$ cross-edges for $$\mathcal A$$. Hence   \[1- q_{\mathcal A}(G) \geq \left(\frac{s}{2(r+1)}-1\right) \frac2{rn} + \frac{n-s}{n} \frac{r+1}{n} = \frac{r+1}{n} + \frac{s}{n} \left(\frac1{r(r+1)} - \frac{r+1}{n} \right) - \frac2{rn}.\] Now suppose that $$n \geq 2r(r+1)^2$$. Then   \[1- q_{\mathcal A}(G) \geq \frac{r+1}{n} + \frac{s}{n} \left(\frac1{2r(r+1)} \right) - \frac2{rn} \geq \frac{r+1}{n} + \frac1{rn}.\] But $$\frac1{rn} > \frac{r(r+2)}{n^2}$$ (since $$n > r^2(r+2)$$), so by (12) we have$$1- q_{\mathcal A}(G) > 1-g_r(n)$$, and so $$q_{\mathcal A}(G) < g_r(n) \leq q^+_r(n)$$. Thus we need only to consider regular graphs with all components of size less than $$6(r+1)$$. For an $$r$$-regular graph with a connected component $$H$$ on $$h$$ vertices, if $$h< 2 \sqrt{n/r}$$ (the ‘resolution limit’ [20]) then no optimal partition breaks up this component. For, if some optimal partition breaks $$H$$ into $$i \geq 2$$ parts, then   \begin{eqnarray*} 0 & \leq & \frac{(hr)^2-i(hr/i)^2}{(nr)^2} - \frac{i-1}{nr/2} \; = \; \frac{i-1}{n} \left(\frac{h^2}{i n} - \frac2{r} \right), \end{eqnarray*} so $$h^2 \geq 2i n/r \geq 4n/r$$. Thus for graphs with maximum component size $$h$$ and $$n > rh^2/4$$ vertices, the partition into connected components is the unique optimal partition. Hence, for $$n \geq 9 r (r+1)^2$$, we need only to consider graphs with the connected components partition $$\mathcal C$$. But now by the strict convexity of $$f(x)=x^2$$, we see that each graph with the maximum modularity must have at most two sizes of components, differing by one if $$r$$ is even and by 2 if $$r$$ is odd; and then it is easy to see that these must be the smallest two such sizes. Hence the graphs $$G^*_n$$ and $$H^*_n$$ constructed earlier achieve the maximum modularity, and any graph achieving the maximum modularity must be of this form. The only flexibility is in the choice of the missing 2-factor in the graphs $$H_{r+3}$$. This completes the proof of part (b), and thus of the whole of Proposition 1.8. □ In Proposition 1.8 part (b), it is not hard to improve the bound $$n \geq 9 r (r+1)^2$$ by a constant factor, though possibly our bound is very pessimistic and $$n \geq r(r+1)$$ may suffice. 7. Concluding remarks Two main contributions of this article are (a) the numerical bounds for the typical modularity of random regular graphs $$G_{n,r}$$ for $$3 \leq r \leq 12$$, which can be used to investigate the significance of observed clustering, together with determining the asymptotic behaviour for large $$r$$; and (b) showing high modularity for graphs in families such as the low degree treelike graphs, and thus for example for random planar graphs. We also investigated the minimum modularity $$q_r^-(n)$$, and the maximum modularity $$q_r^+(n)$$. Proposition 1.4 shows that the modularity of any large cubic graph is at least $$2/3 -o(1)$$; and in our simulations the highest modularity value of a partition found for a random cubic graph was about $$0.68$$ (though there is no guarantee this is close to optimal). Does the minimum modularity $$q_3^{-}(n) \to \tfrac23$$ as $$n \to \infty$$? Perhaps we even have $$q^*(G_{n,3}) \to \frac23$$ in probability as $$n \to \infty$$? If so, then random cubic graphs would give extremal examples for low modularity, but is it the case? The opposite conjecture was presented by the first author at the Bellairs workshop on Probability, Combinatorics and Geometry in April 2016. Conjecture 7.1 There exists $$\delta>0$$ such that $$q^*(G_{n,3}) \geq 2/3 + \delta$$ whp. Our results on cubic graphs highlight the importance of choosing the right baseline for modularity to assess significance. For suppose we have a cubic network $$G$$ with $$n$$ vertices, where $$n$$ is large. We have seen in Corollary 1.4 and Theorem 1.6 that $$q^*(G) > 0.66$$, just because $$G$$ is cubic. Hence, unless $$q_0>0.66$$, the fact that a partition $${\mathcal A}$$ has $$q_{\mathcal A}(G) =q_0$$ should certainly not be considered as evidence that $$\mathcal A$$ shows community structure. We have discussed the modularity of random regular graphs, $$q^*(G_{n,r})$$. This is very different from considering the modularity of a random partition of a fixed graph. For let $$G$$ be any fixed graph (with at least one edge). Fix $$k \geq 2$$, and suppose that we generate a random partition $$\mathcal A$$ of the vertices by placing each vertex into one of $$k$$ parts independently with probability $$1/k$$. Then   \begin{equation} \label{eqn.randpart} {\mathbb E}[q_{\mathcal A}(G)] < 0. \end{equation} (13) Thus comparing the modularity of a partition which we find to that of a random partition is likely to give a false positive! To see why (13) holds, observe that for an edge $$e$$ in $$G$$ the probability that both endpoints are placed in the same part is $$1/k$$, so $${\mathbb E}[q_{\mathcal A}^E(G)]=1/k$$; and by (9) the degree tax is always at least $$1/k$$, and sometimes larger. In a companion paper [14] (see also [36]) we prove that there is a phase transition for the modularity of Erdős-Rényi random graphs. Additionally we show in [39] that large subgraphs of lattices, and more generally all large graphs which embed in space with ‘small distortion’, have high modularity. Acknowledgements Thanks to Michael Krivelevich for comments at the meeting Combinatorics Downunder in Melbourne in 2016, which led us to Lemma 5.1. References 1. Reichardt J. & Bornholdt S. ( 2006) When are networks truly modular? Phys. D , 224, 20– 26. Google Scholar CrossRef Search ADS   2. Fortunato S. & Hric D. ( 2016) Community detection in networks: a user guide. Phys. Rep. , 659, 1– 44. Google Scholar CrossRef Search ADS   3. Lancichinetti A. & Fortunato S. ( 2011) Limits of modularity maximization in community detection. Phys. Rev. E. , 84, 066122. Google Scholar CrossRef Search ADS   4. Reichardt J. & Bornholdt S. ( 2006) Statistical mechanics of community detection. Phys. Rev. E. , 74, 016110. Google Scholar CrossRef Search ADS   5. Brandes U., Delling D., Gaertler M., Gorke R., Hoefer M., Nikoloski Z. & Wagner D. ( 2008) On modularity clustering. IEEE Trans Knowl. Data Eng.,  20, 172– 188. Google Scholar CrossRef Search ADS   6. Bagrow J. P. ( 2012) Communities and bottlenecks: trees and treelike networks have high modularity. Phys. Rev. E. , 85, 066118 Google Scholar CrossRef Search ADS   7. De Montgolfier Montgolfier., Soto M. & Viennot L. ( 2011) Asymptotic modularity of some graph classes. Algorithms Comput. , 435– 444. Google Scholar CrossRef Search ADS   8. Guimerà R., Sales-Pardo M. & Amaral L. A. N. ( 2004) Modularity from fluctuations in random graphs and complex networks. Phys. Rev. E. , 70, 025101. Google Scholar CrossRef Search ADS   9. Newman M. E. J. & Girvan M. ( 2004) Finding and evaluating community structure in networks. Phys. Rev. E. , 69, 026113. Google Scholar CrossRef Search ADS   10. Fortunato S. ( 2010) Community detection in graphs. Phys. Rep. , 486, 75– 174. Google Scholar CrossRef Search ADS   11. Porter M. A., Onnela J. K. & Mucha P. J. ( 2009) Communities in networks. Notices Amer. Math. Soc. , 56, 1082– 1097. 12. Bolla M., Bullins B., Chaturapruek S., Chen S. & Friedl K. ( 2015) Spectral properties of modularity matrices. Linear Alg. Appl. , 473: 359– 76. Google Scholar CrossRef Search ADS   13. Majstorović S. & Stevanović D. ( 2014) A note on graphs whose largest eigenvalues of the modularity matrix equals zero. Electron. J. Linear Algebra , 27, 256. Google Scholar CrossRef Search ADS   14. McDiarmid C. & Skerman F. ( 2017) Modularity of Erdős-Rényi random graphs. preprint. 15. Trajanovski S., Wang H. & Van Mieghem P. ( 2012) Maximum modular graphs. Eur. Phys. J. B , 85, 1– 14. Google Scholar CrossRef Search ADS   16. McDiarmid C. & Skerman F. ( 2013) Modularity in random regular graphs and lattices. Electron. Notes Discrete Math. , 43, 431– 437. Google Scholar CrossRef Search ADS   17. Blondel V. D., Guillaume J. L., Lambiotte R. & Lefebvre E. ( 2008) Fast unfolding of communities in large networks. J. Stat. Mech. Theory Exp. , 10, P10008. Google Scholar CrossRef Search ADS   18. Le Martelot E. & Hankin C. ( 2013) Fast multi-scale detection of relevant communities in large-scale networks. Comput. J. , 56, 1136– 1150. Google Scholar CrossRef Search ADS   19. Franke B. & Wolfe P. J. ( 2016) Network modularity in the presence of covariates. preprint arXiv:1603.01214 . 20. Fortunato S. & Barthémy M. ( 2007) Resolution limit in community detection. Proc. Natl. Proc. Natl. Acad. Sci. USA , 104, 36– 41. Google Scholar CrossRef Search ADS   21. Kleinberg J. & Tardos E. ( 2005) Algorithm Design . Boston, Massachusetts, United States: Addison Wesley. 22. Bodlaender H. L. ( 1998) A partial $$k$$-arboretum of graphs with bounded treewidth. Theoret. Comput. Sci. , 209, 1– 45. Google Scholar CrossRef Search ADS   23. Dvořák Z. & Norin S. ( 2014) Treewidth of graphs with balanced separations. preprint arXiv:1408.3869 . 24. Gilbert J. R., Hutchinson J. P. & Tarjan R. E. ( 1984) A separator theorem for graphs of bounded genus. J. Algorithms , 5, 391– 407. Google Scholar CrossRef Search ADS   25. McDiarmid C. & Reed B. ( 2008) On the maximum degree of a random planar graph. Combin. Probab. Comput. , 17, 591– 601. Google Scholar CrossRef Search ADS   26. Steger A. & Wormald N. C. ( 1999) Generating random regular graphs quickly. Combin. Probab. Comput. , 8, 377– 396. Google Scholar CrossRef Search ADS   27. Jeub L. G. S., Bazzi M., Jutla I. S. & Mucha P. J. ( 2011) A generalized louvain method for community detection implemented in MATLAB. http://netwiki.amath.unc.edu/GenLouvain ( 2011– 2017). 28. Janson S., Łuczak T. & Ruciński A. ( 2011) Random Graphs , vol. 45. Hoboken, New Jersey, United States: John Wiley. 29. Alon N. ( 1997) On the edge-expansion of graphs. Combin. Probab. Comput. , 6, 145– 152. Google Scholar CrossRef Search ADS   30. Díaz J., Serna M. J. & Wormald N. ( 2007) Bounds on the bisection width for random $$d$$-regular graphs. Theoret. Comput. Sci. , 382, 120– 130. Google Scholar CrossRef Search ADS   31. Dembo A., Montanari A. & Sen S. ( 2017) Extremal cuts of sparse random graphs. Ann. Probab.  45, 1190– 1217. Google Scholar CrossRef Search ADS   32. Van Mieghem Mieghem., Ge X., Schumm P., Trajanovski S. & Wang H. ( 2010) Spectral graph analysis of modularity and assortativity. Phys. Rev. E. , 82, 056113. Google Scholar CrossRef Search ADS   33. Alon N. & Spencer J. H. ( 2000) The probabilistic method. Wiley Ser. Discrete Math. Optim. , second edn. p. 140. 34. Alon N. & Chung F. R. K. ( 1988) Explicit construction of linear sized tolerant networks. Ann. Discrete Math. , 38, 15– 19. Google Scholar CrossRef Search ADS   35. Kolesnikm B. & Wormald N. ( 2014) Lower bounds for the isoperimetric numbers of random regular graphs. SIAM J. Discrete Math. , 28, 553– 575. Google Scholar CrossRef Search ADS   36. Skerman F. ( 2016) Modularity of Networks . Ph.D. thesis. 37. Friedman J. ( 2008) A Proof of Alon’s Second Eigenvalue Conjecture and Related Problems , vol. 195, No. 910. Memoirs of the American Mathematical Society. Providence, Rhode Island, United States: American Mathematical Society, pp. viii+ 100. 38. DasGupta B. & Desai D. ( 2013) On the complexity of Newman’s community finding approach for biological and social networks. J. Comput. System Sci. , 79, 50– 67. Google Scholar CrossRef Search ADS   39. McDiarmid C. & Skerman F. ( 2017+) Modularity of lattices and other well-embeddable graphs. preprint . 40. Prokhorenkova L. O., Prałat P. & Raigorodskii A. ( 2017) Modularity of models of complex networks. preprint arXiv:1701.03141 . © The authors 2017. Published by Oxford University Press. All rights reserved.

Journal

Journal of Complex NetworksOxford University Press

Published: Oct 7, 2017

There are no references for this article.

You’re reading a free preview. Subscribe to read the entire article.


DeepDyve is your
personal research library

It’s your single place to instantly
discover and read the research
that matters to you.

Enjoy affordable access to
over 18 million articles from more than
15,000 peer-reviewed journals.

All for just $49/month

Explore the DeepDyve Library

Search

Query the DeepDyve database, plus search all of PubMed and Google Scholar seamlessly

Organize

Save any article or search result from DeepDyve, PubMed, and Google Scholar... all in one place.

Access

Get unlimited, online access to over 18 million full-text articles from more than 15,000 scientific journals.

Your journals are on DeepDyve

Read from thousands of the leading scholarly journals from SpringerNature, Elsevier, Wiley-Blackwell, Oxford University Press and more.

All the latest content is available, no embargo periods.

See the journals in your area

DeepDyve

Freelancer

DeepDyve

Pro

Price

FREE

$49/month
$360/year

Save searches from
Google Scholar,
PubMed

Create lists to
organize your research

Export lists, citations

Read DeepDyve articles

Abstract access only

Unlimited access to over
18 million full-text articles

Print

20 pages / month

PDF Discount

20% off