Egalitarian Graph Orientations

Given an undirected graph, one can assign directions to each of the edges of the graph, thus orienting the graph. To be as egalitarian as possible, one may wish to find an orientation such that no vertex is unfairly hit with too many arcs directed into it. We discuss how this objective arises in problems resulting from telecommunications. We give optimal, polynomial-time algorithms for: finding an orientation that minimizes the lexicographic order of the indegrees and finding a strongly-connected orientation that minimizes the maximum indegree. We show that minimizing the lexicographic order of the indegrees is NP-hard when the resulting orientation is required to be acyclic.


Introduction
We consider problems of orienting the edges of an undirected graph so that no vertex is unfairly hit with too many arcs directed into it. We refer to such orientations as egalitarian: the total available indegree is shared among the vertices as equally as allowed by the topology of the graph. This objective arises in various telecommunications problems. Depending on the requirements of the problem, the orientation may be unconstrained or need to be strongly connected or acyclic. We start by describing these motivating applications and related work.
Unconstrained orientations Venkateswaran introduced the problem of directing the edges of an undirected graph so as to minimize the maximum indegree [17]. The problem arises from a telecommunications network design problem in which source-sink pairs (s i , t i ) are linked by a directed s i -to-t i path c i (called a circuit). When an edge of the network fails, all circuits using that edge fail and must be rerouted. For each failed circuit, the responsibility for finding an alternate path is assigned to either the source or sink corresponding to that circuit. To limit the rerouting load of any vertex, it is desirable to minimize the maximum number of circuits for which any vertex is responsible.
Venkateswaran models this problem with an undirected graph whose vertices are the sources and sinks and whose edges are the circuits. He assigns the responsibility of a circuit's potential failure by orienting the edge to either the source or the sink of this circuit. Minimizing the maximum number of circuits for which any vertex is responsible can thus be achieved by finding an orientation that minimizes the maximum indegree of any vertex. Venkateswaran shows how to find such an orientation [17]. Asahiro, Miyano, Ono, and Zenmyo give a simpler analysis [4]. Asahiro et al show further that for any w ≥ maxdegree 2 the Path Reversal algorithm minimizes the number of vertices with indegree at most w and consequently minimizes the number of vertices with indegree at least w + 1 [2].
However, there may be multiple orientations that have the same minimized maximum indegree. The orientation that has the minimum number of nodes with maximum indegree is preferable since it minimizes the number of nodes that have the maximum rerouting load. Among the orientations that minimize the number of nodes with maximum indegree, the one that minimizes the number of second largest indegree is preferable for the same reason of rerouting load. Continuing this reasoning, we can formalize this notion in the following way: given two orientations G A and G B , we prefer G A to G B if the sequence of indegrees of G A (in non-increasing order) is lexicographically before the sequence of indegrees of G B (in non-increasing order). We refer to finding the best orientation with respect to this measure as the minimum lexicographic orientation. In Section 2.1, we show that a natural greedy algorithm finds the minimum lexicographic orientation: start with an arbitrary orientation and repeatedly reverse the orientation of a directed path while doing so improves the objective.
Strongly-connected orientations Networks that are used to route messages should, naturally, be strongly connected: one should be able to send a packet along a directed path from any vertex to any other vertex. A destination-based routing protocol chooses the next arc along which to send a message based only on the destination of the message. Such a protocol can be implemented with an interval routing scheme [15]. An interval routing scheme for a directed graph is defined by a cyclic numbering of the vertices and a labeling of each arc with an interval of the vertex numbers. (More generally, each edge can be labelled with multiple intervals. We will show that one interval is sufficient and therefore the best possible.) For each vertex u, the disjoint union of the intervals labeling the outgoing arcs from u cover all but u's vertex numbers. When a packet destined for vertex v reaches a vertex u = v it is forwarded from u along the outgoing arc from u whose label contains the interval containing v's number. Such a scheme, in order to be feasible, must be such that a packet originating at any vertex destined for any other vertex will reach the destination vertex when routing is done as described above.
In Section 3, we show that for any strongly connected graph there is an interval routing scheme such that each outgoing arc is labelled with at most one interval. This is the most compact routing scheme possible and allows the routing decision at a given vertex to be made in time proportional to the outdegree of that vertex. Thus, to minimize the routing time at each vertex, we would like to find a strongly-connected orientation of G, the underlying physical network, which minimizes the maximum number of outgoing arcs from any vertex. To keep the notation the same between sections of this paper, we instead minimize the maximum indegree; this is equivalent by way of reversing all the edges of the graph. We give an algorithm to find such an orientation in Section 3.2. We conjecture that the natural generalization of this algorithm also finds the minimum lexicographic order of the indegrees of the graph.
Acyclic orientations Consider a packet network with input buffers. A vertex can forward a packet from its input buffer to the next-hop (the next vertex in the packet's route) if the input buffer of the next-hop is not already full. Such networks can suffer from deadlock. For example, consider a ring network in which all input buffers are full: no vertex can forward a packet to its next-hop because the next-hop's input buffer is full. If no packet is allowed to go along certain length-two paths then deadlock is prevented. In particular, Wittorff shows how to find such a collection of forbidden lengthtwo paths by orienting the edges of the network so that the resulting graph is acyclic with a single source and making every pair of edges oriented into the same vertex a forbidden length-two path [20]. Then a path between every pair of vertices avoiding forbidden paths can be found that avoids any transition from travelling along an arc to travelling along the reverse of another arc (and hence avoids a pair of edges that get directed into the same vertex). Minimizing the maximum indegree minimizes the number of forbidden pairs at any vertex and hence minimizes the number of routing contraints at any vertex.
In Section 4 we present a simple algorithm to find an acyclic orientation for the objective of minimizing the maximum indegree. On the other hand, we also show that minimizing the lexicographic order of the indegrees is NP-hard when the resulting orientation must be acyclic.

Related work
Asahiro et al. consider the edge-weighted version of the unconstrained problem [4]. They build on the work of Venkateswaran and give a 2 − 1/kapproximation algorithm where k is the maximum weight of any edge in the graph. They further show that the weighted version of the problem is strongly NP-hard even if all edge weights belong to the set {1, k} where k ≥ 2 is an integer [3]. Klostermeyer considers the problem of reorienting edges (rather than whole paths) so as to create graphs with given properties, such as strongly connected graphs and acyclic graphs [14]. De Fraysseix and de Mendez show that they can find an indegree assignment of the vertices given a particular properties [11]. In our work we are searching for a particular degree assignment not known a priori.
Biedl, Chan, Ganjali, Hajiaghayi, and Wood give a 13 8 -approximation algorithm for finding an ordering of the vertices such that for each vertex v, the neighbors of v are as evenly distributed to the right and left of v as possible [5]. For the purpose of deadlock prevention [19], Wittorff describes a heuristic for finding an acyclic orientation that minimizes the sum over all vertices of the function δ(v) choose 2, where δ(v) is the indegree of vertex v. This obective function is motivated by a problem concerned with resolving deadlocks in communications networks as described in the previous section [20].

Notation
We use basic notation for graph theoretic concepts for graphs G = (V, E) with n vertices and m edges. A directed edge or arc, a, is oriented from the vertex tail(a) to the vertex head(a). For a directed graph, the indegree of a vertex v, denoted δ(v), is the number of arcs for which v is the head. We may use a subscript to denote the graph with respect to which we measure the degree. A directed path is a sequence of arcs a 1 , a 2 , . . . , a k with head(a i ) = tail(a i+1 ) for 1 ≤ i < k. We add trivial paths to this definition which are identified by a single vertex. A cycle is a path such that head(a k ) = tail(a 1 ). An orientation of an undirected graph is an assignment of directions to each edge in the graph. A directed graph is strongly connected if for every pair of vertices, u, v ∈ V , there are directed paths from u to v and from v to u. A directed graph is acyclic if there are no directed cycles in the graph. For a subset of vertices X, G[X] is the subgraph induced by X and m(X) is the number of edges in G[X].

Unconstrained orientations
We will show that a simple, greedy algorithm, first given by de Fraysseix and de Mendez [11], finds an orientation of an undirected graph that minimizes the lexicographic order of the indegrees. We say that a directed path from u to v is reversible if δ(u) < δ(v) − 1. The greedy algorithm, given an undirected graph, is: Path-Reversal arbitrarily orient every edge while there is a reversible path let P be any reversible path whose last vertex is of highest indegree reverse the orientation of each arc of P This algorithm can be implemented in quadratic time by arguing that the algorithm proceeds in k phases where k is the maximum indegree in the initial orientation (below). Therefore, there are at most m iterations of the algorithm and each iteration can be implemented in linear time using, for example, depth-first search.
Consider any integer ≤ k. Consider an iteration in which we reverse a u-to-v path where δ(v) = . Let Q be the set of vertices of indegree > just before this reversal and let Q be the set of vertices that have paths to a vertex in Q. (Note: Q ⊆ Q .) By definition neither u nor v is in Q , for otherwise, we would reverse a path ending in a vertex of indegree > .
Further, after this reversal, Q is still the set of vertices of indegree > and Q is still the set of vertices that have paths to a vertex in Q. It follows that there is a well-defined phase , a contiguous subset of iterations that reverse paths ending in vertices of indegree : after reversing a path ending in a vertex of indegree , the algorithm does not reverse a path ending in a vertex of higher indegree.

Minimizing the lexicographic order
Path-Reversal finds an orientation that minimizes the maximum indegree. This observation was made by Venkateswaran with a rather involved proof [17]; a simpler analysis was given by Ashario et al. [4]. This observation is also implied by de Fraysseix and de Mendez, Lemma 1 [11].
Path-Reversal is more powerful than simply minimizing the maximum indegree. We show that the resulting orientation, in fact, minimizes the lexicographic order of the indegrees.
We define a cycle reversal to be the reversal of every edge in a cycle. Notice that performing a cycle reversal will not change the number of vertices of any particular indegree.
Then O 1 can be transformed into O 2 by a sequence of cycle reversals.
Proof: Let E R be the set of arcs in O 1 that have an opposite orientation in O 2 . Notice that for all vertices v in the graph induced by E R , the indegree of v equals the outdegree of v. For otherwise, there is some v such that . It follows that each connected component of the graph induced by these edges has an Euler tour [13]. Reversing these tours gives the lemma. 2 We define a weak reversal to be the reversal of a path from a vertex u to a vertex v where δ(u) = δ(v) − 1. Notice that performing a weak reversal will not change the number of vertices of any particular indegree.
Theorem 2 Any orientation that minimizes the lexicographic order of the indegrees of the vertices can be transformed into an orientation induced by Path-Reversal via a sequence of weak reversals or cycle reversals.
Proof: Let D lex denote an orientation that minimizes the lexicographic order of the indegrees of the vertices, and let D P R denote an orientation given by Path-Reversal. Let δ lex (v) and δ P R (v) be the indegree of a vertex v in D lex and D P R respectively.
We will use induction on S : If |S| = 0 then by Lemma 1, the theorem holds. Now suppose that S > 0. Let and if there is a choice among many such vertices, then maximizes δ P R (v). Then we have the following two cases: This is because u∈U δ lex (u) is the number of edges in G[U ], u∈U δ P R (u) also includes the indegree from edges in U and may additionally include It is not possible for δ lex (u) < δ lex (v) − 1 for otherwise reversing a u to v path would give an orientation with a smaller lexicographic order than D lex . Therefore we have that δ lex (u) = δ lex (v) − 1 and there is a weakly reversible path from u to v in the directed graph defined by D lex . Reversing this path decreases S by 2.
. This means that there is a reversible path from u to v, a contradiction because D P R has no reversible paths.
2 Corollary 3 The algorithm Path-Reversal finds an orientation that minimizes the lexicographic order of the indegrees.
Remarks Let us revisit the motivating problem of failure recovery in network design, for which a failed circuit notifies either its source vertex or its sink vertex. We argued that minimizing the maximum indegree or the lexicographic order of the indegrees minimizes effort in failure recovery. We could also measure the recovery effort per vertex as a function f (·) of the number of circuits this vertex is responsible for. The total effort for error recovery is then v f (δ(v)). The shape of f (·), convex or concave or other more complex nature, can be debated. However, if f (·) is increasing and strictly convex, we remark that the algorithm Path-Reversal as we have seen also minimizes the total effort. Asahiro et al. [21] present a network flow algorithm that also gives an orientation that minimizes for any increasing and strictly convex function f .
Let G a be an orientation of the graph that minimizes the given objective. Let G b be the result of the algorithm Path-Reversal using G a as the initial orientation. By Theorem 3, G b minimizes the lexicographic order of the indegrees. Since the non-increasing sequence of indegrees that corresponds to such an orientation is unique, it follows that any orientation G c that minimizes the lexicographic order of the indegrees satisfies α i (G c ) = α i (G b ) for all i. It further follows that all orientations that minimize the lexicographic order of the indegrees achieve the same objective: Suppose for a contradiction to the theorem that the degree distributions of G b and G a differ. Therefore, the algorithm Path-Reversal performs at least one path reversal. Let G 1 be the graph obtained from G a after reversing one path, say from a vertex u to a vertex v.
We compare F (G a ) to F (G 1 ). Let δ Ga (u) = k and δ Ga (v) = . Since this path from u to v was a reversible path in G a , k < − 1. By the path reversal operation, we get δ G 1 (u) = k + 1 and δ G 1 (v) = − 1. Then: Since k < − 1 and f is increasing and strictly convex, term A is greater than term B, and so the above difference is positive. It follows that F (G a ) > F (G 1 ), contradicting the fact that G a minimizes the objective F (G). Therefore, G a and G 1 must have the same degree distribution. 2

Strongly connected orientations
In this section we will show how to find a strongly-connected orientation that minimizes the maximum indegree. First we argue that this would enable an interval routing scheme (as described in the introduction) with minimum

Minimum routing tables for strongly connected graphs
It is well known, as a generalization of Whitney's characterizations of 2-edge connected, undirected graphs [18] and Robbins' correspondence between strong connectivity and 2-edge connectivity [16], that a directed graph is strongly connected if and only if it has an ear-decomposition. An ear decomposition of a directed graph is a partition of the edges into a simple directed cycle P 0 and simple directed paths (or cycles) P 1 , . . . , P k such that for each i > 0, the intersection of P i with ∪ j<i P j are the endpoints of P i (which may be coincident if P i is a cycle). Each P i is called an ear. An ear decomposition can be found in linear time [6]. Given an ear decomposition of a strongly-connected graph, we can define the routing tables using the procedure Routing below. We will define a cyclic ordering L of the vertices. For each arc uv, we will define an interval [a, b], a, b ∈ L. Recall from the introduction that this information can be used for routing: a message at a vertex u with destination d will be forwarded along uv if d is in [a, b], that is if d is (inclusively) between a and b in the cyclic ordering L. We say that such a labeling is feasible if it allows a message to be routed between any pair of vertices.
We assume, without loss of generality, that each ear in the ear decomposition contains at least two edges: a single-edge ear could be removed while maintaining strong connectivity and so will not be required for routing. We denote the number of edges in P by |P |. See Figure 1 for a demonstration of this procedure. It is convenient to use both open and closed endpoints for intervals of L. For example, (a, b] contains all the vertices that are strictly after a and before (or equal to) b in the ordering. We use (a, a) to represent all the vertices in the cyclic ordering except a. Further, for the purposes of analysis, it is convenient to think of the intervals as being continuous.
Routing (ear decomposition P 0 , P 1 , . . .) Initialize L to contain all the vertices of P 0 in their order around P 0 . Assign each arc ab of P 0 the interval (a, a). For i = 1, . . . , k: Let v 1 be the first vertex of P i .
Let v 2 , . . . , v p be the second through penultimate vertices of P i .
Insert v 2 , . . . , v p into L after v 1 . For j = 2, . . . , p: Assign the arc leaving v j the interval (v j , v j ). Let v 1 u be the arc leaving v 1 that is assigned the interval (v 1 , a) (for some a). Let b be the vertex after v p in the cyclic ordering L.
The following invariant, among other things, shows that the arc v 1 u exists and is unique.
Invariant 5 At any stage in the algorithm, the intervals assigned to the arcs leaving a vertex v are disjoint and form a partition of (v, v).
Proof: When a vertex is first introduced and there is only one arc leaving it, this invariant is true by construction.
If we assume for an induction that the invariant holds prior to the introduction of a new arc v 1 v 2 leaving v 1 , then there must be exactly one arc whose assigned interval starts with (v 1 ,. (Also, since a closed endpoint of an interval is never introduced, this arc must be assigned an interval of the form (v 1 , a) for some a.) Since, prior to the insertion of v 2 , . . . , v p into L, b is the vertex after v 1 in the cycle ordering, (v 1 , b) ⊆ (v 1 , a) for all a. Therefore after the insertion of v 2 , . . . , v p into L between v 1 and b we still have that is a partition of (v 1 , a), the invariant holds. 2 Routing produces a feasible interval routing scheme with each arc having exactly one interval.
Note that this result has been shown previously with a different approach by Fraigniaud and Gavoille [8] in Lemma 3. Proof: As mentioned above, for convenience of analysis, we view the intervals as continuous. Let H i = ∪ j≤i P j and let L i be the cyclic ordering of the vertices of H i at the start of iteration i (or end of iteration i − 1 for i = k). For a vertex v ∈ H i , let n i (v) be the vertex immediately after v in L i . We prove the following statement by induction: for v ∈ H i , at the start of iteration i (or end of iteration i − 1 for i = k), a message with destination in the (continuous) interval [v, n i (v)) will reach vertex v. This statement is true for the base case which corresponds to the interval assignment for P 0 .
Consider ear P i . We show that the intervals defined at the end of iteration i allow a message with destination in the interval [y, n i (y)) starting at vertex x will reach vertex y (for x = y). The non-trivial cases are Cases 2, 3 and 4. 1.
x and y are internal vertices of P i and y is after x along P i : For every vertex v in P i , a message will get routed on the arc leaving v unless it is destined for v since the interval assigned to the unique arc leaving v contains everything except v.
2. x = v 1 and y is an internal vertex of P i : The vertices in P i are in the interval [v 2 , v p ]. By construction and definition of b, this is the same as the interval (v 1 , b) since b is the vertex after v p in L and v 1 is the vertex before v 2 in L. So [y, n i (y)) ⊂ (v 1 , b) and a message at v 1 going to a destination in [y, n i (y)) gets routed along the arc v 1 v 2 . Correctness follows from Case 1.
3. x ∈ H i−1 \ v 1 and y and internal vertex of P i : We argue that the message will reach v 1 . By definition b = n i−1 (v 1 ) and by construction [y, n i (y)) ⊂ [v 1 , b) = [v 1 , n i−1 (v 1 )). Since v 1 ∈ H i−1 , by the inductive hypothesis, a message with destination in the interval [v 1 , n i−1 (v 1 )) will reach v 1 ; we are done by Case 2.
4. x = v 1 and y ∈ H i−1 : Note that n i−1 (y) = n i (y). Since y = x and b = n i−1 (x), y ∈ [b, v 1 ). Therefore [y, n i (y)) ∩ (v 1 , b) is empty and the message does not get routed along v 1 v 2 . Therefore a message in [y, n i (y)) reaches y by the inductive hypothesis.

x, y ∈ H i−1 :
If a message in [y, n i (y)) reaches v 1 , then the message reaches y by Case 4. If a message in [y, n i (y)) does not reach v 1 , then we are done by the inductive hypothesis because n i−1 (y) = n i (y).
6. x is an internal vertex of P i and y ∈ H i−1 : Note that n i−1 (y) = n i (y). Since v / ∈ [y, n i (y)) for any internal vertex v of P i , a message in [y, n i (y)) will reach H i−1 . Then by Case 5, a message in [y, n i (y)) will reach y. 7.
x and y are internal vertices of P i and y is before x along P i : Since v / ∈ [y, n i (y)) for any internal vertex v of P i after x because x is after y in P i , a message in [y, n i (y)) will reach H i−1 . By Cases 2 and 3, a message in [y, n i (y)) will reach y.

2
It is non-standard to use open intervals for such a scheme. Given the final interval assignment and cyclic ordering, numbers can be assigned to the vertices based on the cyclic ordering and the intervals can be closed in the natural way.
Since we can generate an interval routing scheme with exactly one interval per arc and each arc is required for routing when each ear has at least two arcs, our labeling is optimal. We can minimize the table sizes if we can first strongly orient the graph to minimize the maximum outdegree. To keep with the notation of the rest of the paper, we instead, without loss of generality, minimize the maximum indegree.

Strongly-connected orientations that minimize the maximum indegree
We will show that a modified version of Path-Reversal finds a stronglyconnected orientation of an undirected graph that minimizes the maximum indegree. In this section we will assume that the given directed graph has a strongly-connected orientation. Given a directed graph, we say that a path from u to v is strongly reversible if δ(u) < δ(v) − 1 and reversing the path will maintain strong connectivity. The greedy algorithm, given an undirected graph, is: SC-Path-Reversal start with an arbitrary strongly-connected orientation while there is a strongly reversible path starting with a max-indegree vertex let P be such a path reverse the orientation of each arc of P One can find a strongly-connected orientation in linear time using depthfirst search: orient all edges in the depth-first search tree downward away from the root and orient all the non-tree edges upward with respect to the tree, cross edges may be oriented arbitrarily.  Strongly-reversible paths are characterized by the number of edge disjoint paths between endpoints. We say that a vertex v two-reaches a vertex u if there are two arc-disjoint paths from v to u. We say that a vertex v two-reaches a vertex set U if there are paths from v to u 1 and from v to u 2 where u 1 , u 2 ∈ U , and these paths are arc disjoint.
In the following we will use network flow theory. Let N = (V, E) be a directed network with s, t ∈ V being the source and the sink of N respectively. The capacity of an edge is a mapping c : E → R + , denoted by c uv . This is the maximum amount of flow that can pass through an edge. A flow is a mapping f : E → R + , denoted by f uv , subject to the following two constraints: f uv ≤ c uv , for each (u, v) ∈ E and u:(u,v)∈E f uv = u:(v,u)∈E f vu , for each v ∈ V \ {s, t}. The value of flow is defined by |f | = v∈V f sv , where s is the source of N . An s − t cut C = (S, T ) is a partition of V such that s ∈ S and t ∈ T . The cut-set of C is the set {(u, v) ∈ E|u ∈ S, v ∈ T }. The max-flow, min-cut theorem states that the value of the maximum flow is equal to the value of the minimum cut [7].
A consequence of this theorem is that if the maximum flow is greater than or equal to k in a unit-capacity network, then there are k arc disjoint s to t paths [1].
Lemma 7 Reversing a u-to-v path maintains strong connectivity if and only if u two-reaches v.
Proof: Suppose that when we reverse a u-to-v path P , the graph remains strongly connected. Thus there must still be a u-to-v path when P is reversed, so in the original graph the max u-to-v flow must have been at least 2. By the max-flow, min-cut theorem, we know that there are 2 arc-disjoint paths from u to v. Now suppose that u two-reaches v in a strongly connected orientation. Reversing one of these paths will create a cycle. Any pair of vertices requiring one of these paths for connectivity can be connected by way of the cycle, which will maintain strong connectivity. 2 SC-Path-Reversal can be implemented to run in quadratic time: strongpath reversibility can be detected in linear time by two iterations of the augmenting path algorithm for maximum flow [7]. There are a linear number of iterations: we show, as in Section 2, that after reversing a stronglyreversible path ending in a vertex of indegree , the algorithm does not reverse a strongly-reversible path ending in a vertex of higher indegree.
As for the algorithm Path-Reversal, we argue that the algorithm proceeds in k phases where k is the maximum indegree of the initial strongly connected orientation. In phase , strongly-reversible paths ending in vertices of indegree are reversed. This reduces the indegree of these vertices by one, and does not result in any extra vertices of indegree greater than .
Let Q be the set of vertices of indegree > just before the start of phase and let Q be the set of vertices that have strongly-reversible paths to a vertex in Q. (Note: Q ⊆ Q .) If, in the first iteration of phase , a strongly-reversible path ending in a vertex v of indegree is reversed, then the indegrees of the vertices in Q must be > and v / ∈ Q. Therefore, after reversing a strongly-reversible path ending in a vertex of indegree , the algorithm does not reverse a path ending in a vertex of higher indegree.

Strongly connected structure
To prove that SC-Path-Reversal minimizes the maximum indegree, we will use a transitivity-like property of arc-disjointness: Lemma 8 Suppose vertices s and t each two-reach a vertex v. If there are arc-disjoint u-to-s and u-to-t paths, then u two-reaches v.
Proof: We argue that the min u-v cut is at least 2, proving the lemma by the max-flow-min-cut theorem. Consider any u-v cut (viewed as a bipartition of the vertices), (A, B). If s ∈ A, then the min cut is at least 2 (because the min sv-cut is at least 2). Likewise if t ∈ A. If both s and t are in B, then the min u-v cut is at least 2, as witnessed by the arc-disjoint u-to-s and u-to-t paths. 2 In order to ensure strong connectivity, we get: Proof: Let C be a component of G[V \U ] and suppose for a contradiction that there are multiple arcs from C to U . Let v 1 , v 2 , v 3 , . . . , v p be vertices in C that are tails of these arcs. Let C i be the set of vertices in C that reach v i . We will argue that all of the C i s are in fact the same, so there is only one v i that is the tail of an arc from C into U . Since the graph is strongly connected, every vertex in C reaches U and so must reach some v i . If x ∈ C i ∩ C j for some i = j, then by Lemma 8, x two-reaches U , contradicting the definition of U . Therefore C 1 , . . . , C p is a partition of C. However, since C is connected, there must be an arc uv from, say, C i to C j . In which case, u ∈ C j , a contradiction by the above case. Therefore, the partition cannot contain more than one set. So there is only one arc from C to U .

Minimizing the maximum indegree
We show that the algorithm minimizes the maximum indegree by meeting the following lower bound. For a set of vertices U , let c(U ) be the number of components of G[V \U ].

Lemma 11
The maximum indegree of any strongly connected orientation is at least Proof: The total indegree that must be shared amongst U is at least the number of edges in G[U ] + c(U ), where the second term follows from Corollary 9. By an averaging argument at least one vertex must have indegree at least m(U )+c(U ) |U | . 2

Theorem 12
The algorithm SC-Path-Reversal finds a strongly connected orientation that minimizes the maximum indegree.
Proof: Let k be the maximum indegree resulting from SC-Path-Reversal.
Let v be a vertex of indegree k. Let U be the set of vertices that two-reach v. By the termination criteria of the algorithm, all vertices in U have indegree k or k − 1. By Lemma 10, the total indegree shared amongst U is m(U ) + c(U ). We have that |U |k ≥ m(U ) + c(U ) > |U |(k − 1). Dividing by |U | yields k ≥ m(U )+c(U )
We conjecture that SC-Path-Reversal is indeed optimal for the "minimizing the lexicographic order" objective as well. Unfortunately our proof technique from Section 2 for minimizing the lexicographic order of an arbitrary orientation does not follow through. For example, we would need to consider the set of vertices U that have at least two paths to a vertex of highest indegree, but there could be a vertex x on a path from u ∈ U to v that is not in U . In this case inequality (1) does not hold. For this, and other reasons, a different technique will needed to obtain this result.

Acyclic orientations
We now examine the situation in which the resulting orientation needs to be acyclic. Unlike what we have seen, minimizing the lexicographic order is no longer polynomially solvable. However, a simple algorithm guarantees optimality of minimizing the maximum indegree.

Minimizing the maximum indegree
The following simple procedure minimizes the maximum indegree for an acyclic orientation. Stripping Procedure Choose a vertex with minimum degree. Orient all incident edges into that vertex. Remove that vertex and its adjacent edges. Repeat.

Theorem 13
Stripping finds an acyclic orientation with maximum indegree minimized.
Proof: Let k be the maximum indegree resulting from stripping and let v be a vertex with indegree k. Thus at some iteration, v had the minimum degree among the remaining vertices, U . Let H be the subgraph induced by U with orientation inherited from an optimal orientation of the original graph. H must have a sink and since every vertex in H has degree at least k, this vertex must have indegree at least k.

Acyclic minimum lexicographic orientation is NP-hard
We will show that the problem of minimizing the lexicographic order of an acyclic orientation is NP-hard. We will give a reduction from set cover to the related problem of finding an acyclic orientation such that: • the maximum indgree is minimized • the number of nodes with this maximum indegree is also minimized Clearly, finding an acyclic orientation with minimum lexicographic order of indgrees solves this related problem. The decision version of this related problem "Is there an acyclic orientation that minimizes the maximum inegree and further has at most vertices with that maximum indegree?" is in NP because the orientation is the certificate. The Set Cover problem is defined as follows: Given a set of elements {1, 2, . . . , m} (called the universe) and n sets whose union comprises the universe, the set cover problem is to identify the smallest number of sets whose union contains all elements in the universe. Set cover is proven to be NP-hard by a reduction from the vertex cover problem [12].
We say that a set of vertices is t-strippable if the stripping procedure results in maximum indegree at most t among these vertices.
We will use the following k-gadget graph H with 1 ≤ < k and k odd:  If is odd H is composed of 2 copies of K k , a clique on k vertices, and a root vertex r. Connect r to (k − )/2 of the vertices in each of the complete graphs. Add a matching between the vertices of degree k − 1 of the K k subgraphs. (Figure 2

(a))
If is even H is composed of a left and right copy of K k , a root vertex r, and an extra vertex s. Connect r to k − vertices in the left K k . Connect s to /2 vertices in the left K k . Connect s to k − /2 of the vertices in the right K k . Add a matching between the vertices of degree k − 1 of the left and right K k subgraphs. (Figures 2(b) and 2(c)) It is easy to verify that H has the following properties: 1. All the vertices, except the root vertex r, have degree k.
2. The root vertex r has degree k − .
Let S = {S 1 , S 2 , . . . S m } be the instance of set cover. We wish to find sets that cover all of the elements. Let f x denote the frequency of element x in S. Let k be the smallest odd number which is greater than We construct a graph G as follows (See Figure 3): For each S i ∈ S create a set k-gadget H 1 , with root vertex r i . For each element x create an element k-gadget H fx , with root vertex r x . For every x ∈ S i connect r i to r x . G has the following properties: 1. All vertices in G have degree k except for the vertices r i of the set gadgets, these have degree k + |S i | − 1.
2. All vertices have degree at least k, so the minimum possible maximum indegree of any acyclic orientation of G is k.
The first two properties are clear from construction. We will prove the third property with the following two lemmata.

Lemma 14
The vertices of a set gadget in G with any vertex v removed are (k − 1)-strippable.
Proof: r is the only vertex in the set gadget that potentially has degree greater than k.
If v = r then the vertices that were adjacent to r have degree k − 1 so we can (k − 1)-strip the remaining vertices.
Suppose that v = r. The vertices of the set gadget can be (k−1)-stripped as illustrated in Figure 2.
If is odd, first strip all of the vertices of the clique containing v then strip all of the vertices of the other clique. We know that r originally had degree k + |S i | − 1 and we removed k − 1 of the vertices adjacent to it. Thus r has degree |S i | which is at most k − 1, so we can strip r.
If is even, then either v ∈ K k or v = s. If v ∈ K k for either the left or right clique, first strip all of the vertices in this clique, then strip s, then strip the vertices in the other clique and finally strip r as in the odd case.
If v = s then we can strip both cliques, because both were connected to s, and finally strip r. 2 A similar argument shows: Lemma 15 Any element gadget with any vertex v removed is (k − 1)strippable.
It follows that G is k-strippable: stripping one vertex of degree k from each set and element gadget leaves (k − 1)-strippable subgraphs.
Theorem 16 G has an acyclic orientation with at most vertices of indegree k if and only if there is a covering subcollection of S of size at most .
Proof: For the forward direction: Let X be the set of at most vertices which have indegree k. G\X is (k−1)-strippable. Let S be the subcollection of S containing (i) all the sets whose gadgets have an indegree k vertex and (ii) for each element gadget that has an indegree k vertex, one set that contains this element.
Notice that |S | ≤ . We will show that S is a covering. For any element x, let P be the element gadget corresponding to x. There are two cases for P : (a) P includes a vertex of indegree k.
In this case x is covered by a set of type (ii). (b) P does not include a vertex of indegree k.
The degree of the root vertex r P of P is k. The assumption that P does not have any vertices of indegree k implies that at least one edge is oriented away from r P . If this edge is from r P to a set gadget, then at least one vertex of the set gadget must have indegree k. The set corresponding to this set gadget must be included in S , so x is covered. If the edge oriented away from r P is directed to another vertex in P , then there must be a vertex of indegree k in P . By the construction of the gadget and the acyclicity property of the orientation, this is a contradiction to the fact that the edge oriented away from r P is directed into another vertex in P . Thus in any case, element x is covered. Therefore S is a cover. For the reverse direction: Let S be the collection of at most sets from S that form a cover. Take a non-root vertex from each set gadget corresponding to a set in S and orient all edges toward it. Each of these gadgets is now (k − 1)-strippable by Lemma 14. Each element x is covered, so stripping the set gadget covering x directs the edge between the set gadget and the element gadget for x away from the element gadget (see the orientation of Figure 3). The root of the element gadget has degree k − 1, so each element gadget is (k−1)-strippable in G\X. Consider the set gadgets for the sets not in S . The roots of these gadgets all have remaining degree k − 1, because all of the element gadgets have been stripped so these are also k − 1-strippable. This orientation has at most vertices of indegree k. 2

Closing
Graph orientation is a rich problem area. In this paper we have presented three variants of the problem with their respective motivations. In one variant the resulting graph has no structural constraints, in another strong connectivity is required, and finally an acyclic orientation is required. For the first two variants the simple algorithm of path reversal proves to be pow-erful. We have shown the optimality of the algorithm for the "minimizing the maximum indegree" objective in both variants and for the minimizing the lexicographic order objective for the first variant. We conjecture that SC-path-reversal is indeed optimal for the "minimizing the lexicographic order" objective as well. The third variant, requiring the resulting graph to be acyclic introduced quite a different problem. We have included an NP-hardness proof for acyclic minimizing the lexicographic order to demonstrate the point. How to approximate the "minimizing the lexicographic order" objective and enforce the acyclicity constraint remains an interesting open problem.