1 Introduction

Allocating resources to several agents in a satisfactory way is a classical problem in combinatorial optimization. In particular, interesting questions arise if agents have different valuations of resources or if additional constraints are imposed for a feasible allocation. In this work we study the fair allocation of n indivisible goods or items to a set of k agents. Each agent has its own additive utility function over the set of items. The goal is to assign every item to exactly one of the agents so that the minimal utility over all agents is as large as possible. Related problems of fair allocation are frequently studied in Computational Social Choice, see, e.g., [18]. Recent papers from this field containing many pointers to the literature and studying fairness issues, also in connection with an underlying graph structure, are given by [11, 17]. In the area of Combinatorial Optimization a similar problem is well-known as the Santa Claus problem (see [9]), which can also be seen as a scheduling problem.

In this paper we look at the problem from a graph theoretical perspective and add a major new aspect to it. We allow an incompatibility relation between pairs of items, meaning that incompatible items should not be allocated to the same agent. This can reflect the fact that items rule out their joint usage or simply the fact that certain items are identical (or of a similar type) and it does not make sense for one agent to receive more than one of these items. We will represent such a relation by a conflict graph where vertices correspond to items and edges express incompatibilities.

As a more concrete example consider the distribution of transportation orders among a number of shipping partners which should all be treated as equally as possible according to a joint master agreement. In some industries, goods cannot be combined in an arbitrary way due to safety regulations or rules for hazardous materials (see [59] for the delivery of goods from incompatible categories to small neighborhood stores). Then, a conflict graph can be used to express forbidden freight combinations (see, e.g., [33, 41]).

When items represent tasks with a starting and end time, each agent should be allocated a fair subset of non-overlapping tasks. Again, the mutual exclusion of two tasks/items, will be represented by the edges of a conflict graph (see, e.g., [32, 46]). Note that in [20] a general treatment of conflict graphs was performed for the COIN OR Branch-and-Cut (CBC) solver.Footnote 1

In all such scenarios every feasible allocation to one agent must be an independent set in the conflict graph. This means that the overall solution can also be expressed as a partial k-coloring of the conflict graph G, but in addition every vertex/item has a profit value for every color/agent and the sum of profits of vertices/items assigned to one color/agent should be optimized in a maxi-min sense.

We believe that this problem combines aspects of independent sets, graph coloring, and weight partitioning in an interesting way, offering new perspectives to look at these classical combinatorial optimization problems.

1.1 Problem Definitions

The classical fair division problem

We consider a set V of items with cardinality \(|V|=n\) and k profit functions \(p_1,\ldots ,p_k: V \rightarrow {\mathbb {Z}}_+\). An ordered k-partition of V is a sequence \((X_1,\ldots ,X_k)\) of k pairwise disjoint subsets of V such that \(\bigcup _{i = 1}^k X_i = V\). The satisfaction level of an ordered k-partition \((X_1,\ldots ,X_k)\) of V (with respect to \(p_1,\dots , p_k\)) is defined as the minimum of the resulting profits \(p_j(X_j):= \sum _{v\in X_j}p_j(v)\), where \(j\in \{1,\ldots , k\}\). The classical

Fair k -Division of Indivisible Items

$$\begin{aligned} \begin{array}{ll} { Input} &{} \hbox {A set } V \hbox {of } n\hbox {items }, k \hbox {profit functions }p_1,\ldots ,p_k: V \rightarrow {\mathbb {Z}}_+.\\ { Task} &{} \hbox {Compute an ordered } k-\hbox {partition of } V \hbox {with maximum satisfaction }\\ &{} \hbox {level}. \end{array} \end{aligned}$$

Connections with scheduling and knapsack problems

For the special case where all k profit functions are identical, i.e., \(p_1= p_2=\ldots =p_k\), the problem can also be represented in a scheduling setting. There are k identical machines and n jobs, which have to be assigned to the machines by a k-partitioning. The goal is to maximize the minimal completion time (corresponding to the satisfaction level) over all k machines. It was pointed out in [30] that this problem is weakly NP-hard even for \(k=2\) machines. Indeed, it is easy to see that an algorithm deciding the above scheduling problem for two machines would also decide the classical Partition problem: given n integers \(a_1,\ldots , a_n\), can they be partitioned into two subsets with equal sums? For \(k\ge 3\), one can simply add jobs of length one half of the sum of weights in the instance of Partition. If k is not fixed, but part of the input, the same scheduling problem is strongly NP-hard as mentioned in [8] (a PTAS was derived in [64]). In fact, an instance of the strongly NP-complete 3-Partition problem with 3m elements and target bound B could be decided by any algorithm for the scheduling problem with \(n=3m\) jobs, \(k=m\) machines and a desired minimal completion time equal to B. We conclude for later reference.

Observation 1

Fair k-Division of Indivisible Items, even with k identical profit functions, is weakly NP-hard for any constant \(k\ge 2\) and strongly NP-hard for k being part of the input.

Note that for \(k = 2\), the decision version of Fair k -Division of Indivisible Items also generalizes the decision version of the Knapsack problem: Given a set \(V = \{1,\ldots , n\}\) of items with weights \(w_1,\ldots , w_n\in {\mathbb {Z}}_+\) and values \(v_1,\ldots , v_n\in {\mathbb {Z}}_+\), and two positive integers W and C such that \(W<\sum _{j\in V}w_j\), is there a subset of the items having total weight at most W and total value at least C?Footnote 2

It should be noted that Fair k-Division of Indivisible Items is still only weakly NP-hard for constant k even for arbitrary profit functions, since we can construct a pseudo-polynomial algorithm solving the problem with a k-dimensional dynamic programming array.

Our generalization In this paper we study a generalization of Fair k-Division of Indivisible Items, where a conflict graph \(G = (V,E)\) on the set V of items to be divided is introduced. An edge \(\{i,j\} \in E\) means that items i and j should not be assigned to the same subset of the partition. Allocating items in a conflict-free way immediately gives rise to (partial) colorings of the graph, a concept studied by Berge [12] and de Werra [29].

Definition 1

A partial k-coloring of a graph G is a sequence \((X_1,\ldots ,X_k)\) of k pairwise disjoint independent sets in G.

Combining the profit structure with the notion of coloring we define for the k profit functions \(p_1,\ldots ,p_k: V \rightarrow {\mathbb {Z}}_+\) and for each partial k-coloring \(c = (X_1,\ldots , X_k)\) a k-tuple \((p_1(X_1),\ldots , p_k(X_k))\), called the profit profile of c. The minimum profit of a profile, i.e., \(\min _{j=1}^k \{p_j(X_j)\}\), is the satisfaction level of c. Now we can define the problem considered in this paper:

Fair k-Division Under Conflicts

$$\begin{aligned} \begin{array}{ll} { Input} &{} \hbox {A graph } G = (V,E), k \hbox {profit functions } p_1,\ldots ,p_k: V \rightarrow {\mathbb {Z}}_+.\\ { Task} &{} \hbox {Compute a partial } k-\hbox {coloring of } G \hbox {with maximum satisfaction}\\ &{} \hbox {level}. \end{array} \end{aligned}$$

In the hardness reductions of this paper we will frequently use the decision version of this problem: for a given \(q \in {\mathbb {Z}}_+\), does there exist a partial k-coloring of G with satisfaction level at least q?

Note that an optimal partial k-coloring \((X_1,\ldots ,X_k)\) does not necessarily select all vertices from V. Furthermore, note also that for \(k=1\), the problem coincides with the Weighted Independent Set problem: given a graph \(G = (V,E)\) and a weight function on the vertices, find an independent set of maximum total weight. In particular, since the case of unit weights and \(k = 1\) coincides with the Independent Set problem, we obtain the following result.

Observation 2

Fair 1-Division Under Conflicts is strongly NP-hard.

Thus, the addition of the conflict structure gives rise to a much more complicated problem, since Fair k-Division of Indivisible Items (which arises naturally as a special case for an edgeless conflict graph G) is trivial for \(k=1\) and only weakly NP-hard for \(k\ge 2\) (see Observation 1).

Fig. 1
figure 1

Relationships between various graph classes and the complexity of Fair k-Division Under Conflicts (decision version). An arrow from a class \({\mathcal {G}}_1\) to a class \({\mathcal {G}}_2\) means that every graph in \({\mathcal {G}}_1\) is also in \({\mathcal {G}}_2\). Label ‘PP’ means that for each fixed k the problem is solvable in pseudo-polynomial time in the given class, and label ‘sNPc’ means that for each fixed \(k\ge 2\) the decision version of the problem is strongly NP-complete. For graph classes with round corners the result is shown in the cited theorem of this paper. Results depicted in rectangles follow from the inclusion of graph classes. For all graph classes in the figure, the problem is solvable in strongly polynomial time for \(k = 1\), as it coincides with the Weighted Independent Set problem

1.2 Our Goal and Contributions

The goal of our research is a characterization of the computational complexity of Fair k-Division Under Conflicts for different classes of conflict graphs. We study the boundary between strongly NP-hard cases and those where a pseudo-polynomial algorithm can be derived for a constant k. Observation 1 implies that this is the only type of positive result we can achieve. Moreover, considering Observation 2, it only makes sense to consider graph classes where the Weighted Independent Set problem is (pseudo-)polynomially solvable. One such prominent example is the class of perfect graphs (see [40]). Thus, in this paper we concentrate (mainly) on various subclasses of perfect graphs as depicted in Fig. 1. Additionally, we show how to adapt the algorithm for chordal graphs to obtain a pseudo-polynomial algorithm for graphs of bounded treewidth. For \(k=2\) our pseudopolynomial dynamic programming approaches generalize the standard dynamic program for the Knapsack problem.

Our contributions are as follows. We first show that for all \(k\ge 1\), the decision version of our Fair k-Division Under Conflicts is strongly NP-complete for conflict graphs from any graph class \({\mathcal {G}}\) for which Independent Set is NP-complete, provided a certain mild technical ‘extendability’ condition is satisfied (Sect. 2.1). By a similar reasoning we can also reach a strong inapproximability result for our problem. For bipartite conflict graphs as well as their line graphs Fair k-Division Under Conflicts can be shown to be strongly NP-hard for all \(k\ge 2\) (Sect. 2.2), even though the corresponding Weighted Independent Set problem is polynomial-time solvable. On the other hand, for the relevant special case of biconvex bipartite graphs (cf. [42, 47]), Fair k-Division Under Conflicts can be solved by a pseudo-polynomial time algorithm. This result is based on an insightful pseudo-polynomial algorithm for the problem on a cocomparability conflict graph (Sect. 3). Besides these results, in Sect. 3 we present dynamic programming based solutions for the classes of chordal graphs and graphs of bounded treewidth. Finally, Sect. 4 explains how fully polynomial time approximation schemes (FPTAS) can be derived from the pseudo-polynomial algorithms of this paper. Figure 1 gives on overview of the results.

1.3 Overview of Related Work

The first elaborate treatment of the Fair k-Division of Indivisible Items problem was given in [13], where two approximation algorithms with non-constant approximation ratios were given. The authors also mention that the problem cannot be approximated by a factor better than 1/2 (under \(\text {P} \ne \text {NP}\)). In [38] further approximation results were derived, among them a bicriteria approximation algorithm, which allocates a guaranteed fraction of the optimal solution value to almost all agents. In 2006 Bansal and Sviridenko [9] coined the term Santa Claus problem, which corresponds to the variant of the above problem when k is not fixed but part of the input. Since then various approximation results have appeared on this problem of allocating indivisible items exploring different concepts of objective functions and various approximation measures, see, e.g., [7, 21].

An interesting variant is the maximin share concept. Here, one considers the hypothetical scenario where every agent is allowed to partition the set of items into k subsets and receives the least valued subset. An allocation should give to every agent at least that amount. While this is known to be impossible in general, several approximation algorithms were derived, see [4, 10, 37, 43].

A different specialization is assumed in the widely studied Restricted Max-Min Fair Allocation problem. This is a special case of Fair k-Division of Indivisible Items where every item \(v_i \in V\) has a fixed valuation \(p(v_i)\) and every agent either likes or ignores item \(v_i\), i.e., the profit function \(p_j(v_i) \in \{0, p(v_i)\}\). A fairly recent overview of approximation results both for this restricted setting as well as for the general case of the Santa Claus problem can be found in [5].

Disjunctive constraints represented by conflict graphs were considered in the literature for a wide variety of combinatorial optimization problems. Related to the allocation problem studied in this paper, there is the knapsack problem with conflicts for which several exact algorithms were developed, most recently by [23]. Moreover, from a similar perspective as in the current paper [52, 54] identified special graph classes as conflict graphs which still permit a pseudopolynomial solution algorithm. Also the distribution of items into bins as required in the classical bin packing problem has some resemblance to Fair k-Division of Indivisible Items, where (not all) items are distributed to a fixed number of agents. The bin packing problem with a conflict graph was studied in a number of papers, most notably in [34, 50, 57]. Also scheduling problems, where the allocation of jobs to machines is subject to pairwise conflicts between certain jobs, should be named as a related optimization problem. The resulting complexity and approximation questions were considered, e.g., in [15, 32, 35], and most recently in [46].

From a more general perspective, various optimization problems on graphs were studied with the feature of an added conflict structure, e.g., [28, 53, 58]. Recently, [48] presented an interesting model for consistency in databases based on a conflict graph. This widespread attention to conflict graphs in combinatorial optimization underlines the relevance of investigating disjunctive constraints also for our fair allocation problem.

The problem studied by Berge [12] and de Werra [29] is similar to Fair k-Division Under Conflicts but differs from it in one crucial aspect: instead of maximizing the minimum profit of a profile, the goal is to maximize the sum \(\sum _{j=1}^k p_j(X_j)\) of all the profits. Furthermore, they considered the case of unit profit functions \(p_j:V\rightarrow \{1\}\), for all j, that is, the the Maximum Induced k-Colorable Subgraph problem. This problem has been extensively studied in the literature (see, e.g., [36, 44, 49, 65]); the case \(k= 2\) is is equivalent to the Odd Cycle Transversal problem (see, e.g., [27, 55]).

Berge [12] gave a sufficient condition for a partial k-coloring to be optimal, in terms of existence of a particular family of cliques, and gave several characterizations of graphs for which this condition is satisfied by every optimal solution. Using connections with perfect graphs and balanced hypergraphs, Berge showed that line graphs of bipartite multigraphs satisfy this property. De Werra [29] continued this line of research, applying network flow techniques and linear programming to several classes of graphs. These characterizations rely on a min-max relation, which does not hold in general but does hold for several classes of perfect graphs (including the classes of comparability and cocomparability graphs). The above results imply the existence of polynomial-time algorithm for the Maximum Induced k-Colorable Subgraph problem in the corresponding class of graphs, since the problem reduces to that of finding a maximum independent set in a derived perfect graph. Berge [12] asked if for every k, the problem is solvable in polynomial time in the class of perfect graphs. This is not the case unless P = NP, since Addario-Berry et al. [2] identified a subclass of perfect graphs on which the problem is NP-complete already for \(k= 2\).

Due to the non-linearity of the objective function, we have no reason to expect similar min-max results for Fairk-Division Under Conflicts for \(k\ge 2\). The intuition that this seems to be a much more complicated problem than Maximum Induced k-Colorable Subgraph is also confirmed by the hardness results developed in this paper, in particular, that for all \(k\ge 2\) the problem is strongly \(\text {NP}\)-complete in the classes of bipartite graphs and their line graphs.

1.4 Definitions and Notation

All graphs considered in this paper are finite, simple, and undirected. A vertex in a graph G is said to be isolated if it has no neighbors and universal if it is adjacent to all other vertices. A clique in a graph G is a set of pairwise adjacent vertices and an independent set is a set of pairwise nonadjacent vertices. A matching in G is a set of pairwise disjoint edges, and a matching M is perfect if every vertex of G is an endpoint of an edge of M. For a graph \(G = (V,E)\) and a set \(X\subseteq V\), we denote by G[X] the subgraph of G induced by X, that is, the graph with vertex set X in which two vertices are adjacent if and only if they are adjacent in G. Given two graphs G and H, we say that G is H-free if no induced subgraph of G is isomorphic to H.

2 Hardness Results

Observation 2 shows that Fair k-Division Under Conflicts is strongly NP-hard even for \(k=1\) for general graphs, while Observation 1 shows the weak NP-hardness of the problem for constant \(k\ge 2\) in the absence of conflicts. In what follows, we show that Fair k-Division Under Conflicts is strongly NP-hard also for all \(k\ge 2\), for various well-known graph classes.

2.1 General Hardness Results

We start with the following general property of graph classes. Let us call a graph class \({{\mathcal {G}}}\) sustainable if every graph in the class can be enlarged in polynomial time to a graph in the class by adding to it one vertex. More formally, \({{\mathcal {G}}}\) is sustainable if there exists a polynomial-time algorithm that computes for every graph \(G\in {{\mathcal {G}}}\) a graph \(G'\in {{\mathcal {G}}}\) and a vertex \(v\in V(G')\) such that \(G'-v = G\). Clearly, any class of graphs closed under adding isolated vertices, or under adding universal vertices is sustainable. This property is shared by many well known graph classes, including planar graphs, bipartite graphs, chordal graphs, perfect graphs, etc. Furthermore, all graph classes defined by a single nontrivial forbidden induced subgraph are sustainable.

Lemma 3

For every graph H with at least two vertices, the class of H-free graphs is sustainable.

Proof

Let \({{\mathcal {G}}}\) be the class of H-free graphs and let \(G\in {{\mathcal {G}}}\). Since H has at least two vertices, it cannot have both a universal and an isolated vertex. If H has no universal vertex, then the graph obtained from G by adding to it a universal vertex results in a graph in \({{\mathcal {G}}}\) properly extending G. If H has no isolated vertex, then the disjoint union of G with the one-vertex graph results in a graph in \({{\mathcal {G}}}\) properly extending G. \(\square \)

For an example of a graph class \({{\mathcal {G}}}\) closed under vertex deletion that is not sustainable, consider the family of all cycles and their induced subgraphs. Then every cycle is in \({{\mathcal {G}}}\) but cannot be extended to a larger graph in \({{\mathcal {G}}}\). The importance of sustainable graph classes for Fair k-Division Under Conflicts is evident from the following theorem.

Theorem 4

Let \({{\mathcal {G}}}\) be a sustainable class of graphs and let k be a positive integer such that the decision version of Fair k-Division Under Conflicts is (strongly) NP-complete. Then, for every \(\ell \ge k\), the decision version of Fair \(\ell \)-Division Under Conflicts with conflict graphs from \({{\mathcal {G}}}\) is (strongly) NP-complete.

Proof

Let \({{\mathcal {G}}}\) be a sustainable class of graphs for which the decision version of Fair k-Division Under Conflicts is (strongly) NP-complete and let \(\ell > k\). Let \((G,p_1,\ldots , p_k,q)\) be an instance of Fair k-Division Under Conflicts (decision version) such that \(G\in {{\mathcal {G}}}\). Since \({{\mathcal {G}}}\) is sustainable, one can compute in polynomial time a graph \(G'\in {{\mathcal {G}}}\) such that \(G'-\{x_1,\ldots , x_{\ell -k}\} = G\) for some \(\ell -k\) additional vertices \(x_1,\ldots , x_{\ell -k}\). We now define the profit functions \(p_1',\ldots ,p_{\ell }': V(G') \rightarrow {\mathbb {Z}}_+\). For all \(j = 1,\ldots , k\), let

$$\begin{aligned} p'_{j}(v)={\left\{ \begin{array}{ll} p_{j}(v) &{} \text {if }v\in V(G), \\ 0 &{} \text {if }v\in \left\{ x_{j}\mid 1\le j\le \ell -k\right\} . \end{array}\right. } \end{aligned}$$

and in addition let, for all \(j = k+1,\ldots , \ell \), let

$$\begin{aligned} p_{j}(v)={\left\{ \begin{array}{ll} q &{} \text {if }v=x_{j-k}, \\ 0 &{} \text {if }v\in V\left( G'\right) \setminus \left\{ x_{j-k}\right\} . \end{array}\right. } \end{aligned}$$

Observe that \(G'\) has a partial k-coloring \((X_1',\ldots ,X_k')\) such that \(p_j'(X_j')\ge q\) for all \(j= 1,\ldots , \ell \) if and only if G has a partial k-coloring \((X_1,\ldots ,X_k)\) such that \(p_j(X_j)\ge q\) for all \(j= 1,\ldots , k\). Since all the numbers involved in the reduction are polynomially bounded, we conclude that Fair \(\ell \)-Division Under Conflicts with conflict graphs from \({{\mathcal {G}}}\) is also (strongly) NP-complete. \(\square \)

Since the Independent Set problem is a special case of Fair 1-Division Under Conflicts, Theorem 4 immediately implies the following.

Corollary 5

Let \({{\mathcal {G}}}\) be a sustainable class of graphs for which the decision version of Independent Set is NP-complete. Then, for every \(k\ge 1\), the decision version of Fair k-Division Under Conflicts with conflict graphs from \({\mathcal G}\) is strongly NP-complete.

It is known (see, e.g., [3]) that for every graph H that has a component that is not a path or a subdivision of the claw (the complete bipartite graph \(K_{1,3}\)), the decision version of Independent Set is NP-complete on H-free graphs. Thus, for every such graph H, Lemma 3 and Corollary 5 imply that for every \(k\ge 1\), Fair k-Division Under Conflicts (decision version) with H-free conflict graphs is strongly NP-complete. Further exploiting the relation to Independent Set, we also get the following strong inapproximability result for general graphs. Its proof is closely related to the inapproximability result for Independent Set, but to keep the paper self-contained, we include the detailed construction in Appendix A.

Theorem 6

For every \(k\ge 1\) and every \(\varepsilon >0\), it is \(\text {NP}\)-hard to approximate Fair k-Division Under Conflicts within a factor of \(|V(G)|^{1-\varepsilon }\), even for unit profit functions.

2.2 Bipartite Graphs and Their Line Graphs

In this section we show that for all \(k\ge 2\), Fair k-Division Under Conflicts is \(\text {NP}\)-hard in two classes of graphs where the Weighted Independent Set problem is solvable in polynomial time: the classes of bipartite graphs and their line graphs. Recall that for a graph H, its line graph has a vertex for each edge of H, with two distinct vertices adjacent in the line graph if and only if the corresponding edges share an endpoint in H. Polynomial-time solvability of the Weighted Independent Set problem in the class of bipartite graphs is well-known from a reduction to a network flow problem (see, e.g., [60, Corollary 21.25a]). For line graphs of bipartite graphs polynomial-time solvability follows from the facts that we can compute in linear time a bipartite graph H such that the input graph G is the line graph of H [45, 56] and that the Weighted Independent Set problem on G is equivalent to the weighted matching problem on H. Clearly, polynomial-time solvability for the two classes also follows from the fact that both classes are subclasses of the class of perfect graphs (cf. Fig. 1 and [60, Section 66.1]).

The proof for bipartite graphs shows strong NP-hardness even for the case when all the profit functions are equal.

Theorem 7

For each integer \(k\ge 2\), the decision version of Fair k-Division Under Conflicts is strongly \(\text {NP}\)-complete in the class of bipartite graphs.

Proof

We use a reduction from the decision version of the Clique problem: Given a graph G and an integer \(\ell \), does G contain a clique of size \(\ell \)? Consider an instance \((G,\ell )\) of Clique such that \(2\le \ell < n:= |V(G)|\). We define an instance of Fair k-Division Under Conflicts (decision version) consisting of a bipartite conflict graph \(G'\), profit functions \(p_1,\ldots , p_k\), and a lower bound q on the required satisfaction level. The graph \(G'=(A\cup B, E')\) has a vertex for each vertex of the graph G as well as for each edge of G and k new vertices \(x_1,\ldots , x_k\). It is defined as follows:

$$\begin{aligned} A&=V(G)\cup \left\{ x_1 \right\} ,\ B=E(G)\cup \left\{ x_i \mid 2\le i\le k \right\} ,\\ E'&=\left\{ ve\mid v\in V(G)\text { is an endpoint of }e\in E(G)\right\} \cup \left\{ vx_{i}\mid v\in V(G),2\le i\le k\right\} . \end{aligned}$$

The lower bound q on the satisfaction level is defined by setting \(q=n^4+\left( {\begin{array}{c}\ell \\ 2\end{array}}\right) n+(n-\ell )\). For ease of notation we set \(N_1 = n^4\) and we furthermore introduce a second integer \(N_2\) such that \(q = N_{2}+\left( m-\left( {\begin{array}{c}\ell \\ 2\end{array}}\right) \right) n\), where \(m = |E(G)|\). (Note that \(N_2\ge n^3\).) With this, the profit functions \(p_i:V(G')\rightarrow {\mathbb {Z}}_+\), for all \(i\in \{1,\ldots , k\}\), are defined as

$$\begin{aligned} p_i(v)=\left\{ \begin{array}{ll} 1; &{} \hbox {if } v\in V(G);\\ n; &{} \hbox {if } v\in E(G);\\ N_1; &{} \hbox {if } v = x_1;\\ N_2; &{} \hbox {if } v = x_2;\\ q; &{} \hbox {if } v = x_j \hbox {for some} j\in \{3,\ldots , k\}. \end{array} \right. \end{aligned}$$

Note that all the profits introduced as well as the number of vertices and edges of \(G'\) are polynomial in n. To complete the proof, we show that G has a clique of size \(\ell \) if and only if \(G'\) has a partial k-coloring with satisfaction level at least q. First assume that G has a clique C of size \(\ell \). We construct a partial k-coloring \(c = (X_1,\ldots , X_k)\) of \(G'\) by setting

$$\begin{aligned} X_{1}&=\left\{ x_{1}\right\} \cup \left\{ e\in E(G)\mid e\subseteq C\right\} \cup \left( V(G)\setminus C\right) , \\ X_{2}&=\left\{ x_{2}\right\} \cup \left( E(G)\setminus X_{1}\right) , \\ X_{j}&=\left\{ x_{j}\right\} \text { for }3\le j\le k. \end{aligned}$$

Observe that the partial k-coloring c gives rise to the corresponding profit profile with all entries equal to q, which establishes one of the two implications.

Suppose now that there exists a partial k-coloring \(c= (X_1,\ldots ,X_k)\) of \(G'\) for which the profit profile has all entries \(\ge q\). Since for each \(i\in \{1,\ldots , k\}\), the total profit of the set \(V(G)\cup E(G)\) is only \(mn+n<n^4\), the partial coloring c must use exactly one of the k vertices \(x_1,\ldots , x_k\) in each color class. We may assume without loss of generality that \(x_i\in X_i\) for all \(i\in \{1,\ldots , k\}\). Let U be the set of uncolored vertices in \(G'\) w.r.t. the partial coloring c. Since for each of the profit functions \(p_i\), the difference between the overall sum of the profits of vertices of \(G'\) and \(k\cdot q\) is equal to \(\ell \), we clearly have \(\sum _{v\in U}p_i(v)\le \ell <n\), which implies that \(U\subseteq V(G)\). Next, observe that every vertex of E(G) belongs to either \(X_1\) or to \(X_2\), since otherwise we would have \(p_1(X_1)+p_2(X_2)<2q\), contrary to the assumption that the satisfaction level of c is at least q.

Consider the sets \(W = X_1\cap V(G)\) and \(F = X_1\cap E(G)\). Then \(X_1 = \{x_1\}\cup W\cup F\) and, since \(\sum _{v\in X_{1}}p_1(v)\ge q = N_{1}+\left( {\begin{array}{c}\ell \\ 2\end{array}}\right) n+(n-\ell )\), it follows that \(X_1\) contains exactly \(\left( {\begin{array}{c}\ell \\ 2\end{array}}\right) \) vertices from E(G) (if \(|F|>{\ell \atopwithdelims ()2}\), then \(p_2(X_2)<q\)) and at least \(n-\ell \) vertices from V(G). Let C denote the set of all vertices of \(G'\) with a neighbor in F. By the construction of \(G'\) and since \(|F| = {\ell \atopwithdelims ()2}\), it follows that C is of cardinality at least \(\ell \). Furthermore, since \(X_1\) is independent, we have \(C\cap W=\emptyset \). Consequently, \(n = |V(G)|\ge |C|+|W|\ge \ell + (n-\ell ) = n\), hence equalities must hold throughout. In particular, C is a clique of size \(\ell \) in G. \(\square \)

Theorem 8

For each integer \(k\ge 2\), the decision version of Fair k-Division Under Conflicts is strongly \(\text {NP}\)-complete in the class of line graphs of bipartite graphs.

Proof

Note that it suffices to prove the statement for \(k = 2\). For \(k>2\), Theorem 4 applies, since the class of line graphs of bipartite graphs is sustainable. Indeed, if \(G'\) is the line graph of a bipartite graph G, then the graph obtained from \(G'\) by adding to it an isolated vertex is the line graph of the bipartite graph obtained from G by adding to it an isolated edge.

For \(k = 2\), we use a reduction from the following problem: Given a bipartite graph G and an integer Q, does G contain two disjoint matchings \(M_1\) and \(M_2\) such that \(M_1\) is a perfect matching and \(|M_2|\ge Q\)? This problem was shown to be NP-complete by Pálvölgi (see [51]). Consider an instance (GQ) of this problem such that \(1\le Q\le n/2\) and \(n = |V(G)|\) is even. Then we define the following instance of the decision version of Fair 2-Division Under Conflicts with a conflict graph \(G'\), where \(G'\) is the line graph of G. The lower bound q on the satisfaction level is defined by setting \(q = n\cdot Q/2\). The profit functions \(p_1, p_2: V(G')\rightarrow {\mathbb {Z}}_+\) are defined as \(p_1(v)=Q\) for all \(v\in V(G')\), and \(p_2(v)=n/2\) for all \(v\in V(G')\). Clearly, all the profits introduced as well as the number of vertices and edges of \(G'\) are polynomial in n. Recall that every matching in G corresponds to an independent set in \(G'\).

We now show that the instances of the two decision problems have the same answers. Suppose first that G has two disjoint matchings \(M_1\) and \(M_2\) such that \(M_1\) is a perfect matching and \(|M_2|\ge Q\). Then the sequence \((M_1,M_2)\) is a partial 2-coloring of \(G'\) such that

$$\begin{aligned} p_1(M_1) = Q|M_1| = Q\cdot n/2= q \text { and } p_2(M_2) = (n/2)\cdot |M_2| \ge (n/2) Q = q. \end{aligned}$$

Conversely, suppose that \(G'\) has a partial 2-coloring \((X_1,X_2)\) with satisfaction level at least q. Then the independent sets \(X_1\) and \(X_2\) in \(G'\) are disjoint matchings in G. Moreover, since

$$\begin{aligned} p_1(X_1) = Q|X_1| \ge q = Q\cdot n/2 \text { and } p_2(X_2) = (n/2)\cdot |X_2| \ge q = Q\cdot n/2, \end{aligned}$$

we obtain \(|X_1|\ge n/2\) and \(|X_2| \ge Q\). Thus, \(X_1\) is a perfect matching in G and any set of Q edges in \(X_2\) is a matching in G disjoint from \(X_1\). This proves that the decision version of Fair 2-Division Under Conflicts is strongly \(\text {NP}\)-complete in the class of line graphs of bipartite graphs. \(\square \)

3 Pseudo-Polynomial Algorithms for Special Graph Classes

In this section we turn our attention to classes of graphs for which the Fair k-Division Under Conflicts is solvable in pseudo-polynomial time. As shown in Theorem 7, for each \(k\ge 2\), Fair k-Division Under Conflicts is strongly \(\text {NP}\)-complete in the class of bipartite graphs, and this rules out the existence of a pseudo-polynomial time algorithm for the problem in the class of bipartite graphs, unless \(\text {P} = \text {NP}\). We show that for every k there is a pseudo-polynomial time algorithm for the Fair k-Division Under Conflicts in a subclass of bipartite graphs, the class of biconvex bipartite graphs (see the definition in Sect. 3.2). The algorithm reduces the problem to the class of bipartite permutation graphs. To solve the problem in the class of bipartite permutation graphs, we develop a solution in a more general class of graphs, the class of cocomparability graphs (containing permutation graphs). Further, using a dynamic programming approach, we show that for every k there is a pseudo-polynomial time algorithm for Fair k-Division Under Conflicts in the classes of chordal graphs and graphs of bounded treewidth. It will be shown in Sect. 4 that all these pseudo-polynomial dynamic programming algorithms allow the construction of a fully polynomial time approximation scheme (FPTAS).

Let us first fix some notation. Given a graph G and k profit functions \(p_1,\ldots , p_k:V\rightarrow {\mathbb {Z}}_+\), we denote by n the number of vertices in G, \(n=|V(G)|\). All pseudo-polynomial results in this section depend on an upper bound on the maximum reachable profit value \(Q=\max _{1\le j\le k}p_j(V)\). Given an integer \(k>0\), the addition and subtraction of k-tuples is defined component-wise, and for all \(\ell \in \{1,\ldots , k\}\), we denote by \({\textbf{e}}_\ell (x)\) the k-tuple with all coordinates equal to 0, except that the \(\ell \)-th coordinate is equal to x.

3.1 Cocomparability Graphs

A graph \(G = (V,E)\) is a comparability graph if it has a transitive orientation, that is, if each of the edges \(\{u,v\}\) of G can be replaced by exactly one of the ordered pairs (uv) and (vu) so that the resulting set A of directed edges is transitive (that is, for every three vertices \(x,y,z\in V\), if \((x,y)\in A\) and \((y,z)\in A\), then \((x,z)\in A\)). A graph G is a cocomparability graph if its complement is a comparability graph. Comparability graphs and cocomparability graphs are well-known subclasses of perfect graphs. The class of cocomparability graphs is a common generalization of the classes of interval graphs, permutation graphs, and trapezoid graphs (see, e.g., [19, 39]).

Since every bipartite graph is a comparability graph, Theorem 7 implies that for each \(k\ge 2\), Fair k-Division Under Conflicts is strongly \(\text {NP}\)-complete in the class of comparability graphs. For cocomparability graphs, we prove that the problem is solvable in pseudo-polynomial time. The key result in this direction is the following lemma.

Lemma 9

For every \(k\ge 1\), given a cocomparability graph \(G=(V,E)\) and k profit functions \(p_1,\ldots , p_k:V\rightarrow {\mathbb {Z}}_+\), the set of all profit profiles of partial k-colorings of G can be computed in time \({\mathcal {O}}(n^{k+2}(Q+1)^k)\), where \(Q = \max _{1\le j\le k}p_j(V)\).

Proof

Let G be a cocomparability graph. In time \({\mathcal {O}}(n^2)\), we compute the complement of G and a transitive orientation D of it [61]. Since D is a directed acyclic graph, one can compute in linear time a topological sort of D, that is, an ordering \(v_1,\ldots , v_n\) of the vertices such that if \((v_i,v_j)\) is an arc of D, then \(i<j\) (see, e.g., [24]). Note that

(\(*\)):

a set \(X = \{v_{i_1},\ldots , v_{i_p}\}\subseteq V\) with \(i_1<\ldots <i_p\) is independent in G if and only if \((v_{i_1},\ldots , v_{i_p})\) is a directed path in D.

Thus, a partial k-coloring in G corresponds to a collection of k vertex-disjoint directed paths in D, and vice versa. We process the vertices of G in the ordering given by the topological sort of D and try all possibilities for the color (if any) of the current vertex \(v_j\) in order to extend a partial k-coloring of the already processed subgraph of G with \(v_j\). (In terms of D, we choose which of the k directed paths will be extended into \(v_j\).) To avoid introducing additional terminology and notation, we present the details of the algorithm in terms of partial k-colorings of G instead of systems of disjoint paths in D.

For each \(j\in \{0,1,\ldots , n\}\) and each k-tuple \((i_1,\ldots , i_k)\in \{0,1,\ldots , j\}^k\), we compute the set \(P_j(i_1,\ldots , i_k)\) of all k-tuples \((q_1,\ldots , q_k)\in {\mathbb {Z}}_+^k\) such that there exists a partial k-coloring \((X_1,\ldots , X_k)\) of the subgraph of G induced by \(\{v_1,\ldots , v_j\}\) (which is empty if \(j =0\)) such that \(q_\ell = p_\ell (X_\ell )\) and

$$\begin{aligned} i_\ell = \left\{ \begin{array}{ll} \max \{r: v_r\in X_\ell \}, &{} \hbox {if } X_\ell \ne \emptyset ; \\ 0, &{} \hbox {if } X_\ell = \emptyset \end{array} \right. \end{aligned}$$
(1)

for all \(\ell \in \{1,\ldots , k\}\). Note that for each \(\ell \in \{1,\ldots , k\}\), the possible values of the \(\ell \)-th coordinate of any member of \(P_j(i_1,\ldots , i_k)\) belong to the set \(\{0,1,\ldots , Q\}\) where \(Q = \max _{1\le j\le k}p_j(V)\). Thus, each set \(P_j(i_1,\ldots , i_k)\) has at most \((Q+1)^k\) elements. Note also that the total number of sets \(P_j(i_1,\ldots , i_k)\) is of the order \({\mathcal {O}}(n^{k+1})\).

In what follows we explain how to compute the sets \(P_j(i_1,\ldots , i_k)\). For \(j = 0\), the only feasible choice for the k-tuple \((i_1,\ldots , i_k)\) is \((0,\ldots , 0)\) and we set \(P_{0}(0,\ldots , 0) = \{0\}^k = \{(0,\ldots , 0)\}\). This is correct since the only partial k-coloring of the graph with no vertices is the k-tuple \((\emptyset , \ldots , \emptyset )\). Suppose that \(j>1\) and that the sets \(P_{j-1}(i_1,\ldots , i_k)\) are already computed for all \((i_1,\ldots , i_k)\in \{0,1,\ldots , j-1\}^k\). Fix a k-tuple \((i_1,\ldots , i_k)\in \{0,1,\ldots , j\}^k\). To describe how to compute the set \(P_{j}(i_1,\ldots , i_k)\), we will use the following notation. We consider three cases. For each of them, we first give a formula for computing the set \(P_{j}(i_1,\ldots , i_k)\) and then we argue why the formula is correct.

  1. 1.

    If j appears at least twice as a coordinate of \((i_1,\ldots , i_k)\), then we set

    $$\begin{aligned} P_{j}(i_1,\ldots , i_k) = \emptyset . \end{aligned}$$
    (2)

    Note that since j appears at least twice as a coordinate of \((i_1,\ldots , i_k)\), there is no partial k-coloring \((X_1,\ldots , X_k)\) of the subgraph of G induced by \(\{v_1,\ldots , v_j\}\) such that equality (1) holds for all \(\ell \in \{1,\ldots , k\}\). Thus, Eq. (2) is correct.

  2. 2.

    If j does not appear as any coordinate of \((i_1,\ldots , i_k)\), then we set

    $$\begin{aligned} P_{j}(i_1,\ldots , i_k) = P_{j-1}(i_1,\ldots , i_k). \end{aligned}$$
    (3)

    Since j does not appear as any coordinate of \((i_1,\ldots , i_k)\), every partial k-coloring of the subgraph of G induced by \(\{v_1,\ldots , v_{j-1}\}\) such that equality (1) holds for all \(\ell \in \{1,\ldots , k\}\) is a partial k-coloring of the subgraph of G induced by \(\{v_1,\ldots , v_{j}\}\) and vice versa. This implies relation (3).

  3. 3.

    If j appears exactly once as a coordinate of \((i_1,\ldots , i_k)\), say \(i_{s} = j\), then we set

    $$\begin{aligned} P_{j}(i_1,\ldots , i_k) =\!\!\!\! \bigcup _{ \left\{ {\begin{array}{c} {j': j' = 0 \text{ or } }\\ {v_{j'}\in N_D^-(v_j)} \end{array}}\right\} }\!\!\!\! \{{{\textbf {q}}}+ {{\textbf {e}}}_{s}(p_{s}(v_j)) \mid {{\textbf {q}}} \in P_{j-1}(i_1,\dots ,i_{{s}-1}, j', i_{{s}+1}, \dots , i_k)\},\nonumber \\ \end{aligned}$$
    (4)

    where \(N_D^-(v_j)\) denotes the set of all vertices \(v_{j'}\) such that \((v_{j'},v_j)\) is an arc of D. (Note that \(j'<j\) for all \(v_{j'}\in N_D^-(v_j)\), since \(v_1,\dots , v_n\) is a topological sort of D.) Let \({\textbf{q}}=(q_1,\ldots , q_k)\in P_{j}(i_1, \dots , i_k)\) and consider a partial k-coloring \((X_1,\ldots , X_k)\) of the subgraph of G induced by \(\{v_1,\ldots , v_j\}\) such that \(p_\ell (X_\ell ) = q_\ell \) and equality (1) holds for all \(\ell \in \{1,\ldots , k\}\). Then \(\max \{q: v_q\in X_{s}\} = i_{s} = j\). In particular, \(v_j\in X_{s}\). Let \(X_{s}'= X_{s}\setminus \{v_j\}\) and let

    $$\begin{aligned} j'= \left\{ \begin{array}{ll} \max \{r: v_r\in X_{s}'\}, &{} \hbox {if } X_{s}' \ne \emptyset ; \\ 0, &{} \hbox {if } X_{s}' = \emptyset . \end{array} \right. \end{aligned}$$

    Note that if \(X_{s}'\ne \emptyset \) then \(v_{j'}\in N_D^-(v_j)\). Indeed, digraph D is an orientation of the complement of G, in which vertices \(v_{j'}\) and \(v_j\) are adjacent (recall that they belong to the independent set \(X_{s}\) in G). This implies that either \((v_j,v_{j'})\) or \((v_{j'},v_{j})\) is an arc of D, but since \(j'<j\) and \(v_1,\ldots , v_n\) is a topological sort of D, the pair \((v_{j'},v_{j})\) must be an arc of D. Let \((i_1',\ldots , i_k')\) be the k-tuple obtained from \((i_1,\ldots , i_k)\) by replacing \(i_{s}\) with \(j'\), and let \((X_1',\ldots , X_k')\) be the k-tuple obtained from \((X_1,\ldots , X_k)\) by replacing \(X_{s}\) with \(X_{s}'\). Then \((X_1',\ldots , X_k')\) is a partial k-coloring of the subgraph of G induced by \(\{v_1,\ldots , v_{j-1}\}\) such that equality obtained from (1) by replacing \(X_\ell \) with \(X_\ell '\) and \(i_{\ell }\) with \(i_{\ell }'\) holds for each \(\ell \in \{1,\ldots , k\}\). Furthermore, \((p_1(X_1),\ldots , p_k(X_k)) = (p_1(X_1'),\ldots , p_k(X_k'))+{\textbf{e}}_{s}(p_{s}(v_j))\). This shows that if \({\textbf{q}}=(q_1,\ldots , q_k)\in P_{j}(i_1,\ldots , i_k)\), then the k-tuple \({\textbf{q}}\) belongs to the union

    $$\begin{aligned} \bigcup _{\left\{ j': j' = 0 \text{ or } v_{j'}\in N_D^-(v_j)\right\} }\{{{\textbf {q}}}+ {{\textbf {e}}}_{s}(p_{s}(v_j)) \mid {{\textbf {q}}} \in P_{j-1}(i_1,\dots ,i_{{s}-1}, j', i_{{s}+1}, \dots , i_k)\}. \end{aligned}$$

    For the converse direction, let \(j' \in \{0\}\cup \{1\le j'\le j-1\mid v_{j'}\in N_D^-(v_j)\}\), let \((i_1',\ldots , i_k')\) be the k-tuple obtained from \((i_1,\ldots , i_k)\) by replacing \(i_{s}\) with \(j'\), and let \({\textbf{q}}=(q_1,\ldots , q_k)\in P_{j-1}(i_1', \dots , i_k')\). Then, there exists a partial k-coloring \((X_1',\ldots , X_k')\) of the subgraph of G induced by \(\{v_1,\ldots , v_{j-1}\}\) such that for each \(\ell \in \{1,\ldots , k\}\), we have \(p_\ell (X_\ell ') = q_\ell \) and equality obtained from (1) by replacing \(X_\ell \) with \(X_\ell '\) and \(i_{\ell }\) with \(i_{\ell }'\) holds. Let \((X_1,\ldots , X_k)\) be the k-tuple obtained from \((X_1',\ldots , X_k')\) by replacing \(X_{s}'\) with \(X_{s}'\cup \{v_j\}\). To show that \((X_1,\ldots , X_k)\) is a partial k-coloring of the subgraph of G induced by \(\{v_1,\ldots , v_{j}\}\), it suffices to verify that \(X_{s} = X_{s}'\cup \{v_j\}\) is an independent set in G. If \(X_{s}' = \emptyset \), then \(X_{s} = \{v_j\}\) is independent. Suppose that \(X_{s}' \ne \emptyset \). Then, by (\(*\)), \(X_{s}'\) corresponds to a directed path in D ending in \(v_{j'}\). Extending this path with vertex \(v_j\in N_D^+(v_{j'})\) results in a directed path in D with vertex set \(X_s\), which shows, again by (\(*\)), that \(X_s\) is independent in G. Clearly, we have that \(\max \{r: v_r\in X_{s}\} = j\), and hence \((X_1,\ldots , X_k)\) is a partial k-coloring of the subgraph of G induced by \(\{v_1,\ldots , v_{j}\}\) equality (1) holds for each \(\ell \in \{1,\ldots , k\}\). Furthermore, \((p_1(X_1),\ldots , p_k(X_k)) = {\textbf{q}} + {\textbf{e}}_{s}(p_{s}(v_j))\). This shows that if \({\textbf{q}}\in P_{j-1}(i_1', \dots , i_k')\), then the k-tuple \({\textbf{q}}+{\textbf{e}}_{s}(p_{s}(v_j))\) belongs to \(P_{j}(i_1,\ldots , i_k)\). Therefore, Eq. (4) is correct.

Finally, the set of all profit profiles of partial k-colorings of G equals to the union, over all \((i_1,\ldots , i_k)\in \{0,1,\ldots , n\}^k\), of the sets \(P_n(i_1,\ldots , i_k)\).

The algorithm can be easily modified so that for each profit profile also a corresponding partial k-coloring is computed. We would just need to store, for each \(j\in \{0,1,\ldots , n\}\), each \((i_1,\ldots , i_k)\in \{0,1,\ldots , j\}^k\), and each k-tuple \((q_1,\ldots , q_k)\in P_j(i_1,\ldots , i_k)\), one partial k-coloring \((X_1,\ldots , X_k)\) of the subgraph of G induced by \(\{v_1,\ldots , v_i\}\) such that \(p_\ell (X_\ell ) = q_\ell \) and equality (1) holds for all \(\ell \in \{1,\ldots , k\}\).

It remains to estimate the time complexity of the algorithm. For each \(j\in \{1,\ldots , n\}\) and each of the \({\mathcal {O}}(n^k)\) k-tuples \((i_1,\ldots , i_k)\in \{0,1,\ldots , j\}^k\), we can decide which of the three cases (i)–(iii) occurs in time \({\mathcal {O}}(k)\). Step (2) takes constant time, step (3) takes time \({\mathcal {O}}((Q+1)^k)\), and step (4) can be implemented in time \({\mathcal {O}}(n(Q+1)^k)\). Altogether, this results in running time \({\mathcal {O}}(n(Q+1)^k)\) for each fixed \(j\in \{1,\ldots , n\}\) and each k-tuple \((i_1,\ldots , i_k)\in \{0,1,\ldots , j\}^k\). Consequently, the total running time of the algorithm is \({\mathcal {O}}(n^{k+2}(Q+1)^k)\).\(\square \)

Lemma 9 implies the following.

Theorem 10

For every \(k\ge 1\), Fair k-Division Under Conflicts is solvable in time \({\mathcal {O}}(n^{k+2}(Q+1)^k)\) for cocomparability conflict graphs G, where \(Q = \max _{1\le j\le k}p_j(V(G))\).

Proof

By Lemma 9, we can compute the set \(\Pi \) of all profit profiles of partial k-colorings of G in the stated running time. For each profit profile in \(\Pi \), we can determine the satisfaction level of the corresponding partial k-coloring of G. Taking the maximum satisfaction level over all profiles gives the optimal value of Fair k-Division Under Conflicts for (\(G,p_1,\ldots , p_k)\). \(\square \)

3.2 Biconvex Bipartite Graphs

Recall from Theorem 7 that Fair k-Division Under Conflicts is strongly \(\text {NP}\)-hard for bipartite conflict graphs. Thus, we consider in the following the more restricted case of biconvex bipartite conflict graphs. Recall that a bipartite graph \(G=(A\cup B, E)\) is biconvex if it has a biconvex ordering, that is, an ordering of A and B such that for every vertex \(a \in A\) (resp. \(b \in B\)) the neighborhood N(a) (resp. N(b)) is an interval of consecutive vertices in the ordering of B (resp. ordering of A).

It is known that a connected biconvex bipartite graph G can always be ordered in such a way that the first and last vertices on one side have a special structure. Fix a biconvex ordering of G, say \(A=(a_1, \ldots , a_s)\) and \(B=(b_1,\ldots , b_t)\). Define \(a_L\) (resp. \(a_R\)) as the vertex in \(N(b_1)\) (resp. \(N(b_t)\)) whose neighborhood is not properly contained in any other neighborhood set (see [1, Def. 8]). In case of ties, \(a_L\) is the smallest such index (and \(a_R\) the largest). We always assume that \(a_L \le a_R\), otherwise the ordering in A could be mirrored. Under these assumptions, the neighborhoods of vertices appearing in the ordering before \(a_L\) and after \(a_R\) are nested.

Lemma 11

[Abbas and Stewart [1]] Let \(G=(A\cup B, E)\) be a connected biconvex graph. Then there exists a biconvex ordering of the vertices of G such that:

  1. 1.

    For all \(a_i\), \(a_j\) with \(a_1 \le a_i< a_j \le a_L\) we have \(N(a_i) \subseteq N(a_j)\).

  2. 2.

    For all \(a_i\), \(a_j\) with \(a_R \le a_i < a_j \le a_s\) we have \(N(a_j) \subseteq N(a_i)\).

  3. 3.

    The subgraph \(G'\) of G induced by vertex set \(\{a_L, \ldots , a_R\} \cup B\) is a bipartite permutation graph.

Property (iii) can be put in context with Theorem 10. Indeed, it is known that every permutation graph is a cocomparability graph (see, e.g., [19]). This gives rise to the following result that Fair k-Division Under Conflicts on biconvex bipartite graphs is indeed easier (from the complexity point of view) than on general bipartite graphs. The high-level idea of the algorithm is illustrated in Algorithm 3.2.

figure a

Theorem 12

For every \(k\ge 1\), Fair k-Division Under Conflicts is solvable in time \({\mathcal {O}}(n^{3k+2}(Q+1)^k)\) for connected biconvex bipartite conflict graphs G, where \(Q = \max _{1\le j\le k}p_j(V(G))\).

Proof

At first Lemma 11 is applied for obtaining from G the cocomparability graph \(G'\). However, we have to consider also the vertex sets \(A_L:=\{a_1,\ldots , a_{L-1}\}\) and \(A_R:=\{a_{R+1}, \ldots , a_s\}\). This is done by considering assignments of vertices in \(A_L\cup A_R\) to the k subsets of a partial k-coloring of G in an efficient way as follows.

For every \(j\in \{1, \ldots , k\}\), we guess, by going through all possibilities, the largest index vertex \({\overline{a}}_j \in A_L\) (resp. smallest index \({\underline{a}}_j \in A_R\)) inserted in \(X_j\). One can add an artificial vertex \(a_0\) (resp. \(a_{s+1}\)) to represent the case that no vertex from \(A_L\) (resp. \(A_R\)) is inserted in \(X_j\). Thus, every guess is represented by a 2k-tuple \(\sigma = ({\overline{a}}_1, \ldots , {\overline{a}}_k, {\underline{a}}_1, \ldots , {\underline{a}}_k)\). The total number of such guesses (i.e., iterations) is bounded by \((n+1)^k\) for each of \(A_L\) and \(A_R\), i.e., \({\mathcal {O}}(n^{2k})\) selections to be considered in total.

For each such guess \(\sigma \) we perform the following computations. For every \(j\in \{1, \ldots , k\}\) the vertices in the neighborhood \(N({\overline{a}}_j) \subseteq B\) (and \(N({\underline{a}}_j) \subseteq B\)) of the chosen index must be excluded from insertion into the corresponding set \(X_j\). This can be easily realized by setting to 0 the profits \(p_j\) of all vertices in \(N({\overline{a}}_j)\) (resp. \(N({\underline{a}}_j)\)). With these slight modifications of the profits we can apply Lemma 9 for the cocomparability graph \(G'\) and the modified profit functions \(p_j^\sigma \) to obtain the set \(\Pi _\sigma \) of all (pseudo-polynomially many) profit profiles \((q_1,\ldots , q_k)\) of partial k-colorings of \(G'\) with respect to \(p^\sigma \). Every entry \(q_j\) of a profit profile in \(\Pi _\sigma \) is increased by \(p_j({\overline{a}}_j)+p_j({\underline{a}}_j)\), to account for inclusion of the vertices selected by the guess \(\sigma \).

In every guess there are the two vertices \({\overline{a}}_j\) and \({\underline{a}}_j\) permanently assigned to \(X_j\) for every j and their neighborhoods \(N({\overline{a}}_j)\) and \(N({\underline{a}}_j)\) are excluded from \(X_j\). Now it follows from properties (i) and (ii) of Lemma 11 that for each vertex \(a' \in A_L\) with \(a' < {\overline{a}}_j\) (resp. \(a' \in A_R\) with \(a'>{\underline{a}}_j\)) the neighborhood \(N(a')\) is a subset of \(N({\overline{a}}_j)\) (resp. \(N({\underline{a}}_j)\)). Thus, these vertices \(a'\) could also be inserted in \(X_j\) without any violation of the conflict structure. Therefore, we can start from the set \(\Pi _\sigma \) of profit profiles computed for \((G',p^\sigma )\) and consider iteratively (in arbitrary order) the addition of a vertex \(a' \in A_L\) to one of the color classes \(X_j\), as it is usually done in dynamic programming. Each \(a'\) is considered as an addition to every profit profile \((q_1,\ldots , q_{k}) \in \Pi _\sigma \) and for every index j with \(a' < {\overline{a}}_j\) yielding new profit profiles \((q_1,\ldots , q_{j-1}, q_j+p_j(a'), q_{j+1}, \ldots , q_k)\) to be added to \(\Pi _\sigma \). An analogous procedure is performed for all vertices \(a'\in A_R\) where the addition is restricted to indices j with \(a' > {\underline{a}}_j\).

For every guess \(\sigma \), the running time is dominated by the effort of computing the \({\mathcal {O}}((Q+1)^k)\) profit profiles of \((G',p^\sigma )\) according to Lemma 9, since adding any of the \({\mathcal {O}}(n)\) vertices \(a'\) requires only k operations for each profit profile.

In this way, we construct the set \(\Pi _\sigma \) of all profit profiles of partial k-colorings of G for each guess \(\sigma \). It remains to identify the optimal solution in the set \(\Pi := \bigcup _\sigma \Pi _\sigma \) similarly as in the proof of Theorem 10. Going over all \({\mathcal {O}}(n^{2k})\) guesses \(\sigma \), the total running time can be given from Lemma 9 as \({\mathcal {O}}(n^{3k+2}(Q+1)^k)\). \(\square \)

For disconnected conflict graphs, we can easily paste together the profit profiles of all connected components. Note that this construction applies for general graphs.

Lemma 13

Given a conflict graph G consisting of \(c>1\) connected components \(G_\ell \), \(\ell =1, \ldots , c\), each of them with a set of profit profiles \(\Pi _\ell \), where the size of each \(\Pi _\ell \) is of order \({\mathcal {O}}((Q+1)^k)\) with \(Q = \max _{1\le j\le k}p_j(V(G))\), Fair k-Division Under Conflicts can be solved for G in time \({\mathcal {O}}((c-1)(Q+1)^{2k})\).

Proof

We maintain a set of profit profiles \(\Pi \), initialized by \(\Pi :=\Pi _1\), and iteratively merge each of the profit profiles \(\Pi _2, \ldots , \Pi _m\) with \(\Pi \). To merge a set of profit profiles \(\Pi _\ell \), we consider every pair of profiles from \(\Pi \) and \(\Pi _\ell \) and perform a vector addition to obtain a (possibly) new profit profile which is added to \(\Pi \). At most \((Q+1)^{2k}\) such pairs may exist. In each of the \(c-1\) iterations the number of different profit profiles in \(\Pi \) remains bounded by the trivial upper bound \((Q+1)^k\). Finally, the best objective function value is determined by evaluating all profit profiles. The total running time of this procedure is of order \({\mathcal {O}}((c-1)(Q+1)^{2k})\). \(\square \)

Running Algorithm 3.2 for all c components of a graph with n vertices can be done in time \({\mathcal {O}}(n^{3k+2}(Q+1)^k)\). Applying Lemma 13 on the resulting profit profiles, we obtain the following corollary. Note that the computational complexity does not depend on the size of the components.

Corollary 14

For every \(k\ge 1\), Fair k-Division Under Conflicts is solvable in time \({\mathcal {O}}(n^{3k+2}(Q+1)^k+(c-1)(Q+1)^{2k})\) for biconvex bipartite conflict graphs G consisting of c connected components, where \(Q = \max _{1\le j\le k}p_j(V(G))\).

Note that the increased running time factor of \((Q+1)^{2k}\) cannot be easily avoided. In particular, the natural idea of connecting the biconvex components by inserting dummy vertices to obtain a single connected biconvex graph does not work. This is shown in Appendix B.

3.3 Chordal Graphs

In this section we present a pseudo-polynomial time algorithm that solves the Fair k-Division Under Conflicts on chordal graphs. Recall that a graph is chordal if all its induced cycles are of length three. First we state some known results on chordal graphs and their tree decompositions.

A tree decomposition of a graph G is a pair \({{{\mathcal {T}}}} = (T, \{B_t\}_{t\in V(T)})\) where T is a tree whose every node t is assigned a vertex subset \(B_t\subseteq V(G)\) called a bag such that the following conditions are satisfied:

  • Every vertex of G is in at least one bag.

  • For every edge \(\{u,v\}\in E(G)\) there exists a node \(t\in V(T)\) such that \(B_t\) contains both u and v.

  • For every vertex \(u\in V(G)\) the subgraph of T induced by the set \(\{t\in V(T):\,u\in B_t\}\) is connected (that is, a tree).

A tree decomposition \((T, \{B_t\}_{t\in V(T)})\) is rooted if we distinguish one vertex r of T which will be the root of T. This introduces natural parent–child and ancestor–descendant relations in the tree T. Following [26], we will say that a tree decomposition \((T, \{B_t\}_{t\in V(T)})\) is nice if it is rooted and the following conditions are satisfied:

  • If \(t\in V(T)\) is the root or a leaf of T, then \(B_t = \emptyset \);

  • Every non-leaf node t of T is one of the following three types:

    • Introduce node a node t with exactly one child \(t'\) such that \(B_t = B_{t'}\cup \{v\}\) for some vertex \(v\in V(G)\setminus B_{t'}\);

    • Forget node a node t with exactly one child \(t'\) such that \(B_t = B_{t'}{\setminus }\{v\}\) for some vertex \(v\in B_{t'}\);

    • Join node a node t with exactly two children \(t_1\) and \(t_2\) such that \(B_t = B_{t_1} = B_{t_2}\).

The width of a tree decomposition \((T, \{B_t\}_{t\in V(T)})\) of a graph G is defined as \(\max _{t\in V(T)}|B_t|-1\). Lemma 7.4 from [26] shows that every tree decomposition of width at most \(\ell \) can be transformed in polynomial time into a nice tree decomposition of width at most \(\ell \). The proof actually shows the following statement, which will be useful for our purpose.

Lemma 15

Given a tree decomposition \({\mathcal {T}} = (T, \{B_t\}_{t\in V(T)})\) of an n-vertex graph G, one can in time \({\mathcal {O}}(n^2\cdot \max \{n,|V(T)|\})\) compute a nice tree decomposition \({\mathcal {T}}'\) of G that has at most \({\mathcal {O}}(n^2)\) nodes and such that every bag of \({\mathcal {T}}'\) is a subset of a bag of \({\mathcal {T}}\).

Let us now apply these concepts to chordal graphs. A clique tree of a graph G is a tree decomposition \((T,\{B_t\}_{t\in V(T)})\) such that the bags are exactly the maximal cliques of G. It is well known (see, e.g., [14]) that a graph is chordal if and only if it has a clique tree, and in such a case a clique tree can be constructed in linear time (see, e.g., [62]). Furthermore, every chordal graph G has at most |V(G)| maximal cliques (see, e.g., [14]).

Lemma 16

Given an n-vertex chordal graph G, we can compute in linear time a tree decomposition \((T,\{B_t\}_{t\in V(T)})\) of G with \({\mathcal {O}}(n)\) bags, all of which are cliques.

Combining Lemmas 15 and 16 yields the following.

Lemma 17

Given an n-vertex chordal graph G, we can compute in time \({\mathcal {O}}(n^3)\) a nice tree decomposition \((T, \{B_t\}_{t\in V(T)})\) of G with \({\mathcal {O}}(n^2)\) bags, all of which are cliques.

We will also need the following technical lemma about tree decompositions (see, e.g., [26]).

Lemma 18

Let \((T,\{B_t\}_{t\in V(T)})\) be a tree decomposition of a graph G and let \(\{a,b\}\) be an edge of T. The forest \(T -\{a,b\}\) obtained from T by deleting edge \(\{a,b\}\) consists of two connected components \(T_{a}\) (containing a) and \(T_b\) (containing b). Let \(A =\left( \bigcup _{t\in V(T_a)} B_t\right) {\setminus } (B_a\cap B_b)\) and \(B=\left( \bigcup _{t\in V(T_b)} X_t\right) {\setminus } (B_a\cap B_b)\). Then no vertex in A is adjacent to a vertex in B.

Before we proceed to the main result for chordal graphs, we need to introduce an auxiliary definition. Let \(G = (V,E)\) be a graph, let \(U\subseteq V\), let \(c = (X_1,\ldots , X_k)\) be a partial k-coloring of G[X], and let \(c' = (Y_1,\ldots , Y_k)\) be a partial k-coloring of G. We say that \(c'\) agrees with c on U if \(X_j\cap U=Y_j\) for all \(j\in \{1,\dots , k\}\).

Theorem 19

For every \(k\ge 1\), Fair k-Division Under Conflicts is solvable in time \({\mathcal {O}}(n^{k+2}(Q+1)^{2k})\) for a chordal conflict graph G, where \(Q = \max _{1\le j\le k}p_j(V(G))\).

Proof

Fix \(k\ge 1\) and let G be a chordal graph equipped with profit functions \(p_1,\ldots , p_k:V(G)\rightarrow {\mathbb {Z}}_+\). We will show that we can compute the set \(\Pi \) of all profit profiles of partial k-colorings of G in the stated running time. The maximum satisfaction level over all profit profiles will then give the optimal value of Fair k-Division Under Conflicts for (\(G,p_1,\ldots , p_k)\).

We first apply Lemma 17 and compute in time \({\mathcal {O}}(n^3)\) a nice tree decomposition \((T, \{B_t\}_{t\in V(T)})\) of G with \({\mathcal {O}}(n^2)\) bags, all of which are cliques. Recall that by definition T is a rooted tree decomposition of G. Let r be the root of T. For every node \(t\in V(T)\), we denote by \(V_t\) the union of all bags \(B_{t'}\) such that \(t'\in V(T)\) is a (not necessarily proper) descendant of t in T.

We traverse tree T bottom-up and use a dynamic programming approach to compute, for every node \(t\in V(T)\) and every partial k-coloring c of \(G[B_t]\), the family P(tc) of all profit profiles of partial k-colorings of \(G[V_t]\) that agree with c on \(B_t\).

Since \((T, \{B_t\}_{t\in V(T)})\) is a nice tree decomposition, we have \(B_r = \emptyset \); in particular, the trivial partial k-coloring \(\emptyset ^k\) consisting of k empty sets is the only partial k-coloring of \(G[B_r]\). Thus, since \(V_r = V(G)\) and every partial k-coloring of G agrees with the trivial partial k-coloring of \(G[B_r]\) on \(B_r\), the set \(P(r,\emptyset ^k)\) is the set of all profit profiles of partial k-colorings of G, which is what we want to compute.

We consider various cases depending on the type of a node \(t\in V(T)\) in the nice tree decomposition. For each of them we give a formula for computing the set P(tc) from the already computed sets of the form \(P(t',c')\) where \(t'\) is a child of t in T, and argue why the formula is correct.

  1. 1.

    t is a leaf node. By the definition of a nice tree decomposition it follows that \(B_t=\emptyset \). Thus, the only partial k-coloring of \(G[B_t]\) is the trivial one, \(\emptyset ^k\). Clearly, \(P(t,\emptyset ^k)= \{(0,\ldots , 0)\}\).

  2. 2.

    t is an introduce node. By definition, t has exactly one child \(t'\) and \(B_t = B_{t'}\cup \{v\}\) holds for some vertex \(v\in V{\setminus } X_{t'}\). Clearly, \(V_{t} = V_{t'} \cup \{v\}\), and this is a disjoint union. (If \(v\in V_{t'}\), then the subtree of T consisting of all bags \(B_\tau \) such that \(v\in B_\tau \) is not connected; a contradiction.) Consider an arbitrary partial k-coloring \(c=(X_1,\ldots , X_k)\) of \(G[B_t]\). We want to compute P(tc) using the set \(P(t',c')\), where \(c' = (X_1{\setminus }\{v\},\ldots , X_k{\setminus }\{v\})\). (Note that \(c'\) is a partial k-coloring of \(G[B_{t'}]\).) We claim that the following equality holds:

    $$\begin{aligned} P(t,c)=\left\{ \begin{array}{ll} \{{\textbf{q}} + {\textbf{e}}_j(p_j(v))\mid {\textbf{q}}\in P(t',c')\}, &{} \hbox {if } v\in X_j \hbox {for some } j\in \{1,\ldots , k\};\\ P(t',c'), &{} \hbox {otherwise}. \end{array} \right. \end{aligned}$$

    To show the recurrence, note first that if for all \(j\in \{1,\dots , k\}\) we have \(v\notin X_j\), then \(c' = c\) and thus \(P(t,c)=P(t',c')\) in this case. If, however, \(v\in X_j\) for some \(j\in \{1,\ldots , k\}\), then there can only be one such j, and thus \(c'=(X_1,\dots , X_{j-1},X_j{\setminus } \{v\}, X_{j+1},\dots , X_k)\). In this case, we will need the fact that v is not adjacent to any vertex of \(V_{t'}\setminus B_{t'}\). Indeed, applying Lemma 18 to \(a = t\) and \(b = t'\) shows that no vertex of \(V(G)\setminus V_{t'}\) is adjacent to any vertex of \(V_{t'}\setminus B_{t'}\), hence the statement follows since \(v\in V(G){\setminus } V_{t'}\). The fact that all neighbors of v in the set \(V_{t'}\) are contained in \(B_{t'}\) implies that for every partial k-coloring of \(G[V_{t'}]\) that agrees with \(c'\) on \(B_{t'}\), adding v to the j-th color class will result in a partial k-coloring of \(G[V_{t}]\) that agrees with c on \(B_t\). Thus, there is a bijective correspondence between the set of partial k-colorings of \(G[V_{t}]\) that agree with c on \(B_t\) and those of \(G[V_{t'}]\) that agree with \(c'\) on \(B_{t'}\), given by removing v from the j-th color class. This implies the claimed equality \(P(t,c)=\{{\textbf{q}}+{\textbf{e}}_j(p_j(v))\mid {\textbf{q}}\in P(t',c')\}\).

  3. 3.

    t is a forget node. By definition, t has exactly one child \(t'\) in T and \(B_{t}=B_{t'}{\setminus } \{v\}\) holds for some vertex \(v\in V {\setminus } B_t\). Thus, \(V_t=V_{t'}\). Consider an arbitrary partial k-coloring \(c=(X_1,\dots , X_k)\) of \(G[B_t]\). We claim that the following equality holds:

    $$\begin{aligned} P(t,c)=P(t',c)\cup \bigcup _{j: X_j = \emptyset } P(t',(X_1,\dots , X_{j-1},\{v\},X_{j+1}\dots , X_k)). \end{aligned}$$

    Consider an arbitrary partial k-coloring \((Y_1,\ldots , Y_k)\) of \(G[V_t]\) that agrees with c on \(B_t\). If \(v\not \in Y_j\) for all \(j\in \{1,\ldots , k\}\), then \((Y_1,\ldots , Y_k)\) agrees with c on \(B_{t'}\). Suppose now that \(v\in Y_j\) for some \(j\in \{1,\ldots , k\}\). Then, j is unique. Furthermore, since \(B_{t'}\) is a clique in G and hence in \(G[V_{t'}]\), the fact that \(v\in Y_j\) implies that \(Y_j\cap B_{t'} = \{v\}\), and consequently \(X_j = Y_j\cap B_{t} = \emptyset \). In this case, the partial k-coloring \((Y_1,\ldots , Y_k)\) agrees with the partial k-coloring \((X_1,\dots , X_{j-1}, \{v\}, X_{j+1}, \ldots , X_k)\) of \(G[V_{t'}]\) on \(B_{t'}\). Thus, every partial k-coloring of \(G[V_t]\) that agrees with c on \(B_t\) either agrees with c on \(B_{t'}\) or agrees with \((X_1,\dots , X_{j-1},\{v\},X_{j+1}\dots , X_k)\) on \(B_{t'}\) for some \(j\in \{1,\ldots , k\}\) such that \(X_j = \emptyset \). Similar arguments can be used to show the converse inclusion, that is, any partial k-coloring of \(G[V_{t'}]\) that satisfies one of the above conditions is a partial k-coloring of \(G[V_t]\) that agrees with c on \(B_t\). This implies the claimed equality.

  4. 4.

    t is a join node. By definition, t has exactly two children \(t_1\) and \(t_2\) in T and it holds that \(B_t = B_{t_1} = B_{t_2}\). We claim that \(V_{t_1}\cap V_{t_2}=B_t\). It is clear that \(B_t\subseteq V_{t_1}\cap V_{t_2}. \) Assume for contradiction that there is a vertex \(v\in V(G)\) such that \(v\in (V_{t_1}\cap V_{t_2}){\setminus } B_t\). Then there are nodes \(t_1'\) and \(t_2'\) of T such that \(v\in B_{t_1'}\), \(v\in B_{t_2'}\), and \(t_1'\) and \(t_2'\) are (possibly not proper) descendants of \(t_1\) and \(t_2\), respectively. It follows that the subgraph of T consisting of all bags containing v is not connected; a contradiction. Thus \(B_t=V_{t_1}\cap V_{t_2}\), as claimed. Furthermore, applying Lemma 18 to \(a = t_1\) and \(b = t\) we can show that no vertex of \(V_{t_1}\setminus B_{t}\) is adjacent in G to any vertex of \(V(G){\setminus } V_{t_1}\). Since \(V_{t_2}{\setminus } B_{t}\subseteq V(G){\setminus } V_{t_1}\), this implies that no vertex in \(V_{t_1}\setminus B_{t}\) is adjacent in G to any vertex of \(V_{t_2}\setminus B_{t}\). Consider now an arbitrary partial k-coloring \(c=(X_1,\dots , X_k)\) of \(G[B_t]\) (observe that c is also a partial k-coloring of \(G[B_{t_1}]\) and \(G[B_{t_2}]\)). In this case, we have the following recurrence relation:

    $$\begin{aligned} P(t,c)=\{\mathbf {q_1}+\mathbf {q_2}-(p_1(X_1), \dots , p_k(X_k))\mid \mathbf {q_1}\in P(t_1,c), \mathbf {q_2}\in P(t_2,c)\}. \end{aligned}$$

    It is clear that for any partial k-coloring \((X_1', \ldots , X_k')\) of \(G[V_t] \) that agrees with c on \(B_t\), the k-tuples \((X_1'\cap V_{t_1}, \ldots , X_k'\cap V_{t_1})\) and \((X_1'\cap V_{t_2}, \ldots , X_k'\cap V_{t_2})\) are partial k-colorings of \(G[V_{t_1}] \) and \(G[V_{t_2}]\) that agree with c on \(B_{t_1}\) and \(B_{t_2}\), respectively. The fact that no vertex in \(V_{t_1}\setminus B_t\) is adjacent in G to any vertex in \(V_{t_2}\setminus B_t\) implies that the other direction is also true: given partial k-colorings \((X_1', \ldots , X_k')\) and \((X_1'', \ldots , X_k'')\) of \(G[V_{t_1}] \) and \(G[V_{t_2}]\) that agree with c on \(B_{t_1}\) and \(B_{t_2}\), respectively, we have \(X_j'\cap B_t=X_j''\cap B_t=X_j\) for all \(j\in \{1,\dots , k\}\), and thus \((X_1'\cup X_1'', \ldots , X_k'\cup X_k'')\) is a partial k-coloring of \(G[V_t]\) that agrees with c on \(B_t\). Furthermore, for all \(j\in \{1,\dots , k\}\), the fact that \(V_{t_1}\cap V_{t_2}=B_t\) implies that \(X_j'\cap X_j''=X_j\), and hence \(p_j(X_j'\cup X_j'')=p_j(X_j')+p_j(X_j'')-p_j(X_j)\). The claimed equality follows.

It remains to estimate the time complexity of the algorithm. We compute a nice tree decomposition of G in time \({\mathcal {O}}(n^3)\). Each of the \({\mathcal {O}}(n^2)\) bags is a clique, so in total we have \({\mathcal {O}}(n^k)\) partial k-colorings per bag. Furthermore, note that for each partial coloring \((X_1,\ldots , X_k)\) of any induced subgraph of G and each \(j\in \{1,\ldots , k\}\), we have \(p_j(X_j)\in \{0,1,\ldots , Q\}\). Thus, each set P(tc) has at most \((Q+1)^k\) elements. For each of the \({\mathcal {O}}(n^{k+2})\) pairs (tc) where t is a node of T and c is a partial k-coloring of \(G[B_t]\), we compute the set P(tc) using the formula corresponding to the type of node t. The time complexity of this step depends on the type of the node. Case 1 takes constant time. In Case 2, we check in constant time whether \(v\in X_j\) for some \(j\in \{1,\dots , k\}\) and then compute the set P(tc) in time \({\mathcal {O}}((Q+1)^k)\). In Case 3, we first compute in (constant) time \({\mathcal {O}}(k)\) the set of indices \(j\in \{1,\ldots ,k\}\) such that \(X_j = \emptyset \). Then, the union given by the formula can be computed in time \({\mathcal {O}}((Q+1)^k)\), simply by iterating over all families in the union and keeping track of which of the \({\mathcal {O}}((Q+1)^k)\) profit profiles appear in any of the families. Finally, Case 4 can be done in time \({\mathcal {O}}((Q+1)^{2k})\). Altogether, this results in running time \({\mathcal {O}}((Q+1)^{2k})\) for each fixed \(t\in V(T)\) and each partial k-coloring c of \(B_t\). Consequently, the total running time of the algorithm is \({\mathcal {O}}(n^{k+2}(Q+1)^{2k})\). \(\square \)

3.4 Graphs with Bounded Treewidth

Recall that the width of a tree decomposition \((T, \{B_t\}_{t\in V(T)})\) of a graph G is defined as \(\max _{t\in V(T)}|B_t|-1\). The treewidth of a graph G is the minimum possible width of a tree decomposition of G. A graph class \({\mathcal {G}}\) is said to be of bounded treewidth if there exists a nonnegative integer \(\ell \) such that each graph in \({\mathcal {G}}\) has treewidth at most \(\ell \). For each fixed treewidth bound \(\ell \), given a graph G of treewidth at most \(\ell \), a tree decomposition of G of width at most \(\ell \) can be computed in linear time [16]. Such a decomposition leads to linear-time algorithms for many problems that are generally NP-hard (see, e.g., [6, 25]).

A similar approach as the one used in the proof of Theorem 19 for solving the Fair k-Division Under Conflicts on chordal graphs can be used on graphs of bounded treewidth.

Fix \(k,\ell \ge 1\) and let \((G,p_1,\ldots , p_k)\) be the input to Fair k-Division Under Conflicts such that the treewidth of G is at most \(\ell \). In time \(\ell ^{{\mathcal {O}}(\ell ^3)}n\) we can compute a tree decomposition of G a width at most \(\ell \) using the algorithm of Bodlaender [16]. Clearly, the obtained tree decomposition has at most \(\ell ^{{\mathcal {O}}(\ell ^3)}n\) bags. By Lemma 15 it follows that we can compute in time \({\mathcal {O}}(\ell ^{{\mathcal {O}}(\ell ^3)}n^3)\) a nice tree decomposition \({\mathcal {T}} = (T, \{B_t\}_{t\in V(T)})\) of G of width at most \(\ell \), with \({\mathcal {O}}(n^2)\) bags. Every bag has at most \(\ell +1\) vertices, so for every bag we have at most a constant number, \((\ell +1)^{k+1}\), partial k-colorings, which in total gives \({\mathcal {O}}(n^2)\) pairs (tc) of a node \(t\in V(T)\) and a partial k-coloring c of t. For each such pair (tc), we again compute the family P(tc) of all profit profiles of partial k-colorings of \(G[V_t]\) that agree with c on \(B_t\). Since \({\mathcal {T}}\) is a nice tree decomposition, every node is of one of the four possible types, and in Cases 1, 2, and 4 we have identical equalities as in the corresponding cases in the proof of Theorem 19, while in Case 3 the union over all j such that \(X_j=\emptyset \) of the sets \(P(t',(X_1,\dots , X_{j-1},\{v\},X_{j+1}\dots , X_k))\) is replaced by the union over all j such that \(X_j\cup \{v\}\) is an independent set in G of the sets \(P(t',(X_1,\dots , X_{j-1},X_j\cup \{v\},X_{j+1}\dots , X_k))\). Since we can compute the adjacency matrix of G in time \({\mathcal {O}}(n^2)\), we may assume that adjacency checks can be done in constant time. Thus, the expressions in the formulas corresponding to each of the Cases 2 and 3 can be evaluated in time \({\mathcal {O}}((Q+1)^k)\), while the corresponding time complexity of Case 4 is \({\mathcal {O}}((Q+1)^{2k})\). Altogether, this gives us the claimed running time and yields the following theorem (where the constant hidden in the \({\mathcal {O}}\) notation depends on k and \(\ell \)).

Theorem 20

For every \(k\ge 1\) and \(\ell \ge 1\), Fair k-Division Under Conflicts is solvable in time \({\mathcal {O}}(n^2(n+(Q+1)^{2k}))\) for a graph G of treewidth at most \(\ell \), where \(Q = \max _{1\le j\le k}p_j(V(G))\).

4 Approximation

All the pseudo-polynomial dynamic programming algorithms presented in this paper share the following characteristics. Throughout the execution feasible states are computed, where every state describes a profit allocation given by a feasible solution of Fair k-Division Under Conflicts. Each such state is represented by a k-dimensional vector \((q_1, \ldots , q_k) \in {\mathbb {Z}}_+^k\), where every entry \(q_j\) describes the profit \(p_j(X_j)\) assigned to agent j by a partial coloring \((X_1, \ldots , X_k)\). While Pareto-dominated states can be eliminated, the total number of states remains trivially bounded by \((Q+1)^k\), where \(Q = \max _{1\le j\le k}p_j(V(G))\). The optimal solution with maximum satisfaction level can be determined at the end of such an algorithm by simply going through all generated states and inspecting their satisfaction levels.

In a canonical step of our algorithms a vertex v (resp. item) is feasibly assigned to an agent j thereby generating a new state \((q_1, \ldots , q_{j-1}, q_j+p_j(v), q_{j+1}, \ldots , q_k)\) from a previous state \((q_1, \ldots , q_k)\). The decisions taken by the algorithms depend only on the graph but not on the profit values of previously generated states. Every vertex is assigned to each agent at most once.

Under these preconditions, we can derive a fully polynomial time approximation scheme (FPTAS) for each such dynamic programming algorithm (considering k as a constant). For an optimal satisfaction level \(z^*\), an FPTAS computes for every given \(\varepsilon >0\), an approximate solution with satisfaction level \(z^A\) fulfilling \(z^A \ge z^*/(1+\varepsilon )\) with running time polynomial in the size of the encoded input and in \(1/\varepsilon \).

The FPTAS is based on the observation that the k profit values of a solution can also be seen as k objective function values in a multiobjective optimization problem. Thus, the technique for deriving an FPTAS for the multiobjective knapsack problem described in [31] can be applied as follows.

Denote the upper bound for the profit assigned to agent j by \(\textit{UB}_j=p_j(V(G))\) and set \(u_j = \lceil n \log _{1+\varepsilon }{} \textit{UB}_j\rceil \), where, as usual, \(n = |V(G)|\). Partition the profit range for each agent j into \(u_j\) intervals

$$\begin{aligned}{}[1, (1+\varepsilon )^{1/n}), \, [(1+\varepsilon )^{1/n}, (1+\varepsilon )^{2/n}), \,&[(1+\varepsilon )^{2/n}, (1+\varepsilon )^{3/n}), \ldots \\&[(1+\varepsilon )^{(u_j-1)/n}, (1+\varepsilon )^{u_j/n}]\,. \end{aligned}$$

To obtain an FPTAS from the generic dynamic programming algorithm indicated above we restrict the possible profit values \(q_j\) allocated to agent j to the lower interval endpoints of these intervals. The FPTAS mimics exactly the operations of the exact dynamic program, but whenever a vertex v is assigned to j, the resulting profit \(q_j+p_j(v)\) is rounded down to the nearest interval endpoint. Note that this does not change the steps of the dynamic program since we assumed that its decisions do not depend on the profit values of states.

The bound \(u_j = \lceil n \log _{1+\varepsilon }{} \textit{UB}_j\rceil \) is in \({\mathcal {O}}(n /\varepsilon \cdot \log _2(\textit{UB}_j))\), which is polynomial in the encoding length of the input, since

$$\begin{aligned} \log _{1+\varepsilon }{} \textit{UB}_j= (\ln 2 \log _2 \textit{UB}_j)/\ln (1+\varepsilon ) \le (2\ln 2 \log _2 \textit{UB}_j)/\varepsilon , \end{aligned}$$

for all \(\varepsilon \in (0,1)\). The above inequality follows from \(x\le 2\ln (1+x)\), which can be verified to hold for all \(x \in (0,1)\) by standard calculus. Thus, the total number of states in the modified algorithm is bounded by \({\mathcal {O}}((n/\varepsilon )^k (\log _2 Q)^k)\).

Concerning the loss of accuracy we can proceed similarly to [31] and compare an arbitrary state \((q_1, q_2, \ldots , q_k)\) of the exact dynamic program to some state of the FPTAS consisting of lower interval endpoints \((\tilde{q}_1, \tilde{q}_2, \ldots , \tilde{q}_k)\). For every state \((q_1, \ldots , q_j, \ldots , q_k)\) generated by the exact algorithm after assigning i vertices to agent j, we claim that in the FPTAS there exists a state \((\tilde{q}_1, \tilde{q}_2, \ldots , \tilde{q}_k)\) of lower interval endpoints such that

$$\begin{aligned} q_j \le (1+\varepsilon )^{i/n} \tilde{q}_j. \end{aligned}$$
(5)

This claim can be shown by induction. For \(i=1\), there was one vertex v assigned to agent j giving profit \(q_j=p_j(v)\). In the FPTAS, there will be a state where \(\tilde{q}_j\) is the largest lower interval endpoint not exceeding \(q_j\). By construction of the intervals, we have \((1+\varepsilon )^{1/n} \tilde{q}_j \ge q_j\).

Assuming the claim to be true for some \(i-1\), we consider the i-th assignment of a vertex v to j. In the exact algorithm, \(p_j(v)\) is added to some value \(q_j\) for which there exists a lower interval endpoint \(\tilde{q}_j\) fulfilling \(q_j \le (1+\varepsilon )^{(i-1)/n} \tilde{q}_j\). During the FPTAS, \(p_j(v)\) will also be added to \(\tilde{q}_j\) and the result will be rounded down to a lower interval endpoint \(\tilde{q}'\) with \((1+\varepsilon )^{1/n} \tilde{q}' \ge \tilde{q}_j + p_j(v) \ge (1+\varepsilon )^{-(i-1)/n} q_j + p_j(v) \ge (1+\varepsilon )^{-(i-1)/n} (q_j + p_j(v)) \). Moving terms around, this proves (5) for the new profit \(q_j + p_j(v)\).

Since there can be at most n vertices assigned to any agent, (5) holds also for the satisfaction level of the optimal solution.

Summarizing the above discussion and the proofs of Theorem 10, Corollary 14, Theorem 19, and Theorem 20, we conclude:

Theorem 21

Fair k-Division Under Conflicts with constant k admits an FPTAS if the conflict graph is a cocomparability graph, a biconvex bipartite graph, a chordal graph, or a graph of bounded treewidth.

To put Theorem 21 in perspective, recall that by Theorem 6 no constant-factor approximation for Fair k-Division Under Conflicts exists for general graphs, unless P = NP.

5 Conclusions

In this paper we introduced the Fair k-Division Under Conflicts and studied it from a computational complexity point of view, with respect to various restrictions on the conflict graph. In particular, we could show that the problem is strongly \(\text {NP}\)-hard on general bipartite conflict graphs, but can be solved in pseudo-polynomial time on biconvex bipartite graphs, on chordal graphs, on cocomparability graphs, and on graphs of bounded treewidth. There are other graph classes sandwiched between the two classes of our results, for which the complexity of Fair k-Division Under Conflicts is still open. In particular, we can derive open problems from the following sequence of inclusions: biconvex bipartite \(\subseteq \) convex bipartite \(\subseteq \) interval bigraph \(\subseteq \) chordal bipartite \(\subseteq \) bipartite. We believe that a positive result for convex bipartite graphs could be within reach. Outside this chain of inclusions, we pose the complexity of the problem for planar bipartite conflict graphs as another interesting open question.