Trees, forests, and total positivity: I. $q$-trees and $q$-forests matrices

We consider matrices with entries that are polynomials in $q$ arising from natural $q$-generalisations of two well-known formulas that count: forests on $n$ vertices with $k$ components; and trees on $n+1$ vertices where $k$ children of the root are smaller than the root. We give a combinatorial interpretation of the corresponding statistic on forests and trees and show, via the construction of various planar networks and the Lindstr\"om-Gessel-Viennot lemma, that these matrices are coefficientwise totally positive. We also exhibit generalisations of the entries of these matrices to polynomials in \emph{eight} indeterminates, and present some conjectures concerning the coefficientwise Hankel-total positivity of their row-generating polynomials.

The main goal of this paper is to prove the total positivity of some matrices that arise from generalisations of f n,k and t n,k . Recall that a matrix is totally positive (strictly totally positive) if all of its minors are nonnegative (strictly positive, respectively). 2 Total positivity has many applications across combinatorics, statistical physics, representation theory, and background material on the topic can be found in [42,26,51,22].
Our first result concerns the forests (of rooted labelled trees) matrix F := (f n,k ) n,k≥0 = n − 1 k − 1 n n−k n,k≥0 , (1.9) (the first few rows of which appear in (1.5)) and the (rooted labelled) trees matrix T := (t n,k ) n,k≥0 = n k n n−k n,k≥0 , (1.10) (the first few entries of which appear in (1.8)). We have: Theorem 1.1. The matrices F and T are totally positive.
The total positivity of the forests and trees matrices has been proven very recently in [66,67] using different methods to the ones we employ in the present paper. Sokal observes in [66] that F is the exponential Riordan array R[F, G] with F (t) := 1 and G(t) the tree function [16] G(t) := ∞ n=1 n n−1 t n n! , (1.11) and similarly in [67] Sokal and Chen observe that T is the exponential Riordan array n n t n n! = 1 1 − G(t) (1.12) and G(t) as above. In [66] and [67] the author(s) exploit these intepretations of F and T and make use of the production-matrix method to prove these matrices are totally 2 The terms "totally nonnegative" and "totally positive" have been used by previous authors (see, for example, [26,24,22]) in place of what we have called here "totally positive" and "strictly totally positive" respectively. In studying the literature it is important to clarify which sense of total positivity is being used, since many theorems are valid only for strictly totally positive matrices.
The matrices F and T are closely related; by studying the entries one can, in effect, see the woods for the trees since for n > 0 f n,k = n − 1 k − 1 n n−k = k n n k n n−k = k n t n,k , (1.13) that is, F and T are related via a diagonal similarity transform (see Lemma 3.5 in Section 3.3): where diag(a) denotes (for the sequence a = (a n ) n≥0 ) the diagonal matrix with (n, n)entry equal to a n and all other entries 0 (note we must take a limit in the above to avoid division by zero in the first column of T). Total positivity is preserved under matrix multiplication (this follows from the Cauchy-Binet formula), so (1.14) shows that the total positivity of T implies that of F (a diagonal matrix with nonnegative entries on the diagonal is clearly totally positive).
In fact there are a number of identities we present in Section 3.3 that allow one to go from T to F (and vice versa) via simple matrix multiplications that preserve total positivity. By specialising q to q = 1 in Lemma 3.11 below we obtain the identity where M := (m n,k ) n,k≥0 is the unit-lower-triangular matrix with (n, k)-entry m n,k = n! k! (1. 16) for n ≥ k and all other entries 0. The matrix M is easily shown to be totally positive (see Section 3.3), so it follows from (1.15) that the total positivity of F implies that of T. In order to prove Theorem 1.1 it therefore suffices to prove that the forests matrix F is totally positive; we do this in Section 4 by constructing a planar network with nonnegative rational weights and showing that the corresponding path matrix is F. The total positivity of F then follows from the LGV lemma (see Section 2.1). In this paper, however, we are chiefly concerned with q-generalisations of the forests and trees matrices. The formula f n,k has a perfectly natural q-analogue, thus we define the q-forests matrix F(q) := (f n,k (q)) n,k≥0 to be the matrix with (n, k)-entry f n,k (q) := where [n] q := 1 − q n 1 − q = 1 + q + · · · + q n−2 + q n−1 if n > 0, 0 if n = 0, (1.18) n k q is the q-binomial coefficient: (1.19) in which [n] q ! := [j] q if n > 0, 1 if n = 0, (1.20) and δ nk is the Kronecker delta: It follows easily from (1.17) that f n,k (q) is a monic self-reciprocal polynomial of degree (n − 1) 2 − (k − 1) 2 , and the first few rows of F(q) are: The q-forests matrix counts forests on n vertices with k components with respect to some statistic, which we interpret combinatorially in Section 3 (see Corollary 3.2). Please note that in [66] Sokal considers a different generalisation of F (he introduces indeterminates into F that count forests of rooted labelled trees in terms of proper and improper edges), whereas our results grew from studying natural q-generalisations of the matrix entries. In Section 6 we discuss how our generalisation gives rise to some curious conjectures concerning generalisations of well-known polynomial sequences including: the Schläfli-Gessel-Seo polynomials; the general Abel polynomials; (p, q)-Stirling cycle polynomials; and the reverse Bessel polynomials.
Each entry t n,k of the trees matrix has a similar natural q-analogue; we thus define the q-trees matrix to be T(q) := (t n,k (q)) n,k≥0 where t n,k (q) := n k q ([n] q ) n−k . (1.23) Once more it is easy to see that t n,k (q) is a monic self-reciprocal polynomial of degree n(n − 1) − k(k − 1), and the first few rows of T(q) are:     1 1 1 q 2 + 2q + 1 q 2 + 2q + 1 1 q 6 + 3q 5 + 6q 4 + 7q 3 + 6q 2 + 3q + 1 q 6 + 3q 5 + 6q 4 + 7q 3 + 6q 2 + 3q + 1 q 4 + 2q 3 [7,8] that the entries of the matrix T(q) count forests on n + 1 vertices with k + 1 components where the vertex n + 1 is a leaf with respect to some statistic, and we give a combinatorial interpretation of q in Section 3. We note that our qgeneralisation of the tree matrix and the corresponding combinatorial interpretation differs from the generalisation of T studied by Chen and Sokal in [67].
The entries of F(q) and T(q) are polynomials in q with integer coefficients, and there is a natural extension of total positivity to matrices whose entries are polynomials in one or more indeterminates x. We equip the polynomial ring R[x] with the coefficientwise partial order, that is, we say that P is nonnegative (and write P 0) in case P is a polynomial with nonnegative coefficients. We then say that a matrix with entries in R[x] is coefficientwise totally positive (TP) if all of its minors are polynomials with nonnegative coefficients, and if all of its minors of size ≤ r are polynomials with nonnegative coefficients we say that the matrix is totally positive of order r (TP r ). Our main result is the following: Theorem 1.2. The matrices F(q) and T(q) with entries in the polynomial ring Z[q] are coefficientwise totally positive.
It is plain to see that the above theorem reduces to Theorem 1.1 when q is specialised to q = 1. More generally, we say that a matrix M with polynomial entries belonging to R[x] is pointwise totally positive on some domain D ⊆ R + if M is totally positive for all x ∈ D (by which we mean all the indeterminates x are specialised to values in D). Coefficientwise total positivity of M thus implies pointwise total positivity for all x ∈ R + , but the converse is not true.
The main goal of this paper is to prove Theorem 1.2 and the structure of our proof is as follows: after reviewing some basic concepts in total positivity from the perspective of planar networks in Section 2, we then provide combinatorial interpretations of the entries of F(q) and T(q) in Section 3 and establish some identities that show the coefficientwise total positivity of F(q) implies that of T(q). In Section 4 we construct a planar network with weights that are rational and pointwise nonnegative functions of q, and prove that the path matrix corresponding to this planar network agrees with F(q); thanks to the LGV lemma this proves pointwise total positivity of F(q) and T(q) for q ∈ R + (Theorem 1.1 is then obtained by specialising q to q = 1). In Section 5 we show how the network from Section 4 can be transformed into a planar network with weights that are polynomials in q, thereby proving Theorem 1.2. We conclude in Section 6 with some further generalisations and open problems, some of which will be the subject of future work.

Preliminaries
Here we review some fundamental definitions and facts regarding total positivity. Please note that since our proofs rely on Lindström-Gessel-Viennot lemma, many of the results in this section are motivated by performing operations on planar networks (see [22,24,5,6]), from which various matrix identites follow.

Total positivity and the Lindström-Gessel-Viennot lemma
One fundamental tool in the study of total positivity is the Lindström-Gessel-Viennot (LGV) lemma. Suppose G is a locally finite acyclic digraph with source vertices U := {u 0 , u 1 , . . . , u n } and sink vertices V := {v 0 , v 1 , . . . , v n }, where the weight w e of an edge e is an element of some commutative ring R. Let w(P (u i , v j )) denote the product of the weights of the edges of a path P (u i , v j ) starting at u i and ending at v j , and define to be the sum over all weighted paths between u i and v j . The path matrix corresponding to G is then the matrix We say that a family of nonintersecting paths from U to V is an n-tuple (P 0 , P 1 , . . . , P n ) of paths in G such that: (i) There exists a permutation σ of {0, 1, 2, . . . , n} such that for each i, P i is a path from u i to v σ(i) . (ii) Whenever i = j, paths P i and P j have no vertices in common (this includes endpoints). The LGV lemma states that det(P G ) = where sgn(σ) = (−1) inv(σ) is the signature of the permutation σ arising from P i mapping u i to v σ(i) (note that inv(σ) denotes the number of inversions of σ, that is, pairs (i, j) in {0, 1, . . . , n} such that i < j and σ(i) > σ(j)). In particular, if the only permutation giving rise to nonempty families of nonintersecting paths is the identity then det(P G ) gives the sum over all weighted families of nonintersecting paths in G that begin at U and end at V , where the weight of each family is the product of the weights of the paths (P 0 , . . . , P n ). Suppose now the source and sink vertices of G are fully compatible, by which we mean that for any subset of sources u n 1 , u n 2 , . . . , u nr (where n 1 < n 2 < · · · < n r ) and sinks v k 1 , v k 2 , . . . , v kr (where k 1 < k 2 < . . . < k r ), the only permutation σ ∈ S r mapping each source u n i to the sink v k σ(i) that gives rises to nonempty families of paths is the identity. The LGV lemma then implies that every minor of P G is a sum over families of nonintersecting paths between specified subsets of U and V , where each family has weight w(P i ). If every edge has a weight that is a positive real number then P G is totally positive; if the weights of the network belong to the field Q(x) of rational functions of x that are pointwise nonnegative on some domain D then P G is pointwise totally positive on D; and if the weight of each edge is a polynomial in the indeterminates x with nonnegative integer coefficients then P G is totally positive in Z[x] equipped with the coefficientwise order.
Determining whether a general locally finite acyclic digraph is fully compatible is non-trivial, however, if G is embedded in the plane and the source and sink vertices U and V lie on the boundary of G in the order "first U in reverse order, then V in order" then the topology of G clearly implies that U and V are fully compatible (see, for example, Lemma 9.18 in [49]). From now on we will refer to locally acyclic digraphs embedded in the plane with fully compatible sources and sinks as planar networks, in the spirit of [24].

The binomial-like planar network
The matrices T(q) and F(q) are unit-lower-triangular, so in the sequel we will be principally concerned with what we call the binomial-like planar network (depicted in Figure 1). This planar network consists of vertices indexed by i (j) increasing horizontally from the right (vertically upwards, respectively) where 0 ≤ i ≤ j. Each source u i is the vertex with index (i, i) while each sink v j is the vertex (0, j). Each horizontal edge directed from vertex (i, j) to vertex (i−1, j) has weight α i,j−i+1 , while the weight of a diagonal edge directed from vertex (i, j) to (i − 1, j − 1) has weight β i,j−i . We also assume there exists a directed edge from u 0 to v 0 with weight 1.
The binomial-like planar network with weights α = {α i,l } i,l≥1 and β = {β i,l } i≥1,l≥0 described above is denoted N . Please note that the source and sink vertices of N are fully compatible, so it follows immediately from the LGV lemma that the path matrix P N is automatically coefficientwise totally positive over Z[α, β] in all of these indeterminates! This is really the beauty of the LGV lemma (in the context of total positivity): given a lower-triangular matrix M that appears to be coefficientwise totally positive in R[x], one can try to prove total positivity by specialising α i,l , β i,l to suitable nonnegative elements of R[x] and showing that under such a specialisation Indeed, this is how we concoct our proof of Theorem 1.2. We first show that specialising the weights of the binomial-like network to suitably chosen rational functions of q yields a path matrix that agrees with F(q) in Section 4; since these rational functions are all nonnegative for q ∈ R + we conclude that F(q) is pointwise totally positive for q ∈ R + . In Section 5 we then transform this binomial-like network to obtain a different planar network with weights that are polynomials in q in order to show that F(q) is coefficientwise totally positive. The planar network construction described above originally goes back to Brenti [5] who also observed that if the binomial-like network N has weights α and β that depend purely on the first index (that is, α i,l = α i, * and β i,l = β i, * for all i) then the entries of the path matrix P N satisfy the n-dependent recurrence Similarly if the weights depend solely on the second index (that is, α i,l = α * ,l and β i,l = β * ,l for all l) then the entries of the path matrix satisfy the k-dependent The most straightforward (and thus, eponymous) example that illustrates this connection between matrices with entries satisfying purely n-(or k-) dependent recurrences and binomial-like planar networks is the weighted binomial matrix, the entries of which satisfy the n-dependent linear recurrence for n > 0 with initial condition (B x,y ) 0,k = δ 0k . The corresponding planar network is the network N with α i,l = y and β i,l = x, and it follows immediately from the LGV lemma that Matrices with entries given by purely n-dependent or purely k-dependent recurrences have relatively straightforward planar network representations, and often in these cases it is easy to deduce a straightforward planar network by studying the recurrence.
Matrices with entries that satisfy recurrences dependent on both n and k, however, give rise to seemingly much more complex planar networks (see, for example, [11]). For example, the entries of the forests matrix satisfy the recurrence: (2.10) for n > 1 with initial conditions f n,0 = δ n0 , and f 1,1 = 1. We note that we were able to find the correct weights for the binomial-like planar network corresponding to F in spite of this complicated recurrence, and not because of it.
In the sequel we will also make use of the following fact. Suppose α i,l = 1 and consider the sum over all weighted paths from u n to v k in N (denoted P N (u n → v k )). By studying the network it is relatively easy to see that P N (u n → v k ) can be expressed as a nested sum (2.12) Observe that if the weights β i,l are dependent only on the first index then P N (u n → v k ) can be realised as the elementary symmetric polynomial e n−k (X 1 , X 2 , . . . , X n ) := where X n := β n, * . If instead the weights β i,l depend solely on the second index then (2.12) can be realised as the complete homogeneous symmetric polynomial where X k = β * ,k−1 (this observation again goes back to Brenti [5]). In this article we study total positivity primarily through the lens of planar networks; the next section dicusses how planar networks can be intepreted algebraically as matrix factorisations.

Matrix factorisations
The planar network approach outlined above allows us to easily write down various factorisations of the path matrix P N . Before discussing these factorisations we first clarify some notation. We use N to denote the binomial-like network described in the previous subsection with the set of horizontal weights α and diagonal weights β. Conversely, given a matrix M , in this section we will often use N M to denote a planar network with corresponding path matrix P N M satisfying In this case N M is referred to as a planar network representation of the matrix M . We will make much use of the following definition. For sequences a := (a n ) n≥0 and b := (b n ) n≥0 , let L(a, b) denote the lower-bidiagonal matrix with (n, k)-entry The first few rows and columns of L(a, b) are: In case a n = 1 for all n we abbreviate L(a, b) to L(b), while if b n = 0 for all n the matrix L(a, b) is simply the diagonal matrix diag(a) with (n, n)-entry a n and all other entries 0. Lastly, if a n = 1 and the sequence b is constant, that is, b n = x for all n, we abbreviate L(b) to L(x), and if we have a n = x and b n = y for all n with y = 1 we abbreviate L(a, b) to L(x, y).
. Note that unlabelled directed edges are assumed to have weight 1.
The lower-bidiagonal matrix L(a, b) has a planar network representation N L(a,b) in which P N L(a,b) (u n → v n ) = a n (2.18) and (see the diagram on the left in Figure 2). Since we view these matrices through the lens of planar networks we will refer to the sequences a and b as edge-sequences corresponding to L(a, b). According to the LGV lemma we have: It is straightforward to verify that where E n (a, b) denotes the elementary (lower) bidiagonal matrix with (n, n)-entry a, (n + 1, n)-entry b, all other diagonal entries 1, and all other entries 0. As with bidiagonal matrices, in case a = 1 we abbreviate E n (1, b) to E n (b). We now present a useful lemma relating matrix products and concatenated planar networks:  Then the matrix product M 1 M 2 is the path matrix corresponding to the planar network N M 3 obtained by concatenating M 1 and M 2 , with source vertices U and sink vertices V , where each vertex v i ∈ V is identified with u i ∈ U for all i.

Proof.
Since v i is identified with u i we can write the sum over over weighted paths from u n to v k in N M 3 as Concatenating planar networks thus corresponds to multiplying path matrices, and the matrices M 1 and M 2 in the above are referred to as transfer matrices of the planar network N M 3 . The elementary bidiagonal matrices on the right-hand side of (2.20) are thus transfer matrices of N L(a,b) , 4 and concatenating the planar networks for E 0 (a 0 , b 0 ), E 1 (a 1 , b 1 ), . . . yields the planar network on the right in Figure 2.
We now interpret the binomial-like planar network N and its path matrix P N from Subsection 2.2 in light of these definitions. By extending the source vertices of N to the left so that they lie on the same vertical line we obtain a planar network N 1 that is isomorphic to N (see Figure 3), in particular we have (2.26) Consider a subnetwork C i of N 1 consisting of source vertices U := {(i+1, j) : j ∈ N} and sink vertices V := {(i, j) : j ∈ N}. Let a i denote the sequence of weights of horizontally directed edges emanating from vertex (i + 1, i + n) for increasing n, that is, a i := (a n ) n≥0 where a n = α i+1,n if n > 0, Similarly let b i denote the sequence of weights of the diagonal edges emanating from vertex (i + 1, i + n + 1) for increasing n, that is, b i := (β i+1,n ) n≥0 . It is easy to see that the path matrix corresponding to C i is the column transfer matrix where I i is the identity matrix of size i, and L(a i , b i ) is the lower-bidiagonal matrix with corresponding edge sequences a i and b i . Obviously the matrix P C i is totally positive in Z[a, b] equipped with the coefficientwise order. Since N 1 is the concatenation of column transfer matrices we immediately obtain what we refer to as a production-like factorisation of P N : Corollary 2.4 (Production-like factorisation). The path matrix P N corresponding to the binomial-like planar network N has the factorisation: where a i = (α i+1,n ) n≥0 (with α i+1,0 = 1) and b i = (β i+1,n ) n≥0 .
Recall from the previous subsection that the weighted binomial matrix B x,y is the path matrix of the binomial-like network N with α i,l = y and β i,l = x. The above corollary thus yields the following factorisation of B x,y : Corollary 2.5 (Production-like factorsation of B x,y ). The matrix B x,y has the productionlike factorisation where L(y, x) denotes the lower-bidiagonal matrix with (0, 0)-entry 1, all other diagonal entries y, all subdiagonal entries x, and all other entries 0.
We note that the above corollary imples that B x,y satisfies B x,y = 1 0 0 B x,y L(y, x).  There are other ways to factorise P N that rely on the following helpful definition. Given a sequence a = (a n ) n≥0 let T (a) := (a * n,k ) n,k≥0 denote the lower-triangular matrix with (n, k)-entry for n ≥ k and 0 in all other cases (we consider the empty product arising from n = k to be 1). The first few rows and columns of T (a) are thus: The matrix T (a) is the path matrix corresponding to the planar network N T (a) in which Figure 4). Clearly T (a) is totally positive in Z[a] equipped with the coefficientwise order, and by comparing Figure 2 with Figure 4 and (2.20) it is easy to see that . We thus obtain the following corollary: Corollary 2.6 (Inverse lower-bidiagonal matrices). For a sequence a = (a n ) n≥0 we have In light of Corollary 2.6 we refer to the matrix T (a) as an inverse (lower-)bidiagonal matrix with corresponding edge sequence a. The case where a n = x for all n often arises in the study of total positivity, and T (a) is then referred to as a Toeplitz matrix of powers of x since each (n, k) entry is x n−k , and we denote it T ∞ (x). It follows from the LGV lemma that T ∞ (x) is coefficientwise totally positive in Z[x]. More generally, given a sequence a = (a n ) n≥0 we call the infinite lower-triangular matrix T ∞ (a) = (a n−k ) n,k≥0 where a l = 0 for l < 0 the (infinite) Toeplitz matrix associated to a. 5 Let us return again to the binomial-like planar network N . Observe that N is isomorphic to the planar network N 2 in Figure 5, in particular we have for all n, k ≥ 0. Consider a subnetwork D l of N 2 contained between a pair of consecutive dashed diagonal lines. The path matrix for each such subnetwork is the diagonal transfer matrix : The concatenation of subnetworks D 0 , D 1 , . . . from left to right yields a different factorisation of P N , namely its quasi-production-like factorisation: 5 We observe here that a sequence a = (a n ) n≥0 of real numbers is Toeplitz-totally positive if its associated Toeplitz matrix T ∞ (a) is totally positive, and such sequences are commonly referred to as Pólya frequency sequences. A sufficient condition for Toeplitz-total positivity of a sequence a of real numbers is given by the celebrated Aissen-Schoenberg-Whitney-Edrei theorem [ Corollary 2.7 (Quasi-production-like factorisation). The path matrix P N has the factorisation where a l = (α n+1,l ) n≥0 , and b l = (β n,l ) n≥0 .
The weighted binomial matrix B x,y thus has the following quasi-production-like factorisation which can also be found in [10, Lemma 2.8]: Corollary 2.8 (Quasi-Production-like factorisation of B x,y ). The weighted binomial matrix B x,y has the quasi-production-like factorisation Observe that we can write the factorisation of B x,y above as where y = (1, y, y, . . .), from which it immediately follows that We conclude this subsection with one final lemma relating bidiagonal and inverse bidiagonal matrices. Lemma 2.9. Suppose a = (a n ) n≥0 and b = (b n ) n≥0 are sequences of elements belonging to a field F . Then (i) If a n = −b n for all n then L(a)T (b) = I; (ii) If a n + b n = 0 for all n then where a = (a n ) n≥0 is the edge sequence in which Proof. (i) If a n = −b n then we trivially have (ii) Suppose a n + b n = 0 for all n, and let M = L(a)T (b) and (2.48) Figure 6. The planar network representation of Lemma 2.9 Clearly M n,n = 1 = N n,n , while for n > k ≥ 0 the matrix entries of M n,k can be written as a telescoping product (the empty product is taken to be 1). Figure 6 is a planar network representation of Lemma 2.9. As simple as Lemma 2.9 is, it will prove to be a fundamental tool in our proof of Theorem 1.2. In applications in this paper the field F will be the field Q(q) of rational functions of q, which is the fraction field of the ring Z[q] of polynomials in q. The planar network we present in Section 4 arises from specialising the weights α and β of the binomial-like planar network N to certain rational functions of q, and Lemma 2.9 allows us to transform this network into a different network with weights that are polynomials in q.

A remark on Neville elimination
Given a totally positive matrix M there are myriad ways in which to express M as a product of totally positive matrices, however, if the entries of M belong to R then Gasca and Peña [30] provide an algorithm for systematically determining a "canonical" factorisation. The process is based on the Neville-Aitken technique [28] which, in the context of solutions of linear systems, gives rise to Neville elimination [29,27]. Neville elimination can be a powerful tool for studying totally positive matrices in general; here we sketch a brief overview of it purely for unit-lower-triangular matrices. For a full treatment please see [30].
Let M := (m n,k ) 0≤n,k≤N be a unit-lower-triangular matrix of size N + 1. If M contains any zeroes in its initial k = 0 column then form the matrix M 0 := (m 0 n,k ) 0≤n,k≤N by moving the offending rows of M to the bottom in such a way that the relative order among them is preserved (if M does not contain any zeroes in its initial column then set M 0 := (m 0 n,k ) 0≤n,k≤N ). The entries m 0 i,0 for i ≥ 0 are referred to as the (i, 0) pivots of M .
Suppose row n 1 is the bottom-most nonzero entry in column k = 0. For i decreasing from n 1 to 1 subtract m 0 from row i (thereby reducing m 0 i,0 to 0 from bottom to top as i decreases). This operation is equivalent to left-multiplying M by a product of elementary lower-bidiagonal matrices, and can thus be expressed algebraically as where: E N +1,n (x) is the elementary bidiagonal matrix of size N + 1 with (n, n − 1)entry x, 1s on the diagonal, and 0s everywhere else; R N +1 is some matrix of size N +1 that encodes a permutation of rows; and Reducing the zeroth column of M 1 to 0s everywhere except on the diagonal in the manner described above (that is, rearranging rows and successively subtracting them from each other) yields where M 2 = (m 2 n,k ) 0≤n,k≤N −2 is a matrix of size N − 1 and is a ratio of pivots of M 1 . Proceeding iteratively on smaller and smaller matrices we obtain, after a finite number of steps, the identity where each ρ i,j is a ratio of pivots obtained at each step of the algorithm: We call the factorisation of M obtained in this way the Neville factorisation of M . Gasca and Peña showed in [30] that the matrix M is totally positive if and only if R j = I j for all j (that is, Neville elimination can be applied to M without ever interchanging rows at any stage of the algorithm), and the pivots of M are all nonnegative (the same result can also be found in Chapter 6 of Pinkus' book [51], although Neville elimination is not treated explicitly there).
We can translate the Neville factorisation of M into the language of planar networks. If M is totally positive then it follows from (2.56) that where every pivot ρ i,j is nonnegative. We can easily construct a planar network representation N M of this factorisation (see Figure 7); the network we obtain is simply the standard binomial-like planar network with α n,k = 1 and β n,k = ρ n,k . We call the planar network N M obtained using Neville elimination the Neville network corresponding to M . We have already seen how to interpret such planar networks as production-like and quasi-production-like factorisations. By reading the network as a product of column transfer matrices we obtain the production-like factorisation Similarly, by reading the network as a product of diagonal transfer matrices we obtain the quasi-production-like factorisation (2.62) We note that the quasi-production-like factoristion above can be obtained directly from the products of elementary bidiagonal matrices in (2.58), since according to (2.35) we have . (2.63) The production-like factorisation, on the other hand, can be obtained from (2.58) by commuting elementary bidiagonal matrices. We have The right-hand side agrees with that of (2.59) since (2.66) Neville elimination can easily be applied to a unit-lower-triangular matrix M with entries that belong to the polynomial ring Z[x], though the resulting factorisation may well consist of matrices with entries that belong to the field Q(x) of rational functions of x. The planar network N 1 described in Section 4 below (see Figure 8) that we use to prove the pointwise total positivity of the q-forests matrix is the Neville network for the matrix F (q) = (f n,k (q)) n,k≥1 . By transforming this Neville network into a different planar network with weights that are polynomials in q we eventually show in Section 5 that F(q) is coefficientwise totally positive in Z[q].
Determining binomial-like planar networks via Neville elimination can be incredibly useful if the set of pivots are of a "nice" form from which a general pattern is easy to guess; however, often when attempting to construct planar networks for suspected totally positive matrices 6 one finds oneself with a set of rational expressions for the pivots that are difficult to make any sense of at all. Luckily, in the case of the forests and the trees matrices the pivots were of a general form that was easy to understand.
We have now established all of the fundamental concepts required to prove our main result (Theorem 1.2). In the next section we will interpret the entries of the q-forests matrix and the q-trees matrix combinatorially, and prove some matrix identities relating them.
3. Combinatorial interpretations of the entries of the q-forests and q-trees matrices, and some identites relating them The entries of the matrices F(q) and T(q) are polynomials in q that count trees or forests according to some statistic, and it is natural to try to interpret what that statistic might be. We present one such interpretation in the following two subsections, before considering some identities relating F(q) and T(q).

A combinatorial interpretation of the entries of F(q)
We begin with the q-forests matrix which counts forests on n vertices with k-components. Let F n,k denote the set of such forests for given n, k and consider a forest F ∈ F n,k . The vertices of F can be partitioned into three subsets: : v is neither a root, nor a lowest-numbered child of a root}.
We now describe one way in which to assign weights to the vertices in V r (F ), V s (F ), to be the set of nonroot vertices in F that are lower-numbered than a root vertex v. Each root v ∈ V r (F ) is then given the weight and for a forest F ∈ F n,k define 7 The vertex v min is the child of one of v 0 , . . . , v k−1 , so we assign v min the weight where v j is the parent of v min (we say that j is the smallest child index of F and denote it scindex(F )).
where parent(v) denotes the label of the parent of v, and define Putting the above together in one place we have for a vertex v in F : (3.10) We then define the weight of a forest to be the product of the weights of its vertices: 11) and note that if n = k we have wt(F ) = 1.
Proposition 3.1. For the set F n,k of forests on n vertices comprised of k components with n > k we have Our proof below is an extension of the first proof of Proposition 5.3.2 given by Stanley in [69], and we are very grateful to Bishal Deb for pointing it out.
Proof. A forest F ∈ F n,k consists of a root set V r (F ), and a subforest attached to the roots consisting of the vertices V t (F ) ∪ V s (F ). We construct a sequence σ 1 , σ 2 , . . . , σ n−k+1 of subforests of F (all with root set V r (F )) in the following way: set σ 1 = F . If i < n − k + 1 and σ i is defined then let σ i+1 be the subforest obtained from σ i by removing its largest nonroot endpoint v i (together with the edge incident to it). Let p i be the unique vertex of σ i adjacent to v i and consider the Prüfer sequence (or Prüfer code, see [54]) of the subforest of F that arises from removing all vertices in Now let F n,Vr denote the set of forests with a specified root set V r of size k. The map from forests to Prüfer sequences described above is a bijection (see [69,Proposition 5.3.2]). 8 Our aim is to understand the contribution of the weights from the vertices in terms of these Prüfer sequences and root sets.
Each subforest on the vertices V t (F ) ∪ V s (F ) has a unique Prüfer sequence (p 1 , p 2 , . . . , p n−k−1 , p n−k ), (3.15) and the first n − k − 1 elements of the sequence correspond to vertices with weights (t p 1 −1 , t p 2 −1 , . . . , t p n−k−1 −1 ). The weight of all sequences (p 1 , p 2 , . . . , p n−k−1 ) is thus It is easy to see that the element p n−k is the parent of v min , and since v min has weight s l for 0 ≤ l ≤ k − 1 (according to the definition of the weight function), the weight of the set of subforests with root set V r is What remains is to show that the weight of all possible root sets is Given a set of k root vertices V r chosen from [n], form the word w = w 1 w 2 . . . w n of length n on the alphabet {0, 1}, containing 0s at positions v 1 , . . . , v k ∈ V r and 1s everywhere else. The weight we assign to each vertex v i ∈ V r then corresponds to the number of 1s preceding the 0 at position w v i , so counting root sets with the weighting specified above is equivalent to counting all words w with respect to the number of inversions in w (an inversion is a pair (i, j) such that w i = 1, w j = 0, and i < j). This is a well-known interpretation of the r-binomial coefficient: The above proposition might invite one to consider the more general matrix F(r, s, t) := (f n,k (r, s, t)) n,k≥0 (3.19) with (n, k)-entry given by but alas, the first few rows of this matrix are: which is not even coefficientwise TP 2 in Z[r, s, t] since f 2,1 (r, s, t)f 3,2 (r, s, t) − f 3,1 (r, s, t)f 2,2 (r, s, t) In fact it seems the only way to ensure that F(r, s, t) is coefficientwise totally positive is to set r = s = t = q, thereby reducing F(r, s, t) to the q-forests matrix F(q). We conclude: For the q-forests matrix F(q) = (f n,k (q)) n,k≥0 we have where F n,k denotes the set of forests on n vertices with k components.
Having established this combinatorial interpretation of the entries of F(q) we now turn to the q-trees matrix.

A combinatorial interpretation of the entries of T(q)
The entries of the q-trees matrix (3.24) count rooted trees on n + 1 vertices with k children smaller than the root with respect to some statistic. In [7, Lemma 2], however, the authors give a bijection between the set of all such trees and the set of forests F * n+1,k+1 on the vertex set [n + 1] comprised of k + 1 components where n + 1 is a leaf (note that a root with no children is also a leaf); we therefore interpret the entries of T(q) as enumerating forests in F * n+1,k+1 with respect to certain statistics.
We can can construct the set F * n+1,k+1 in the following way: either take the set F n,k+1 of forests on n vertices with k + 1 components, and for each forest F ∈ F n,k+1 attach the vertex n + 1 as a leaf to any of the vertices in F (there are n ways to do this); or take the set of forests F n,k on n vertices with k components and to each F ∈ F n,k attach the vertex n + 1 as a singleton component. It follows that |F * n+1,k+1 | = n|F n,k+1 | + |F n,k | = n n − 1 k n n−k−1 + n − 1 k − 1 n n−k = n k n n−k .
(3.25) If we weight the forests in F * n+1,k+1 according to (3.11) in the previous subsection then it is not difficult to see that since the weight of the set of forests where n + 1 is a leaf, but not a component, is (3.27) (we obtain a multiplicative factor of t parent(n+1)−1 each time we attach n + 1 as a leaf to a leaf of a component, and each possible parent of n + 1 is an element of [n] in a forest F ∈ F n,k+1 ) and the weight of the set of forests where n + 1 is a singleton component is (since all nonroot vertices of F ∈ F n,k are smaller than n + 1, and this corresponds to appending a 0 to the word obtained from the root set V r (F ) described in the proof of Proposition 3.1). Letting T(r, s, t) := (t n,k (r, s, t)) n,k≥0 = ([n] t ) n−k r n−k n k r [k] s + [k + 1] s n k + 1 r (3.29) we have: (3.30) The first few rows of T(r, s, t) are: so T(r, s, t) is not even coefficientwise TP 2 in Z[r, s, t]. Again, it seems the only way to restore total positivity is to specialise r = s = t = q, in which case We thus have: Corollary 3.4. The entries of the q-trees matrix T(q) = (t n,k (q)) n,k≥0 satisfy where F * n+1,k+1 denotes the set of forests on n + 1 vertices with k + 1 components, in which the vertex n + 1 is a leaf.
It is safe to say that the statistics defined above are quite unconventional, arising from inserting q-weights into the Prüfer sequence for trees and forests. In [21] the authors provide an alternative method for encoding weighted trees that is more refined than that of Prüfer; a closer examination of this weight-preserving bijection in relation to q-forests and q-trees matrices will form part of future work on these matrices. For the time being we will turn our attention to some identities relating the matrices F(q) and T(q).

Some identities involving F(q) and T(q)
We have already seen in Section 1 that the entries of the forests matrix F := (f n,k ) n,k≥0 = n − 1 k − 1 n n−k n,k≥0 (3.35) and the entries of the trees matrix T := (t n,k ) n,k≥0 = n k n n−k n,k≥0 for n > 0. We therefore have: Lemma 3.5. The matrices F and T satisfy The above lemma shows that the total positivity of T implies that of F, however, by observing that t n,0 = t n,1 we also obtain the following identity: Lemma 3.6. The matrices F and T satisfy where E 0 (1) is the elementary bidiagonal matrix.
Proof. This follows from Lemma 3.5 and observing that right multiplying a matrix with E 0 (1) corresponds to adding column 1 to column 0.
We conclude that total positivity of F implies that of T, but there are yet more identities to uncover. By observing that Corollary 3.8. The matrices F and T satisfy But what of the more general matrices F(q) and T(q)? In order to understand how the q-forests and q-trees matrices are related we first present some well-known identities concerning q-binomial coefficients.
The q-binomial coefficient satisfies the dual recurrences: so it follows that for the q-forest numbers and the q-trees numbers t n,k (q) = n k q ([n] q ) n−k n,k≥0 (3.49) we have for n ≥ 1. We therefore have a direct q-generalisation of Lemma 3.5: Lemma 3.9. The matrices F(q) and T(q) satisfy By observing that t n,0 (q) = t n,1 (q) we also obtain a q-generalisation of Lemma 3.6: Lemma 3.10. The matrices F(q) and T(q) satisfy Since the entries of diag(([n] q + ) n≥0 ) −1 are rational functions of q, Lemma 3.9 shows that the pointwise total positivity of F(q) implies that of T(q), and vice versa (also, note that Lemma 3.10 shows that the pointwise total positivity of F(q) implies that of T(q)). It follows that to show both of these matrices are pointwise totally positive (Corollary 4.3 below) it suffices to prove that one of them is. Neither of the above lemmas, however, are of any help when considering the coefficientwise total positivity of our matrices.
We have one more simple identity that shows the coefficientwise total positivity of F(q) implies the coefficientwise total positivity of T(q). It turns out that T(q) can be obtained by right-multiplying F(q) with a simple inverse lower-bidiagonal matrix with entries that are polynomials in q.
Lemma 3.11. The matrices F(q) and T(q) satisfy T(q) = F(q)T (a(q)), (3.53) where T (a(q)) is the inverse bidiagonal matrix with edge sequence Proof. Since T (a(q)) is the inverse of the lower-bidiagonal matrix L(−a(q)) (Corollary 2.6 above), proving (3.53) is equivalent to showing that where L(−a(q)) is a lower-bidiagonal matrix with 1s on the diagonal, (n, n − 1)-entry − q n [n + 1] q (3.56) and all other entries 0. We have which clearly reduces to δ nk for k = 0. For k > 1 the right-hand side reduces, via the dual recurrences (3.45) and (3.46), to completing the proof.
The matrix T (a(q)) in the above lemma is clearly coefficientwise totally positive, so it follows from Lemma 3.11 that in order to prove that T(q) is coefficientwise totally positive it suffices to show that F(q) is coefficientwise totally positive. We were unable to find a similar identity that proves the coefficientwise total positivity of T(q) implies that of F(q), and this is why we focus on the matrix F(q) in the sequel.
In the next section we describe how to specialise the weights of the binomial-like network to rational functions of q, and show that the corresponding path matrix agrees with F(q). In Section 5 we show how this network can be transformed into a different network with weights that are polynomials in q, thus proving that F(q) (and therefore T(q)) is coefficientwise totally positive in Z[q].

Pointwise total positivity of the q-forests and q-trees matrices
Recall the binomial-like network N with edge weights α and β described in Section 2. This section is devoted to showing how specialising the weights α and β to pointwise nonnegative elements of the field Q(q) (that is, the fraction field of the polynomial ring Z[q]) yields a path matrix that agrees with F(q), from which the pointwise total positivity of F(q) (and thus, T(q)) trivially follows. We then present the production-like and quasi-production-like factorisations of F(q).

The planar network N 1
We begin by observing that since where F (q) := (f n+1,k+1 (q)) n,k≥0 = n k q ([n + 1] q ) n−k , (4.2) the pointwise (and indeed, coefficientwise) total positivity of F(q) is trivially equivalent to that of F (q). Now let N 1 denote the binomial-like planar network N in which and (see Figure 8). Observe that since N 1 is a binomial-like network in which the horizontal edges have weight 1 it must be a Neville network for some unit-lower-triangular matrix. We make the following proposition: Proposition 4.1. The path matrix matrix P N 1 satisfies Please note that by relabelling the source vertices u n → u n+1 and v k → v k+1 , and inserting a new source vertex u 0 at the bottom of N 1 connected via a horizontal edge of weight 1 to a new sink vertex v 0 , we obtain the planar network N 1 with corresponding path matrix Since the weights of N 1 are nonnegative for q ∈ R + , the pointwise total positivity of F(q) (and therefore also T(q) according to Lemma 3.11) follows from Proposition 4.1.
The author would like to point out that he is very grateful to Xi Chen and Shaoshi Chen for discovering a proof of Proposition 4.1 with q specialised to q = 1, which inspired what follows. Our proof of Proposition 4.1 arises from considering directly the sum over weighted paths in the network N 1 from u n to v k : (see (2.12), where the β i,l s have been replaced with the weights defined in (4.4)). Proving Proposition 4.1 amounts to showing that the right-hand side of (4.7) equals Since the nested sum in (4.7) is somewhat complicated, in order to make better sense of it we first prove the following lemma: the right-hand side of which can be written The dual recurrences for q-binomial coefficients (3.45) and (3.46) then reduce (4.11) to which agrees with the right-hand side of (4.9) when t is replaced with t − 1.
With Lemma 4.2 in hand we are now ready to prove Proposition 4.1.
Proof of Proposition 4.1. We will show that 13) where P N 1 (u n → v k ) denotes the sum over weighted directed paths in N 1 starting at u n and ending at v k . According to (4.7) we have 14) The nested sum (4.14) can be expressed recursively. Let and for 1 ≤ m ≤ n − k − 1 define so that in particular (where S n−k−m | m=n−k−1,i 0 =0 denotes the right-hand side of S n−k−m where m is replaced with n − k − 1 and i 0 = 0). We make the following claim: To prove (4.18) we first observe that since Substituting m = n−k−1 and i 0 = 0 in the right-hand side of (4.18)) for n ≥ k ≥ 0 yields completing the proof.
The above proposition immediately implies the following corollary: The matrices F(q) and T(q) are pointwise totally positive for q specialised to q ∈ R + .
Proof. According to Proposition 4.1 the matrix F (q) is the path matrix corresponding to a planar network with weights that are rational functions of q. Each weight in N 1 is pointwise totally positive for q ∈ R + , so according to the LGV lemma (see Subsection 2.1) F (q) is pointwise totally positive for q ∈ R + . Since pointwise total positivity of F(q) is trivially equivalent to that of F (q), the matrix F(q) is pointwise totally positive. We have already seen in Section 3 (see Lemma 3.11, for example) that pointwise total positivity of F(q) implies that of T(q), so T(q) and F(q) are pointwise totally positive.
Of course for q specialised to q = 1, Corollary 4.3 proves that both the trees matrix T and the forests matrix F are totally positive (Theorem 1.1). Moreover, the planar network in Figure 8 implies, via Proposition 4.1, a matrix factorisation of F (q) and hence a factorisation of F(q). Indeed, we can obtain two such factorisations depending on whether we view N 1 as a concatenation of column transfer matrices (yielding a production-like factorisation, see Corollary 2.4 above), or a concatenation of diagonal column transfer matrices (yielding a quasi-production-like factorisation, see Corollary 2.7 above).
Corollary 4.4. The matrix F(q) has the production-like factorisation F(q) = · · · I 3 0 0 L(a 2 (q)) · I 2 0 0 L(a 1 (q)) · I 1 0 0 L(a 0 (q)) (4.24) where L(a i (q)) is the lower-bidiagonal matrix with corresponding edge sequence . (4.25) We will use the above matrix factorisation in our proof of Theorem 1.2, however, we also remark that F(q) also has a quasi-production-like factorisation (thanks to Corollary 2.7): Corollary 4.5. The matrix F(q) has the quasi-production-like factorisation where T (a * l (q)) is the inverse bidiagonal matrix with corresponding edge sequence .

(4.27)
Having established the pointwise total positivity of the q-forests and q-trees matrix via the planar network N 1 , in the next section we will show how N 1 can be transformed into a different planar network with weights that are polynomial in q, from which the coefficientwise total positivity of F(q) and T(q) follows.

Coefficientwise total positivity of the q-forests and q-trees matrices
We now present a different planar network with weights that are polynomials in q and show that its corresponding path matrix can be transformed into the productionlike factorisation of F(q) from the previous section.
Let N 2 denote the planar network in Figure 9. Observe that this network does not have the structure of the binomial-like network that we have considered up to this point, nonetheless we can still apply the tools from Section 2 to understand the corresponding path matrix. In particular we will repeatedly make use of Lemma 2.9, so for ease of reading we recall it here: Lemma (Lemma 2.9 above). Suppose a = (a n ) n≥0 and b = (b n ) n≥0 are sequences of elements belonging to a field F . Then (i) If a n = −b n for all n then L(a)T (b) = I; (ii) If a n + b n = 0 for all n then where a = (a n ) n≥0 is the edge sequence in which a n := a 0 + b 0 if n = 0, a n−1 (an+bn) a n−1 +b n−1 if n > 0, (5.2) and b = (b n ) n≥0 is the edge sequence in which Consider a subnetwork C i of N 2 depicted in Figure 9. The column transfer matrix corresponding to each subnetwork is where L(a i (q)) and T (b i (q)) are lower-bidiagonal and inverse lower-bidiagonal matrices (respectively) with corresponding edge sequences and b i (q) = (q i [n + 1] q ) n≥0 . (5.6) The path matrix corresponding to N 2 has the factorisation P N 2 = · · · P C 2 P C 1 P C 0 (5.7) Figure 9. The planar network N 2 up to source u 6 and sink v 6 . Note that the dashed red lines do not form part of the network, they simply delineate the column transfer matrices of N 2 . Also note that the direction of the edges have been omitted, the reader should assume all edges are directed from left to right.
We make the following proposition: Proposition 5.1. The path matrix for N 2 satisfies Before beginning the proof proper we first outline our approach. The factorisation of P N 2 in (5.7) is of the form · · · (L 4 T 4 )(L 3 T 3 )(L 2 T 2 )(L 1 T 1 ), (5.9) where L i denotes a lower-bidiagonal matrix L downshifted by i: and similarly T i denotes an inverse lower-bidiagonal matrix T downshifted by i: Applying Lemma 2.9 to the rightmost product L 1 T 1 we obtain where T 2 is an inverse lower-bidiagonal matrix downshifted by 2 and L 1 a lowerbidiagonal matrix downshifted by 1. The factorisation in (5.9) can therefore be expressed as More generally, Lemma 2.9 enables us to "pull" lower-bidiagonal matrices "through" inverse lower-bidiagonal matrices to the right (compare Figure 6 with Figure 9), so that in particular for a given i > 0 the factorisation in 5.9 can be written in the form where each T i+1,j is an inverse bidiagonal matrix downshifted by i + 1, and each L i is a lower-bidiagonal matrix downshifted by i. It is clear that in the limit (as i → ∞) the inverse lower-bidiagonal matrices disappear, and what remains is a factorisation of P N 2 into downshifted lower-bidiagonal matrices: We will show that this resulting factorisation of P N 2 agrees with the production-like factorisation of F(q) given in Corollary 4.4 of the previous section.
Proof of Proposition 5.1. It is easy to see that the matrices agree in the first column, since P N 2 (u n → v 0 ) = δ n0 = f n,0 (q), (5.16) so consider again the matrix F (q) := (f n,k (q)) n,k≥0 = n k q ([n + 1] q ) n−k n,k≥0 (5.17) and let N 2 denote the planar network obtained by removing from N 2 vertices u 0 , v 0 and relabelling vertices u i → u i−1 , v i → v i−1 for i > 0 (the corresponding path matrix P N 2 is thus obtained by deleting the first row and column of P N 2 ). As described above, we will prove (5.8) by repeatedly applying Lemma 2.9 to the matrix factorisation of P N 2 , thereby expressing P N 2 as a product of lower-bidiagonal matrices that agree with those given in Corollary 4.4. To this end, fix i ≥ 0 and consider the product ·L(a 0 (q))T (b 0 (q)) (each matrix P C i is obtained by deleting the first row and column from P C i defined in (5.4) above). Claim 1. We claim that is a product of inverse bidiagonal matrices with corresponding edge sequences (5.23) and each L(c i (q)) is the lower-bidiagonal matrix with edge sequence Please note that the lower-bidiagonal matrices L(c i (q)) are obtained by deleting the first row and column of the matrices found in the production-like factorisation of F(q) in Corollary 4.4 above, so proof of the proposition follows once we have proved the claim (since (5.21) implies that for 0 ≤ n ≤ i + 1, each (n, k)-entry of P C i · · · P C 1 P C 0 agrees with that of F (q)). First observe that we can apply Lemma 2.9 to the product L(a i (q))T (b i (q)) in P C i , yielding Clearly T (b i (q)) = T (b i,0 (q)), moreover it is easily verified that a 0 (q) = c 0 (q), so suppose (5.21) holds for i − 1 ≥ 0. By the induction hypothesis and (5.25) we have · · · L(c 0 (q)).
(5.28) We now make the following claim: where c m (q) is the edge sequence Claim 2 (5.29) clearly holds for m = 0 by way of Lemma 2.9: · L(c 1 (q)), (5.31) and more generally we have (again by Lemma 2.9) · L(c m+1 (q)). (5.32) Letting m = i − 1 above proves Claim 2 (5.29), which in turn confirms Claim 1 (5.21) since it is straightforward to check that c i (q) = c i (q), thereby completing the proof of the proposition.
Coefficientwise total positivity of F(q) and T(q) follows almost immediately from Proposition 5.1: Proof of Theorem 1.2. Since N 2 is a planar network with weights that are polynomials with nonnegative coefficients in q and we have just shown that P N 2 = F(q), the matrix F(q) is coefficientwise totally positive in Z[q] thanks to the LGV lemma. The coefficientwise total positivity of T(q) then follows from the fact that (see Lemma 3.11 above), since the inverse lower-bidiagonal matrix T ((q n [n + 1] q ) n≥0 ) is coefficientwise totally positive.
Proving Theorem 1.2 was the main goal of this paper, however, the planar network N 2 can be seen as a specialisation of a more general network that appears to satisfy some interesting properties that we believe warrant further investigation. We discuss this more general network in the following section.

Further comments and some open problems
In this final section we turn our attention to a generalisation of the planar network N 2 that under certain specialisations yield matrices with entries that appear to count a variety of combinatorial objects with respect to different statistics. These matrices are automatically coefficientwise totally positive, since they arise from planar networks with weights that are polynomials with nonnegative coefficients. Furthermore, under certain specialisations, sequences of row-generating polynomials related to these matrices turn out to be sequences of polynomials that are already well-known, and in some cases are also known to be coefficientwise Hankel-totally positive (a sequence a = (P n (x)) n≥0 of polynomials in one or more indeterminates x is coefficientwise Hankel-totally positive if its associated Hankel matrix H ∞ (a) := (P n+k (x)) n,k≥0 is coefficientwise totally positive in all the indeterminates x).
We will briefly touch upon the method of production matrices (see [18,19]), which in recent years has become an important tool in enumerative combinatorics and has its roots in Stieltjes' work on continued fractions 9 . The theory of production matrices with respect to total positivity is extensively studied in [64], however, since [64] is not yet publicly available we direct the reader to Sections 2.2 and 2.3 of [66] for a fuller treatment.
For our purposes we will require the following principles: let P = (p i,j ) i,j≥0 be an infinite matrix with entries in R[x] equipped with the coefficientwise order. In order that powers of P are well defined we assume that P is either row finite (that is, has only finitely many nonzero entries in each row) or column finite. Let us now define the infinite matrix A := (a n,k ) n,k≥0 where a n,k = (P n ) 0,k , (6.1) that is, row n of A is the first row of the matrix power P n (in particular we set a 0,k = δ 0k ). We call P the production matrix of A, while A is referred to as the output matrix of P and we write O(P) = A. The entries of A are, explicitly, a n,k = i 1 ,...,i n−1 p 0,i 1 p i 1 ,i 2 p i 2 ,i 3 · · · p i n−2 ,i n−1 p i n−1 ,k , (6.2) which can be seen as the total weight of all n-step walks in N from i 0 = 0 to i n = k, in which the weight of a walk is the product of the weights of its steps, and each step from i to j has weight p i,j . An equivalent formulation is to define the entries by the recurrence a n,k = ∞ i=0 a n−1,i p i,k (6.3) for n ≥ 1 with initial condition a 0,k = δ 0k . Given a production matrix P, we define the augmented production matrix to bẽ and it is easy to show [66, Section 2.2] that the output matrix of P has the factorisation Clearly if P is coefficientwise totally positive then so isP, and hence so is O(P) (Theorem 2.9 in [66]). The factorisation given above is the reason we call the factorisation in Corollary 2.4 production-like. The quasi-production-like factorisation in Corollary 2.7 is named after the related concept of quasi-production matrices (see [10]) that we do not require here.
In the following subsections we consider further generalisations of the forests matrix to more indeterminates, and a common theme begins to emerge; in each case we have observed that modifying these matrices in a similar way to (6.6) above and shifting the indeterminates by 1 yields a set of matrices with row-generating polynomials that appear to be coefficientwise Hankel-totally positive jointly in a number of indeterminates.
The polynomialsF n (x; q) are, in fact, specialisations of a q-generalisation of the general Abel polynomials presented in [13,37,38]: Note that for w = 1, b = h = 0 the above formula gives a q-generalisation of the Stirling cycle polynomials, so the polynomials a n (x; b, h, w, q) interpolate between qforest polynomials and a q-generalisation of the Stirling cycle polynomials (below we will consider a different q-generalisation of the Stirling cycle polynomials).
Johnson [38,Section 4] showed that the polynomials a n (x; b, h, w, q) are of qbinomial type, that is, they satisfy a n (x; a + b, h, w, q) = n k=0 n k q a n−k (0; a, h × a k (x; a, h, w, q) (6.18) and a n (x + y; a + b, 0, w, q) = n k=0 n k q a n−k (yq k ; a, × a k (x; a, 0, w, q). (6.19) The identities above are q-extensions of an identity that goes back to Rothe [59] in 1793 and Pfaff [50] in 1795, usually expressed as: which were introduced by Schläfli in 1847 [61], and resurfaced much later in a 2006 paper by Gessel and Seo [31] who showed that enumerates k-component forests on the vertex set [n] by proper and improper vertices, and also by ascents and descents. Sokal's paper contains a fuller discussion of these polynomials as well as a number of interesting conjectures regarding their coefficientwise Hankel-total positivity, and we enthusiastically encourage the reader to consult the final section of [66] for further details. There is, unsurprisingly, something of an overlap between this current paper and the generalisations of the forest matrix studied by Sokal [66]. In the next subsection we will show how our planar network N 2 from Section 5 can be modified to derive some of the results proven in [66].

Enumerating forests by proper and improper edges
In [66] Sokal considers total positivity properties of generalisations of the forests matrix that differs from the q-generalisations studied in this paper. We will now show how making some simple modifications to the planar network N 2 yields a path matrix that agrees with one of the generalisations studied in [66].
Given two vertices i and j of a tree T belonging to a forest, we say that j is a descendant of i if the unique path from the root of T to j passes through i (note that every vertex is a descendant of itself). Let e = ij be an edge of T . We say that e is improper if there is a descendant of j (possibly j itself) that is lower-numbered than i, otherwise we say that e is proper (see Section 1 of [66]).
where L(iz) denotes the lower-bidiagonal matrix with 1 on the diagonal, iz on the subdiagonal, and 0 everywhere else. Comparing Figure 9 in Section 5 with Figure 11 it is easy to see that we obtain N 4 from N 2 by specialising q = 1 and multiplying the weights of the blue and green edges by y and z respectively. We make the following proposition: Proposition 6.2. The path matrix corresponding to N 4 satisfies P N 4 = F(y, z). (6.36) Proof. Consider the factorisation of F(y, z) in (6.34) above: .
The matrix B z has the production-like factorisation (see Corollary 2.5 with y = 1 and x replaced with z, and also observe that the righthand side above implies that L(z) is the augmented production matrix of B z ). It follows that . where D = diag((n!) n≥0 ), since Toeplitz matrices matrices commute: where a * b is the convolution of the sequences a and b Furthermore, it is easily verified that . (6.44) Iteratively commuting T (y * ) with B iz and writing for increasing i in the factorisation of F(y, z) given above completes the proof.
The focus of this paper has been q-generalisations of the forests and trees matrices, and note that we can easily introduce q-weights into the planar network N 3 . Consider the network N 5 in Figure 12, which has the corresponding path matrix where B q;z is the q-binomial matrix B q;z = n k q z n−k n,k≥0 . (6.47) Now letF (q, y, z) = (f n,k (q, y, z)) n,k≥0 = P N 5 (6.48) and observe thatF(q, y, z) is the output matrix of the lower-Hessenberg production matrix P (q, y, z) = (p n,k (q, y, z)) n,k≥0 where Define the row-generating polynomials ofF(q, y, z) to be: F 0 (x; q, y, z) = 1 (6.50) andF n (x; q, y, z) = n k=0f n,k (q, y, z)x k (6.51) for n ≥ 1. We have the following lemma: Figure 12. The planar network N 5 , obtained by introducing q-weights into the network N 3 .
In order to prove Lemma 6.3 we first recall two easy results from [66]. The first is: That is, up to a factor b 0,0 , the matrix AB has production matrix B −1 P B.
The second is the following theorem: Theorem 6.5 (Theorem 2.14 in [66]). Let P = (p i,j ) i,j≥0 be an infinite row-finite or column-finite matrix with entries in a partially ordered commutative ring R, and define the infinite Hankel matrix H ∞ (O 0 (P )) = ((P n+n ) 0,0 ) n,n ≥0 . If P is totally positive of order r, then so is H ∞ (O 0 (P )).
Our proof of Lemma 6.3 relies on these two useful facts, and follows along the same lines as the argument found in the proof of Lemma 2.16 of [66] where D is replaced with D q , B x is replaced with B q;x , and Proof of Lemma 6.3. The row-generating polynomials ofF(q, y, z) are the entries in the zeroth column of the matrix F * (q, x, y, z) =F(q, y, z)B q;x , (6.54) and according to Lemma 6.4 above we havê F * (q, x, y, z) = O(B −1 q;x P (q, y, z)B q;x ). (6.55) Since P (q, y, z) is coefficientwise totally positive it suffices (thanks to Theorem 6.5) to show that the matrix B −1 q;x P (q, y, z)B q;x (6.56) is coefficientwise totally positive. We have and It follows that B q;x and D q T ∞ (φ)D −1 q commute. Note further that according to the recurrences for q-binomial coefficients (see (3.45) and (3.46) in Section 3) we have ∆B q;x = B q;x (diag((q n x) n≥0 ) + ∆). (6.60) We therefore have q;x P (q, y, z)B q;x = P (q, y, z)(I + ∆ T diag((q n x) n≥0 )), (6.61) so B −1 q;x P (q, y, z)B q;x coefficientwise totally positive. This completes the proof. My experiments suggest that there is a more general principle lurking behind Lemma 6.3, concerning production matrices of q-Riordan arrays (see [12], and also [39,32]). This will be rigorously addressed in future work; for now we turn our attention to a more general planar network that yields both N 2 and N 4 under suitable specialisations.
Consider now the planar network N 6 in Figure 13 and observe that N 4 can be obtained from N 6 by specialising q = 1 in N 6 to q = 1, and by instead specialising y = z = 1 in N 6 we obtain the planar network N 2 . The path matrix corresponding to N 6 has the factorisation: where a i (q, z) = (q n+1+i z[i + 1] q ) n≥0 (6.63) and b i (q, y) = (q i y[n + 1] q ) n≥0 . (6.64) Figure 13. The planar network N 6 .
But what of a combinatorial interpretation of the entries ofF(q, y, z)? As we have seen, on the one hand the entries ofF(1, y, z) count forests on n vertices with k components with respect to proper and improper children, and on the other the entries ofF(q, 1, 1) count forests on n vertices with k components with respect to the statistics defined in Section 3. I therefore pose the following problem: Problem 1. Find a combinatorial interpretation of the entries ofF(q, y, z).
I have verified the above conjecture to 5×5, and I do not yet understand what these polynomials enumerate. The conjectured coefficientwise Hankel-total positivity of the shifted row-generating polynomials ofF(p, q, r, s, γ, µ, y, z) is in a sense stronger than the coefficientwise total positivity ofF(p, q, r, s, γ, µ, y, z) alone, and in light of this a combinatorial interpretation of the entries ofF(p, q, r, s, γ, µ, y, z) is much desired. Clearly each (n, k)-entry enumerates k-component forests on n vertices with respect to eight statistics; interpreting these statistics is left as an open problem: Problem 3. Find a combinatorial interpretation of the entries ofF(p, q, r, s, γ, µ, y, z).

(p, q)-Stirling polynomials
The network N 7 is an interlacing of two different planar networks (one with green diagonal edges, one with blue). By setting r = s = µ = y = 0 we effectively remove the blue edges and are left with a binomial-like planar network we shall denote N 7 . Specialising γ = z = 1 in N 7 we obtain the binomial-like network with edge weights specialised to α i,l = 1 and with corresponding path matrix G(p, q) := (g n,k (p, q)) n,k≥0 = P N 7 = F(p, q, 0, 0, 1, 0, 0, 1) (6.92) The weights of the network N 7 are purely i-dependent so the entries of G(p, q) satisfy the recurrence: g n,k (p, q) = g n−1,k−1 (p, q) + [n − 1] p,q g n−1,k−1 (p, q) (6.93) for n ≥ 1 with initial condition g 0,k = δ 0k . Moreover we have  [74], and the expression in terms of elementary functions (6.94) can be found in Proposition 2.3 (part (a)) of [17]. The entries of G(p, q) are thus the (p, q)-Stirling cycle numbers (or unsigned (p, q)-Stirling numbers of the first kind, denoted c p,q [n, k]) and the row-generating polynomials of G(p, q) are where y = 1 (see Proposition 2.3 part (b) of [17]). Note that the authors of [17] have a combinatorial interpretation of c p,q [n, k], but it has nothing to do with forests and trees! Intead they consider 0-1 tableaux: a 0-1 tableau is a pair ψ = (λ, f ) where λ = (λ 1 ≥ λ 2 ≥ · · · ≥ λ k ) is a partition of an integer m = |λ| and f = (f i,j ) 1≤j≤λ i a filling of of the corresponding Ferrer's diagram of λ with 0s and 1s such that there is exactly one 1 in each column. In [17] de Médicis and Leroux define two statistics on ψ: the inversion number, inv(ψ), is the number of 0s below a 1 in ψ, and the noninversion number, nin(ψ), is the number of 0s above a 1 in ψ. They then show that where T d(k, r) denotes the set of 0-1 tableaux with k rows and columns of length at most r, where the lengths of the columns are distinct. Permutations, however, are perhaps arguably more natural objects to study in relation to generalisations of the Stirling cycle numbers (the polynomial c n (x; 1, 1) is the generating function for permutations counted with respect to cycles, after all). For p specialised to p = 1 Zeng [74, Section 3, where s q (n, k) = q n−k c 1,q [n, k]] showed that c n (x; 1, q) = σ∈Sn x lrm(σ) q inv(σ) (6.97) where lrm(σ) denotes the number of left-right maxima in a permutation σ (that is, the number of σ(i) such σ(i) > σ(j) for all j < i), and inv(σ) the number of inversions of σ (that is, the number of pairs i < j such that σ(i) > σ(j)), hence g n,k (1, q) = σ∈Sn(k) q inv(σ)+k−n , (6.98) where S n (k) denotes the set of permutations on [n] with k left-right maxima. Clearly G(p, q) is totally positive, and for p specialised to p = 1 we can express the row-generating polynomials of G(1, q) as the S-type (or Stieltjes-type) continued fraction 11 1 + n,k≥1 where λ 2n−1 := (x + [n] q )q n−1 and λ 2n = [n] q q n+1 for n ≥ 1 (Lemma 3 of Zeng 1993, where we have replaced x with tq, and a with x/q). If a sequence of polynomials has an S-fraction with nonnegative coefficients then the corresponding Hankel matrix is coefficientwise totally positive (see [64] and [49, Section 9]), so we have: Corollary 6.8. The polynomial sequence (c n (x; 1, q)) n≥0 is coefficientwise Hankeltotally positive in x, q.
I have verified this up to 7 × 7, and am yet to discover a suitable combinatorial interpretation of these polynomials. I therefore pose the following problem: Problem 4. Find a combinatorial interpretation of the polynomials G n (x; p, q, γ, z).
I have verified this up to 5 × 5, and am yet to discover a suitable combinatorial interpretation of the entries of M(r, s, µ, y) or indeed M (r, s, µ, y), and therefore pose the following problem: Problem 5. Find combinatorial interpretations of M (r, s, µ, y) and M(r, s, µ, y).
There is one final observation to make concerning perfect matchings that may help in tackling the foregoing problem. A perfect matching M on [2n] is a partition of 1, 2, . . . , 2n into n pairs (i, j) where i < j. We denote the set of all such perfect matchings M 2n , and it is well-known that |M 2n | = (2n − 1)!!. (6.124) Two pairs (i r , j r ) and (i s , j s ) belonging to M ∈ M 2n form a crossing if i r < i s < j r < j s , and form a nesting if i r < i s < j s < j r . The number of crossings in M is denoted cr(M ) and the number of nestings is denoted ne(M ).