Parking Functions on Directed Graphs and Some Directed Trees

Classical parking functions can be defined in terms of drivers with preferred parking spaces searching a linear parking lot for an open parking spot. We may consider this linear parking lot as a collection of $n$ vertices (parking spots) arranged in a directed path. We generalize this notion to allow for more complicated"parking lots"and define parking functions on arbitrary directed graphs. We then consider a relationship proved by Lackner and Panholzer between parking functions on trees and"mapping digraphs"and we show that a similar relationship holds when edge orientations are reversed.


Introduction
Parking functions were first defined by Konheim and Weiss [8] during their study of the linear probing solution to collisions on hash tables. The authors described a sequence of n drivers attempting to park randomly along a one-way street. If the spot a driver attempts to park in is occupied, she drives to the next available spot and parks. As we are interested in the number of ways such a procedure results in all n drivers parking, we may consider the initial checked spot as a preferred parking place, rather than a randomly chosen spot. Let s ∈ [n] n and consider a directed path with vertex set [n] and edge orientations i → i + 1. One-by-one the drivers attempt to park according to the following process: 1) Driver i begins at vertex s i .
2) If the current vertex is unoccupied, the driver parks there. If it is occupied, the driver drives to the next vertex, following edge orientation, and repeats Step 2.
3) If she parks, the process continues with driver i + 1 attempting to park at vertex s i+1 . Otherwise, the process terminates.
A sequence s such that all n drivers successfully park is called a classical parking function of length n. With some consideration, one can see that as long as there is no i such that too many drivers prefer a vertex from {i, i + 1, i + 2, . . . , n}, then all drivers will park. This is formulated in an alternative definition of parking functions: Definition 1 (Parking Functions). A classical parking function of length n is a sequence s ∈ [n] n such that for all i ∈ [n], |{j : s j i}| n − i + 1.
Additionally, we may consider the case when m n drivers attempt to park. We call these (n, m)-parking functions and the definition is the same as in the classical case for s ∈ [n] m .
It is well-known that there are (n+1) n−1 parking functions of length n, while there are (n−m+1)(n+1) m−1 classical (n, m)-parking functions [3]. Classical parking functions have appeared throughout combinatorics as chains in the noncrossing lattice, in enumeration of hyperplane arrangements, in noncrossing partitions, and in tree enumeration (see [5,12,14] as well as references herein).
Parking functions have seen many generalizations: G-parking functions [11], u-parking functions [9], parking sequences [4], rational parking functions [1], and those defined on tree-shaped parking lots [2,10]. In this paper, we extend the "drivers searching for a parking spot" analogy from the trees in [10] to general digraphs and give a description that generalizes the set definition of the classical parking functions in Section 2. In Sections 3 and 4, we closely follow the results of Lackner and Panholzer [10] and show that many of their theorems have analogues when the edge orientations of the tree and mapping digraphs are reversed. Finally, we conclude with some new research directions and propose extensions to the concepts of increasing and prime parking functions. This paper is, in part, an expansion of Sections 2 and 4 of [6].

Parking Functions on Digraphs
One interpretation of classical parking functions is of drivers attempting to park in a preferred spot along a street and parking in the first available spot they find afterwards. We may extend this notion to general digraphs by allowing driver to choose which out-edge to travel along. More formally,  2) If the current vertex is unoccupied, the driver parks there. If it is occupied, the driver chooses a vertex in the neighborhood of the current one and drives there.
3) The driver repeats step 2) until she either parks, and the next driver enters, or is unable to find an available parking space, and the process terminates.
When the maximum outdegree of a vertex in D is 1, the parking process is deterministic. In the general case, however, drivers must "choose" which edge to take in search of a parking spot. Our interest lies in the possibility of all drivers parking, so we give the following definition as our parking function generalization: For a sequence s ∈ [n] m and digraph D with vertex set [n], we say that s is a parking function on D if it is possible for all of the m drivers to park following the parking process. If s is a parking function on D, we call the pair (D, s) an (n, m)-parking function. Figure 1 gives an example of an (n, n)-parking function. Drivers 2 and 5 are the only drivers who may make a choice of which edge to travel along and all drivers can park as long as at least one of those drivers uses the edge (1, 4) during parking.
Definition 3 is clearly a generalization of the classical parking function case, but it is sometimes difficult to apply practically, so we now consider an equivalent definition that is more useful. For i, j ∈ [n], we say i D j if and only if there exists a directed path from i to j in D. We have i D i for any i as the directed path between i and itself contains zero edges, making D a quasiorder on the vertices of D. If we wish to consider when i = j, we say i ≺ D j. For vertex i, define the set of vertices reachable from i as Then for any A ⊆ [n] define the reachable set of A as  Proof. If we let B be the bipartite graph with vertex set C ∪ [n] where {C i , j} ∈ E(B) if and only if s i D j, then by Hall's Theorem, we are claiming that s is a parking function if and only if there exists a matching on B saturating C. If s is a parking function, then park the drivers in some manner. Suppose C i is parked on v i for each i. Then, since we must have These edges define a matching that saturates C.
The other direction is not as clear because the parking process requires drivers to park in the first empty spot they find. We use a matching to determine a (not necessarily unique) way of parking on D.
The iterative process is the same for each C i , starting at i = 1. At step i, pick any x with s i D x D v i such that there exists a walk s i = y 0 → y 1 → · · · → y k → x such that the y j 's are spots occupied by cars in previous iterations. If no such y 0 exists, then In each step, the vertex x is the first unoccupied vertex along some walk between s i and the vertex with which C i is matched. At least one such x exists because, at the start of step i, C i is matched with a vertex which is not occupied by any car. At the end of step i, we know the updated M is a matching saturating {C } >i because we know Rather than considering subsets of the drivers, we may reformulate the statement in terms of the number of drivers wanting to park in various "regions" of the graph (c.f. Definition 1).
Proof. Let s be a parking function on D and On the other hand, suppose for all B ⊆ [n] we have |{C i : the electronic journal of combinatorics 27(2) (2020), #P2.48 thus s is a parking function.
From this set definition, it is immediately obvious that the ordering of s does not matter.
Remark 7. The number of distinct R D (B) is the same as the number of filters of the quasiorder D , which is, in general, much less than 2 n .
In the case of a classical parking function s, for any B ⊆ [n] with smallest element b, , |{j : s j i}| n + 1 − i, as in Definition 1. In addition, Corollary 5 generalizes the description of parking functions given in [10], which we now consider as we turn our attention to rooted trees with edges oriented away from the root.

Parking Functions on Source Trees
Lackner and Panholzer [10] and Butler, Graham, and Yan [2] independently generalized the "drivers searching for a parking space" interpretations of parking functions to rooted trees with edges oriented towards a root. In this section, we follow the enumerative discussion from [10] and show that several of their theorems have analogous results when edge orientations are reversed.
If T is a rooted tree with vertex set [n] and edges oriented towards the root, we let T be the tree obtained by reversing the orientation of all the edges. In our pictures, the root will be the top-most vertex. We call these sink and source trees, matching whether the root is a sink or source vertex. Similarly, if M f is the digraph obtained from f : We will call these mapping and inverse mapping digraphs, respectively. We note that digraphs in each of these families have a single cycle on each connected component. Define the sets We similarly define T n and M n for the source trees and inverse mapping digraphs. Figure 2 gives an example of a source tree and an inverse mapping digraph along with an s ∈ [7] 7 that is a parking function on both.
For source trees, because the indegree of a node is at most 1, for two distinct vertices, u and v, the sets R T (u) and R T (v) are either disjoint or one contains the other. Thus, the 2 n inequalities in Corollary 5 reduce to only n independent inequalities. We briefly introduce some notation out of convenience. We call u the parent of v if the two are adjacent and u lies on the unique path between the root and v. Here, we do the electronic journal of combinatorics 27(2) (2020), #P2.48 Additionally, for digraph D with vertex set [n], let We first study the extremal values of P ( T , m).
Proposition 9. Let T be a source tree, u a non-root vertex, v the parent of u, and w such that v T w and w / ∈ T u . Let T be the tree obtained by removing the edge (v, u) and adding the edge (w, u). Then P ( T , m) P ( T , m).
Proof. To clarify which tree we are considering, we denote by x the vertex in T with label x. Let ( T , s) be an (n, m)-parking function. By Corollary 5, we must check |{i : s i ∈ T x }| | T x | for all x ∈ V ( T ). By the construction of T , |{i : s i ∈ T y }| = |{i : s i ∈ T y }| and | T y | = | T y | for all y not satisfying v ≺ T y T w . Therefore, let y be a vertex satisfying v ≺ T y T w . We thus have: As a result, we obtain an upper and lower bound on P ( T , m).
Corollary 10. The number of (n, m)-parking functions is maximized when T is a path and minimized when T is a star, meaning where n k = n(n − 1)(n − 2) · · · (n − k + 1) is the falling factorial.
Proof. For a path, the parking functions, up to vertex labeling, are classical parking functions, and thus number (n − m + 1)(n + 1) m−1 . On a star, for 0 i m, when i drivers prefer the root, there are n−1 m−i ways to choose the preferred non-root vertices, m i ways to place the drivers preferring the root in s, and (m − i)! ways to order the drivers preferring non-roots in s.
In the case of sink trees, the maximum and minimum number of parking functions also occur on paths and stars, respectively. From [10], we have If T is a star, it is not immediately clear for an arbitrary choice of (n, m) which of P (T, m) and P ( T , m) is larger. However, we can say after inspecting the formulae that if m is 0 or 1 then the two are equal and if n 3 then P (T, 3) is larger. What happens when 3 < m < n remains open, but we can determine which is larger when m = n for all T .
Theorem 11. Let T ∈ T n . Then P (T, n) P ( T , n) with equality if and only if T is a path.
Proof. Let (T, s) be a parking function on sink tree T . We give a process to determine an involution τ ∈ S n such that τ (s) = (τ (s 1 ), τ (s 2 ), . . . , τ (s n )) is a parking function on the source tree T . Park cars on T following the parking procedure, highlighting an edge if it is used by a driver after failing to park at her preferred spot. Since T is a sink tree, each vertex has outdegree at most 1, so parking is deterministic. We define τ by individually considering the components connected by highlighted edges. So without loss of generality, we may assume that every edge in T is highlighted. We define a collection of length 2 "paths" in T , one for each leaf, whose vertices form a partition of the vertices of T . The purpose of these "paths" is to identify a section of the tree where we can "flip" the edge orientations and driver preferences and still guarantee each driver a spot to park.
Let {v i }, for 1 i k be the leaves of T indexed such that v i < v i+1 . We recursively define the sets P i : the set P i is the smallest set of vertices of the path between v i and the root such that no vertices from P j , j < i, are in P i , there are |P i | drivers preferring P i , and all vertices of P i are connected to v i through vertices in {P j } i j=1 . For example, on the left tree of Figure 3, we have sets P 1 = {1, 2, 3, 5} and P 2 = {4, 6}. Two drivers prefer the leaf {1}, three drivers prefer the vertices {1, 2}, four drivers prefer {1, 2, 3} and {1, 2, 3, 5}, so the latter is P 1 . When determining P 2 , we skip over vertices in previously-chosen paths, in this case the vertex labeled 5. The collection {P i } k i=1 must partition the vertices of T . Suppose it does not and let v / ∈ P i for any i be such that v is the only vertex in T v , the subtree rooted at v, with this property. The vertex v is not a leaf of T , as all leaves are in the sets {P i } k i=1 by construction, and thus is the terminus of at least one edge, (u, v). Since none of the "paths" corresponding to leaves of T v contain v and because all cars can park, all cars preferring spots w T u can park without occupying v. This means the edge (u, v) is not used by any driver after failing to park in her preferred spot, which contradicts our assumption that this was true of all edges. Therefore, such a v can not exist.
For each i, let n i = |P i | and label the elements of P i by w i,j such that w i,1 = v i T w i,2 T . . . T w i,n i . Finally, we define τ (w i,j ) = w i,n i +1−j . This reverses the driver preference along the "path" so that when the edge orientation is flipped for T , the drivers may park as they did on T .
We can recover the P i from ( T , τ (s)) using the exact same method. Thus, we can invert the process. On the right tree of Figure 3, zero drivers prefer {1}, one driver prefers {1, 2}, two drivers prefer {1, 2, 3}, and four drivers {1, 2, 3, 5}, so this is P 1 . For P 2 , no drivers prefer {4}, we skip over 5 as it is already in P 1 , and two drivers prefer {4, 6}.
If T is not a directed path, then this process is not surjective because the parking function in which all n drivers prefer the root of T is not obtainable in this manner as at least one driver prefers each leaf vertex.
Define the following for n 1: As we previously mentioned, when m < n, the result of Theorem 11 does not necessarily hold. For the tree in Figure 4, P (T, 2) = 15, as any sequence except (4,4) parks. However, P ( T , 2) = 14 as neither (1, 1) nor (2, 2) are parking functions. Lackner and Panholzer [10] proved n · F n,m = M n,m . In fact, this relationship still holds when the edge orientations are reversed. We prove the claim when m = n, then we will show the more general case. While the overall idea of the proofs are similar to their counterparts in [10], there are some technical differences in dealing with the source trees. Because, on sink trees, the spot in which each driver parked was well-defined, the authors of [10] were able to identify edges in the digraphs that were not used during parking and thus could be freely manipulated. In our case, as the drivers no longer necessarily have a unique walk along which to search for a parking spot, we must instead identify edges that are not necessary for some successful parking. This is simple enough on trees using the characterization of Corollary 5, but it is not immediately clear for inverse mapping digraphs. So, we first prove that at least one cycle edge on each component of an inverse mapping digraph is not needed for parking.
, then there are strictly fewer than n drivers attempting to park, contradicting the assumption that ( M f , s) is an (n, n)-parking function. Hence, we know α i V i for some i. Since s is a parking function on M f , at least one driver prefers i (otherwise, too many drivers prefer non-cycle vertices). We construct an (n − 1, n − 1)parking function by contracting the edge (i, i − 1) to identify the vertices i − 1 and i as a single vertex (with label i − 1) to form the digraph M , deleting the first instance of i from s, and changing all others to i − 1 to form the sequence s . For non-cycle vertex v, Let T be the digraph obtained by deleting e from M f and T be obtained by deleting e from M . Since (T , s ) is a parking function, we know for any v ∈ T , we have |{j : s j ∈ R T (v)}| |R T (v)|. We now check the vertices of T to determine if (T, s) is a parking function.
So (T, s) is indeed a parking function and we know the edge e is not necessary for parking on M f . Construction of the bijection. Let ( T , s) be a parking function for source tree T , and pick v ∈ V ( T ). We define a bijection ψ such that ψ ( T , s, v) = ( M f , s) for some appropriate inverse mapping digraph M f , constructed by identifying edges in T that can be manipulated without affecting the ability of the cars to park. The sequence s will not change.
Let (u, w) be an edge in T . If |{i : s i ∈ T w }| = | T w |, then for any successful parking, no car may cross (u, w) as otherwise too many cars would attempt to park in the subtree T w . Additionally, at least one driver must prefer w, as one driver must park in w and no driver may use the edge (u, w). These two observations will allow us to select edges to manipulate in T .
Consider the path root( We first identify the edges that are freely manipulatable, then we use the order of s to choose a subset of those. A is nonempty. By the second observation above, all v i ∈ A appear as preferences in s. The edge (v i−1 , v i ) is not used by any driver, so we may manipulate it (even delete it) without affecting parking. Next, for the v i ∈ A, we define the rank d(v i ) to be the index of the first appearance of v i in s. We now let B ⊆ A be given by the elements {v i : ∀j < i, d(v j ) < d(v i )}. That is, the elements of B are those in A that appear in s after their ancestors from A. Note that B = ∅ as root( T ) = v 1 ∈ B.
Consider the unique sequence {v i j } |B| j=1 such that v i j ∈ B and i j < i j+1 . For j > 1, remove the edge (v i j −1 , v i j ) and add the edge (v i j −1 , v i (j−1) ). Finally, add the edge (v, v i |B| ) (if v is the root, this will be a loop as then v = v 1 ). The resulting graph is an inverse mapping digraph, M f , where f (i) is the unique j such that (j, i) is an edge. In particular, the edges that were manipulated and the one that was added are  For the inverse, we know by Lemma 14 that at least one edge in each cycle of the graph is not necessary for parking. We let the setÂ be the set of vertices in the cycles of M f that are the terminal vertices of an edge that is not necessary for parking. Definê B ⊆Â as the set of vertices which have the highest rank in each cycle. By Remark 16, if ( M f , s) = ψ ( T , s, v) , we know B =B. Label these elements ofB by As promised, we can extend this result to (n, m)-parking functions. Proof. Let s ∈ [n] m be a parking function on T ∈ T n , and let v ∈ V ( T ). Our goal is to extend s to s ∈ [n] n in a reversible manner, then apply ψ. We must do so in a way that is not affected by the change in edges caused by ψ, which suggests we avoid using edges along the path root( T ) → v.
To this end, drivers choose to park as follows. We recursively define {A i } m i=1 so that A 1 = {s 1 } and in general A i are the spots that driver i could park at so that the remaining drivers may successfully park, given the first i − 1 drivers are parked. Let B i ⊆ A i be the vertices of A i that are reachable from s i by utilizing a minimal number of edges in the path root( T ) → v. From there, driver i parks at the vertex with label min(B i ). Once driver i is parked, we construct A i+1 and continue until all drivers have parked.
Let {x i } n−m i=1 be the unoccupied spaces after the drivers have parked in this manner, ordered in an increasing manner. We then define s as follows: Then, we apply ψ to ( T , s , v). Since s does not change under ψ and is a parking function, s is also a parking function on the resulting mapping digraph M f . In order to reverse, we must be able to extend s to s on M f . Because the edges on the path between root( T ) and v become the cycle edges, drivers park as defined in the first paragraph, but instead of utilizing a minimal number of path edges, they use a minimal number of cycle edges.

Concluding Remarks and Future Research
In this paper, we gave several equivalent characterizations of an extension of the "drivers searching for a parking space" description of parking functions to digraphs. Additionally, we follow the work of Lackner and Panholzer to show many of their results on trees with edges oriented towards a root still hold when the edge orientation is reversed. Furthermore, we showed that source trees never had fewer (n, n)-parking functions than sink trees.
We propose here some generalizations of on other notions of classical parking functions. Prime parking functions were defined by Gessel [12] and can be understood as classical parking functions for which every edge in the path is necessary for parking. More formally, Definition 18. A classical parking function s ∈ [n] n is prime if, for all 2 i n, we have |{j : s j i}| < n − i + 1.