Towards a Distributed Search Engine Ricardo Baeza-Yates Yahoo! Research Barcelona Spain & Santiago, Chile
Abstract. In this invited talk we address the algorithmic problems behind a truly distributed Web search engine. The main goal is to reduce the cost of a Web search engine while keeping all the benefits of a centralized search engine in spite of the intrinsic network latency imposed by Internet. The key ideas to achieve this goal are layered caching, online prediction mechanisms and exploit the locality and distribution of queries.
1
Motivation
A standard Web search engine has two main parts [8]. The first part, conducted off-line, fetches Web pages (crawler) and builds an index with the text content (indexer). The second part, conducted online, processes a stream of queries (query processor). From the user’s perspective, there are three main requirements: an answer of good quality, a short response time, and a large Web collection available in the index. Given the large number of users having access to the Web, these requirements imply the necessity of a hardware and software infrastructure that can index a high volume of data and that can handle a high query throughput. Currently, such a system comprises a cluster of computers with sufficient capacity to hold the index and the associated data. To achieve the desired throughput, several replicated clusters, possibly in different places, are necessary. To get an idea of such a system, suppose that we have 100 billion Web pages, which implies at least 500 terabytes of text or an index of around 100 terabytes. For efficiency purposes, a large portion of this index must fit into RAM. Using computers with several gigabytes of main memory, we would need approximately 2,500 of them in each cluster to hold the index. As for response time, large search engines answer queries in a fraction of a second. Suppose that a cluster can answer 1,000 queries per second, using caching and without considering other system overheads. Suppose now that we have to answer 500 million queries per day, which implies 5,800 queries per second on average and around 12,000 queries per second on peak times. We then need to replicate the system at least 12 times, ignoring fault tolerance aspects. That means we need at least 30,000 computers overall. Deploying such a system may cost over hundred million US dollars, not considering the cost of ownership (people, power, bandwidth, etc.). If we go through the same exercise for a Web 10 times larger and, being conservative, T. Calamoneri and J. Diaz (Eds.): CIAC 2010, LNCS 6078, pp. 1–5, 2010. c Springer-Verlag Berlin Heidelberg 2010
2
R. Baeza-Yates
duplicating the query traffic, we would need clusters of 25,000 computers and then a system of at least half a million computers, which is not really reasonable. Centralized Web search engines are attractive from an economic point of view. It is often the case that companies select the location for a new data center based on the cost of land, labor, services, and in particular electricity and network connectivity. However, by considering only such factors, system architects might be overlooking the potential advantages for having smaller data centers close to the end users. In addition, the preference for a centralized solution often comes from a lack of understanding of a distributed solution, as it is not clear whether the benefits of such an architecture compensate its drawbacks. In fact, distributed architectures for Web search engines are a potential solution to the scalability problem of Web search. As data centers hosting search engine servers have limited capacity [10], it is critical to have a system design that can cope with the growth of the Web, and that is not constrained by the physical and environmental limitations of a data center. We explore this possibility next.
2
A Distributed Web Search Engine
Our challenge is to design a large-scale distributed Web search system that satisfy the user expectations, in which the system use resources efficiently, thereby reducing the cost per query. This is feasible as we can exploit the topology of the network, layers of caching [15,4], high concurrency, the local query distribution (see [23] for a good survey), load balancing [18,1,21], document replication, and several other techniques [19,24,16]. However, designing a distributed system is difficult because it depends on several factors that are seldom independent. Designing such a system depends on so many considerations that one poor design choice can affect performance adversely or increase costs. An example of an important benefit of a distributed solution is the proximity of the search engine to Web data and its users. Being closer to data implies that the system requires fewer machines to perform the same crawling, as the Web connections are shorter and the data transfer is faster. In fact, longer connections reduce the throughput of crawlers and front-end servers, which host Web servers interacting with users, as their capacity often depends on the total number of simultaneous connections. In addition, as the overall workload is distributed, the cost of handling network bandwidth saturation, redundancy, and fault tolerance within a single site may also decrease by employing less costly configurations. These gains can improve the quality of the answers due to a better Web collection as well as being able to apply better ranking schemes [13]. A distributed architecture also enables the service to exploit the potential local properties of the workload. Indeed, locality implies lower utilization of the network, and thus, reduces the communication cost. Also, locality may improve the ranking by using local features. Moreover, locality of queries may imply better local customization, since teams of developers can use local expertise to tailor services to local preferences, thus improving the user experience and increasing the advertising revenue.
Towards a Distributed Search Engine
3
Hence, we need to provision a search site in such a way that it is able to process locally a significant fraction of the queries, ideally all of the traffic. However, in practice, achieving the goal of processing all queries locally is difficult. Nevertheless, we can increase the fraction of local queries to decrease answer time and reducing the average latency of query processing. In addition to locality, we can also look at the volume of queries for which the distributed system retrieves more or fewer clicked documents than a centralized system, assuming that a click by a user on a retrieved document is an indication of relevance. The sites that comprise the distributed Web search engine may be connected via a simple network topology, such as star, ring or clique. The algorithms we present assume that each site is able to communicate with each other site, possibly using a path of intermediate sites. For our experiments we use a simple star topology, which has a minimal number of connections and requires at most two hops between any pair of sites, but any other network topology is feasible, and in fact part of the design options to be optimized by the system architects. To assess the feasibility of distributed Web search engines comprising geographically dispersed sites we introduced a detailed cost model that includes operational costs, and enables us to answer questions related to efficiency and cost [5]. With this cost model we can show that with sufficient locality in the query workload, there exist an optimal number of sites that minimizes the overall cost of the search engine. We then present a query-processing algorithm that maximizes the amount of locally-processed queries, without sacrificing the quality of the results. We enhance our algorithm to improve the amount of locality, and consequently performance, such as replicating documents retrieved frequently across sites [5]. For the experimental analysis, we use real document collections and real query workloads to measure the actual parameters needed by our cost model, and show that a distributed search engine can be competitive with respect to a centralized architecture and at the same time be less expensive. Building a distributed search engine involves designing and optimizing a large number of different components [20,9,3,11]. Hence our results can be improved by using other techniques. In particular, we also present several prediction mechanisms that can enhance significantly the previous solution, including predicting queries that are not local [7] and predicting queries that should not be cached [6]. In the first case we can even have a small cache for wrong predictions. Further work in several other areas is also needed. In particular we have not addressed the problem of distributed indexing [17] nor improved the limited research available on distributed Web crawling [22,14]. Finally, evaluation of distributed architectures is also not trivial and further research is also needed [12,2].
References 1. Badue, C.S., Baeza-Yates, R., Ribeiro-Neto, B.A., Ziviani, A., Ziviani, N.: Analyzing imbalance among homogeneous index servers in a web search system. Inf. Process. Manage. 43(3), 592–608 (2007)
4
R. Baeza-Yates
2. Badue, C.S., Baeza-Yates, R., Ribeiro-Neto, B.A., Ziviani, A., Ziviani, N.: Modeling performance-driven workload characterization of Web search systems. In: Yu, P.S., Tsotras, V.J., Fox, E.A., Liu, B. (eds.) CIKM, Arlington, Virginia, USA, November 2006, pp. 842–843. ACM, New York (2006) 3. Baeza-Yates, R., Castillo, C., Junqueira, F., Plachouras, V., Silvestri, F.: Challenges in distributed information retrieval (invited paper). In: ICDE (2007) 4. Baeza-Yates, R., Gionis, A., Junqueira, F., Murdock, V., Plachouras, V., Silvestri, F.: Design trade-offs for search engine caching. TWEB 2(4) (2008) 5. Baeza-Yates, R., Gionis, A., Junqueira, F., Plachouras, V., Telloli, L.: On the feasibility of multi-site Web search engines. In: ACM CIKM 2009, Hong Kong, China, November 2009, pp. 425–434 (2009) 6. Baeza-Yates, R., Junqueira, F., Plachouras, V., Witschel, H.F.: Admission Policies for Caches of Search Engine Results. In: Ziviani, N., Baeza-Yates, R. (eds.) SPIRE 2007. LNCS, vol. 4726, pp. 74–85. Springer, Heidelberg (2007) 7. Baeza-Yates, R., Murdock, V., Hauff, C.: Efficiency trade-offs in two-tier Web search systems. In: Allan, J., Aslam, J.A., Sanderson, M., Zhai, C., Zobel, J. (eds.) SIGIR, Boston, MA, USA, pp. 163–170. ACM, New York (2009) 8. Baeza-Yates, R., Ribeiro-Neto, B.A.: Modern Information Retrieval. AddisonWesley Longman Publishing Co., Inc., Boston (1999) 9. Barroso, L.A., Dean, J., H¨ olzle, U.: Web search for a planet: The google cluster architecture. IEEE Micro 23(2), 22–28 (2003) 10. Barroso, L.A., H¨ olzle, U.: The Datacenter as a Computer - an introduction to the design of warehouse-scale machines. Morgan and Claypool Publishers (May 2009) 11. Bender, M., Michel, S., Triantafillou, P., Weikum, G.: Design Alternatives for Large-Scale Web Search: Alexander was Great, Aeneas a Pioneer, and Anakin has the Force. In: Proceedings of the 1st LSDS-IR Workshop, pp. 16–22 (2007) 12. Cacheda, F., Carneiro, V., Plachouras, V., Ounis, I.: Performance analysis of distributed information retrieval architectures using an improved network simulation model. Information Processing and Management 43(1), 204–224 (2007) 13. Cambazoglu, B.B., Plachouras, V., Baeza-Yates, R.: Quantifying performance and quality gains in distributed Web search engines. In: Allan, J., Aslam, J.A., Sanderson, M., Zhai, C., Zobel, J. (eds.) SIGIR, Boston, MA, USA, July 2009, pp. 411–418. ACM, New York (2009) 14. Exposto, J., Macedo, J., Pina, A., Alves, A., Rufino, J.: Geographical partition for distributed web crawling. In: Proceedings of the 2005 workshop on Geographic information retrieval, pp. 55–60 (2005) 15. Long, X., Suel, T.: Three-level caching for efficient query processing in large web search engines. In: WWW (2005) 16. Marin, M., Gil-Costa, V., Bonacic, C., Baeza-Yates, R., Scherson, I.D.: Sync/async parallel search for the efficient design and construction of Web search engines. Parallel Computing (to appear) 17. Melink, S., Raghavan, S., Yang, B., Garcia-Molina, H.: Building a distributed fulltext index for the web. ACM Trans. Inf. Syst. 19(3), 217–241 (2001) 18. Moffat, A., Webber, W., Zobel, J.: Load balancing for term-distributed parallel retrieval. In: SIGIR, pp. 348–355 (2006) 19. Moffat, A., Webber, W., Zobel, J., Baeza-Yates, R.: A pipelined architecture for distributed text query evaluation. Inf. Retr. 10(3), 205–231 (2007) 20. Orlando, S., Perego, R., Silvestri, F.: Design of a Parallel and Distributed WEB Search Engine. In: Proceedings of Parallel Computing (ParCo) 2001 conference, September 2001, pp. 197–204. Imperial College Press, London (2001)
Towards a Distributed Search Engine
5
21. Puppin, D., Perego, R., Silvestri, F., Baeza-Yates, R.: Tuning the capacity of search engines: Load-driven routing and incremental caching to reduce and balance the load. ACM Transactions on Information Systems 28(2) (April 2010) 22. Shkapenyuk, V., Suel, T.: Design and implementation of a high-performance distributed web crawler. In: ICDE (2002) 23. Silvestri, F.: Mining query logs: Turning search usage data into knowledge. Foundations and Trends in Information Retrieval 3(4) (2009) 24. Skobeltsyn, G., Junqueira, F., Plachouras, V., Baeza-Yates, R.: ResIn: A Combination of Result Caching and Index Pruning for High-performance Web Search Engines. In: SIGIR 2008: Proceedings of the 31st International ACM SIGIR conference on Research and Development in Information Retrieval, Singapore (2008)
Mechanisms for the Marriage and the Assignment Game Paul D¨ utting1 and Monika Henzinger2 1 2
Ecole Polytechnique F´ed´erale de Lausanne (EPFL), Station 14, CH-1015 Lausanne
[email protected] Universit¨ at Wien, Fakult¨ at f¨ ur Informatik, Universit¨ atstrasse 10/11, A-1090 Wien
[email protected]
Abstract. Starting with two models fifty years ago, the discrete marriage game [1] and the continuous assignment game [2], the study of stable matchings has evolved into a rich theory with applications in many areas. Most notably, it has lead to a number of truthful mechanisms that have seen a recent rejuvenation in the context of sponsored search. In this paper we survey the history of these problems and provide several links to ongoing research in the field. Keywords: stable matchings, auction mechanisms, matching markets.
1
Introduction
Starting with two models fifty years ago, the discrete marriage game [1] and the continuous assignment game [2], the study of stable matchings has evolved into a rich theory with applications in many areas. Most notably, it has lead to a number of truthful mechanisms that have seen a recent rejuvenation in the context of sponsored search. In this paper we survey the history of these problems and provide several links to ongoing research in the field. Both models are given as input two sets, I and J, and have to match or assign the elements of I to the elements of J. The goal is to find a stable matching between the elements of I and the elements of J. The exact definition of what constitutes a stable matching depends on the model under consideration. For many models the next question to study is which stable matching is the “best” stable matching, using a notion of optimality that has a useful economic interpretation. This leads then to the question of truthfulness, i.e., whether players can achieve even “better” outcomes for themselves if they misreport the model parameters related to them. The literature on stable matchings can be classified as follows: 1. One-to-one, one-to-many, or many-to-many: To how many elements of set J can an element of set I be matched simultaneously, and vice versa? We say that a matching is one-to-one if the elements of both sets can be matched
This work was conducted as part of a EURYI scheme award (see http://www.esf. org/euryi/).
T. Calamoneri and J. Diaz (Eds.): CIAC 2010, LNCS 6078, pp. 6–12, 2010. c Springer-Verlag Berlin Heidelberg 2010
Mechanisms for the Marriage and the Assignment Game
7
with at most one element of the other set. It is one-to-many if the elements of one set can be matched to more than one element of the other set, but not vice versa. If elements of both sets can be matched to multiple elements of the other set, then it is many-to-many. 2. Preference lists or utility functions: Are the preferences that each element of I resp. J has with respect to the elements of the other set given as (not necessarily complete) preference lists, or are they given as utility functions? 3. One-sided or two-sided: Is the notion of stability one-sided, i.e., the only concern is to respect the preferences of one of the two sets, or is it two-sided, i.e., do we we have to respect the preferences of both sets? 4. Further restrictions: If we think of one of the two sets as “the buyers” and of the other as “the sellers” and assume that each seller has a unique item to sell, are there any restrictions on the prices of the items? Do the sellers impose reserve prices, i.e., lower bounds on the price they are willing to accept? Or do the buyers have a maximum price or budget, i.e., an upper bound on the price they are willing to pay? In this survey we restrict ourselves to discussing one-to-one matchings. We first define all game-theoretic terminology in Section 2. Afterwards, in Section 3 and 4, we describe the results for one-to-one matchings in chronological order. We conclude with open research problems in the area.
2
Game-Theoretic Terminology
In this section we introduce the game-theoretic terminology used in this survey. A game is defined by a set N of players, each with a set Si of possible strategies. In our case the set of players N is given by the sets I and J. The set of strategies Si of player i is given by the preferences that she can specify, depending on the model either as a preference list or as a set of utility functions. Each game has an outcome o. In our case the outcome specifies a matching μ, i.e., it tells us which elements are matched, and - in the case where the preferences are given as utility functions - a price p for each pair (i, j) in the matching. Given such an outcome o, the players in N derive a certain utility. In the case of preference lists, these utilities are given by the corresponding entries in the preference lists. In the case of utility functions, the utilities are given by the corresponding utility functions. A strategy profile s specifies for each player i a strategy si . Such a strategy profile s∗ is a (weakly) dominant strategy [3] if for all i, all si ∈ Si , and all s−i ∈ S−i : ui (s∗i , s−i ) ≥ ui (si , s−i ), where u(s∗i , s−i ) resp. u(si , s−i ) denotes the utility of player i if she plays s∗i resp. si and the other players play s−i ∈ S−i = S1 × · · · × Si−1 × Si+1 × . . . S|N | . That is, a strategy profile is a dominant strategy if every player is guaranteed to get the highest possible utility, no matter which strategy the other players choose. If in a mechanism truthful revelation of preferences is a dominant strategy, then the mechanism is said to be incentive compatible [3], or truthful [4]. We will use these terms interchangeably.
8
P. D¨ utting and M. Henzinger
The core [3] of a game is defined in terms of a value function v that associates with each subset of players P a value v(P ). It is defined as the set of feasible payoff vectors that cannot be improved upon. Formally: A vector (xi )i∈P of real numbers is a P -feasible payoff vector if i∈P xi = v(P ). We refer to a N -feasible payoff vector as feasible payoff vector. A feasible payoff vector (xi )i∈N cannot be improved upon, if there is no coalition P and P -feasible payoff vector (yi )i∈P for which yi > xi for all i ∈ P.
3
Marriage Game
The model with discrete preferences is typically referred to as marriage game. It was introduced by Gale and Shapley in 1962 [1]. The goal is to match n men with m women in a one-to-one fashion. The preferences are given as (not necessarily complete) preference lists. A matching is stable if no two men α and β are assigned to women A and B, although both would prefer to be matched to the other partner, i.e., man α prefers woman B over A and woman A prefers man β to man α. Note that the stability notion is two-sided as both, men and women, discriminate between the partners of the opposite sex. A stable matching is men-optimal (or women-optimal) if every man (or woman) is at least as well off under it as under any other stable matching. A simple example shows that a matching that is optimal for both, men and women, does not exist in all cases. The main contribution of Gale and Shapley was a combinatorial mechanism, known as the deferred acceptance mechanism, that always finds a men-optimal (or women-optimal) matching. The mechanism works in rounds. In each round all men (or women) who have not yet been accepted propose to their favorite women (or men). Each woman keeps her favorite from among those who have proposed to her, but does not accept him yet. She does not accept him to allow for the possibility that someone better may propose to her later. She rejects all other men. In the next round all men who have been rejected propose to their next best choices, and so on. The running time of this mechanism is polynomial. Dubbins and Freedman [5] and later Gale and Sotomayor [6] showed that if an mechanism computes a men-optimal (or women-optimal) matching, then it is a dominant strategy [3] for the men (or women) to reveal their true preferences. In other words: It is in the best interest of the men (or women) to reveal their true preferences, because they will end up with a partner that they like at least as much as the partner they would get if they misreported their preferences. That is, any such mechanism is truthful. There exists many variants of the marriage game that we do not want to discuss in detail here (for a detailed discussion see [7]), some of which do not permit a polynomial time mechanism unless P = N P [8].
4
Assignment Game
In the assignment game, which was introduced by Shapley and Shubik in 1972 [2], n buyers are to be matched with m sellers. Each seller has a unique item to sell,
Mechanisms for the Marriage and the Assignment Game
9
so the terms “seller” and ”item” can be used interchangeably. The goal is to compute a matching μ along with a vector of prices p. In the two-sided version both, the buyers and the sellers, derive a certain utility from being matched to a seller or buyer at a given price, where the utility of the buyers (resp. sellers) is a monotonically decreasing (resp. increasing) function of the price. In the one-sided version the seller does not discriminate between buyers. Hence the one-sided version is a special case of the two-sided version, where the utility function of each of the sellers is the same for all buyers. The utility functions are typically assumed to be continuous. Depending on which form the utility functions have we distinguish the following cases. 4.1
Linear Case (with Slope 1)
This is the case that was originally studied by Shapley and Shubik. The i-th buyer values the item of the j-th seller at vi,j dollars. The j-th seller values her item at rj dollars. The value rj can be interpreted as the reserve price imposed by the seller, because she will not sell her item below this price. If seller j sells her item to buyer i for pj dollars, then j’s final profit (or utility) is pj and i’s profit (or utility) is exactly ui = vi,j − pj . A matching μ with prices p is stable if (1) ui + pj = vi,j if i and j are matched, and (2) ui + pj ≥ vi,j if they are not. Since the sellers do not discriminate between the buyers, this model can be characterized as being one-sided. Shapley and Shubik formulated the problem as a linear program and used this formulation to (1) prove that a stable outcome always exists and (2) identify the set of stable outcomes with the core [3] of the associated game. In this specific case the value v(P ) of a subset of players P is v(P ) = max[vi1 ,j1 + · · · + vik ,jk ], where k = min(|I ∩ P |, |J ∩ P |) and the maximum is taken over all arrangements of 2k distinct players i1 , . . . , ik in P ∩ I and j1 , . . . , jk in P ∩ J. A payoff (u , p ) is P -feasible if i∈P ui + j∈P pj = v(P ). The core is the set of N -feasible payoffs (u, p) for which there is no P -feasible payoff (u , p ) in which a all buyers and sellers in P are strictly better off, i.e., ui > ui for all i ∈ I ∩ P and pj > pj for all j ∈ J ∩ P . So intuitively, if you think of the game as a bipartite graph with node sets I and J and edges (i, j) ∈ I × J with weight vi,j , then this shows that every outcome in the core must be a maximum weight matching. They also showed that the set of stable outcomes has a lattice structure, i.e., for any two payoffs (u , p ) and (u , p ) that correspond to stable outcomes the payoffs (u, p) and (u, p) with ui = min(ui , ui ), pj = max(pj , pj ), ui = max(ui , ui ), and pj = min(pj , pj ) also correspond to stable outcomes. That is, any two stable outcomes can be combined in a way that is “best” for all buyers resp. “best” for all sellers. This “lattice lemma” allows them to prove the existence of highest payoffs u∗i (resp. p∗j ) and lowest payoffs u∗i (resp. p∗j ) in the core. These payoffs correspond to the buyer- and seller-optimal outcomes. A similar approach, which is also based on LPs, was taken by Leonard in 1983 [9], who showed how to “tweak” the LPs so that by solving first the primal program and then the dual program constrained to the outcome of the primal program one can find the stable outcome with the highest (lowest) payoff to
10
P. D¨ utting and M. Henzinger
the buyers. He also showed that any mechanism that computes this outcome is truthful for the buyers (sellers). The first combinatorial mechanism for this problem is due to Demange et al. [10]1 . This mechanism, which they refer to as multi-item auction, is based on the Hungarian Method of Kuhn [11,12]. It starts with an initial price vector p0 in which all prices are set to the reserve prices r. Each bidder i now announces which item(s) j he wants to buy at the current prices. Call each such pair (i, j) a desired edge. If it is possible to create a one-to-one matching consisting only of desired edges, this matching is already the desired stable outcome. If no such assignment exists then the mechanism raises the price of some of the items. By a celebrated theorem from combinatorics, namely Hall’s Theorem [13], a necessary and sufficient condition for a stable outcome is that there is no overdemanded item set. An item set S is overdemanded if the number of bidders all of whose desired edges go to items in S is greater than the number of items in S. It is minimal if none of its proper subsets is overdemanded. By raising the prices of all items in a minimal overdemanded item set by the same amount the mechanism either (a) resolves the overdemand for this item set or (b) increases the size of the minimal overdemanded item set under consideration. Since the size of this set is bounded by the number of items, this shows that eventually all overdemand will be resolved and, hence, a stable outcome is found. In fact, this mechanism does not only find a stable outcome, but the stable outcome with the “smallest” prices, which corresponds to the buyer-optimal outcome. It is truthful, because in this case any mechanism that finds a buyeroptimal outcome is truthful [9]. The running time can be shown to be polynomial if in each step the prices are raised “by as much as possible”. Recently, variants of the “classic” assignment game have been studied, in which (1) each seller has a reserve price ri,j for each of the buyers and (2) each buyer has a maximum price or budget mi,j for each of the items. In [14] it was shown that if the input is in “general position”, then a unique buyeroptimal outcome exists and can be found in polynomial time using a variant of the Hungarian Method. This mechanism is truthful for inputs in “general position”. In [15] it was shown that, with a slightly different notion of stability, the “general position” requirement can be dropped, i.e., a buyer-optimal outcome always exists. The authors of [15] also showed how to compute this outcome in polynomial time using a different variant of the Hungarian Method. This mechanism – just as the mechanism of [14] – is not truthful for arbitrary inputs. 4.2 Piece-Wise Linear Case A more general case, namely that of “locally linear” or piece-wise linear utilities has been studied by Alkan in 1989 [16] using an LP-based approach and in 1991 [17] using a combinatorial approach. 1
In their paper Demange et al. argue that their model is “unsymmetrical” in that each buyer specifies number of items many numbers (her valuations), while each seller specifies only one number (the reserve price). They claim that there mechanism can be modified to handle buyer-dependent reserve prices. This would make the model two-sided, as now the sellers would discriminate between the buyers.
Mechanisms for the Marriage and the Assignment Game
11
A piece-wise linear utility function is a (continuous) function that is composed of linear segments. Each segment can have a different slope. With utilities of this form the above observation that by raising the prices of all items in a minimal overdemanded item set by the same amount it possible to either (a) resolve the overdemand or (b) increase the size of the minimal overdemanded set is no longer true. The main contribution of [16] was to prove the existence of a “stable direction” or amounts by which the prices have to be raised in the piece-wise linear case so that this observation continues to hold. The main contribution of [17] was to use these “stable directions” for the price updates in the multi-item auction of [10]. This mechanism finds the buyeroptimal outcome and runs in time polynomial in the number of buyers and items, and linear in the number of “linear domains” entered. A linear domain is a region of the price space in which the slope of all piece-wise linear utility functions remains the same. Note that this result also establishes the existence of a buyer-optimal stable outcome for arbitrary, but continuous utility functions (discussed in more detail below), because any such function can be approximated arbitrarily well by piecewise linear utility functions. In [18] it is shown that any mechanism that finds a buyer-optimal outcome for arbitrary, but continuous utility functions is truthful. Since piece-wise linear utilities are a special case of general utilities this shows that Alkan’s generalization of the multi-item auction is truthful. 4.3
General Case
The case of arbitrary, but continuous utility functions was studied by Demange and Gale [18] in 1985. They were able to generalize the “lattice lemma” of [2] by showing that even in this very general case (and with a two-sided notion of stability) the set of stable outcomes forms a lattice, which by a similar argument as in the linear case, establishes the existence of a buyer- resp. seller-optimal outcome. Using the buyer- resp. seller-optimality and a lemma that was originally proved by Hwang, they proved that the buyer- resp. seller-optimal outcome cannot be manipulated by a subset of the buyers resp. sellers. That is, for all buyers it is a dominant strategy to reveal their true preferences. In other words: Any mechanism that computes a buyer- resp. seller-optimal outcome is truthful for the buyers resp. sellers. Demange and Gale did not give a mechanism to compute such outcomes. The variant of this problem with not necessarily continuous utility functions, that are, e.g., required to model maximum prices or budgets, has been addressed only recently [19], where it was shown that the lattice structure persists in the presence of discontinuities and implies the existence of a buyer-optimal outcome. The authors of [19] also gave a brute-force mechanism that finds this outcome in time exponential in the number of items, but polynomial in the number of buyers.
5
Open Questions
There are several open questions: First of all, it would be interesting to see whether Alkan’s approach for continuous piece-wise linear utilities can be
12
P. D¨ utting and M. Henzinger
extended to settings with discontinuous piece-wise linear utilities. Furthermore, it would be interesting to (dis)prove the existence of a polynomial time mechanism for computing a buyer-optimal outcome for general (continuous or discontinuous) utility functions. Finally, it would be interesting to study similar questions for the one-to-many and many-to-many case that we did not discuss here.
References 1. Gale, D., Shapley, L.S.: College admissions and the stability of marriage. The American Mathematical Monthly 69(1), 9–15 (1962) 2. Shapley, L., Shubik, M.: The assignment game I: The core. International Journal of Game Theory 1(2), 111–130 (1972) 3. Myerson, R.B.: Game Theory: Analysis of Conflict. Harvard University Press, Cambridge (1997) 4. Nisan, N., Roughgarden, T., Tardos, E., Vazirani, V.V.: Algorithmic Game Theory. Cambridge University Press, Cambridge (2007) 5. Dubins, L.E., Freedman, D.A.: Ms. Machiavelli and the Gale-Shapley algorithm. American Mathematical Monthly 88(7), 485–494 (1981) 6. Demange, G., Sotomayor, M.A.O.: Some remarks on the stable matching problem. Discrete Applied Mathematics 11(3), 223–232 (1985) 7. Roth, A.E., Sotomayor, M.A.O.: Two-Sided Matching - A Study in Game-Theoretic Modelling and Analysis. Cambridge University Press, Cambridge (1990) 8. Manlove, D.F., Irving, R.W., Iwama, K., Miyazaki, S., Morita, Y.: Hard variants of stable marriage. Theoretical Computer Science 276(1-2), 261–279 (2002) 9. Leonard, H.B.: Elicitation of honest preferences for the assignment of individuals to positions. The Journal of Political Economy 91(3), 461–479 (1983) 10. Demange, G., Gale, D., Sotomayor, M.A.O.: Multi-item auctions. The Journal of Political Economy 94(4), 863–872 (1986) 11. Kuhn, H.: The Hungarian Method for the assignment problem. Naval Research Logistics Quarterly 2(1-2), 83–97 (1955) 12. Frank, A.: On Kuhn’s Hungarian Method - A tribute from Hungary. Naval Research Logistics 51(1), 2–5 (2004) 13. Hall, P.: On representatives of subsets. J. London Math. Soc. 10(2), 26–30 (1935) 14. Aggarwal, G., Muthukrishna, S., P´ al, D., P´ al, M.: General auction mechanism for search advertising. In: World Wide Web Conference, pp. 241–250 (2009) 15. D¨ utting, P., Henzinger, M., Weber, I.: Sponsored search, market equilibria, and the Hungarian Method. In: Symposium on Theoretical Aspects of Computer Science, pp. 287–298 (2010) 16. Alkan, A.: Existence and computation of matching equilibria. European Journal of Political Economy 5(2-3), 285–296 (1989) 17. Alkan, A.: Equilibrium in a Matching Market with General Preferences. In: Equilibrium and Dynamics. Essays in Honour of David Gale, The MacMillan Press Ltd., Basingstoke (1992) 18. Demange, G., Gale, D.: The strategy structue of two-sided matching markets. Econometrica 53(4), 873–883 (1985) 19. D¨ utting, P., Henzinger, M., Weber, I.: Bidder optimal assignments for general utilities. In: Workshop on Internet and Network Economics, pp. 575–582 (2009)
Resilient Algorithms and Data Structures Giuseppe F. Italiano Dipartimento di Informatica, Sistemi e Produzione Universit` a di Roma “Tor Vergata” via del Politecnico 1, 00133 Roma, Italy
[email protected]
Abstract. Modern memory devices may suffer from faults, where some bits may arbitrarily flip and corrupt the values of the affected memory cells. The appearance of such faults may seriously compromise the correctness and performance of computations. In recent years, many algorithms for computing in the presence of memory faults have been introduced in the literature: in particular, an algorithm or a data structure is called resilient if it is able to work correctly on the set of uncorrupted values. In this invited talk I will survey recent work on resilient algorithms and data structures.
1
Motivation
Modern memories are made up from increasingly smaller and more complicated integrated circuits which are required to work at low voltage levels and to offer large storage capacities [23]. Unfortunately, these technological improvements have increased the likelihood of soft memory errors, where arbitrary bits may flip and corrupt the contents of the affected memory cells [63]. Soft memory errors depend not only on manufacturing defects and on power failures, but also on environmental conditions such as cosmic radiation and alpha particles [35,47,63,64]. Although the soft memory error rate in individual memories is still quite low, so as to be neglectable in practice, it is predicted to increase substantially in the near future [8]. Furthermore, soft memory errors pose already several concerns in large-scale applications running on massive data sets. To cite a few, NASA’s Earth Observing System generates Petabytes of data per year, while Google currently reports to be indexing and searching several billions of Web pages. In all applications processing massive data sets, there is an increasing demand for large, fast, and inexpensive memories, which are typically organized in clusters, where the frequency of soft memory errors is much larger. Indeed as the memory size becomes larger, the mean time between failures decreases considerably: assuming standard soft error rates for the internal memories currently available on the
This work has been partially supported by the 7th Framework Programme of the EU (Network of Excellence “EuroNF: Anticipating the Network of the Future - From Theory to Design”) and by MIUR, the Italian Ministry of Education, University and Research, under Project AlgoDEEP.
T. Calamoneri and J. Diaz (Eds.): CIAC 2010, LNCS 6078, pp. 13–24, 2010. c Springer-Verlag Berlin Heidelberg 2010
14
G.F. Italiano
market [63], a system with Terabytes of memory (e.g., a cluster of computers with a few Gigabytes per node) could experience one bit error every few minutes. There are other scenarios in which soft memory errors may have already a significant impact. Indeed a faulty memory may cause a variety of problems in secure applications, which in some cases can also pose very serious threats, such as breaking cryptographic protocols [10,12,66], taking control over a Java Virtual Machine [34] or breaking smart cards and cryptographic protocols [2,3,7,60]. Most of these fault-based attacks work by manipulating the non-volatile memories of cryptographic devices, so as to induce very timing-precise controlled faults on given individual bits: this forces a cryptographic algorithm to output wrong ciphertexts and may allow the attacker to recover the secret key used in the encryption. Differently from the almost random errors affecting the behavior of large size memories, in this context the errors can be considered as introduced by a malicious adversary, which can have some knowledge of the algorithm’s behavior. Since the amount of cosmic rays increases with the altitude, another scenario in which soft memory errors can be of serious concern, and should be modeled in an adversarial worst-case setting, are software applications in avionics and space electronic systems [61]. We stress that even very few memory faults may jeopardize the correctness of the underlying algorithms. Consider for example a simplified scenario, where we are given a set of n keys, to be sorted with a classical sorting algorithm, say, mergesort. It is easy to see that the corruption of a single key is sufficient to make the algorithm output a sequence with Θ(n) keys in a wrong position. Similar phenomena have been observed in practice [36,37]. The classical way to deal with memory faults is via error detection and correction mechanisms, such as redundancy, Hamming codes, etc. These traditional approaches imply non-negligible costs in terms of performance and money, and thus they do not provide a feasible solution when speed and cost are both at prime concern. In the design of reliable systems, when specific hardware for fault detection and correction is not available or is too expensive, it makes sense to look for a solution to these problems at the application level, i.e., to design algorithms and data structures that are able to perform the tasks they were designed for, even in the presence of unreliable or corrupted information.
2
Related Work
Dealing with unreliable information has been addressed in a variety of different settings, and the problem of computing with unreliable information or in the presence of faulty components dates back to the 50’s [65]. Due to the heterogeneous nature of faults (e.g., permanent or transient) and to the large variety of components that may be faulty in computer platforms (e.g., processors, memories, network nodes or links), many different models have been proposed in the literature. In the software community, the main focus has been on ensuring that code runs as expected, anticipating critical errors caused by hardware errors and malicious
Resilient Algorithms and Data Structures
15
attacks. In this framework, it is imperative to detect errors, which can be done by means of techniques such as assertions [57], control flow checking [1], procedure duplication [54], and automatically correcting heap-based memory errors [49]. We next briefly survey some models that have been considered in the theoretical computer science community, and relate them to the faulty-memory RAM considered in this paper. The liar model. Two-person games in the presence of unreliable information have been the subject of extensive research since R´enyi [58] and Ulam [62] posed the following “twenty questions problem”: Two players, Paul and Carole, are playing the game. Carole thinks of a number between one and one million, which Paul has to guess by asking up to twenty questions with binary answers. How many questions does Paul need to get the right answer if Carole is allowed to lie once or twice? Many subsequent works have addressed the problem of searching by asking questions answered by a possibly lying adversary [4,13,24,26,41,48,51,52]. These works consider questions of different formats (e.g., comparison questions or general yes-no questions such as “Does the number belong to a given subset of the search space?”) and different degrees of interactivity between the players (in the adaptive framework, Carole must answer each question before Paul asks the next one, while in the non-adaptive framework all questions must be issued in one batch). We remark that the problem of finding optimal searching strategies has strong relationships with the theory of error correcting codes. Furthermore, different kinds of limitations can be posed on the way Carole is allowed to lie: e.g., fixed number of errors, probabilistic error model, or linearly bounded model in which the number of lies can grow proportionally with the number of questions. Even in the very difficult linearly bounded model, searching is now well understood and can be solved to optimality: Borgstrom and Kosaraju [13], improving over [4,24,51], designed an O(log n) searching algorithm. We refer to the excellent survey by Pelc [52] for an extensive bibliography on this topic. Problems such as sorting and selection have instead substantially different bounds. Lakshmanan et al. [43] proved that Ω(n log n + k · n) comparisons are necessary for sorting when at most k lies are allowed. The best known O(n log n) algorithm tolerates only O(log n/ log log n) lies, as shown by Ravikumar in [55]. In the linearly bounded model, an exponential number of questions is necessary even to test whether a list is sorted [13]. Feige et al. [26] studied a probabilistic model and presented a sorting algorithm correct with probability at least (1 − q) that requires Θ(n log(n/q)) comparisons. Lies are well suited at modelling transient ALU failures, such as comparator failures. We remark that, since memory data get never corrupted in the liar model, fault-tolerant algorithms may exploit query replication strategies. This kind of approach does not work in the faulty-memory RAM model. Fault-tolerant sorting networks. Destructive faults have been first investigated in the context of fault-tolerant sorting networks [5,44,45,67], in which comparators
16
G.F. Italiano
can be faulty and can possibly destroy one of the input values. Assaf and Upfal [5] present an O(n log2 n)-size sorting network tolerant (with high probability) to random destructive faults. Later, Leighton and Ma [44] proved that this bound is tight. The Assaf-Upfal network makes Θ(log n) copies of each item, using data replicators that are assumed to be fault-free. We observe that, differently from fault-tolerant sorting networks, the algorithms and data structures that we are going to present use data replication only at a very limited extent, i.e., without increasing asymptotically the space consumption with respect to their non-resilient counterparts. Parallel computing with memory faults. Multiprocessor platforms are even more prone to hardware failures than uniprocessor computers. A lot of research has been thus devoted to deliver general simulation mechanisms of fully operational parallel machines on their faulty counterparts. The simulations designed in [19,20,21,38] are either randomized or deterministic, and operate with constant or logarithmic slowdown, depending on the model (PRAM or Distributed Memory Machine), on the nature of faults (static or dynamic, deterministic or random), and on the number of available processors. The notion of algorithmbased fault tolerance for parallel architectures was introduced in [40] to facilitate fault–tolerant programming in scientific computation. Some of these works also assume the existence of a special fault-detection register that makes it possible to recognize memory errors upon access to a memory location. This is different from the faulty-memory RAM model, where corrupted values are not distinguishable from correct ones. Pointer-based data structures. Unfortunately, many pointer-based data structures are highly non-resilient: losing a single pointer makes the entire data structure unreachable. This problem has been addressed in [6], providing faulttolerant versions of stacks, linked lists, and binary search trees: these data structures have a small time and space overhead with respect to their non-faulttolerant counterparts, and guarantee that only a limited amount of data may be lost upon the occurrence of memory faults. In contrast, in the faulty-memory RAM model correct values cannot get lost. Checkers. Blum et al. [11] considered the following problem: given a data structure residing in a large unreliable memory controlled by an adversary and a sequence of operations that the user has to perform on the data structure, design a checker that is able to detect any error in the behavior of the data structure while performing the user’s operations. The checker can use only a small amount of reliable memory and can report a buggy behavior either immediately after an errant operation (on-line checker) or at the end of the sequence (off-line checker). Memory checkers for random access memories, stacks and queues have been presented in [11], where lower bounds of Ω(log n) on the amount of reliable memory needed in order to check a data structure of size n are also given. In this paper, we survey recent work on resilient algorithms and data structures. The remainder of the paper is organized as follows. In Section 3 we introduce the faulty-memory RAM. In Section 4 we focus on the design and analysis
Resilient Algorithms and Data Structures
17
of resilient fundamental algorithms. In particular, in Section 4.1 we consider the resilient counting problem, while Section 4.2 deals with resilient sorting; Section 4.3 is devoted to resilient searching in a sorted sequence, and Section 4.3 presents resilient dynamic programming. In Section 5 we focus on the design and analysis of resilient data structures. In more details, we consider priority queues in Section 5.1 and resilient search trees in Section 5.2. We conclude with some remarks and open problems in Section 6.
3
The Faulty-RAM Model
In this paper we focus on the faulty-RAM model introduced in [30,33]. In this model, an adaptive adversary can corrupt any memory word, at any time, by overwriting its value. Corrupted values cannot be (directly) distinguished from correct ones. An upper bound δ is given on the total number of memory faults that can occur throughout the execution of an algorithm or during the lifetime of a data structure. We remark that δ is not a constant, but a parameter of the model. The adaptive adversary captures situations like cosmic-rays bursts, memories with non-uniform fault-probability, and hackers’ attacks which would be difficult to be modelled otherwise. The model assumes that there are O(1) safe memory words which cannot be accessed by the adversary, and thus can never get corrupted. The safe memory stores the code of the algorithms / data structure (which otherwise could be corrupted by the adversary), together with a small number of running variables. This assumption is not very restrictive, since typically the space occupied by the code is orders of magnitude smaller than the space taken by data: hence one can usually afford the cost of storing the code in a smaller, more expensive and more reliable memory. We remark that a constant-size reliable memory may even not be sufficient for a recursive algorithm to work properly: parameters, local variables, return addresses in the recursion stack may indeed get corrupted. A natural approach to the design of algorithms and data structures in the faulty-RAM model is data replication. Informally, a resilient variable consists of (2δ + 1) copies x1 , x2 ,. . ., x2δ+1 of a standard variable. The value of a resilient variable is given by the majority of its copies (which can be computed in linear time and constant space [14]). Observe that the value of x is reliable, since the adversary cannot corrupt the majority of its copies. The approach above induces a Θ(δ) multiplicative overhead in terms of both space and running time. For example, a trivially-resilient implementation of a standard dictionary based on balanced binary search trees would require O(δn) space and O(δ log n) time for each search, insert and delete operation. Thus, it can tolerate only O(1) memory faults while maintaining optimal time and space asymptotic bounds. This type of overhead seems unavoidable, especially if we insist on computing a totally correct output (even on corrupted data). For example, with less than 2δ+1 copies of a key, we cannot avoid that its correct value gets lost. Since a Θ(δ) multiplicative overhead could be unacceptable in several applications even for small values of δ, we could relax the definition of correctness, by requiring that
18
G.F. Italiano
algorithms/data structures be consistent only with respect to the uncorrupted data. For example, we might accept that the keys which get corrupted possibly occupy a wrong position in the sorted output sequence, provided that at least all the remaining keys are sorted correctly. In this framework, we say that an algorithm or data structure is resilient to memory faults if, despite the corruption of some memory location during its lifetime, it is nevertheless able to operate correctly (at least) on the set of uncorrupted values. Of course, every triviallyresilient algorithm is also resilient. However, there are resilient algorithms for some natural problems which perform much better than their trivially-resilient counterparts. We stress that the algorithms and data structures that we are going to present might not always be able to detect faulty behaviors: nonetheless, they are able to operate correctly on the uncorrupted data.
4 4.1
Resilient Algorithms Resilient Counting
In [17], Brodal et al. consider the problem of maintaining resilient counters. In particular, a resilient counter with additive error γ is a data structure subject to an increment operation and a query operation. The query operation returns an integer in the range [v−γ, v+γ], with v being the number of increment operations preceding the query. They show that any resilient counter with non-trivial additive error must use Ω(δ) space, that a deterministic query operation requires Ω(δ) time, and provide several deterministic and randomized data structures with different trade-offs for increment time, query time and additive error γ. 4.2
Resilient Sorting
In [31,33], the resilient sorting problem is considered. Here, we are given a set K of n keys. A key is a finite (possibly negative) real value. We call a key faithful if it is never corrupted, and faulty otherwise. The problem is to compute a faithfully sorted permutation of K, that is a permutation of K such that the subsequence induced by the faithful keys is sorted. This is the best one can hope for, since the adversary can corrupt a key at the very end of the algorithm execution, thus making faulty keys occupy wrong positions. This problem can be trivially solved in O(δ n log n) time. In [33], an O(n log n + δ 3 ) time algorithm is described together with a Ω(n log n + δ 2 ) lower bound. A sorting algorithm ResSort with optimal O(n log n + δ 2 ) running time is later presented in [31]. This result implies √ that one can sort resiliently in optimal O(n log n) time while tolerating up to O( n log n) memory faults. In the special case of polynomiallybounded integer keys, an improved running time of O(n+δ 2 ) can be achieved [31]. In [27] an experimental study of resilient sorting algorithms is presented. The experiments show that a careful algorithmic design can have a great impact on the performance and reliability achievable in practice.
Resilient Algorithms and Data Structures
4.3
19
Resilient Searching
The resilient searching problem is studied in [31,33]. Here we are given a faithfully sorted sequence K of n keys, and a search key κ. The problem is to return a key (faulty or faithful) of value κ, if K contains a faithful key of that value. If there is no faithful key equal to κ, one can either return no or return a (faulty) key equal to κ. Note that, also in this case, this is the best possible: the adversary may indeed introduce a corrupted key equal to κ at the very beginning of the algorithm, such that this corrupted key cannot be distinguished from a faithful one. Hence, the algorithm might return that corrupted key both when there is a faithful key of value κ (rather than returning the faithful key), and when such faithful key does not exist (rather than answering no). There is a trivial algorithm which solves this problem in O(δ log n) time. A lower bound of Ω(log n + δ) is described in [33] for deterministic algorithms, and later extended to randomized algorithms in [31]. A O(log n+δ 2 ) deterministic algorithm is given in [33]. An optimal O(log n + δ) randomized algorithm ResSearch is provided in [31]. An optimal O(log n + δ) deterministic algorithm is eventually given in [15]. For both resilient sorting and searching, the space usage is O(n). 4.4
Resilient Dynamic Programming
In [18] Caminiti et al. tackle the design of dynamic programming algorithms for a rather general framework that includes problems such as edit distance, longest common subsequence, and sequence alignment. They present algorithms that that are correct with high probability, i.e., obtain exactly the same results as nonresilient algorithms in the absence of memory faults. The proposed algorithms can tolerate a polynomial number of faults while maintaining (asymptotically) the same space and running time as the non-resilient implementations. In particular, for d-dimensional dynamic programming problems with input size bounded by dn, they obtain resilient algorithms having running time of O(nd + δ d+1 ) and space usage of O(nd +nδ). These bounds match the running time and space usage of non-resilient implementations, for any d ≥ 2, as long as δ = O(nd/(d+1) ).
5
Resilient Data Structures
More recently, the problem of implementing resilient data structures has been addressed. 5.1
Resilient Priority Queues
A resilient priority queue maintains a set of elements under the operations insert and deletemin: insert adds an element and deletemin deletes and returns either the minimum uncorrupted value or a corrupted value. Observe that this definition is consistent with the resilient sorting problem discussed in Section 4.2: given a sequence of n elements, inserting all of them into a resilient priority queue and then performing n deletemin operations yields a sequence in
20
G.F. Italiano
which uncorrupted elements are correctly sorted. In [39] Jorgensen et al. present a resilient priority queue that supports both insert and deletemin operations in O(log n + δ) amortized time per operation. Thus, their priority queue matches the performance of classical optimal priority queues in the RAM model when the number of corruptions tolerated is O(log n). An essentially matching lower bound is also proved in [39]: a resilient priority queue containing n elements, with n > δ, must use Ω(log n + δ) comparisons to answer an insert followed by a deletemin. In [27] an experimental study of resilient priority queues is presented. The experiments show that the performance resilient priority queues is quite sensitive to δ, and it degrades substantially with increasing δ. 5.2
Resilient Dictionaries
A resilient dictionary is a dictionary where the insert and delete operations are defined as usual, while the search operation must be resilient as described in Section 4.3. In [32], Finocchi et al. present a resilient dictionary using O(log n+δ 2 ) amortized time per operation. In [15], Brodal et al. present a simple randomized algorithm Rand achieving optimal O(log n + δ) time per operation. Using an alternative, more sophisticated approach, they also obtain a deterministic resilient dictionary Det with the same asymptotic performances. For all the mentioned implementations, the space usage is O(n), which is optimal. An implementation of resilient dictionaries, and a thorough experimental study is contained in [29]. The lessons learned from this experimental evaluation are that the best-known (asymptotically optimal) resilient dictionaries tend to have very large space overheads. More precisely, most of the space used by these data structures is not due to key storage. This might not be acceptable in practice since resilient data structures are meant for applications where a huge amount of data (often of the order of terabytes) has to be stored. By exploiting techniques developed in the context of resilient (static) sorting and searching, in combination with some new ideas, Ferraro Petrillo et al. [29] showed how to design and engineer an alternative implementation of resilient dictionaries which, while still guaranteeing optimal asymptotic time and space bounds, performs much better in terms of memory without compromising the time efficiency.
6
Conclusions
In this paper we have surveyed some recent work related to the design of algorithms and data structures resilient to memory faults. We have considered fundamental algorithmic problems, such as counting, sorting and searching, and the design of basic data structures, such as dictionaries and priority queues. The work on resilient algorithms and data structures has raised many open and perhaps intriguing questions. First, the model itself may need further investigations: indeed, in the simple faulty-memory RAM of [30,33] there are simple problems for which it seems difficult to design efficient algorithms, such as computing the sum of n keys. Is it possible to refine the faulty-memory model in order to take this into account?
Resilient Algorithms and Data Structures
21
Furthermore, the faulty-RAM is a simple variant of the standard RAM model. Since resilient algorithms and data structures appear to be especially important when processing massive data sets in large and inexpensive memories, can we design resilient algorithms for more complex memory hierarchies? Along these lines, the connection between fault-tolerance and I/O-efficiency has been already investigated in [17]. Finally, all the algorithms that we have discussed in this paper make explicit use of an upper bound δ on the number of memory faults: can we obtain (efficient) resilient algorithms that do not assume any a priori knowledge of δ?
Acknowledgments I am indebted to my coauthors Umberto Ferraro Petrillo, Irene Finocchi and Fabrizio Grandoni for many discussions on this topic.
References 1. Abadi, M., Budiu, M., Erlingsson, U., Ligatti, J.: Control-flow integrity. In: Proc. 12th ACM Conference on Computer and Communications Security, pp. 340–353 (2005) 2. Anderson, R., Kuhn, M.: Tamper resistance – a cautionary note. In: Proc. 2nd Usenix Workshop on Electronic Commerce, pp. 1–11 (1996) 3. Anderson, R., Kuhn, M.: Low cost attacks on tamper resistant devices. In: Proc. International Workshop on Security Protocols, pp. 125–136 (1997) 4. Aslam, J.A., Dhagat, A.: Searching in the presence of linearly bounded errors. In: Proc. 23rd STOC, pp. 486–493 (1991) 5. Assaf, S., Upfal, E.: Fault-tolerant sorting networks. SIAM J. Discrete Math. 4(4), 472–480 (1991) 6. Aumann, Y., Bender, M.A.: Fault-tolerant data structures. In: Proc. 37th IEEE Symp. on Foundations of Computer Science (FOCS 1996), pp. 580–589 (1996) 7. Bar-El, H., Choukri, H., Naccache, D., Tunstall, M., Whelan, C.: The Sorcerers Apprentice Guide to Fault Attacks. Proceedings of the IEEE 94(2), 370–382 (2006) 8. Baumann, R.: Soft errors in advanced computer systems. IEEE Design and Test of Computers 22(3), 258–266 (2005) 9. Bentley, J., Sedgewick, R.: Quicksort is optimal. Stanford University (January 2002) (invited talk), http://www.cs.princeton.edu/~ rs/talks/QuicksortIsOptimal.pdf 10. Bl¨ omer, J., Seifert, J.-P.: Fault based cryptanalysis of the Advanced Encryption Standard (AES). In: Wright, R.N. (ed.) FC 2003. LNCS, vol. 2742, pp. 162–181. Springer, Heidelberg (2003) 11. Blum, M., Evans, W., Gemmell, P., Kannan, S., Naor., M.: Checking the correctness of memories. In: Proc. 32th IEEE Symp. on Foundations of Computer Science, FOCS 1991 (1991) 12. Boneh, D., DeMillo, R.A., Lipton, R.J.: On the importance of checking cryptographic protocols for faults. In: Fumy, W. (ed.) EUROCRYPT 1997. LNCS, vol. 1233, pp. 37–51. Springer, Heidelberg (1997) 13. Borgstrom, R.S., Rao Kosaraju, S.: Comparison based search in the presence of errors. In: Proc. 25th STOC, pp. 130–136 (1993)
22
G.F. Italiano
14. Boyer, R., Moore., S.: MJRTY — A fast majority vote algorithm. In: Automated Reasoning: Essays in Honor of Woody Bledsoe, pp. 105–118 (1991) 15. Brodal, G.S., Fagerberg, R., Finocchi, I., Grandoni, F., Italiano, G.F., Jørgensen, A.G., Moruz, G., Mølhave, T.: Optimal Resilient Dynamic Dictionaries. In: Arge, L., Hoffmann, M., Welzl, E. (eds.) ESA 2007. LNCS, vol. 4698, pp. 347–358. Springer, Heidelberg (2007) 16. Brodal, G.S., Jørgensen, A.G., Mølhave, T.: Fault tolerant external memory algorithms. In: Dehne, F., Gavrilova, M., Sack, J.-R., T´ oth, C.D. (eds.) WADS 2009. LNCS, vol. 5664, pp. 411–422. Springer, Heidelberg (2009) 17. Brodal, G.S., Jørgensen, A.G., Moruz, G., Mølhave, T.: Optimal Counting in the Presence of Memory Faults. In: Dong, Y., Du, D.-Z., Ibarra, O. (eds.) ISAAC 2009. LNCS, vol. 5878, pp. 842–851. Springer, Heidelberg (2009) 18. Caminiti, S., Finocchi, I., Fusco, E.G.: Resilient dynamic programming. (2010) (manuscript) 19. Chlebus, B.S., Gambin, A., Indyk, P.: PRAM computations resilient to memory faults. In: van Leeuwen, J. (ed.) ESA 1994. LNCS, vol. 855, pp. 401–412. Springer, Heidelberg (1994) 20. Chlebus, B.S., Gambin, A., Indyk, P.: Shared-memory simulations on a faultymemory DMM. In: Meyer auf der Heide, F., Monien, B. (eds.) ICALP 1996. LNCS, vol. 1099, pp. 586–597. Springer, Heidelberg (1996) 21. Chlebus, B.S., Gasieniec, L., Pelc, A.: Deterministic computations on a PRAM with static processor and memory faults. Fundamenta Informaticae 55(3-4), 285– 306 (2003) 22. Cook, C.R., Kim, D.J.: Best sorting algorithms for nearly sorted lists. Comm. of the ACM 23, 620–624 (1980) 23. Constantinescu, C.: Trends and challenges in VLSI circuit reliability. IEEE micro 23(4), 14–19 (2003) 24. Dhagat, A., Gacs, P., Winkler, P.: On playing “twenty questions” with a liar. In: Proc. 3rd ACM-SIAM Symp. on Discrete Algorithms, SODA 1992, pp. 16–22 (1992) 25. Estivill-Castro, V., Wood, D.: A survey of adaptive sorting algorithms. ACM Comput. Surveys 24, 441–476 (1992) 26. Feige, U., Raghavan, P., Peleg, D., Upfal, E.: Computing with noisy information. SIAM J. on Comput. 23, 1001–1018 (1994) 27. Ferraro-Petrillo, U., Finocchi, I., Italiano, G.F.: The Price of Resiliency: a Case Study on Sorting with Memory Faults. Algorithmica 53(4), 597–620 (2009) 28. Ferraro-Petrillo, U., Finocchi, I., Italiano, G.F.: Experimental Study of Resilient Algorithms and Data Structures. In: Proc. 4th International Symposium on Experimental Algorithms (SEA 2010), Ischia, Italy, May 20-22 (2010) (invited talk) 29. Ferraro-Petrillo, U., Grandoni, F., Italiano, G.F.: Data Structures Resilient to Memory Faults: An Experimental Study of Dictionaries. In: Proc. 4th International Symposium on Experimental Algorithms (SEA 2010), Ischia, Italy, May 20-22 (2010) 30. Finocchi, I., Grandoni, F., Italiano, G.F.: Designing reliable algorithms in unreliable memories. Computer Science Review 1(2), 77–87 (2007) 31. Finocchi, I., Grandoni, F., Italiano, G.F.: Optimal sorting and searching in the presence of memory faults. Theor. Comput. Sci. 410(44), 4457–4470 (2009) 32. Finocchi, I., Grandoni, F., Italiano, G.F.: Resilient search trees. In: Proc. 18th ACM-SIAM Symposium on Discrete Algorithms (SODA 2007), pp. 547–553 (2007)
Resilient Algorithms and Data Structures
23
33. Finocchi, I., Italiano, G.F.: Sorting and searching in faulty memories. Algorithmica 52, 309–332 (2008); Preliminary version in Proc. 36th ACM STOC, pp. 101– 110 (2004) 34. Govindavajhala, S., Appel, A.W.: Using memory errors to attack a virtual machine. In: Proc. IEEE Symposium on Security and Privacy, pp. 154–165 (2003) 35. Hamdioui, S., Al-Ars, Z., Van de Goor, J., Rodgers, M.: Dynamic faults in RandomAccess-Memories: Concept, faults models and tests. Journal of Electronic Testing: Theory and Applications 19, 195–205 (2003) 36. Henzinger, M.: The past, present and future of Web Search Engines. In: D´ıaz, J., Karhum¨ aki, J., Lepist¨ o, A., Sannella, D. (eds.) ICALP 2004. LNCS, vol. 3142, p. 3. Springer, Heidelberg (2004) 37. Henzinger, M.R.: Combinatorial algorithms for web search engines - three success stories. In: ACM-SIAM Symposium on Discrete Algorithms (SODA) (2007) (invited talk) 38. Indyk, P.: On word-level parallelism in fault-tolerant computing. In: Puech, C., Reischuk, R. (eds.) STACS 1996. LNCS, vol. 1046, pp. 193–204. Springer, Heidelberg (1996) 39. Jørgensen, A.G., Moruz, G., Mølhave, T.: Priority queues resilient to memory faults. In: Dehne, F., Sack, J.-R., Zeh, N. (eds.) WADS 2007. LNCS, vol. 4619, pp. 127–138. Springer, Heidelberg (2007) 40. Huang, K.H., Abraham, J.A.: Algorithm-based fault tolerance for matrix operations. IEEE Transactions on Computers 33, 518–528 (1984) 41. Kleitman, D.J., Meyer, A.R., Rivest, R.L., Spencer, J., Winklmann, K.: Coping with errors in binary search procedures. J. Comp. Syst. Sci. 20, 396–404 (1980) 42. Kopetz, H.: Mitigation of Transient Faults at the System Level – the TTA Approach. In: Proc. 2nd Workshop on System Effects of Logic Soft Errors (2006) 43. Lakshmanan, K.B., Ravikumar, B., Ganesan, K.: Coping with erroneous information while sorting. IEEE Trans. on Computers 40(9), 1081–1084 (1991) 44. Leighton, T., Ma, Y.: Tight bounds on the size of fault-tolerant merging and sorting networks with destructive faults. SIAM J. on Comput. 29(1), 258–273 (1999) 45. Leighton, T., Ma, Y., Plaxton, C.G.: Breaking the Θ(nlog2 n) barrier for sorting with faults. J. Comp. Syst. Sci. 54, 265–304 (1997) 46. Lu, C., Reed, D.A.: Assessing fault sensitivity in MPI applications. In: Proc. 2004 ACM/IEEE Conf. on Supercomputing (SC 2004), vol. 37 (2004) 47. May, T.C., Woods, M.H.: Alpha-Particle-Induced Soft Errors In Dynamic Memories. IEEE Trans. Elect. Dev. 26(2) (1979) 48. Muthukrishnan, S.: On optimal strategies for searching in the presence of errors. In: Proc. 5th ACM-SIAM Symp. on Discrete Algorithms (SODA 1994), pp. 680–689 (1994) 49. Novark, G., Berger, E.D., Zorn, B.G.: Exterminator: Automatically correcting memory errors with high probability. Communications of the ACM 51(12), 87– 95 (2008) 50. Panzer-Steindel, B.: Data integrity (April 2007), http://indico.cern.ch/getFile.py/access?contribId=3&sessionId= 0&resId=1&materialId=paper&confId=13797 51. Pelc, A.: Searching with known error probability. Theoretical Computer Science 63, 185–202 (1989) 52. Pelc, A.: Searching games with errors: Fifty years of coping with liars. Theoret. Comp. Sci. 270, 71–109 (2002) 53. Pinheiro, E., Weber, W., Barroso, L.A.: Failure trends in large disk drive populations. In: Proc. 5th USENIX Conference on File and Storage Technologies (2007)
24
G.F. Italiano
54. Pradhan, D.K.: Fault-tolerant computer system design. Prentice-Hall, Inc., Englewood Cliffs (1996) 55. Ravikumar, B.: A fault-tolerant merge sorting algorithm. In: Ibarra, O.H., Zhang, L. (eds.) COCOON 2002. LNCS, vol. 2387, pp. 440–447. Springer, Heidelberg (2002) 56. Reed, D.A., Lu, C., Mendes, C.L.: Reliability challenges in large systems. Future Gener. Comput. Syst. 22(3), 293–302 (2006) 57. Rela, M.Z., Madeira, H., Silva, J.G.: Experimental evaluation of the fail-silent behaviour in programs with consistency checks. In: Proc. 26th Annual International Symposium on Fault-Tolerant Computing, pp. 394–403 (1996) 58. R´enyi, A.: A diary on information theory. J. Wiley and Sons, Chichester (1994); Original publication: Napl´ o az inform´ aci´ oelm´eletr¨ ol, Gondolat, Budapest (1976) 59. Saha, G.K.: Software based fault tolerance: a survey. Ubiquity 7(25), 1 (2006) 60. Skorobogatov, S., Anderson, R.: Optical fault induction attacks. In: Kaliski Jr., B.S., Ko¸c, C ¸ .K., Paar, C. (eds.) CHES 2002. LNCS, vol. 2523, pp. 2–12. Springer, Heidelberg (2003) 61. Taber, A., Normand, E.: Single event upset in avionics. IEEE Transactions on Nuclear Science 40(2), 120–126 (1993) 62. Ulam, S.M.: Adventures of a mathematician. Scribners, New York (1977) 63. Tezzaron Semiconductor. Soft Errors in Electronic Memory – A White Paper (January 2004), http://www.tezzaron.com/about/papers/soft_errors_1_1_secure.pdf 64. Van de Goor, A.J.: Testing semiconductor memories: Theory and practice. ComTex Publishing, Gouda (1998) 65. Von Neumann, J.: Probabilistic logics and the synthesis of reliable organisms from unreliable components. In: Shannon, C., McCarty, J. (eds.) Automata Studies, pp. 43–98. Princeton University Press, Princeton (1956) 66. Xu, J., Chen, S., Kalbarczyk, Z., Iyer, R.K.: An experimental study of security vulnerabilities caused by errors. In: Proc. International Conference on Dependable Systems and Networks, pp. 421–430 (2001) 67. Yao, A.C., Yao, F.F.: On fault-tolerant networks for sorting. SIAM J. on Comput. 14, 120–128 (1985)
An Exact Algorithm for Connected Red-Blue Dominating Set Faisal N. Abu-Khzam1, , Amer E. Mouawad1, and Mathieu Liedloff2 1
Department of Computer Science and Mathematics Lebanese American University Beirut, Lebanon {faisal.abukhzam,amer.mouawad}@lau.edu.lb http://www.csm.lau.edu.lb/fabukhzam 2 Laboratoire d’Informatique Fondamentale d’Orl´eans Universit´e d’Orl´eans 45067 Orl´eans Cedex 2, France
[email protected] http://www.univ-orleans.fr/lifo/Members/Mathieu.Liedloff
Abstract. In the Connected Red-Blue Dominating Set problem we are given a graph G whose vertex set is partitioned into two parts R and B (red and blue vertices), and we are asked to find a connected subgraph induced by a subset S of B such that each red vertex of G is adjacent to some vertex in S. The problem can be solved in O∗ (2n−|B| ) time by reduction to the Weighted Steiner Tree problem. Combining exhaustive enumeration when |B| is small with the Weighted Steiner Tree approach when |B| is large, solves the problem in O∗ (1.4143n ). In this paper we present a first non-trivial exact algorithm whose running time is in O∗ (1.3645n ). We use our algorithm to solve the Connected Dominating Set problem in O∗ (1.8619n ). This improves the current best known algorithm, which used sophisticated run-time analysis via the measure and conquer technique to solve the problem in O∗ (1.8966n ). Keywords: exact algorithms, dominating set, weighted steiner tree.
1
Introduction
Given a graph G = (V, E), the Dominating Set problem asks for a minimum subset of V whose neighborhood is its complement in V . Several variations of this problem have recently become of significant theoretical interest because of their numerous applications. Problems like directed domination, multiple domination, distance domination, independent domination and connected domination are now common in the literature, and illustrate the growing interest and the increasing work on different variants of the domination problem.
This research has been supported in part by the research council of the Lebanese American University.
T. Calamoneri and J. Diaz (Eds.): CIAC 2010, LNCS 6078, pp. 25–36, 2010. c Springer-Verlag Berlin Heidelberg 2010
26
F.N. Abu-Khzam, A.E. Mouawad, and M. Liedloff
The Connected Dominating Set problem (cds) requires that the dominating set induces a connected subgraph. cds received considerable attention lately, due to its applications in wireless ad-hoc networks, in which a connected dominating set is used as an underlying structure for performing various functions. Examples include protocols for location-based routing, multicast/broadcast and energy conservation [1,2]. cds is N P-Complete [3], remains so even when restricted to planar graphs [4], and is not fixed parameter tractable in arbitrary graphs [5]. Most techniques discussed in [1] use approximation algorithms, which is not surprising when the best known exact algorithm has running time in O∗ (1.8966n)1 ([6]) on graphs of order n. In fact, the algorithm proposed in [6] solves the Maximum-Leaf Spanning Tree problem, which is equivalent to cds. In [7], Fomin et al. presented an O∗ (1.94n ) algorithm for a direct solution to the problem, being the first exact algorithm breaking the 2n barrier. In this paper we consider the Connected Dominating Set problem applied to red-blue graphs. A graph G = (V, E) is a red-blue graph whenever the vertex set V is partitioned into two sets R and B. The elements of R and B are called red and blue vertices respectively. A connected red-blue dominating set of G is a subset S of the blue vertices such that S dominates all red vertices of G and the subgraph of G induced by S is connected. The corresponding problem, denoted by crbds, asks to find a connected red-blue dominating set of smallest possible cardinality. crbds can effectively replace the more general cds in a large number of network protocols. Naturally, “powerful” computers in a network (i.e. servers) could be represented by blue nodes, while destination hosts (i.e. laptops) could be represented by red nodes thus making dominating set based routing more efficient. In power management, crbds would be more appropriate than cds since nodes in sleep mode can be mapped to red nodes while blue nodes would preserve the ability of the network to forward messages. Despite the many natural applications of crbds, the problem seems to have been neglected prior to this work. The connectivity property required in both cds and crbds makes them part of the family of non-local problems which are usually harder to solve exactly. Nevertheless, we shall first present an exact algorithm that solves the crbds problem in O∗ (1.3645n) time and polynomial space and then prove that cds is solvable in O∗ (1.8619n) by reduction to crbds.
2
Preliminaries
Throughout this paper we denote by G = (R ∪ B, E) a red-blue graph whose vertex set V = R ∪ B. For a vertex v ∈ B, we denote by NR (v) the set of red neighbors of v. The set NB (v) is defined analogously when v ∈ R. The 1
Throughout this paper we use the modified big-Oh notation that suppresses all polynomially bounded factors. For functions f and g we say f (n) ∈ O∗ (g(n)) if f (n) ∈ O(g(n)poly(n)), where poly(n) is a polynomial.
An Exact Algorithm for Connected Red-Blue Dominating Set
27
Red-Blue Dominating Set problem, henceforth rbds, is defined formally as follows: Given: a red-blue graph G = (R ∪ B, E) and a positive integer k Question: does B have a subset S such that |S| ≤ k and NR (S) = R? rbds is N P-Complete [8], even if the input is restricted to planar graphs [9]. We note here that the technique described in [10] for Dominating Set can also be adopted for rbds and yields a worst-case running time in O∗ (1.2302n). A slightly better asymptotic bound was obtained recently by Rooij et al. in [11]. In this paper, we consider a variant of both cds and rbds, namely crbds, in which the required dominating set induces a connected subgraph. crbds is N P-Complete since it is equivalent to rbds when B, the set of blue vertices, forms a fully connected subset. We shall see that crbds can be reduced to the Weighted Steiner Tree problem (wst), which can be solved in O∗ (2k ) and polynomial space ([12]) where k is the number of terminal nodes (the red nodes in a crbds instances). Our proposed algorithm uses the following “either-or” approach. – While favorable branching rules exist, the algorithm proceeds by applying the branch and reduce paradigm. Favorable branching rules imply that the O∗ (1.3645n) upper bound will never be exceeded. – When the algorithm reaches a search state where favorable branching rules are no longer possible, an instance of the Weighted Steiner Tree problem is generated to solve the remaining part of the problem. This either-or approach can be applied, potentially, to other problems whenever the absence of favorable branching conditions leads to a reduction of the input instance to some manageable size. Wlog, to simplify our algorithm and its analysis, we assume, in the sequel, that: R is an independent set, B is a dominating set of G (otherwise, we have a no instance), and B induces a connected component of G. If G contains distinct blue connected components, the algorithm is applied to each connected component that dominate all red vertices.
3
Reduction to Weighted Steiner Tree
Given a weighted undirected graph G = (V, E), with a weight function w : E → N and a partition {X, Y } of V . The Weighted Steiner Tree problem asks for a minimum-weight subtree of G that connects all the vertices of Y . Elements of Y are termed terminals, while X contains the Steiner nodes. Lemma 1. An arbitrary instance of crbds is reducible to a wst instance where the red vertices are terminal nodes and the blue ones are the Steiner nodes. Proof. Consider G = (R ∪ B, E) an undirected simple red-blue graph with R the independent set of red vertices and B the set of blue vertices. We assign weights to edges of G as follows: each edge {u, v} such that both u and v are in B is assigned a weight w(u, v) = 1, and we set the weight of any other edge to n.
28
F.N. Abu-Khzam, A.E. Mouawad, and M. Liedloff
Let R be the set of terminals when G is considered as an instance of wst and let T be a minimum Steiner Tree of G. We claim that the vertex set of T (V (T )) is a minimum connected red-blue dominating set. To prove this claim we observe the following: – Since R is an independent set and R is the set of terminals, each red vertex is adjacent to a blue vertex in T . Thus V (T ) ∩ B is a red-blue dominating set of G. – Every red vertex is a leaf node in T . Otherwise, some red vertex u would have (at least) two blue neighbors, v and w, in T . Removing one if the two edges, say uv, and connecting v to w via a path of blue vertices (since B is connected), gives a steiner tree of smaller weight (since the weight of any path connecting blue vertices is bounded above by n − 1). Since every red vertex is a leaf node, V (T ) ∩ B is connected. And since every edge that connects internal nodes of T is of weight 1, the number of internal nodes in T is minimum. The current fastest known algorithm for wst has a running time in O∗ (2k ) where k is the number of terminal nodes [12].The algorithm proposed in [12] uses the M¨ obius inversion approach, an extension of the so-called Inclusion-Exclusion principle, to solve the problem in polynomial space and guarantees the same running time. Now let 0 < α < 1 be such that max(2α , 21−α ) is minimized. Then α is 0.5. Accordingly, we distinguish two possible cases: (i) When |B| < αn, then the crbds problem is solvable by exhaustive enumeration of all subsets of B in O∗ (2αn ). (ii) When |B| ≥ αn, then the crbds problem is solvable via the wst algorithm in O∗ (2(1−α)n ). In both cases, the run-time is in O∗ (1.4143n). In the following section, we show how to obtain a better worst-case run-time.
4
An Improved Exact Algorithm
We shall assume the given instance has the following three subsets of vertices: (i) the set D of blue vertices that must belong to an optimum solution, (ii) the set B of remaining blue vertices, and (iii) the set R of red vertices that are yet to be dominated. We refer to elements of D by “dominating vertices.” Once a blue vertex is added to D, its red neighbors are deleted. Moreover, we shall contract an edge if it joins two elements of D. Our algorithm adopts a branch and reduce strategy as long as the following reduction rules and/or favorable branching conditions are detected in a problem instance. In the absence of such conditions, the algorithm uses a Weighted Steiner Tree algorithm as a subroutine denoted by wst(S, T ) where S = B and T = R ∪ D. Solving the wst instance results in connecting all remaining
An Exact Algorithm for Connected Red-Blue Dominating Set
29
isolated vertices in R ∪ D with the minimum number of nodes in B. The algorithm terminates returning the cardinality of the minimum connected red-blue dominating set. The algorithm can be modified easily to return an optimum solution. The following Lemma is needed in the analysis of our algorithm. It does provide us with a breakpoint, as to when to stop branching and apply the wst algorithm. Lemma 2. Let G = (R ∪ B, E) be a red-blue bipartite graph such that: 1. Every blue vertex has degree four or less and every red vertex has degree two or more. 2. For d ∈ {2, 3, 4}, every red vertex of degree d has at most one blue neighbor of degree d while every other blue neighbor has a smaller degree. 3. No two degree-two vertices in R can have a common neighbor in B. 4. When a degree-three vertex and a degree-two vertex in R have a common neighbor in B, the degree-three red vertex can have no degree-three blue neighbor. 5. Every degree-three vertex in R has at most two common neighbors with degree-two red vertices. Whenever all the stated properties are satisfied then |B| ≥ 54 |R|. Proof. Due to space restrictions, the proof of Lemma 2 is omitted here. 4.1
Reduction Rules
We describe reduction rules that are used both as a preprocessing stage and for pruning purposes during our algorithm. 1. If ∃u, v ∈ D such that {u, v} ∈ E, then contract the edge {u, v} and decrement the problem size by one. The soundness of this rule follows from the fact that any subsequent solution must connect any of the two vertices with the rest of the connected dominating set. 2. If ∃u such that u ∈ R and |NB (u)| = 1, then delete u and add its unique blue neighbor to D. Decrement the problem size by one. The soundness of this rule is obvious. 3. If ∃u such that u ∈ D, NB (u) = {v} and D is not a connected dominating set or |D| > 1, then add v to D, contract edge uv and delete NR (v). (Since u cannot be isolated in a solution, and it has only one neighbor in B, then its unique blue neighbor must be added to connect u to the rest of the target dominating set). 4. If ∃{u, v} such that {u, v} ⊆ R and NB (u) ⊆ NB (v) then delete v. This “domination” rule is sound because covering u implies covering v. 5. If |D| > 1 and ∃{u, v} such that u ∈ D, v ∈ R and NB (u) ⊆ NB (v), then delete v. This rule is sound because at least one neighbor of u must be in D, and because the red vertex v is not needed to connect the elements of D in the target solution.
30
4.2
F.N. Abu-Khzam, A.E. Mouawad, and M. Liedloff
Branching Rules
According to the above reduction rules, elements of R ∪ D form an independent set. To make sure the set R is dominated by a connected subset of the blue vertices, our algorithm proceeds until all red vertices are deleted. As for the set D, and due to Reduction Rule 2, we should not have more than one element in D when the algorithm terminates. Whether R is empty or not, elements of the set R ∪ D must be connected by adding a minimum number of blue vertices, which may lead to the use of wst. While contracting edges between elements of D, we must keep track of the number of such elements, being the objective value that we seek to minimize. Therefore, we shall refer to this number by minDS in the pseudo-code of our algorithm. When it comes to branching at a vertex v ∈ B, we consider the neighbors of v that are in R ∪ D. When v is added to an optimum solution, it becomes an element of D and we delete all its red neighbors. Thus, by Reduction Rule 2, we contract the edges between v and its dominating neighbors, which is equivalent to deleting such “independent” neighbors and connecting v to their neighbors in B. In some sense, R and D are indistinguishable when branching at an element v of B, because the problem size is reduced by the number of both red and dominating neighbors of v. We denote by NR∪D (v) the set of neighbors of v belonging to R ∪ D. When none of the reduction rules can be applied, the algorithm “tries” to branch according to seven different cases such that the O∗ (1.3645n) bound on the run-time is not exceeded. Looking at vertices in B, we notice that the regular branching strategy of including or excluding a node from an optimum solution can only be applied to vertices v ∈ B having |NR∪D (v)| ≥ 5. After branching on all such vertices, we are left with a set of vertices in B having bounded degree four with respect to R ∪ D. Since our goal is to minimize the cardinality of R ∪ D (i.e when branching alone does not solve the instance), which is the parameter k for the wst algorithm, we turn our attention to vertices belonging to R ∪ D and their respective neighborhoods in B. Any vertex u ∈ R ∪ D with |NB (u)| ≥ 5 can be ignored because all of its blue neighbors have smaller degree and this structure respects our breaking point criteria. The problematic cases arise when a vertex u ∈ R ∪ D has degree four, three or two since u could have one or more neighbors with equal or greater degree. For every vertex u ∈ R ∪ D having degree d ∈ {2, 3, 4} and at least one neighbor of equal or greater degree, we branch when one of the following rules apply: |NB (u)| = 2∧|NR∪D (NB (u))| ≥ 4, |NB (u)| = 3 ∧ |NR∪D (NB (u))| ≥ 8 or |NB (u)| = 4 ∧ |NR∪D (NB (u))| ≥ 12. The order in which the branching occurs is important for attaining the desired runtime. The algorithm ranks vertices in NB (u) according to their degree (i.e. in decreasing order) and branches accordingly. After every branch, the previously considered vertices can be discarded which further reduces the size of the instance. Additional favorable branching rules are derived when considering degree two vertices in R∪D. Whenever we exclude one of the neighbors of such a vertex the other must automatically be added to an optimum solution to ensure that
An Exact Algorithm for Connected Red-Blue Dominating Set
31
the vertex is dominated. Following the presented rules, we succeed in obtaining a structure where every vertex in R ∪ D of degree d has at most one blue neighbor of degree d while every other blue neighbor has a smaller degree. The soundness of the following branching rules is straightforward: 1. If ∃v such that v ∈ B and |NR∪D (v)| ≥ 5, then we branch with two subproblems: – SU BB11 = ({B \ v}, R, D) deleting v from B. – SU BB12 = ({B\v}, {R\NR(v)}, {D∪v}) deleting five or more neighbors of v from R ∪ D and adding v to D (and, of course, joining v to the blue neighbors of its dominating neighbors). 2. If ∃{u, u } such that {u, u } ⊆ R ∪ D, NB (u) = {v, v }, NB (u ) = {v , v }, and |NR∪D (v)| = |NR∪D (v )| = 1, then we branch with two sub-problems: – SU BB21 = ({B \ v }, {R \ NR (v )}, {D ∪ v }) – SU BB22 = ({B \ {v, v , v }}, {R \ NR (v) ∪ NR (v )}, {D ∪ {v, v }}) (v is deleted, which forces the two other blue vertices to be added to D) 3. If ∃u such that u ∈ R ∪ D, NB (u) = {v, v }, and |NR∪D (v)|+|NR∪D (v )| ≥ 4, then, assuming (w.l.o.g) |NR∪D (v)| ≤ |NR∪D (v )| ≤ 4, we branch with two sub-problems: – SU BB31 = ({B \ v }, {R \ NR (v )}, {D ∪ v }) – SU BB32 = ({B \ {v, v }}, {R \ NR (v)}, {D ∪ v}) 4. If ∃u such that u ∈ R ∪ D, NB (u) = {v, v , v } and |NR∪D (v)|+|NR∪D (v )|+ |NR∪D (v )| ≥ 8, then, assuming |NR∪D (v )| ≤ |NR∪D (v)| ≤ |NR∪D (v )| ≤ 4, we branch with three sub-problems: – SU BB41 = ({B \ v }, {R \ NR (v )}, {D ∪ v }): delete v from B after adding it to D and deleting NR∪D (v ). Note, again, that the neighbors of v in D are deleted due to edge-contraction. – SU BB42 = ({B \ {v, v }}, {R \ NR (v)}, {D ∪ v}) – SU BB43 = ({B \ {v, v , v }}, {R \ NR (v )}, {D ∪ v }) 5. If ∃u such that: u ∈ R ∪ D, NB (u) = {v, v , v , v }, |NR∪D (v )| ≤ |NR∪D (v )| ≤ |NR∪D (v )| ≤ |NR∪D (v)| = 4, and |NR∪D (v)| + |NR∪D (v )| + |NR∪D (v )| + |NR∪D (v )| ≥ 12, then branch with four sub-problems: – SU BB51 = ({B \ v}, {R \ NR (v)}, {D ∪ v}) – SU BB52 = ({B \ {v, v }}, {R \ NR (v )}, {D ∪ v }) – SU BB53 = ({B \ {v, v , v }}, {R \ NR (v )}, {D ∪ v }) – SU BB54 = ({B \ {v, v , v , v }}, {R \ NR (v )}, {D ∪ v }) 6. If ∃{u, u } such that: {u, u } ⊆ R ∪ D, NB (u) = {v, v , v }, NB (u ) = {v, v } (u and u have one common neighbor), |NR∪D (v )| = 3 and |NR∪D (v )| = 2, then we branch with three sub-problems: – SU BB61 = ({B \ v}, {R \ NR (v)}, {D ∪ v}) – SU BB62 = ({B \ {v, v , v }}, {R \ NR (v ) ∪ NR (v )}, {D ∪ {v , v }}) – SU BB63 = ({B\{v, v , v , v }}, {R\NR(v )∪NR (v )}, {D∪{v , v }}) 7. If ∃{u, u , u } such that: {u, u , u } ⊆ R ∪ D, NB (u) = {v, v , v }, NB (u ) = {v, w}, NB (u ) = {v , w }, w = w and |NR∪D (v )| ≥ 2, then we branch with three sub-problems: – SU BB71 = ({B \ v}, {R \ NR (v)}, {D ∪ v}) – SU BB72 = ({B \ {v, v , w}}, {R \ NR (v ) ∪ NR (w)}, {D ∪ {v , w}}) – SU BB73 = ({B \ {v, v , v , w, w }}, {R \ NR(v )∪NR (w)∪NR (w )}, {D ∪ {v , w, w }})
32
4.3
F.N. Abu-Khzam, A.E. Mouawad, and M. Liedloff
The Algorithm
As described above, we could reach a situation where none of the previous branching rules applies and no more reductions are possible. In this case, the algorithm generates and solves a Weighted Steiner Tree instance wst(S, T ). We denote by Generate wst Instance the routine that takes a red-blue graph G and generates an instance of wst, as described in Lemma 1. Algorithm 1. Connected Red-Blue Dominating Set Algorithm: crbds Input: A red-blue graph G = ({R ∪ B}, E) and a set D initially empty. Output: Size of a solution (if any), denoted by minDS, initially 0. if (|R| = 0 ∧ |D| = 1) then return minDS; Apply all reduction rules until none of them can be applied; Take v ∈ B where |N (v) ∩ {R ∪ D}| is maximum; if |N (v) ∩ {R ∪ D}| > 4 then return min{crbds(SU BB11 ), crbds(SU BB12 )}; if BR2 applies then return min{crbds(SU BB21 ),crbds(SU BB22 )}; if BR3 applies then return min{crbds(SU BB31 ),crbds(SU BB32 )}; if BR4 applies then return min{crbds(SU BB41 ),crbds(SU BB42 ),crbds(SU BB43 )}; if BR5 applies then return min{crbds(SU BB51 ),crbds(SU BB52 ),crbds(SU BB53 ),crbds(SU BB54 )}; if BR6 applies then return min{crbds(SU BB61 ),crbds(SU BB62 ),crbds(SU BB63 )}; if BR7 applies then return min{crbds(SU BB71 ),crbds(SU BB72 ),crbds(SU BB73 )}; (S, T ) ← Generate wst Instance(G) return wst(S, T );
The correctness of the algorithm follows easily from the description and soundness of the reduction and branching rules. It is guaranteed to return an optimal solution when one does exist in G.
5
Analysis
We first note that an instance of crbds is solved by either branching only, branching and then solving wst(S, T ) or by solving wst(S, T ) only. The wst instance that results satisfies the following Lemma. Lemma 3. Let G = (R ∪ D ∪ B, E) be the graph that results after applying all the favorable branching rules. Then |R ∪ D| ≤ 4|B|/5. Proof. Let G = (R ∪ D ∪ B, E) be the graph that results after applying all the favorable branching rules. G satisfies the following properties:
An Exact Algorithm for Connected Red-Blue Dominating Set
33
– No vertex in R ∪ D can have less than two blue neighbors in B otherwise the algorithm would have reduced the size of the instance. Therefore, ∀u ∈ R ∪ D we have |NB (u)| ≥ 2. – By the first branching rule (BR1), every vertex of NB (R ∪ D) has degree four or less. – By BR2, we know that no two vertices of degree two in R ∪ D can have a common neighbor in B. – By BR3, every degree-two vertex of R ∪ D has a pendant (degree-one) blue neighbor and another neighbor of degree two at most. – By BR4, every degree-three vertex of R ∪ D having a degree four neighbor in B must also have a pendant neighbor and a degree two (at most) neighbor in B. BR4 also guarantees that any degree three vertex in R ∪ D can have at most two degree three neighbors in B and its third neighbor is pendant. – By BR5, degree four vertices in R ∪ D can have at most two degree four neighbors in B. When a degree four vertex in R ∪ D has two degree four neighbors in B, one of the remaining neighbors is pendant and the other has degree two or less. When a degree four vertex in R ∪ D has one degree four neighbor in B, at least one of the remaining neighbors must have degree two or less. – By BR6, we know that when a degree three and a degree two vertex in R ∪D have a common neighbor in B and the degree three vertex also has a degree three neighbor in B then its third neighbor must be of degree one. – By BR7, every degree three vertex in R∪D can only have two of its neighbors (from B) common with degree two vertices in R ∪ D. In order to apply Lemma 2, we need to make some modifications to the graph. Let Q ⊆ R∪D be the set of all vertices in R∪D identified by one of the following cases: (a) If a degree three vertex u ∈ R ∪ D has a degree four neighbor in B, then u ∈ Q. (b) If a degree three vertex u ∈ R ∪ D has two degree three neighbors in B, then u ∈ Q. (c) If a degree three vertex u ∈ R ∪ D and a degree two vertex v ∈ R ∪ D have a common neighbor in B and u has a degree three neighbor in B, then u ∈ Q. (d) If a degree four vertex u ∈ R ∪ D has two degree four neighbors in B, then u ∈ Q. While Q is not empty, repeat the following steps for each vertex u ∈ Q: 1. 2. 3. 4. 5.
Let v ∈ B denote the neighbor of u of highest degree. Pick from R ∪ D a neighbor of v of highest degree. Denote it by w. Connect the neighbor of u (from B) with lowest degree to w. Delete the edge {v, w}. If (a), (b), (c) and (d) are false, delete u from Q.
The above procedure does not change the number of edges and vertices in the graph and the cardinality of R ∪ D and B is not modified. In the four cases
34
F.N. Abu-Khzam, A.E. Mouawad, and M. Liedloff
((a), (b), (c) and (d)) described above, the neighbor of u with lowest degree will have degree one and the neighbor of v of highest degree must be of degree three or more (from BR3). Thus, the “modified” degree of a vertex in v ∈ B cannot exceed two and no vertex in NR (v) can be of degree less than three. After applying the described procedure, every degree three vertex in R can have no degree four and at most one degree three neighbor in B. Similarly, every degree four vertex in R can have at most one degree four neighbor in B. A degree three vertex in R that has a common neighbor (in B) with a degree two vertex from R can have no degree three neighbor in B. Thus R ∪ D and NB (R ∪ D) induce a bipartite graph satisfying Lemma 2 and |R ∪ D| ≤ 4|B|/5. The proof is now complete. We choose the total number of vertices as a measure for the size of a crbds instance (R, D, B)): n = |R|+|D|+|B|. Let T (n) be the number of sub-problems generated to solve an instance of size n. When we apply any of the reduction rules the size of the problem decreases by at least 1. Consider the case when the algorithm branches. Following the description of crbds we distinguish seven different sub-cases. Thus, based on the reduction procedures and branching, the worst case running time of crbds when only branching is used to solve an instance is bound by: ⎧ T (n − 1) + T (n − 5) ⎪ ⎪ ⎪ T (n − 2) + T (n − 3) ⎪ ⎪ ⎨ T (n − 3) + T (n − 4) + T (n − 4) T (n) ≤ max (1) T (n − 4) + T (n − 4) + T (n − 5) + T (n − 5) ⎪ ⎪ ⎪ ⎪ T (n − 2) + T (n − 5) + T (n − 5) ⎪ ⎩ T (n − 2) + T (n − 4) + T (n − 6)
We conclude that T (n) ≤ αn where α = 1.36443... ≤ 1.3645 is the greatest positive root of the six polynomials induced from the previous equation. Thus the worst case run-time is O∗ (1.3645n) whenever a solution is found without generating a Weighted Steiner Tree instance. The next step would be to consider the run-time when either partial branching occurs and is followed by wst(S, T ) or when no branching or reductions occur and wst(S, T ) returns a solution. In the latter case, D is empty. So in both cases R ∪ D and NB (R ∪ D) induce a bipartite graph that satisfies Lemma 3. It follows that |NB (R ∪ D)| ≥ 54 |R ∪ D|. Hence, whenever wst(S, T ) is called, |T | ≤ 45 |S| (at least) and |T | ≤ 49 n since |S| ≤ n − |T |. By the result obtained in 4 [12], wst(S, T ) runs in O∗ (2|T | ), which is O∗ (2 9 n ) ≡ O∗ (1.3608n). Finally, note that in the branching part of the algorithm the reduction in problem size is due only to vertex deletions. It follows that, when both branching and wst are applied, the run-time is in O∗ (1.3645n1 1.3608n2 ), where n1 is the number of vertices deleted during the branch and reduce phase and n2 = n − n1 . Theorem 1. crbds can be solved exactly by an algorithm whose running time is in O∗ (1.3645n) and uses polynomial space.
An Exact Algorithm for Connected Red-Blue Dominating Set
6
35
An Improved Algorithm for Connected Dominating Set
Next, we show that cds can be solved using our described algorithm for crbds at the cost of doubling the input size. The current best-known algorithm was presented recently in [6] where the authors solve cds by reduction to the MaximumLeaf Spanning Tree problem, in O∗ (1.8966n ). The following reduction to crbds yields a better worst-case run-time. An instance G = (V, E) of cds is transformed into a crbds instance G = (R ∪ B, E ) as follows: – R and B are sets of |V | vertices that are in one-to-one correspondence, each, with V . In other words, there exist r : R → V and b : B → V such that both r and b are bijective. – R is an independent set. – For each pair {u, v} ∈ B, if {b(u), b(v)} ∈ E, then add {u, v} to E . – For each pair {v, w} ∈ R × B, if {r(v), b(w)} ∈ E, then add {v, w} to E . – For each pair {v, w} ∈ R × B, if r(v) = b(w) then add the edge {v, w} to E . In addition, let r and b denote the inverses of r and b, respectively. In other words, r (u) and b (u) are the red and blue images (in G ) of a vertex u ∈ V . Claim: D is a minimum connected red-blue dominating set of G iff b(D) is a minimum connected dominating set of G. Proof. Let D be a connected red-blue dominating set of G . Clearly b(D) is a connected dominating set of G since G [D] = G[b(D)] is connected and r(R) = V . Moreover, |b(D)| = |D|. Conversely, let D be a connected dominating set of G. If we replace D by b (D ) in the modified graph G , then G [b (D )] is connected (by construction) and dominates R since D dominates V and r (V ) = R. Moreover, |b (D )| = |D |. Theorem 2. Connected Dominating Set can be solved exactly by an algorithm whose running time is in O∗ (1.8619n) and uses polynomial space. Proof. Any cds instance G = (V, E) can be reduced to a crbds instance G = (R ∪ B, E ) in polynomial time using the above procedure. Since |R ∪ B| = 2|V |, the running time of our crbds algorithm is bounded above by O∗ (1.36452n ).
7
Conclusion
We showed that the Connected Red-Blue Dominating Set problem is solvable exactly in O∗ (1.3645n) time and polynomial space. Our algorithm starts by applying branch and reduce strategies. Then, when the branching conditions cannot guarantee a desired running time, we transform the instance of crbds into an equivalent instance of the Weighted Steiner Tree problem. In addition, we proved that cds can be solved in O∗ (1.8619n) time and polynomial space by a reduction to crbds, improving the previous result of [6].
36
F.N. Abu-Khzam, A.E. Mouawad, and M. Liedloff
Additional work is needed to determine whether the reduction to wst can be replaced by direct work on the crbds instance, and to make use of the fact that the terminal nodes (or red vertices) form an independent set in the wst instance. Moreover, we note that the use of measure and conquer in the branching phase might not lead to a better run-time since there may be worst-case instances for which favorable branching conditions do not hold.
References 1. Blum, J., Ding, M., Thaeler, A., Cheng, X.: Connected dominating set in sensor networks and manets. In: Handbook of Combinatorial Optimization, vol. B(suppl.), pp. 329–369. Springer, New York (2005) 2. Navid, I.: Data reduction for connected dominating set. Master Thesis, Simon Fraser University (2005) 3. Garey, M., Johnson, D.: Computers and Intractability; A Guide to the Theory of NP-Completeness. W. H. Freeman & Co., New York (1990) 4. Dorn, F., Penninkx, E., Bodlaender, H., Fomin, F.: Efficient exact algorithms on planar graphs: Exploiting sphere cut branch decompositions. In: Proceedings of the 13th Annual European Symposium on Algorithms ESA, pp. 95–106. Springer, Heidelberg (2005) 5. Downey, R., Fellows, M., Stege, U.: Parameterized complexity: A framework for systematically confronting computational intractability. Series in Discrete Mathematics and Theoretical Computer Science DIMACS, pp. 49–99 (1997) 6. Fernau, H., Kneis, J., Kratsch, D., Langer, A., Liedloff, M., Raible, D., Rossmanith, P.: An exact algorithm for the maximum leaf spanning tree problem. In: Proceedings of the 4th International Workshop on Parameterized and Exact Computation IWPEC (2009) 7. Fomin, F., Grandoni, F., Kratsch, D.: Solving connected dominating set faster than 2n . Algorithmica 52(2), 153–166 (2008) 8. Downey, R., Fellows, M., Vardy, A., Whittle, G.: The parametrized complexity of some fundamental problems in coding theory. SIAM J. Comput. 29(2), 545–570 (1999) 9. Alber, J., Bodlaender, H., Fernau, H., Niedermeier, R.: Fixed parameter algorithms for planar dominating set and related problems. In: Halld´ orsson, M.M. (ed.) SWAT 2000. LNCS, vol. 1851, pp. 97–110. Springer, Heidelberg (2000) 10. van Rooij, J., Bodlaender, H.: Design by measure and conquer, a faster exact algorithm for dominating set. In: Proceedings of the 25th International Symposium on Theoretical Aspects of Computer Science STACS, Dagstuhl, Germany. Leibniz International Proceedings in Informatics, vol. 1, pp. 657–668 (2008) 11. van Rooij, J., Nederlof, J., van Dijk, T.: Inclusion/exclusion meets measure and conquer: Exact algorithms for counting dominating sets. In: Fiat, A., Sanders, P. (eds.) ESA 2009. LNCS, vol. 5757, pp. 554–565. Springer, Heidelberg (2009) 12. Nederlof, J.: Fast polynomial-space algorithms using m¨ obius inversion: Improving on steiner tree and related problems. In: Albers, S., Marchetti-Spaccamela, A., Matias, Y., Nikoletseas, S., Thomas, W. (eds.) ICALP 2009. LNCS, vol. 5555, pp. 713–725. Springer, Heidelberg (2009)
Maximizing PageRank with New Backlinks Martin Olsen Center for Innovation and Business Development Institute of Business and Technology Aarhus University Birk Centerpark 15, DK-7400 Herning, Denmark
[email protected]
Abstract. For a given node t in a directed graph G(VG , EG ) and a positive integer k we study the problem of computing a set of k new links pointing to t – so called backlinks to t – producing the maximum increase in the PageRank value of t. This problem is known as Link Building in the www context. We present a theorem describing how the topology of the graph comes in to play when evaluating potential new backlinks. Based on the theorem we show that no FPTAS exists for Link Building under the assumption NP=P and we also show that Link Building is W[1]-hard.
1
Introduction
The founders of Google introduced the PageRank algorithm [1] that computes an estimate of the popularity of each web page based solely on the link structure of the web graph – these estimates are the so called PageRank values. A page will achieve one of the top spots of search results if it has a high PageRank value and matches the search criteria for the actual Google search. For a company it is extremely important that its web page does well in the ranking and Search Engine Optimization (SEO) is a billion dollar industry [2] helping companies to achieve this goal. The problem of obtaining optimal new backlinks in order to achieve good search engine rankings is known as Link Building (a backlink to a page t is a link pointing to t from another page). This paper addresses the problem of identifying new backlinks to t maximizing the PageRank value for t. You might not find it realistic to obtain specific backlinks but Link Building attracts much attention in the SEO literature [3,4,5,6] and leading experts from the SEO industry consider Link Building to be an important aspect of SEO [7]. It should also be noted that there is a market for commercial link analysis software such as LinkScape offering users the ability to ”judge the quality of potential links” to their sites according to a quote from www.seomoz.org/linkscape. There is even professional on line services for buying/selling links with www. textlinkbrokers.com as an example.
Some of the research was carried out visiting NICTA, Sydney, as a PhD student at MADALGO, Department of Computer Science, Aarhus University.
T. Calamoneri and J. Diaz (Eds.): CIAC 2010, LNCS 6078, pp. 37–48, 2010. c Springer-Verlag Berlin Heidelberg 2010
38
M. Olsen
Avrachenkov and Litvak [8] study the effect on PageRank if a given page establishes one or more links to other pages and show that an optimal linking strategy for a page is to establish links only to pages in the community of the page. When Avrachenkov and Litvak speak about a web community they mean ”... a set of Web pages that a surfer can reach from one to another in a relatively small number of steps”. It should be stressed that Avrachenkov and Litvak look for optimal links in {t} × VG for a given page t where VG is the nodes in the directed graph under consideration and that they conclude that t ”... cannot significantly manipulate its PageRank value by changing its outgoing links”. Kerchove et al. [9] study the more general problem of maximizing the sum of PageRank values for a set of pages T by adding links from T × VG . In [10] the author of this paper shows that computing k new links from VG ×VG maximizing the minimum PageRank value for a given set of nodes T is NP-hard. 1.1
Contribution and Outline of the Paper
In this paper we obtain stronger intractability results compared to [10] for computing k new links in VG × {t} maximizing the PageRank value of t which is a natural way to formulate the problem of Link Building from the perspective of a web master – the max-min–formulation in [10] is more artificial. In Sect. 2 we briefly introduce the mathematical background and notation for the paper. In Sect. 3 we develop a theorem expressing among other things how the topology of the graph determines the PageRank potential for a set of backlinks to t. Based on the theorem we show in Sect. 4 that NP=P implies that no FPTAS exists for Link Building and we also show that Link Building is W[1]-hard. In the rest of this section we briefly explain the acronyms PTAS and FPTAS and the complexity classes FPT and W[1]: PTAS and FPTAS: Consider a maximization problem ”arg maxx f (x)” with solution x∗ . A FPTAS (Fully Polynomial Time Approximation Scheme) can compute an x such that f (x) ≥ (1 − ε)f (x∗ ) in time polynomial in 1ε and the size of the instance. Some NP-hard problems allow a FPTAS (for example the Knapsack problem) and some do not. If there is no FPTAS for a problem there is still a chance for a PTAS (Polynomial Time Approximation Scheme) where we can obtain x in polynomial time for any fixed ε. As an example an algorithm 1 with running time n ε counts as a PTAS but not as an FPTAS for a problem with instance size n. FPT and W[1]: We will say that a problem with instance size n involving a parameter k is fixed parameter tractable if it can be solved in time f (k)nc where f is some function and c is independent of k. The class FPT contains the decision problems with this property. We will write A ≤ B if the problem A can be reduced to the problem B preserving fixed parameter tractability in the sense that B ∈ FPT ⇒ A ∈ FPT. Consider the problems VERTEX COVER and INDEPENDENT SET where we have to decide whether a graph contains a vertex cover1 of 1
A vertex cover is a subset of the nodes satisfying that every edge has at least one endpoint in the set.
Maximizing PageRank with New Backlinks
39
size k or an independent set2 of size k respectively. FPT is contained in the complexity class W[1] = {P : P ≤ INDEPENDENT SET}. Even though VERTEX COVER is NP-complete it has been solved for large n and k = 400 [11]. The reason is that VERTEX COVER ∈ FPT with moderate f and c. A corresponding breakthrough is believed to be impossible for INDEPENDENT SET since there is strong evidence in the literature that FPT=W[1] so hardness for W[1] is accepted as evidence that a problem is fixed parameter intractable. According to a recent paper [12] then the currently ”best algorithm” for INDEPENDENT SET runs in time O(n0.792k ) where the exponent of n increases dramatically with k. For more information on FPT and W[1] we refer to [13].
2
Mathematical Background
This section gives the mathematical background for the PageRank algorithm. We refer to [14] for more details on the PageRank algorithm. All vectors throughout this paper are column vectors. Let G(VG , EG ) denote a directed graph and let |VG | = n. The nodes VG and links EG could as an example represent the pages and links in the web graph respectively – multiple links from u to v are treated as one link so G is an unweighted graph. A random surfer visits the nodes in VG according to the following rules: When visiting u the surfer picks a link (u, v) ∈ EG uniformly at random and visits v. If u is a sink – a node not linking to any node – the next node to visit is chosen uniformly at random from VG . The sequence of visited pages is a Finite Markov Chain with state space VG and 1 transition probability matrix P = {puv } given by puv = if (u, v) ∈ EG outdeg(u) and 0 otherwise where outdeg(u) is the out degree of u. If outdeg(u) = 0 then puv = n1 . Now we modify the behavior of the random surfer so that he behaves as described above with probability α < 1 when visiting u but zaps with probability 1 − α to a node v chosen uniformly at random from VG . In this paper we will assume that α is a fixed constant. If E is the matrix with each entry equal to 1 then the transition probability matrix Q for the modified Markov Chain is T i given by Q = 1−α n E + αP . The powers w Q converge to the same probability T distribution π for any initial probability distribution w on VG as i tends to infinity – implying π T Q = π T . The vector π = {πv }v∈VG is known as the PageRank vector and the PageRank value for a node v is the probability that a random surfer visits v after i steps for large i. The matrix I − αP is invertible and entry zuv in Z = (I − αP )−1 is the expected number of visits – preceding the first zapping event – to page v for a random surfer starting at page u [8]. If u = v then the initial visit is also included in the count. The entries in Z induce a sort of distance measure on the nodes in VG : Two nodes u and v that are ”close” to each other will have relatively large entries zuv and zvu . The following identity expresses the connection between π and Z [8] where e is the vector with all entries equal to 1: 2
A set of nodes in a graph is independent if no edge connects two of the nodes.
40
M. Olsen
1−α T e Z . (1) n In this paper we look at the PageRank vector for the graph we obtain if we add a set of links E to G(VG , EG ). We will let π ˜v (E ) denote the PageRank value of v in G(VG , EG ∪ E ). The argument E may be omitted if E is clear from the context. πT =
3
The Effect of Receiving Links
Avrachenkov and Litvak [8] study the effect on PageRank of adding new links with the same origin to the web graph. Avrachenkov and Litvak establish a Theorem that expresses the new PageRank vector π ˜ by means of the “old” PageRank vector π and the “old” version of Z. We present a theorem showing the effect of adding new links pointing to the same page. Without loss of generality we will assume that each of the pages 2 to k + 1 establishes a link to page 1. The techniques used in the proof are similar to the techniques used in [8]. Theorem 1. Let each of the pages 2 to k + 1 create a link to page 1. If π ˜p denotes the updated PageRank value for page p for p ∈ {1, . . . , n} then we have: π ˜p = πp + π2 π3 . . . πk+1 M −1 q . where M = {mij } is a k × k matrix and q is a k-dimensional column vector given by mij = δij ki+1 + zi+1j+1 − αz1j+1 . qi = αz1p − zi+1p + δi+1p . Here ki = outdeg(i) prior to the update and δij = 1 if i = j and 0 otherwise. Theorem 1 shows how to express the increase (or decrease) in the PageRank value for the page p as a product of two factors: Roughly the first factor concerns the PageRank values of the nodes involved and the second factor M −1 q concerns the ”distances” between the nodes involved in the update. Proof. Let ei denote the n-dimensional column vector with a 1 at coordinate i and 0’es elsewhere and e denote the n-dimensional column vector with all 1’es. Let bi denote the k-dimensional column vector with all 0’es except a 1 at coordinate i. Let P˜ denote the updated version of the matrix P . Then we have P˜ = P + ΔP where ΔP =
k+1 i=2
ei
1 (eT − eTi P ) . ki + 1 1
The corresponding change of I − αP is (I − αP˜ ) − (I − αP ) = −αΔP .
Maximizing PageRank with New Backlinks
41
We will use the Woodbury formula [15] to compute Z˜ = (I − αP˜ )−1 – the updated version of Z. In order to do this we find matrices S, T and U with dimensions n × k, k × k and k × n respectively such that −αΔP = ST U . We will use S=−
k+1
ei bTi−1 .
i=2
T =
k+1 i=2
U=
k+1
bi−1 bTi−1
1 . ki + 1
αbi−1 (eT1 − eTi P ) .
i=2
According to the Woodbury formula we have the following Z˜ = Z − ZS(T −1 + U ZS)−1 U Z .
(2)
Since (I − αP )Z = I we have that αP Z = Z − I and consequently UZ =
k+1
bi−1 (αeT1 Z − eTi (Z − I)) .
i=2
Now we can calculate U ZS: U ZS =
k+1 k+1
bi−1 (eTi (Z − I) − αeT1 Z)ej bTj−1
i=2 j=2
=
k+1 k+1
bi−1 (zij − δij − αz1j )bTj−1 .
i=2 j=2
The entry in row i and column j in the k × k matrix M = T −1 + U ZS is mij = δij (ki+1 + 1) + zi+1j+1 − δij − αz1j+1 = δij ki+1 + zi+1j+1 − αz1j+1 . Now we multiply (2) with (1) we get
1−α T e n
from the left and ep from the right. By using
π ˜p = πp − π T SM −1 U Zep .
The i’th entry in the k-dimensional column vector q = U Zep is qi = αz1p − zi+1p + δi+1p . The i’th entry in the k-dimensional row vector −π T S is πi+1 .
In the next section we will use Theorem 1 to prove results on the computational complexity of Link Building.
42
4
M. Olsen
Link Building Is W[1]-Hard and Allows No FPTAS
We now formally define the problem of LINK BUILDING: Definition 1. The LINK BUILDING problem: – Instance: A triple (G, t, k) where G(VG , EG ) is a directed graph, t ∈ VG and k ∈ ZZ + . – Solution: A set S ⊆ VG \ {t} with |S| = k maximizing π ˜t (S × {t}).
2
0.096
1
0.272
8
0.250
0.091
0.060
7
6
3
4
0.085
0.069 5
0.078
(a) The original graph. 2
0.054
0.042 7 1
6
2
0.039
1
0.367
8
0.331
0.042
8
0.375
0.337
0.054
3
0.035
7
4 0.054
5
0.049
0.042
(b) Two optimal new links.
6 0.070
3
4 0.049
5
0.060
(c) Naive solution.
Fig. 1. Link Building examples. The PageRank values for the modified graphs are shown besides the nodes.
Example: Now consider an instance of the LINK BUILDING problem given by the graph in Fig. 1a together with t = 1 and k = 2. In other words we are looking for two optimal sources for links to node 1. The solution S = {4, 6} is shown in Fig. 1b. You might think that the solution would be {6, 7} as shown in Fig. 1c because nodes 6 and 7 are the two most popular nodes in {3, 4, 5, 6, 7} prior to the modification. The nodes {2, 4, 6} is an independent set with relatively low z-values between them making the set a good choice of sources for links to node 1 according to Theorem 1.
Maximizing PageRank with New Backlinks
43
We will show how to embed any regular3 graph in a graph containing a node t such that obtaining links from nodes in an independent set of the regular graph will be optimal for t. All nodes in a regular graph have the same PageRank value and out degree so the z-values become crucial. We just have to make sure that zuv is very big if u and v are neighbors compared to the case where they are not neighbors – this is the intuition for the proof below. To put it more formally we show that no FPTAS for LINK BUILDING exists under the assumption NP=P by reduction from the independent set problem restricted to undirected regular graphs. This problem is known to be NP-complete even for 3-regular graphs [16,17]. We need a couple of definitions to clarify matters: Definition 2. The REGULAR INDEPENDENT SET problem: – Instance: An undirected regular graph H(VH , EH ) and an integer k ≥ 2. – Question: Does H contain an independent set of size k? Definition 3. Let S ∗ be a solution to the LINK BUILDING problem. A FPTAS for the LINK BUILDING problem is an algorithm that given input (G, t, k, ε) computes a feasible solution S to the LINK BUILDING problem satisfying πt (S ∗ × {t}) π ˜t (S × {t}) > (1 − ε)˜ in time polynomial in
1 ε
and the size of (G, t, k).
We now state our first theorem on the computational complexity of LINK BUILDING: Theorem 2. If NP=P then there is no FPTAS for LINK BUILDING. Proof. We show how to solve an instance of the REGULAR INDEPENDENT SET problem in polynomial time if we have a FPTAS to the LINK BUILDING problem at our disposal. Now let the regular graph H(VH , EH ) and the number k ∈ ZZ + represent an instance of the REGULAR INDEPENDENT SET problem and let d denote the degree of all nodes in H. From H(VH , EH ) we now construct the graph G(VG , EG ) shown in Fig. 2 in polynomial time in the following way: 1. The nodes in G are all the nodes in H together with two new nodes named1 2 3 4kx k and r and a clique4 consisting of y nodes with y > 1−α where x = 2d . 1−α2 2. For every node in VH we add links to x − d nodes in the clique. We add the links such that no node in the clique has more than one incoming link from VH (we choose y > (x − d)|VH |). 3. For every edge {u, v} ∈ EH we add two links (u, v) and (v, u) to EG . 4. Finally, we add links (1, r) and (r, 1). 3 4
A regular graph is a graph where all nodes have the same degree. A clique is a set of nodes where all nodes link to all other nodes.
44
M. Olsen
y nodes in a clique x− d links r
x− d links u
v
VH
1
Fig. 2. The graph G(VG , EG )
The graph G is constructed such that one step transitions between the nodes in VH are much more likely to happen compared to transitions of two steps or more. This will make independent sets in H superior sets of sources for links to node 1 since all nodes in VH have the same out degree and PageRank value. The following lemma quantifies the advantage for node 1 for obtaining backlinks from independent sets in H. Lemma 1. Let S1 ⊆ VH be an independent set in H and let S2 ⊆ VG \ {1} be a set with |S1 | = |S2 | = k. If S2 is not an independent set in H then the following holds: π ˜1 (S1 × {1}) − π ˜1 (S2 × {1}) > ρn−1 d−6 k −9 , (3) where n = |VG | and ρ is a positive constant only dependent on α. The proof of Lemma 1 is presented after the proof of Theorem 2 in an attempt to make the structure of the proof of Theorem 2 clear to the reader. Now assume that H contains an independent set of size k. From Lemma 1 we conclude that any solution S ∗ to the LINK BUILDING problem (G, t = 1, k) must be independent and that a constant ρ exists such that the following holds for any feasible solution S which is not an independent set in H: π ˜1 (S × {1}) < (1 − ρn−1 d−6 k −9 )˜ π1 (S ∗ × {1}) .
(4)
This shows that we can decide whether an independent set exists by activating our LINK BUILDING FPTAS with input (G, t = 1, k, ε = ρn−1 d−6 k −9 ) and check whether the solution from the FPTAS is independent. Thus we can solve the REGULAR INDEPENDENT SET problem in polynomial time using the LINK BUILDING FPTAS implying NP=P.
Maximizing PageRank with New Backlinks
45
Before presenting the second theorem on the computational complexity of LINK BUILDING we need to prove Lemma 1 used in the proof of Theorem 2: Proof (Lemma 1). Now we will apply Theorem 1 and examine what happens if we add links to node 1 from an independent set S1 in H and another set S2 both consisting of k nodes. First, we will consider the case where S2 ⊆ VH is a non-independent set in H. In order to align the proof with Theorem 1 we will refer to the nodes in S1 and S2 as nodes 2, 3, . . ., k + 1. According to Theorem 1 we have the following: π ˜1 − π1 = π2 π3 . . . πk+1 M −1 q . (5) Let B = {bij } be the k × k matrix defined by the following identities: bij =
zi+1j+1 zi+1i+1 − 1 if i = j and bii = . x+1 x+1
(6)
Now we have M = (x + 1)(I + B) . If ¯b is an upper bound on the entries in B then it is not hard to show that k s−1¯bs is an upper bound on the entries in B s : 0 ≤ B s ≤ k s−1¯bs E = k −1 (k¯b)s E .
(7)
For S1 we can use the following upper bound: 2 2 1 dα d α2 1 ≤ . (8) x+1 x 1 − α2 x3 1 − α2
Here we use that dα is the probability of following a link and staying in VH x 2 for a random surfer starting in VH . Because S1 is independent then dα is an x upper bound on the probability of reaching j from node i without zapping. We 1 also use that 1 + α2 + α4 + α6 + · · · = 1−α 2 is an upper bound on zjj . We also get an upper bound for S2 : dα 1 d α ¯b2 = 1 ≤ . (9) x + 1 x 1 − α2 x2 1 − α2 2 3 k we have k¯b < 1 and hence we have the following: For x = 2d 1−α2 ¯b1 =
M −1 =
∞
1 1 (I − B + B 2 − B 3 + B 4 − · · ·) = (−1)s B s . x+1 x + 1 s=0
(10)
Now consider a probability distribution w on VG with the same probability mass for each entry corresponding to a node in VH . All entries in wT Qi corresponding to nodes in VH will have the same probability mass for any i because H
46
M. Olsen
is regular. The limiting distribution π T will also have this property. This means that a number β exists such that: π2 π3 . . . πk+1 = βeT . (11) We now use Theorem 1 for p = 1 and get the following identity for q where 1 we use that z11 = 1−α 2 and zi1 = 0 for i ∈ {2, 3, . . . , k + 1}: q=
α e . 1 − α2
(12)
We now insert the results from (10), (11) and (12) in (5): ∞
π ˜1 − π1 =
αβ (−1)s eT B s e . 2 (x + 1)(1 − α ) s=0
(13)
∞ We now use (7) to establish a lower bound of the factor s=0 (−1)s eT B s e for S1 : ∞ ¯b1 k (−1)s eT B s e ≥ k(1−¯b1k−(¯b1 k)3 −(¯b1 k)5 −· · ·) = k 1 − . (14) 1 − (¯b1 k)2 s=0 ∞ We will now develop an upper bound for s=0 (−1)s eT B s e for S2 . There are two nodes u and v in S2 such that (u, v), (v, u) ∈ EG . The probability of reaching v for a random surfer starting at u – preceding the first zapping event – is greater than αx : 1 α 1 α ≥ 2 . (15) bvu , buv ≥ x+1x x 2 Now we can construct the desired upper bound: ∞ s=0
(−1)s eT B s e ≤ k(1 −
1 (buv + bvu ) + (¯b2 k)2 + (¯b2 k)4 + (¯b2 k)6 + · · ·) k
(16)
1 (¯b2 k)2 = k 1 − (buv + bvu ) + . k 1 − (¯b2 k)2 By inserting the lower bound from (14) and the upper bound from (16) in (13) we now conclude that π ˜1 (S1 × {1}) − π ˜1 (S2 × {1}) ≥ ¯b1 k αβ 1 (¯b2 k)2 k (buv + bvu ) − − . (x + 1)(1 − α2 ) k 1 − (¯b2 k)2 1 − (¯b1 k)2 2 3 k For x = 2d we have that (¯b1 k)2 and (¯b2 k)2 are both less than 1−α2 implies the following where we also use (8), (9) and (15):
(17) 1 2
which
Maximizing PageRank with New Backlinks
47
¯b1 k 1 (¯b2 k)2 (buv + bvu ) − − ≥ k 1 − (¯b2 k)2 1 − (¯b1 k)2 1 (buv + bvu ) − 2(¯b2 k)2 − 2¯b1 k ≥ k 2 2 2 d α d α2 1 α 2 −2 k −2 k≥ k x2 x2 1 − α2 x3 1 − α2 1 k −1 x−2 α − α2 d−2 k −3 − α2 k −1 ≥ 2 1 1 k −1 x−2 α − α2 − α2 . 16 2 We now use this inequality together with β > the lower bound in (17):
1−α n
and 2x > x + 1 to replace
˜t (S2 × {t}) ≥ π ˜t (S1 × {t}) − π α(1 − α) −1 −1 1 2 1 2 −1 −2 x n k·k x α− α − α = 2(1 − α2 ) 16 2 α(1 − α) −1 −3 1 1 n x α − α2 − α2 . 2(1 − α2 ) 16 2 which shows that (3) holds. Up till now we have shown that (3) holds if S1 ⊆ VH is an independent set from H and S2 ⊆ VH is not an independent set from H. It is a bit technical but not hard to show that π ˜1 (S1 ×{1}) > π ˜1 (S2 ×{1}) holds if S1 is any subset of VH and S2 ⊆ VG \ {1} is a subset of VG such that |S1 | = |S2 | = k and |S2 ∩ VH | < k. Informally, we show that node 1 should prefer links from VH compared to links from the clique – partly due to the relatively high out degree of the nodes in the clique. This part of the proof is omitted for the sake of brevity. The REGULAR INDEPENDENT SET problem is W[1]-complete [18] so we immediately get the following theorem because k is preserved in the reduction in the proof of Theorem 2 and because the construction of G and the check of independence runs in polynomial time: Theorem 3. If W[1]=FPT then LINK BUILDING is not fixed parameter tractable. Acknowledgments. The author of this paper thanks Joachim Gudmundsson, NICTA, and Gerth Brodal, Aarhus University, for constructive criticism.
48
M. Olsen
References 1. Brin, S., Page, L.: The Anatomy of a Large-Scale Hypertextual Web Search Engine. Computer Networks and ISDN Systems 30, 107–117 (1998) 2. Olsen, P.R.: A Future in Directing Online Traffic. The New York Times (2009), http://www.nytimes.com/2009/01/11/jobs/11starts.html 3. Blankson, S.: SEO. In: How to Optimize your Web Site for Internet Search Engines, Blankson Enterprises Ltd., London (2008) 4. Kent, P.: Search Engine Optimization For Dummies. Wiley, Indianapolis (2006) 5. Ledford, J.L.: Search Engine Optimization Bible. Wiley, Indianapolis (2008) 6. Smith, J.: Get into Bed with Google. The Infinite Ideas Company Limited, Oxford (2008) 7. SEOmoz: Search engine ranking factors 2009 (2009), http://www.seomoz.org/ article/search-ranking-factors 8. Avrachenkov, K., Litvak, N.: The Effect of new Links on Google Pagerank. Stochastic Models 22, 319–331 (2006) 9. de Kerchove, C., Ninove, L., van Dooren, P.: Maximizing PageRank via outlinks. Linear Algebra and its Applications 429, 1254–1276 (2008) 10. Olsen, M.: The Computational Complexity of Link Building. In: Hu, X., Wang, J. (eds.) COCOON 2008. LNCS, vol. 5092, pp. 119–129. Springer, Heidelberg (2008) 11. Cheetham, J., Dehne, F., Rau-chaplin, A., Stege, U., Taillon, P.J.: Solving Large FPT Problems on Coarse Grained Parallel Machines. Journal of Computer and System Sciences 67, 691–706 (2002) 12. Chen, J., Meng, J.: On Parameterized Intractability: Hardness and Completeness. Comput. J. 51, 39–59 (2008) 13. Downey, R., Fellows, M.: Parameterized Complexity. Springer, New York (1999) 14. Langville, A.N., Meyer, C.D.: Google’s PageRank and Beyond: The Science of Search Engine Rankings. Princeton University Press, Princeton (2006) 15. Harville, D.A.: Matrix Algebra From a Statistician’s Perspective. Springer, Heidelberg (1997) 16. Elias, I.: Settling the Intractability of Multiple Alignment. Technical Report TRITA-NA-0316, Nada, KTH (2003) 17. Garey, M., Johnson, D.: Computers and Intractability: A Guide to the Theory of NP-Completeness. W. H. Freeman, New York (1979) 18. Cai, L.: Parameterized Complexity of Cardinality Constrained Optimization Problems. Comput. J. 51, 102–121 (2008)
Enumerating Rooted Graphs with Reflectional Block Structures Bingbing Zhuang and Hiroshi Nagamochi Graduate School of Informatics, Kyoto University {zbb,nag}@amp.i.kyoto-u.ac.jp
Abstract. In this paper, we consider an arbitrary class H of rooted graphs such that each biconnected component is given by a representation with reflectional symmetry, which allows a rooted graph to have several different representations, called embeddings. We give a general framework to design algorithms for enumerating embeddings of all graphs in H without repetition. The framework delivers an efficient enumeration algorithm for a class H if the class B of biconnected graphs used in the graphs in H admits an efficient enumeration algorithm. For example, for the class B of rooted cycles, we can easily design an algorithm of enumerating rooted cycles so that delivers the difference between two consecutive cycles in constant time in a series of all outputs. Hence our framework implies that, for the class H of all rooted cacti, there is an algorithm that enumerates each cactus in constant time.
1
Introduction
The problem of enumerating (i.e., listing) all graphs with bounded size is one of the most fundamental and important issues in graph theory. One of the common ideas behind efficient enumeration algorithms (e.g., [4,5]) is to define a unique object for each of all objects as its “the parent,” which induces a rooted tree of all objects, called the family tree F , each node in which corresponds to an object. Then all objects can be enumerated one by one according to the depth-first traversal of the family tree F . Objects to be enumerated are often encoded into mathematically tractable representations. For example, a rooted unordered tree is represented by a rooted ordered tree by introducing a total order among the siblings of each vertex in the tree. Hence the representation of a rooted unordered tree has a symmetry around each vertex. In order to enumerate rooted unordered trees as rooted ordered trees without duplication, we choose one of all rooted ordered trees of a rooted unordered tree T as the “canonical representation” of T . Then all canonical representations will be enumerated one by one according to the depthfirst traversal of the family tree in such a way that a new one is generated by attaching a new leaf vertex to the immediately previous output and/or by deleting a few leaf vertices from the previous one (e.g., [3,5]). The algorithms output only a constant-size difference between two consecutive trees in the series T. Calamoneri and J. Diaz (Eds.): CIAC 2010, LNCS 6078, pp. 49–60, 2010. c Springer-Verlag Berlin Heidelberg 2010
50
B. Zhuang and H. Nagamochi
of all canonical representations, achieving a constant time enumeration per each output. Recently, based on the tree enumeration algorithm proposed by Nakano and Uno [4,5], Fujiwara et al. [1] and Ishida et al. [2] presented efficient branch-andbound algorithms for enumerating treelike chemical graphs, whose implementations are available as a web server1. Currently we aim to provide an efficient branch-and-bound algorithm for enumerating chemical graphs for a wider class of graphs than trees such as cacti and outerplanar graphs in our web server. In this paper, we propose a new method that enables us to treat the reflectional symmetry of biconnected components separately from that of the symmetry that arises from the tree-like combination of biconnected components in designing enumeration algorithms. For this, we consider an arbitrary class H of rooted graphs such that each biconnected component is given by a representation with reflectional symmetry, which allows a rooted graph to have several different representations, called “embeddings.” We give a general framework to design of algorithms for enumerating embeddings of all graphs in H. The framework delivers an efficient enumeration algorithm for a class H as long as an efficient enumeration algorithm for the class B of biconnected graphs used in graphs in H is available. For example, for the class B of rooted cycles, we can easily design an algorithm of enumerating rooted cycles that delivers the difference between two consecutive cycles in constant time in a series of all outputs. Hence our framework implies that, for the class H of all rooted cacti, there is an algorithm that enumerates each cactus in constant time [7]. Hence after installing the framework in our web server, we can devote ourselves to development of enumeration algorithms for each class B of biconnected graphs as the server’s building blocks. In fact, combining our recent result on a class of rooted biconnected planar graphs with internally triangulated faces [6], the framework yields an algorithm that enumerates all rooted connected planar graphs with internally triangulated faces can be enumerated in O(1) time per output. A full version of this paper is available as a technical report [7], in which the omitted details can be found.
2
Preliminaries
For two sequences A and B, let A > B mean that A is lexicographically larger then B, and let A ≥ B mean that A > B or A = B. Let A = B mean that B is a prefix of A and A = B, and let A B mean that A > B but B is not a prefix of A. Let A B mean that A = B or A = B, i.e., B is a prefix of A. Throughout the paper, a graph stands for a simple undirected graph, which is denoted by a pair H = (V, E) of a vertex set V and an edge set E. A graph is treated as a label graph in which all vertices receive distinct vertex names unless stated otherwise. The set of vertices and the set of edges of a given graph H are denoted by V (H) and E(H), respectively. 1
http://sunflower.kuicr.kyoto-u.ac.jp/˜ykato/chem/
Enumerating Rooted Graphs with Reflectional Block Structures
51
Rooted Graphs. A graph with a vertex r designated as the root is called a rooted graph or a graph rooted at r. For each biconnected component B of a graph rooted at a vertex r, the root r(B) of B is defined to be the unique vertex v ∈ V (B) closest to r, and treat B as a graph rooted at r(B). Let V (B) denote V (B) − {r(B)}. For a vertex v, let B(v) denote the biconnected component with v ∈ V (B) if any. The depth d(B) of a biconnected component B is defined by the number of biconnected components which edge sets intersect with a simple path from a vertex in V (B) to the root r. Two rooted graphs H1 and H2 are rooted-isomorphic if they admits an isomorphic bijection by which the roots of H1 and H2 correspond each other. Such a bijection is called rooted-isomorphic. Class B of Blocks. In this paper, we define a block to be a rooted biconnected graph with a configuration such as an embedding into the plane. Two blocks are called equivalent if the biconnected graphs of these blocks admit a rootedisomorphic bijection under the configuration, where these biconnected graphs may be a rooted-isomorphic bijection which does not obey the configuration. We assume that, for each block B, either (i) no other block B is equivalent to B under the configuration, where B is called asymmetric or (ii) there is exactly one distinct block B which is equivalent to B, and B and B admit a symmetry of order 2 which is given by an automorphism ψ such that V1 (B) = {ψ(v) | v ∈ V2 (B)} and ψ(v) = v, v ∈ V3 (B) for a partition V1 (B), V2 (B) and V3 (B) of the vertex set V (B). A block B in (ii) is called symmetric. A level of vertices in a block B is an assignment of a positive integer (v) for each vertex in V (B) if it satisfies the following property: (1) For an asymmetric block B, it holds (v) = (u) for every two distinct vertices u, v ∈ V (B); and (2) For a symmetric block B, there is a partition V1 (B), V2 (B) and V3 (B) of V (B) such that the vertices in each Vi receive distinct integers and (v) = (ψ(v)) for all v ∈ V1 (B). Let B denote a set of such blocks. More formally, we assume that a parentchild graph relationship (PB , CB ) is defined over all blocks in B: A block B is called the seed block if it has no parent in B. For each non-seed block B, PB (B ) denotes a block B ∈ B that is defined as the parent of B, and CB (B ) denotes the set of children of B , i.e., blocks B with B = PB (B ). Also assume that there exists signature γ of all blocks in B such that (S1) every two blocks B and B are equivalent under the configuration of B if and only if γ(B) = γ(B ); (S2) there is a parent-child relationship among blocks in B such that no child of a block has less number of vertices than its parent has; and (S3) B contains ˜ Moreover, γ is called monotone with respect to the exactly one seed block B. number of vertices if the followings hold: (S4) for any two blocks B , B ∈ CB (B), B ∈ B, if |V (B )| > |V (B )| then γ(B ) > γ(B ); and (S5) for any block B ∈ B, γ(B ) > γ(B) holds for all children B ∈ CB (B), and |V (B )| > |V (B)|, for all ˜ B ∈ CB (B). We assume that the set of vertices in V (B) of a block B ∈ B is stored in a linked list LIST (B) in the decreasing order with respect to their levels , and that the following procedure NextVertex of reporting the current vertex in LIST (B) is available.
52
B. Zhuang and H. Nagamochi
Procedure. NextVertex(B, κ) Input: A block B and a key value κ ∈ ({1, 2, 3} × Z) ∪ {−∞, ∞}. Output: The vertex name u and key(u) = (side(u), (u)) of the vertex next to the vertex v ∈ V (B) with key(v) = κ in a list LIST (B) of vertices to which a block can be attached, where we choose such a vertex u from V3 (B), V2 (B), V1 (B) in this order and the first such vertex is chosen when κ = −∞; return ∅ if no such a nonroot vertex v of B exists or κ = ∞. We will see that NextVertex(B, κ) is invoked consecutively in our main algorithm, and we can maintain the cell in LIST (B) that was accessed last by a pointer so that the next cell can be accessed in constant time. We also assume that a procedure NextMinChild for returning a block B ∈ B with γ(Bmin ) < γ(B ) ≤ γ(Bmax ) for given blocks Bmin and Bmax is available. Procedure. NextMinChild(B, Bmin , Bmax ) Input: Blocks B, Bmin and Bmax , where possibly Bmax = ∞. Output: The child B ∈ CB (B) with the minimum γ(B ) such that γ(Bmin ) < γ(B ) ≤ γ(Bmax ) (if any) or B = ∅ if no such B exists, where we treat γ(Bmax ) with Bmax = ∞ as ∞. Class H of Rooted Graphs over C. We consider the set H of such rooted graphs in which each biconnected component is represented by a block B ∈ B. In a rooted graph H ∈ H, a block B with r(B) = v is called the child-block of v. For two blocks B and B with r(B ) ∈ V (B) in a rooted graph H ∈ H, we say that B is the parent-block of B and that B is a child-block of B. For two blocks B and B such that r(B ) appears in any path from r(B) to rG , we call B an ancestor-block of B and B an descendant-block of B , where B is an ancestor-block and a descendant-block of itself. Two blocks B and B are called incomparable if B is neither an ancestor-block of B nor a descendant-block of B . Given two incomparable blocks B1 and B2 , we define the least common ancestor lca(B1 , B2 ) of B1 and B2 to be either the common ancestor-block B3 of B1 and B2 such that B1 and B2 are descendant-block of different child-blocks of B3 , or the common root r(B1 ) = r(B2 ) of ancestor-blocks Bi of Bi , i = 1, 2 = B2 . If B1 = B2 , then define lca(B1 , B2 ) to be block B1 . If B1 = B2 with B1 and B1 is an ancestor-block of B2 , then lca(B1 , B2 ) is defined to be the root r(B3 ) ∈ V (B1 ) of the child-block B3 of B1 such that B3 is an ancestor-block of B2 . In this paper, we consider a class H of all embeddings over a class B of blocks; For each block B, we define left/right-assignments V C (B), V L (B) and V R (B) as follows. For the vertex set V3 (B), we always set V C (B) = V3 (B). For the vertex sets V1 (B) and V2 (B), there are two choices, either V L (B) = V1 (B), V R (B) = V2 (B) or V L (B) = V2 (B), V R (B) = V1 (B) (see Fig. 1(c)). For an asymmetric block B ∈ B, let V C (B) = V (B) and V L (B) = V R (B) = ∅. For each vertex v ∈ V (B), define the side side(v) of v in B to be the index i such that v ∈ Vi (B). For convenience, we call a vertex in V L (B) (resp., V R (B) and V C (B)) left (resp., right and central). We assume that V C (B), V L (B) and V R (B) denote subsets of these vertices to which other blocks are allowed to append.
Enumerating Rooted Graphs with Reflectional Block Structures
53
We define the depth δ(v) of a vertex v in a rooted graph H ∈ H to be δ(v) = (d(B), (v)) for the block B of H with v ∈ V (B) and the level (v) of v in B. We say that two rooted graphs H1 , H2 ∈ H are depth-isomorphic if and only if they admit a rooted-isomorphic bijection φ that maps each vertex v ∈ V (H1 ) to a vertex φ(v) ∈ V (H2 ) with δ(φ(v)) = δ(v). We define an embedding of a rooted graph H ∈ H as follows. For each vertex v, let BS[v] denote a sequence (B1 , B2 , . . . , Bk ) of all child-blocks of v such that B1 , B2 , . . . , Bk appear in this order, where we say that B1 , B2 , . . . , Bk appear from left to right. For a symmetric block B in an embedding G, there are two left/right-assignments. An embedding of a rooted graph H ∈ H is specified by sequences BS[v] of cut-vertices in H and left/right-assignments of all symmetric blocks B. A rooted graph H ∈ H may have several different embeddings. Two embeddings G1 and G2 of H1 , H2 ∈ H are equivalent if H1 and H2 are depthisomorphic, i.e., G1 can be obtained from G2 by changing the orderings of blocks in BS[v] for some vertices v and exchanging the left/right-assignments of some symmetric blocks. In this paper, we first give a framework of an algorithm for enumerating all rooted graphs H by generating the “canonical” embeddings of them without duplication, using procedures NextVertex and NextMinChild.
3
Signature of Embeddings
In this section, we define signature σ of embeddings of graphs in H. For an embedding G of a graph H ∈ H, let rG denote the root of H. For a block B, L let Vcut (B) denote the set of cut-vertices of v ∈ V (B). Let Vcut (B) = Vcut (B) ∩ L R C V (B). Similarly for Vcut (B) and Vcut (B). For a block B, a child-block B of B is called a left (resp., right and central) child-block if r(B ) ∈ V L (B) (resp., r(B ) ∈ V R (B) and r(B ) ∈ V C (B)), where V L (B) = V R (B) = ∅. In particular, a left (resp., right and central) child-block Bi of B is called the first left (resp., right and central) child-block if B has no other left (resp., right and central) child-block Bj with j < i. We define the key key(v) of a vertex v ∈ V (B) of a block B in an embedding G to be key(v) = (side(v), (v)) and define a total order among keys by the lexicographical order with the first entry side and the second entry . = ∅ in an embedding G We define the tip t(B) of a block B with Vcut (B) to be the vertex v ∈ Vcut (B) with the smallest key. In other words, tip t(B) is chosen as follows: R R (B) = ∅: Define t(B) to be the right vertex v ∈ Vcut (B) with the smallest (1) Vcut (v); R L L (2) Vcut (B) = ∅ and Vcut (B) = ∅: Define t(B) to be the left vertex v ∈ Vcut (B) with the smallest (v); and R L C (3) Vcut (B) = Vcut (B) = ∅, and Vcut (B) = ∅: Define t(B) to be the central C vertex v ∈ Vcut (B) with the smallest (v).
= ∅, the successor of B is defined to be the For a block B such that Vcut (B) rightmost block in BS[t(B)]. The spine of G is defined to be the sequence of all
54
B. Zhuang and H. Nagamochi
successors starting from the rightmost block B 1 ∈ BS[rG ] by B 1 , B 2 , . . . , B p , where B 1 is the rightmost block in BS[rG ], and each B i (i ≥ 2) is the successor of B i−1 . See Fig. 1(a). The last block B p is called the tip-block of G. The parent-embedding PH (G) of an embedding G is defined as follows. ˜ then 1. If the tip-block B of G is not a block equivalent to the seed block B PH (G) is defined to be the embedding obtained by replacing B with its parent PB (B). 2. Otherwise, PH (G) is defined to be the embedding obtained by removing the vertices in V (B) from G. We introduce a total order π(G) among all blocks in an embedding G as i (G), i = 0, 1, . . . , K − 1 denote the embedfollows. Let G have K blocks, let PH i−1 ding PH (PH (G)). Let π(G) = (B1 , B2 , . . . , BK ), where Bi is the tip-block of K−i (G), i.e., the tip-block of the embedding obtained after repeating removal PH of the tip-block K − i times. The code γ (B) of a block B in G is defined to be γ (B) = (d(B), side(r(B)), (r(B)), γ(B)), where side(r(B)) and (r(B)) are the side and level of a vertex v in the block B(v) and we set side(r(B)) = (r(B)) = 0 if r(B) = rG . The signature σ(G) of an embedding G is defined to be σ(G) = [γ (B1 ), γ (B2 ), . . . , γ (BK )] for the order π(G) = (B1 , B2 , . . . , BK ) of all blocks in G. Observe that ˜ [γ (B1 ), γ (B2 ), . . . , γ (BK−1 )] if BK equivalent to B σ(PH (G)) = [γ (B1 ), γ (B2 ), . . . , γ (BK−1 ), γ (PB (BK ))] otherwise, where δ(r(PB (BK ))) = δ(r(BK )). For two indices i and j (i ≤ j), let σi,j (G) denote the subsequence σi,j (G) = [γ (Bi ), γ (Bi+1 ), . . . , γ (Bj )] for the blocks Bi , Bi+1 , . . . , Bj which appear consecutively in π(G). Let G(B) denote the embedding induced from G by B and all descendant-blocks of B. For a block B, G(B) consists of some blocks Bi , Bi+1 , . . . , Bj that appear in this order in π(G). and let σ(G(B); G) denote σi,j (G). Then signature σ has the following property. Lemma 1. Let G and G be two embeddings of a rooted graph H ∈ H. Then G and G are the same embedding if and only if σ(G) = σ(G ). For each block B ∈ BS[v], G(B) consists of blocks B = Bi , Bi+1 , . . . , Bj which appear consecutively in π(G), and we denote by σ(G(B); G) the subsequence σi,j (G). An embedding G is called left-sibling-heavy at a block B ∈ BS[v] = (B1 , B2 , . . . , Bp ) if B = B1 or σ(G) ≥ σ(G ) holds for the embedding G obtained
Enumerating Rooted Graphs with Reflectional Block Structures
rG
rG
rG v=lca(Bj,Bi)
Bh=lca(Bj,Bi)
rblock(Bj,Bi) t(B1)
B
55
1
V2(Bh) V3(Bh) V1(Bh)
Bi’
Bj’
B2
rblock(Bj,Bi) t(Bp-1) tip-block
Bp (a)
B p-1
Bi
Bj (b)
Bi
Bj (c)
Fig. 1. (a) Spine B 1 , B 2 , . . . , B p ; (b) a block Bj is pre-identical to a block Bi , and lca(Bi , Bj ) is a vertex v; (c) Bj is pre-identical to Bi , and lca(Bi , Bj ) is a block Bh from G by exchanging the order of Bi−1 and Bi = B in BS[v]. We see that an embedding G is left-sibling-heavy at a block Bi ∈ BS[v] = (B1 , B2 , . . . , Bp ) with i ≥ 2 if and only if σ(G(Bi−1 ); G) ≥ σ(G(Bi ); G) [7]. For a symmetric block B in an embedding G, let G/B f denote the flipped embedding of G that is obtained by exchanging the vertex set V R (B) with V L (B); i.e., re-attach all child-blocks B at each vertex u ∈ V R (B) (resp., u ∈ V L (B)) to the vertex u ∈ V L (B) (resp., u ∈ V R (B)) with δ(u ) = δ(u). An embedding G is called left-side-heavy at a symmetric block B ∈ BS[v] if σ(G) ≥ σ(G ) holds for the embedding G = G/B f obtained from G by flipping B. For a block B, let B = Bi , Bi+1 , . . . , Bj be the blocks in G(B) that appear in this order in π(G). Sequence σ(G(B); G) consists of four subsequences: the first one is σi,i (G) = [δ(r(B)), γ(B)], the second σi+1,iC (G), the second σiC +1,iL (G), and the second σiL +1,j (G), Bk with i + 1 ≤ k ≤ iC (resp., iC + 1 ≤ C k ≤ iL and iL + 1 ≤ k ≤ j) is a descendant-block of a vertex u ∈ Vcut L R (resp., u ∈ Vcut and u ∈ Vcut ). We denote these subsequences by σ(B; G), σC (G(B); G), σL (G(B); G), and σR (G(B); G), respectively. Hence σ(G(B); G) = [σ(B; G), σC (G(B); G), σL (G(B); G), σR (G(B); G)]. We define the flipped code γ (B) of γ (B) to be the code obtained from γ (B) by replacing the value of the second entry side = 1 (resp., side = 0) with side = 0(resp., side = 1). Let σL (G(B); G) (resp., σR (G(B); G)) denote the sequence obtained from σL (G(B); G) (resp., σR (G(B); G)) by replacing γ (B ) with γ(B ) for all blocks B such that r(B ) ∈ V (B). Denote σf (G(B); G) = [σ(B; G), σC (G(B); G), σR (G(B); G), σL (G(B); G)]. Then an embedding G is leftside-heavy at a symmetric block B ∈ BS[v] if and only if it holds σL (G(B); G) ≥ σR (G(B); G) [7]. An embedding G is called canonical if it is left-sibling-heavy and left-sideheavy at all symmetric blocks in G.
56
B. Zhuang and H. Nagamochi
Lemma 2. Let G be an embedding of a rooted graph H ∈ H. Then G is canonical if and only if σ(G) is lexicographically maximum among all σ(G ) of embeddings G of H. Lemma 3. For a canonical embedding G, its parent-embedding PH (G) (if any) is a canonical embedding. Let G be an embedding with σ(G) = [γ (B1 ), γ (B2 ), . . . , γ (BK )], where BK is the tip-block of G. Let v be a vertex in G. For a block Bi which has an ancestor-block Bk of Bi with v = r(Bk ), we call each block Bj with k ≤ j ≤ i a pre-block of Bi to v, and define the pre-sequence ps(v, Bi ) of Bi to v to be σk,i−1 (G) = [γ (Bk ), γ (Bk+1 ), . . . , γ (Bi−1 )], where ps(Bh , Bi ) = ∅ if k = i. Let Bh be a block in G. For a block Bi which is a descendant-block of a left (resp., right/central) child-block of Bh , we define the initial ancestor-block Bi of Bi to Bh to be the first left (resp., right/central) child-block of Bh , and call each block Bj with i ≤ j ≤ i a pre-block of Bi to Bh . Define the pre-sequence ps(Bh , Bi ) of Bi to Bh to be σi ,i−1 (G) = [γ (Bi ), γ (Bi +1 ), . . . , γ (Bi−1 )]. A left (resp., right) child-block Ba of a block B is called opposing with a right (resp., left) child-block Bb of B. Let γ (B) γ (B ) mean γ (B) = γ (B ) if block B is opposing with B , and γ (B) = γ (B ) otherwise. For two subsequence σj,k (G) and σj ,k (G), let σj,k (G) σj ,k (G) imply that k − j = k − j ≥ 0 and γ (Bj+i ) γ (Bj +i ), i = 0, 1, . . . , k − j. For a block Bi , a block Bj with j < i incomparable Bi is called pre-identical to Bi if one of the following conditions holds: (i) lca(Bi , Bj ) is a vertex v, ps(v, Bj ) = ps(v, Bi ), and the first pre-blocks of Bi and Bj to v are immediately adjacent siblings at v. See Fig. 1(b). (ii) lca(Bi , Bj ) is a block Bh and ps(Bh , Bj ) ps(Bh , Bi ). See Fig. 1(c). Note that ps(Bh , Bj ) ps(Bh , Bi ) holds only when Bh is symmetric and the initial ancestor-block Bi of Bi (resp., Bj of Bj ) to Bh is a right (resp., left) child-block of Bh . Hence conditions (i) and (ii) can be expressed by ps(lca(Bi , Bj ), Bj ) ps(lca(Bi , Bj ), Bi ). If Bi has a left sibling Bj at v = r(Bi ), then Bj is pre-identical to Bi , where ps(v, Bj ) = ps(v, Bj ) = ∅. In a canonical embedding G, the first right child-block B of a block Bh has an opposing block such as the first left child-block Bj , since otherwise G is not left-side-heavy. Hence Bj is pre-identical to such block Bi . Lemma 4. For a block Bd in a canonical embedding G, let Bc and Bb (b < c < d) be two blocks pre-identical to Bd . Then γ (Bc ) ≥ γ (Bb ) ≥ γ (Bd ) holds. In particular, γ (Bd ) γ (Bc ) implies γ (Bd ) γ (Bb ).
4
Enumeration Algorithm for Class H
An embedding G is called a child-embedding of an embedding G if G = PH (G ). Let CH (G) denote the set of all canonical child-embeddings of an canonical embedding G. We define a family tree FH in which each canonical embedding G is joined to its parent PH (G).
Enumerating Rooted Graphs with Reflectional Block Structures
57
Given an integer n ≥ 2, we design an algorithm ENUMERATE(n) which enumerates all canonical embeddings of graphs in H containing at most n vertices (the details of ENUMERATE can be found in [7]). After creating a new ˜ ∈ B as the first block B1 in an canoniblock equivalent to the seed block B cal embedding G, we generate all canonical child-embeddings G of G by the following recursive procedure GEN(G). Procedure. GEN(G) Input: A canonical embedding G with at most n vertices. Output: All descendent-embeddings of G containing at most n vertices. /* Let π(G) = [B1 , B2 , . . . , BK ], and let (B 1 , B 2 , . . . , B p ) be the spine of G, where B p = BK is the tip-block of G */ LowestBlock; /* Let B h be the lowest block in the spine to which a new block can be appended */ ˜ ≤ n then if |V (G)| + |V (B)| for i = 1, 2, . . . , h do AppendSeed endfor endif; if h = p then ExpandTip endif Supposing that a canonical embedding G is obtained, we give an outline of GEN(G). We easily see that a child-embedding G of G is obtained by appending a new block B to a vertex in a block in the spine of G or by extending the tipblock B p of G to its child B ∈ CB (B p ). We first compute the lowest block B h in the spine of G that contains a vertex to which a new block can be appended to generate a canonical child-embedding of G. Hence GEN(G) consists of three tasks: LowestBlock: the task of finding the lowest block B h , AppendSeed: the task of appending new blocks to all blocks B i , i ≤ h in the spine, and ExpandTip: the task of extending the tip-block B p of G to each of all children B ∈ CB (B p ). Finding Lowest Blocks. To facilitate finding the lowest block B h in LowestBlock, we introduce “competitors” of blocks in an embedding. We define the competitor of a block Bi to be the block Bj pre-identical to Bi which has the smallest index j (< i) among all blocks pre-identical to Bi . A block Bi has no competitor if no block Bj , j < i is pre-identical to Bi . Let G be the embedding obtained from a canonical embedding G by ap˜ ∈ B to a pending a new block B which is equivalent to the seed block B i i vertex v ∈ V (B ) of a block B in the spine of G. We consider when G remains canonical. Since G needs to be the parent-embedding of G , the new block B in G needs to be the tip-block of G . To obtain a correct child-embedding G from G, the vertex v must satisfy key(v) < min{key(u) | Vcut (B i )}, where min{key(u) | Vcut (B p )} = ∞ for the tip-block B p of G. Lemma 5. Let Bj and Bi (j < i) be blocks in the spine of a canonical embedding G. Assume that the child-embedding Gi obtained from G by appending a new seed block to a vertex u ∈ V (B i ). Then the child-embedding Gj obtained from G by
58
B. Zhuang and H. Nagamochi
appending a seed block to any vertex v ∈ V (B j ) satisfying key(v) < min{key(u) | Vcut (B j )} is canonical. Consider the block B h with the smallest h, called the lowest block, to which the seed block can be appended to obtain a canonical child-embedding G , and the maximum key endkeyh of a vertex v ∈ V (B h ) with key(v) ≤ endkeyh to which the seed block can be appended to obtain a canonical child-embedding G . For two incomparable blocks Bi and Bj (i < j), let rblock(Bi , Bj ) be the ancestor-block Bh of Bj with r(Bh ) = lca(Bi , Bj ) if lca(Bi , Bj ) is a vertex; let rblock(Bi , Bj ) be the first right child-block of block lca(Bi , Bj ) otherwise. Lemma 6. Let G be a canonical embedding, and denote π(G) = [B1 , B2 , . . . , BK ], and let (B 1 , B 2 , . . . , B p ) be the spine of G, where B p = BK is the tip-block of G. Assume that B p has the competitor Bj with γ (Bj ) γ (BK ). Let Bl be the parentblock of Bj+1 in G, and let B ∗ be the block in the spine with d(B ∗ ) = d(Bl ). (i) If γ (Bj ) = γ (BK ) and Bj+1 is a left child-block of the symmetric block lca(Bj , BK ), then the lowest block B h is given by B ∗ and endkeyh = (1, (r(Bj+1 ))); (ii) If γ (Bj ) γ (BK ) and Bj+1 is the first right child-block of the symmetric block lca(Bj , BK ), then the lowest block B h is given by the parent-block of B ∗ and endkeyh = key(r(B ∗ )); and (iii) In the other case than (i)-(ii), B h is given by B ∗ and endkeyh = key(r(Bj+1 )). In the other case than (i)-(ii), B h is given by B ∗ and endkeyh = key(r(Bj+1 )). Lemma 7. For a canonical embedding G, let π(G) = [B1 , B2 , . . . , BK ], and let (B 1 , B 2 , . . . , B p ) be the spine of G, where B p = BK is the tip-block of G. Assume that B p has no competitor Bj with γ (Bj ) γ (BK ). Then the lowest block B h is given by the tip-block B p and endkeyh = ∞. Task LowestBlock is attained by computing the lowest block B h and the the maximum key endkeyh according to Lemmas 6 and 7 (see [7] for its description). Extending Tip Blocks. We are ready to examine when the embedding G obtained from G by extending the tip-block B p to one of its child B ∈ CB (B p ) remains canonical. Lemma 8. Let G be the embedding obtained from a canonical embedding G by expanding the tip-block B p to a child B ∈ CB (B p ). Then G is not canonical if and only if B p has the competitor Bj in G and γ(B) > γ(Bj ) holds. By Lemma 8, if B p has the competitor Bj with γ (Bj ) γ (B p ), then the tipblock B p cannot be expanded to generate a canonical embedding. In this case, the lowest block B h is not equal to B p by Lemma 6. On the other hand, B p is the lowest block B h by Lemma 7. Hence we try to expand the tip-block B p only when B h = B p . Based on the above observation, a procedure for ExpandTip is described as follows.
Enumerating Rooted Graphs with Reflectional Block Structures
59
ExpandTip ˜ and Bmax := C(BK ) (let Bmax := ∞ if C(BK ) := ∅) ; Let Bmin := B = ∅ and |V (G)| + |V (B)| ≤ n do while B :=NextMinChild(BK , Bmin , Bmax ) B :=NextMinChild(BK , Bmin , Bmax ); Let G be the embedding obtained from G by replacing BK with B, and output G (or the difference between BK and B); GEN(G ); Bmin := B endwhile Appending New Blocks. To append a new block to the current embedding G, we need to know all vertices to which a new block can be appended one by one. A procedure for AppendSeed can be described as follows. Let B 0 denote an imaginary block which is the parent-block of rG = r(B 1 ) such that V (B 0 ) = {rG } for notational convenience. AppendSeed if i < h then endkeyi := key(r(B i+1 )) for r(B i+1 ) of block B i+1 endif; currentkey := −∞; = ∅ do while NextVertex(B i , currentkey) (v, key(v)) :=NextVertex(B i , currentkey); ˜ Create a new block B which is equivalent to seed block B; Let G be the embedding obtained from G by appending block B to v; Compute the competitor C(B) of the new block B, lca(C(B), B) and rblock(C(B), B) according to Cases-C1 and C2; Output G (or B and v); GEN(G ); currentkey := key(v); if currentkey = endkeyi then currentkey := ∞ /* This terminates the while-loop by NextVertex(B i , ∞) = ∅ */ endif endwhile /* no vertex in B i is left for appending a new block */ We can compute the competitor C(B) of the new block in AppendSeed in O(1) time if we also maintain data lca(C(B), B) and rblock(C(B), B) (see [7] for its details). Finally we consider the entire algorithm ENUMERATE. For the correctness of ENUMERATE, we only need to show that, when GEN(G) terminates a recursive call to avoid generating G with more than n vertices, all descendantembeddings of G with at most n vertices have been enumerated. In GEN(G), ˜ ≤ n. We see that, if task AppendSeed is executed only when |V (G)| + |V (B)| ˜ |V (G)| + |V (B)| > n, then no child-embedding G of G obtained by appending the seed block can have an embedding with at most n vertices due to the monotonicity (S5) of γ. Similarly, ExpandTip terminates expansion of the tip-block once the new expanded block B satisfies |V (G)| + |V (B)| > n. In this case, no child-embedding G of G obtained by expanding the tip-block B p to any other unseen children B ∈ CB , because γ(B ) > γ(B) holds by the listing order of NextMinChild and thereby |V (B )| ≥ |V (B)| > n holds by the monotonicity (S4) of γ.
60
B. Zhuang and H. Nagamochi
It is not difficult to implement ENUMERATE(n) so that each new embedding can be generated in O(Δ) time and O(n) without including the time and space complexity of procedures NextVertex and NextMinChild, where Δ denotes the maximum size between two consecutive outputs. Let T (n) and S(n) denote the time and space complexities of procedures NextVertex and NextMinChild. Then we see that all rooted graphs in H can be enumerated by ENUMERATE(n) in O(T (n)) time in average and in O(S(n) + n) time, where Δ = O(T (n)) is assumed. We can reduce the worst case of time delay between two consecutive outputs to O(T (n)) using the technique of changing the timing of outputs (e.g., [4,5]) so that a canonical embedding G at an odd (resp., even) depth in the family tree FH is output before (resp., after) generating any child of G. Theorem 1. Let B be a class of blocks which admits signature γ monotone with respect to the number of vertices. Then all canonical embeddings of rooted graphs in a class H over B can be enumerated in O(S(n) + n) space and in O(T (n)) time per output. As an immediate application of Theorem 1 is design of an enumeration algorithm for the class H of rooted cacti, since no simple algorithm for rooted cacti is known, but we can design an algorithm for the corresponding block class B, i.e., enumerating rooted cycles. Then Theorem 1 delivers an algorithm for enumerating rooted cacti in O(1) time per output (see [7] for the details).
References 1. Fujiwara, H., Wang, J., Zhao, L., Nagamochi, H., Akutsu, T.: Enumerating tree-like chemical graphs with given path frequency. Journal of Chemical Information and Modeling 48, 1345–1357 (2008) 2. Ishida, Y., Zhao, L., Nagamochi, H., Akutsu, T.: Improved algorithm for enumerating tree-like chemical graphs. In: The 19th International Conference on Genome Informatics, Gold Coast, Australia, December 1-3 (2008); Genome Informatics 21, 53-64 (2008) 3. Li, G., Ruskey, F.: The advantage of forward thinking in generating rooted and free trees. In: Proc. 10th Annual ACM-SIAM Symposium on Discrete Algorithms, pp. 939–940 (1999) 4. Nakano, S., Uno, T.: Efficient generation of rooted trees, NII Technical Report, NII-2003-005 (2003) 5. Nakano, S., Uno, T.: Generating colored trees. In: Kratsch, D. (ed.) WG 2005. LNCS, vol. 3787, pp. 249–260. Springer, Heidelberg (2005) 6. Zhuang, B., Nagamochi, H.: Enumerating rooted biconnected planar graphs with internally triangulated faces, Dept. of Applied Mathematics and Physics, Graduate School of Informatics, Kyoto University, Technical Report 2009-018 (2009) 7. Zhuang, B., Nagamochi, H.: Enumerating rooted graphs with reflectional block structures, Dept. of Applied Mathematics and Physics, Kyoto University, Technical Report 2009-019 (2009)
Improved Approximations for TSP with Simple Precedence Constraints (Extended Abstract) Hans-Joachim B¨ockenhauer1, Ralf Klasing2 , Tobias M¨ omke1 , and Monika Steinov´ a1 1
2
Department of Computer Science, ETH Zurich, Switzerland {hjb,tobias.moemke,monika.steinova}@inf.ethz.ch CNRS - LaBRI - Universit´e Bordeaux 1, 351 cours de la Lib´eration, 33405 Talence cedex, France
[email protected]
Abstract. In this paper, we consider variants of the traveling salesman problem with precedence constraints. We characterize hard input instances for Christofides’ algorithm and Hoogeveen’s algorithm by relating the two underlying problems, i. e., the traveling salesman problem and the problem of finding a minimum-weight Hamiltonian path between two prespecified vertices. We show that the sets of metric worst-case instances for both algorithms are disjoint in the following sense. There is an algorithm that, for any input instance, either finds a Hamiltonian tour that is significantly better than 1.5-approximative or a set of Hamiltonian paths between all pairs of endpoints, all of which are significantly better than 5/3-approximative. In the second part of the paper, we give improved algorithms for the ordered TSP, i. e., the TSP, where the precedence constraints are such that a given subset of vertices has to be visited in some prescribed linear order. For the metric case, we present an algorithm that guarantees an approximation ratio of 2.5 − 2/k, where k is the number of ordered vertices. For near-metric input instances satisfying a β-relaxed triangle inequality, we improve the best previously known ratio to kβ log2 (3k−3) .
1
Introduction
Many practically relevant problems in operations research can be formalized by the means of the traveling salesman problem (TSP) or one of its many generalizations [7]. While the classical TSP asks for an arbitrary minimum-weight Hamiltonian tour in a complete edge-weighted graph, we will consider a class of TSP variants here, where the set of feasible tours is restricted by some precedence constraints, i. e., by demanding that certain vertices have to be visited before certain others. In principle, such precedence constraints can be expressed by an arbitrary partial ordering on the vertices, but we will restrict our attention to two simple special cases here: The first variant we are considering here
The research was partially funded by the ANR-projects “ALADDIN” and “IDEA”, the INRIA project “CEPAGE”, and by SNF grant 200021-109252.
T. Calamoneri and J. Diaz (Eds.): CIAC 2010, LNCS 6078, pp. 61–72, 2010. c Springer-Verlag Berlin Heidelberg 2010
62
H.-J. B¨ ockenhauer et al.
is the well-known path TSP with given endpoints, i. e., the problem of finding a minimum-weight Hamiltonian path between two prespecified endpoints. The second variant is the so-called ordered TSP (k-OTSP) [3] where a linear order on a subset of k vertices is given as part of the input and every feasible solution has to contain these special vertices in the prescribed order. While being one of the hardest problems with respect to approximability in its general formulation [10], the metric TSP is well-known to be approximable within a constant factor of 1.5 due to Christofides’ algorithm [4]. Christofides’ algorithm has been generalized by Hoogeveen [9] to work also for the problem of finding a Hamiltonian path with prespecified endpoints. This generalized algorithm achieves an approximation ratio of 5/3. A different proof for the same result was given by Guttmann-Beck et al. [8]. Both of these upper bounds on the approximability have resisted all attempts of improvement for many years. In this paper, we characterize hard input instances for both algorithms by relating these two problems. We show that the sets of worst-case instances for Christofides’ algorithm and Hoogeveen’s algorithm are disjoint in the following sense: We describe an algorithm that, for any metric input instance, either finds a Hamiltonian tour that is significantly better than 1.5-approximative or a set of Hamiltonian paths between all pairs of endpoints, all of which are significantly better than 5/3-approximative (see Figure 1). This result relates to the design of hybrid algorithms as proposed by Vassilevska et al. [11], as well as to the win/win strategy which is popular for designing parametrized algorithms [6]. Very recently, a similar approach of relating the approximability of different optimization problems has been investigated by Eppstein [5]. For the k-OTSP, we consider both the metric case and the near-metric case where the edge-weights satisfy a β-relaxed triangle inequality, i. e., where, for some β > 1, the edge-weight function c satisfies the condition c({u, v}) ≤ β · (c({u, w})+c({w, v})) for any pairwise distinct vertices u, v, and w. In both cases, we improve the approximability results from [3], where a 2.5 approximation algorithm for the metric case and a ((k + 1) · min{4β 2+log2 (k−1) , 1.5β 3+log2 (k−1) , (β + 1)β 2+log2 (k−1) }) approximation algorithm for the near metric case are presented. Note that for k equal to one or two, any Hamiltonian tour respects the order of the special vertices. For k greater than two, our main results in this part of the paper are as follows: For the metric case, we present an algorithm that guarantees an approximation ratio of 2.5 − 2/k, where k is the number of ordered vertices. For near-metric input instances satisfying a β-relaxed triangle inequality, we improve the approximation ratio to kβ log2 (3k−3) . Due to space limitations, some proofs are omitted in this extended abstract.
2
Preliminaries
In a simple graph G = (V, E), the edges are sets of two vertices. We use, however, a shortened notation. Instead of {u, v}, we simply write an unordered pair uv, where u and v are vertices. For a graph G, we refer to the sets of vertices and edges using V (G) and E(G), respectively. A trail from u to v is a sequence of
Improved Approximations for TSP with Simple Precedence Constraints
63
adjacent edges leading from u to v, where no edge may be used more than once. A trail is uniquely defined by a list of vertices uw1 w2 . . . wi v, where consecutive vertices describe the edges of the trail. We say that w1 . . . wi are the inner vertices. The length of a trail is the number of its edges. A trail, where each vertex is used at most once, is a path. A closed trail, i. e., a trail that starts and ends with the same vertex, is a circuit. A circuit, where each inner vertex is visited only once, is a cycle. In a graph G = (V, E), a Hamiltonian path from u to v is a path of length |V | − 1 from u to v and a Hamiltonian tour is a cycle of length |V |. In a tree T , PT (u, v) denotes the unique path between two vertices u and v. Let [n] denote the set {1, 2, . . . , n}, where n is an integer. A trail of length l respects the order of a tuple (v1 , . . . , vk ) of vertices, if there is an injective mapping f : [k] → [l + 1] such that vi is the f (i)-th vertex of the trail and either f (i) < f (j) for all i < j or f (i) > f (j) for all i < j. A circuit respects the order of a tuple, if there is a vertex v such that starting from v, the corresponding trail respects the order of the tuple. We call a complete graph G = (V, E) with cost function c : E → Q+ metric, if the edge costs satisfy the triangle inequality c(uv) ≤ c(uw) + c(wv) for any pairwise distinct vertices u, v, w ∈ V . The cost of a graph or of a trail is the sum of the costs of its edges. For simplicity, we write c(X) for the cost of X, where X can be a graph or a trail. Given a graph G = (V, E) and a vertex v ∈ / V , we define G+v as (V ∪{v}, E ∪ {vw | w ∈ V }). Furthermore, given two vertices u and v in G, then we define G + uv as (V, E ∪ uv). Note that adding vertices to a complete graph results in a complete graph. A vertex is even or odd, if its degree is even or odd, and a graph is even or odd, if all its vertices are even or odd, respectively. The metric traveling salesman problem, ΔTSP, is the problem of finding a minimum-cost Hamiltonian tour in a complete metric graph. We also consider some variations of the ΔTSP. The metric minimum-cost Hamiltonian path problem in complete graphs, where the two end vertices are fixed, is called ΔHPP2 . The ordered metric traveling salesman problem, k-ΔOTSP, is a generalization of the ΔTSP. As in the ΔTSP, we also search for a Hamiltonian tour in the given graph, but we require additionally that some special vertices appear in a predefined order within the tour. Formally, let G = (V, E) be a complete metric graph with cost function c : E → Q+ , and let (s1 , s2 , . . . , sk ) be a k-tuple of vertices of V . Then the k-ΔOTSP is the problem of finding a minimum-cost Hamiltonian tour in G respecting the order of (s1 , s2 , . . . , sk ). We call the k-ΔOTSP with β-relaxed triangle inequality k-Δβ OTSP. For both problems, k-ΔOTSP and k-Δβ OTSP, we assume without loss of generality that k is greater than two.
3
A Win/Win Strategy for TSP and Hamiltonian Paths
Currently, the algorithm of Christofides [4] has the best proven approximation ratio for the ΔTSP, which is 1.5. A slight modification of that algorithm was shown by Hoogeveen [9] to be 5/3-approximative for the ΔHPP2 . In this section,
64
H.-J. B¨ ockenhauer et al.
rP (G, c, u, v)
1.75 1.7 1.65 1.6 1.55 1.5 1
1.1
1.2
1.3
rC (G, c)
1.4
1.5
Fig. 1. Upper bound on the approximation ratio achieved by Algorithm 1. The horizontal line displays the approximation ratio rP (G, c, u, v) ≤ 5/3 proven in [9].
Algorithm 1. Path and Cycle Input: A complete graph G = (V, E), a metric cost function c : E → Q+ , and two vertices u and v. 1: Compute a minimum spanning tree T in G. 2: Compute a minimum perfect matching MC on the odd vertices of T in G. 3: Compute a minimum perfect matching MP on the odd vertices of the multigraph T + uv in G. 4: Compute an Eulerian tour EC in the multigraph T ∪ MC and an Eulerian path EP in the multigraph T ∪ MP . 5: Shorten EC and EP to a Hamiltonian tour HC and a Hamiltonian path HP respectively. Output: HC and HP .
we show that the two mentioned problems are strongly related: for any given metric graph, either we can find a better approximation than 1.5 for ΔTSP or we can solve the ΔHPP2 better than 5/3-approximatively, whichever endvertices we choose. For this purpose, we present Algorithm 1 which combines Christofides’ and Hoogeveen’s algorithm. Considering Algorithm 1, let rC (G, c) := c(HC )/c(OPTC (G, c)) be the approximation ratio for the computed Hamiltonian tour and let rP (G, c, u, v) := c(HP )/c(OPTP (G, c, u, v)) be the approximation ratio for the computed Hamiltonian path for a given input G, c, u, v, where OPTC (G, c) and OPTP (G, c, u, v) are optimal solutions for the ΔTSP and the ΔHPP2 , respectively. Theorem 1. In Algorithm 1, the approximation ratio rP (G, c, u, v) is at most 1 + 1.5/(2rC (G, c)), independent of the choice of u and v. In particular, only pairs of approximation ratios from the shaded area in Figure 1 are possible. Proof. We distinguish two cases according to the cost of OPTC (G, c) in relation to the cost of OPTP (G, c, u, v). Case I: Suppose that c(OPTC (G, c)) ≤ c(OPTP (G, c, u, v)) holds. Since both OPTC (G, c) and OPTP (G, c, u, v) contain a spanning tree, we conclude that c(T ) ≤ c(OPTC (G, c)) ≤ c(OPTP (G, c, u, v)) holds. Similar as in
Improved Approximations for TSP with Simple Precedence Constraints
u
u
v
u
v
u
v
G w (a)
65
v G
G
w (b)
Fig. 2. The transformation removes the solid lines and inserts the dashed lines. In (a), the dashed lines belong to the computed Eulerian cycle in G and in (b) they belong to the Eulerian cycle in G. The dotted lines in (b) are used for the construction, but they are not part of the solution.
the analysis of Christofides’ algorithm [4], we can also estimate the cost of MP : given a set S containing an even number of vertices from V , we focus on the cycle OPTC (G, c), where the vertices from (V \S) are skipped. Due to the metricity, the formed cycle cannot be more expensive than OPTC (G, c). Furthermore, it contains two edge-disjoint perfect matchings of the vertices from S. Thus, the smaller one is at most half as expensive as OPTC (G, c). Since both MC and MP are minimal perfect matchings of an even number of vertices from V , we conclude that MC as well as MP cost at most c(OPTC (G, c))/2. The remaining steps of the algorithm do not increase the costs of the solutions. Thus, we get a 1.5-approximative solution for both the path and the cycle. Case II: Suppose that c(OPTC (G, c)) > c(OPTP (G, c, u, v)) holds. Instead of directly using Algorithm 1, we first construct an auxiliary algorithm for which we will prove our claim. We will show afterwards that Algorithm 1 is always better than the auxiliary algorithm. Let G = (V , E ) be the complete + be the cost graph G + w, where w is a new vertex, and let c : E → Q function defined by c (e) = c(e) for all e ∈ E, c (wu) = c (wv) = e∈E c(e), and c (wa) = min{c(wu) + c(ua), c(wv) + c(va)} for any a ∈ V − u − v. Note that this way all edges wa are maximal with respect to the metricity (i. e., the resulting graph is metric and the metricity would be violated by any higher cost of wa). ˜ in G First, we give an algorithm that transforms a given Hamiltonian tour H ˜ either into another Hamiltonian tour in G that costs at most c (H) and contains ˜ − c (wu) − wu and wv, or into a Hamiltonian tour in G that costs at most c (H) ˜ there are two edges incident to w. Let wu and wv be these c (wv). In H, edges. Let without loss of generality c(uu ) ≤ c(vu ). The algorithm removes the ˜ If c(vv ) ≤ c(uv ), then the algorithm adds the path edges wu and wv from H. ˜ Otherwise, if c(vv ) > c(uv ), the algorithm adds the path u uv u uwvv to H. ˜ see Figure 2. In both cases, the transformation might result in nodes that to H, are visited more than once. But due to the metricity, the resulting circuit can be easily shortened either to a Hamiltonian tour in G containing wu and wv or to a Hamiltonian tour in G.
66
H.-J. B¨ ockenhauer et al.
Now we will show that the constructed tour is sufficiently cheap. In the algorithm, we assumed that c(uu ) ≤ c(vu ) holds. Thus, c(wu ) = c(wu) + c(uu ). If also c(vv ) ≤ c(uv ) holds, then we analogously get c(wv ) = c(wv) + c(vv ). Otherwise, if c(vv ) > c(uv ), then c(wv ) = c(wu) + c(uv ). In both cases, the shortening of the circuit does not increase its cost. Thus, the path u uwvv or the path u uv fulfils our cost requirements. We conclude that there is an optimal Hamiltonian tour in G that contains wu and wv; the second option of the transformation, which is the Hamiltonian tour in G, would contradict the assumption that c(OPTP (G, c, u, v)) < c(OPTC (G, c)) in G, since OPTP (G, c, u, v) together with wu and wv would form a cheaper Hamiltonian tour. We are now ready to present the main part of our algorithm. We construct a in G using Christofides’ algorithm [4]. Then we transform Hamiltonian tour HA the solution as described above. If it contains wu and wv, we remove these edges and output the remaining graph as HP ; for HC we apply Christofides’ algorithm separately. If the transformation results in a Hamiltonian tour for G, we output that tour as HC and construct HP separately using Hoogeveen’s algorithm [9]. Next, we show that the algorithm fulfils the requirements. Let T be the minimum spanning tree and let M be the minimum perfect matching constructed when applying Christofides’ algorithm on G . The tree T costs at most c(OPTP (G, c, u, v))+ c (wu), since adding the edge wu to OPTP (G, c, u, v) forms a spanning tree of G . For an upper bound on the cost of M , consider the Hamiltonian tour H in G formed by OPTP (G, c, u, v) + wu + wv. Then, due to the metricity, c(M ) ≤ c(OPTP (G, c, u, v))/2 + (c(wu) + c(wv))/2. There fore, the cost of HA is at most 1.5c(OPTP (G, c, u, v)) + 1.5c (wu) + 0.5c (wv) = 1.5c(OPTP (G, c, u, v)) + c (wu) + c (wv). Therefore, in the first case of the transformation, removing wu and wv yields a Hamiltonian path HP of cost at most 1.5c(OPTP (G, c, u, v)). Thus, both HP and HC are 1.5-approximative solutions. In the second case of the transformation, a similar argumentation as in the first case bounds c(HC ) from above by 1.5c(OPTP (G, c, u, v)). Together with the definition of rC (G, c), we get c(OPTC ) = c(HC )/rC (G, c) ≤ 1.5c(OPTP )/rC (G, c). Fact 1. In G , any minimum spanning tree can be decomposed into a minimum spanning tree in G and either the edge wu or the edge wv, since all other edges connecting w are more expensive and, due to the high cost for connecting w, the degree of w is one in any minimum spanning tree. Moreover, we can extend any minimum spanning tree in G to a minimum spanning tree in G by simply adding the edge wu. Let S be the set of odd vertices in T +uv, where T is the minimum spanning tree within G that is formed by removing one edge from T , which exists according to Fact 1. Thus, for any minimum perfect matching M of S in T , there is an Eulerian tour from u to v in T ∪M . The tour OPTC (G, c) contains two edge-disjoint
Improved Approximations for TSP with Simple Precedence Constraints
67
perfect matchings of S in T . Since c(T ) ≤ c(OPTP (G, c, u, v)) holds, we can bound c(HP ) now from above by c(HP ) ≤ c(OPTP (G, c, u, v)) + c (OPTC (G, c)) /2 P (G,c,u,v)) ≤ c(OPTP (G, c, u, v)) + 1.5c(OPT . 2rC (G,c) It remains to show that the solution computed by the algorithm that we used for the analysis costs at least as much as the solution of Algorithm 1. Due to Fact 1, we can assume without loss of generality that the minimum spanning tree computed by the transformation algorithm is T + wu. Thus, in both algorithms, we modify the degrees of the vertices of T , one time in order to obtain an even graph for the cycle and a second time in order to obtain a graph containing a trail from u to v. Due to the metricity, in both cases, without changing the tree we cannot do better than computing a minimum perfect matching on the nodes of wrong degree. Therefore, the result of Algorithm 1 cannot be worse than the result of the algorithm used in the proof. Instead of rP (G, c, u, v), we can consider the parameter c(MP )/c(T ) to distinguish different cases. This way, the analysis of the win/win strategy results in higher approximation ratios, but we know which of the two solutions has an improved approximation ratio.
4
Metric Ordered TSP
Our approximation algorithm for k-ΔOTSP is based on the following idea. We obtain a multigraph by combining a minimum spanning tree and a cycle formed by the ordered vertices (compare [3]). In the cycle, however, we skip the two most expensive edges. Afterwards, we obtain an Eulerian graph by adding a minimum perfect matching on the odd vertices to the multigraph. Within this Eulerian graph, we compute an Eulerian tour that respects the order of the input k-tuple. Finally, we shorten the Eulerian tour in order to obtain a Hamiltonian tour that respects the order of the k-tuple. Theorem 2. Algorithm 2 is a polynomial-time (2.5 − 2/k)-approximation algorithm for k-ΔOTSP, where k is the number of ordered vertices. In the proof of Theorem 2, we show that, due to the degrees of vertices in the considered subgraphs, all paths and cycles constructed within the algorithm must exist and that we can shorten the constructed Eulerian tour without violating the order of t. Finally, we show that the avoided edges e1 and e2 are expensive enough to guarantee the claimed approximation ratio.
5
Near-Metric Ordered TSP
Until now, we focused only on graphs with metric cost function. In fact, our approaches inherently depended on the triangle inequality. Now, in this section, we
68
H.-J. B¨ ockenhauer et al.
Algorithm 2. k-ΔOTSP Input: A complete graph G, a metric cost function c, and a k-tuple t = (s1 , s2 , . . . , sk ) ⊆ V k . 1: Compute a minimum spanning tree T in G. 2: C := s1 s2 . . . sk s1 . 3: Let e1 and e2 be the two most expensive edges of C and let C := C − e1 − e2 . 4: Let P be the path connecting the vertices that are incident to e1 in T . 5: Compute a minimum perfect matching M on the odd vertices in the multigraph A := T ∪ C . 6: Let P be the path connecting the vertices that are incident to e2 in A∪M \(C ∪P ). 7: Starting from the circuit C ∪ P ∪ P , compute an Eulerian tour in A ∪ M that respects the order of t. 8: Shorten the Eulerian tour to a Hamiltonian tour that respects the order of t. Output: The computed Hamiltonian tour.
present an algorithm that computes an approximative solution for k-Δβ OTSP. Figure 3 shows a comparison of our result and the best previously known approximation ratios. In the first step of Algorithm 3, we build a minimum spanning tree T and we arbitrarily choose one vertex r of T as its root. Then, starting with r, we color all vertices except the special vertices s1 , . . . , sk , i. e., those vertices that have to occur in prescribed order in the solution, in a breadth-first-search manner by a coloring function f (v) = (f (nearest colored predecessor) mod k) + 1. From now on, we omit to write colorings modulo k, when it is clear from the context. The values are always in the set [k]. The paths Li in Algorithm 3 connecting the vertices si and si+1 use the coloring for bounding the distance between consecutive vertices of Li from above.
10 9 8 7 6 5 4 3 2 20
1 4
40
β
3
60 80
2
k
1 100
Fig. 3. The graph shows the quotient of the previously best known approximation ratio (k + 1) · min{4β 2+log2 (k−1) , 1.5β 3+log 2 (k−1) , (β + 1)β 2+log2 (k−1) } and the ratio kβ log2 3(k−1) achieved by Algorithm 3, i. e., the improvement achieved by the algorithm
Improved Approximations for TSP with Simple Precedence Constraints
69
Algorithm 3. k-Δβ OTSP Input: A complete graph G = (V, E) with edge weights c : E → Q+ that satisfies the β-relaxed triangle inequality, and a tuple of vertices from V , (s1 , s2 , . . . , sk ). 1: Build a minimum spanning tree T of graph G and choose a root r of T . 2: Define a coloring function f : V \ {s1 , . . . , sk } → [k] as follows. Color r by color 1. Continue with coloring the vertices in breadth-first-search manner: For each vertex u, let v be the nearest ancestor in T that is not in {s1 , . . . , sk }. Color vertex u by the color (f (v) mod k) + 1. 3: For i = 1, 2, . . . , k, let Li be the path formed by PT (si , si+1 ), picking only vertices with color i, starting with si and ending with si+1 . 4: Create new paths L1 , . . . , Lk from L1 , . . . , Lk by including the vertices bypassed by all Li s as shown in Figure 5 and discussed later. 5: Create a cycle C by connecting paths L1 , . . . , Lk . 6: Let T1 , . . . , Tq with roots r1 , . . . , rq be the maximal subtrees of T such that vertices in Ti \ri are not included in C and ri ∈ V (C ). Let e∗i be the cheapest edge incident to ri in Ti . Use procedure HCT3 (refined) from [1] on each pair (Ti , e∗i ) for 1 ≤ i ≤ q to obtain Hamiltonian tours Hi of the vertices of Ti . 7: For 1 ≤ i ≤ q, merge Hi with C in ri using e∗i to construct a Hamiltonian tour H. Output: The Hamiltonian tour H.
Lemma 1. In step 3 of Algorithm 3, at most 3k − 4 edges of T are bypassed between two consecutive vertices of color i while picking vertices for path Li . If we connect the paths L1 , . . . , Lk now, we obtain a cycle C containing each vertex at most once and the special vertices respect the given order. But here, we have the problem that C might not contain all vertices of G. There are two types of vertices not connected to C: 1. vertices in the paths in T between two consecutive special vertices that are bypassed but not used (see the left part of Figure 4). Formally, we define the set of these vertices as W = {v ∈ V |∀i (1 ≤ i ≤ k) v ∈ / V (Li ) ∧ ∃j(1 ≤ j ≤ k) v ∈ V (PT (sj , sj+1 ))}. 2. vertices in subtrees of tree T where no special vertex is located and thus no path is passing this part of the tree (see the right part of Figure 4). Formally Y = {v ∈ V | ∀i(1 ≤ i ≤ k) v ∈ / V (PT (si , si+1 ))}. Now, we show how to merge all of vertices of W into the paths Li , thereby constructing the new paths Li . We process the paths Li in order, starting with L1 . After creating the updated path Li , let Wi be the set of vertices of W that are still not connected to any of the paths, with W0 = W . Processing of the path Li works as follows (see Figure 5). Let xy be an arbitrary edge in Li , and let PT (x, y) = xv1 v2 . . . vz y be the corresponding path in the tree. Let pxy be the maximal index such that for all 1 ≤ j ≤ pxy , vj ∈ Wi−1 . Similarly, let qxy be the minimal index such that ∀j, pxy < qxy ≤ j ≤ z, vj ∈ Wi−1 . If pxy and qxy exist, we remove the edge xy from Li and replace it by the path xv1 v2 . . . vpxy vqxy . . . vz y. In the case when pxy or qxy does not exist, v1 . . . vpxy or vqxy . . . vz is empty. Then we replace xy by xvqxy , . . . , vz y or
70
H.-J. B¨ ockenhauer et al. r
r s2
T si s3
s1
T
s3
v s2
s1
s6
si+1
s5
s4
v
Fig. 4. The triangle denotes tree T , dashed lines denote paths L1 , . . . , Lk and the line between si and si+1 is the path PT (si , si+1 ). The two possible cases where vertex v is not connected to paths Li are shown here. Either vertex v lies on some path PT (si , si+1 ) but was not picked to some path Lj (1 ≤ j ≤ k) (left part) or vertex v is in a subtree where no path Lj is passing (right part).
xv1 . . . vpxy y, respectively. The new path Li is constructed by repeating this process for every edge in Li . We set Wi = Wi−1 \ V (Li ). Note that vertices from Wi that are located between pxy and qxy , if any, are added to some later path Lh . This follows from the fact that, since pxy < qxy , there exists an edge (vd1 , vd2 ) in Lh ( i < j ≤ k and pxy < d1 < qxy ) that is processed later. Using the described approach, we include vertices from W into the new paths L1 , . . . , Lk . Then we join these paths to the cycle C . Cycle C passes the special vertices in required order and each vertex in W is included there exactly once. Therefore, later on we deal with the remaining non-connected vertices (set Y ). The vertices in Y are organized in subtrees of T . We use this fact and we apply the algorithm HCT3 (refined) from [1]. This algorithm is an approximation algorithm for the cheapest Hamiltonian tour in a complete graph with a i
i si
vpxy
x v1 v2 . . . h
i
x v1 v 2 h
h
. . . vpxy
Li
vqxy . . .vz y
si+1
h
h i
si
i
i
L i
vqxy . . . vz y h
Fig. 5. Modifying path Li to path Li
Lh
h
si+1 h
Lh
Improved Approximations for TSP with Simple Precedence Constraints
C
C T
xi
ri zi
71
yi
e∗i
ri zi
Hi
T
xi
yi
e∗i
Hi
Fig. 6. Vertex ri is the root of tree Ti , vertices xi and yi are the predecessor and successor of ri in C , respectively. Edge e∗i = (zi , ri ) is the minimal edge incident to the root ri from Ti . The Hamiltonian tour Hi is the tour built by procedure HCT3 (refined) from [1] on the pair (Ti , e∗i ). The merge of Hi to C is done as follows: We reconnect the predecessor xi of ri to the vertex zi . Thus, the Hamiltonian tour H continues from xi to zi , then it uses the Hamiltonian tour Hi , and finally, in ri , it is connected back to the edges of C .
cost function satisfying the relaxed triangle inequality. The algorithm builds a Hamiltonian tour on the vertices of a tree and bounds the cost of the created tour by β + β 2 times the cost of the tree. Moreover, the algorithm includes one particular edge of the tree to the created tour. This edge is then used to merge the created tour to our cycle C . In the following paragraphs we will discuss the use of algorithm HCT3 (refined) in more detail. Let T1 , . . . , Tq be the maximal non-empty subtrees with roots r1 , . . . , rq of T such that V (Ti \ri )∩V (C ) = ∅ (all vertices of the trees except their roots are not in C ). Let e∗1 , . . . , e∗q be the cheapest edges of T1 , . . . , Tq that are incident with r1 , . . . , rq (in [1] they are called locally minimal). We use the procedure HCT3 (refined) with initial edges e∗1 , . . . , e∗q to build the Hamiltonian tours H1 , . . . , Hq that contain all vertices from T1 , . . . , Tq — see step 6 of Algorithm 3. The last part of the algorithm is the merge of H1 , . . . , Hq with C . We use the property of the procedure HCT3 (refined) that H1 , . . . , Hq contain the initial edges e∗1 , . . . , e∗q respectively. These are edges of tree T and therefore we are able to merge the Hamiltonian tours to C in order to create the Hamiltonian tour H without duplicating vertices and without significant increase of the total cost as it is shown in Figure 6. The important property of the β-relaxed triangle inequality is that the direct connection between two vertices of a complete graph can be more expensive than a detour. On the other hand, using the β-relaxed triangle inequality, we can bound the cost of paths with bypassed vertices: according to [2], a single edge bypassing a path P of length l costs at most β log2 l · c(P ). Lemma 2. Let G = (V, E) be a graph with cost function c that satisfies the β-relaxed triangle inequality. Let P = v0 v1 . . . vl be a path in G. For 0 = a0 <
72
H.-J. B¨ ockenhauer et al.
a1 < . . . < ak = l, where 1 ≤ k ≤ l holds, let m := max0≤i
References 1. Andreae, T.: On the traveling salesman problem restricted to inputs satisfying a relaxed triangle inequality. Networks 38(2), 59–67 (2001) 2. Bandelt, H.J., Crama, Y., Spieksma, F.C.R.: Approximation algorithms for multi-dimensional assignment problems with decomposable costs. Discrete Appl. Math. 49(1-3), 25–50 (1994) 3. B¨ ockenhauer, H.-J., Hromkoviˇc, J., Kneis, J., Kupke, J.: On the approximation hardness of some generalizations of TSP (extended abstract). In: Arge, L., Freivalds, R.V. (eds.) SWAT 2006. LNCS, vol. 4059, pp. 184–195. Springer, Heidelberg (2006) 4. Christofides, N.: Worst-case analysis of a new heuristic for the travelling salesman problem. Tech. Rep. 388, Graduate School of Industrial Administration, CarnegieMellon University (1976) 5. Eppstein, D.: Paired approximation problems and incompatible inapproximabilities. In: Charikar, M. (ed.) Proc. of the 21st Annual ACM-SIAM Symposium on Discrete Algorithms (SODA 2010), pp. 1076–1086. SIAM, New York (2010) 6. Fellows, M.R.: Blow-ups, win/win’s, and crown rules: Some new directions in FPT. In: Bodlaender, H.L. (ed.) WG 2003. LNCS, vol. 2880, pp. 1–12. Springer, Heidelberg (2003) 7. Gutin, G., Punnen, A.P. (eds.): The Traveling Salesman Problem and Its Variations. Combinatorial Optimization. Springer, New York (2007) 8. Guttmann-Beck, N., Hassin, R., Khuller, S., Raghavachari, B.: Approximation algorithms with bounded performance guarantees for the clustered traveling salesman problem. Algorithmica 28(4), 422–437 (2000) 9. Hoogeveen, J.A.: Analysis of Christofides’ heuristic: some paths are more difficult than cycles. Oper. Res. Lett. 10(5), 291–295 (1991) 10. Sahni, S., Gonzalez, T.F.: P-complete approximation problems. J. ACM 23(3), 555–565 (1976) 11. Vassilevska, V., Williams, R., Woo, S.L.M.: Confronting hardness using a hybrid approach. In: Proc. of the 17th Annual ACM-SIAM Symposium on Discrete Algorithms (SODA 2006), pp. 1–10. SIAM, New York (2006)
Polynomial Space Algorithms for Counting Dominating Sets and the Domatic Number Johan M.M. van Rooij Institute of Information and Computing Sciences, Utrecht University P.O. Box 80.089, 3508 TB Utrecht, The Netherlands
[email protected]
Abstract. Inclusion/exclusion and measure and conquer are two of the most important recent new developments in the field of exact exponential time algorithms. Algorithms that combine both techniques have been found very recently, but thus far always use exponential space. In this paper, we try to obtain fast exponential time algorithms for graph domination problems using only polynomial space. Using a novel treewidth based annotation procedure to deal with sparse instances, we give an algorithm that counts the number of dominating sets of each size κ in a graph in O(1.5673n ) time and polynomial space. We also give an algorithm for the domatic number problem running in O(2.7139n ) time and polynomial space.
1
Introduction
The field of exact exponential time algorithms for finding solutions to N P-hard problems has been a research field of growing interest over the last decade. Although research on problems like Travelling Salesman Problem [14] and Independent Set [21,22] dates back to the sixties and seventies, many new techniques and results date from the last years. Many examples of these can be found in a recent series of surveys on the topic [10,15,20,25,26]. One could argue that the two most important recent new techniques are the use of inclusion/exclusion by Bj¨ orklund et al. [2,3] and measure and conquer by Fomin et al. [11]. Although the use of inclusion/exclusion was introduced on the Travelling Salesman Problem by Karp [16] and Bax [1] much earlier, Bj¨ orklund et al. introduced it to covering and partitioning problems. The idea behind these algorithms is that it is often better to consider the counting variant of a problem than to solve it directly. Then, in an iterative process, one can sometimes count the number of solutions to a simpler problem; thereafter, one subtracts the number of solutions that were counted to much; and then again, one adds the number of solutions that were subtracted too much, etc.; this, to obtain the number of solutions to the original problem in the end. The second important new technique is measure and conquer. Measure and conquer is a general method to obtain stronger upper bounds on recurrence relations, typically, recurrence relations resulting from analysing branching T. Calamoneri and J. Diaz (Eds.): CIAC 2010, LNCS 6078, pp. 73–84, 2010. c Springer-Verlag Berlin Heidelberg 2010
74
J.M.M. van Rooij
algorithms. Although introduced only a few years ago, this technique has already become the standard in analysing branching algorithms. E.g., the fastest exponential time algorithms for Dominating Set [23,24,11], Dominating Clique [6,17], and Feedback Vertex Set [7] are based on this technique. Recently, van Rooij et al. [24] observed that both techniques can be used in a single algorithm. Similar to Bax [1], they observed that inclusion/exclusion can be interpreted as branching. In this way, they obtained an O(1.5048n ) algorithm for Dominating Set based on the set cover modelling of this problem. We note that this algorithm counts the number of dominating sets of each size κ. The authors combine the traditional branching approach that branches on sets with inclusion/exclusion based branching approach on elements of a set cover instances. On sparse instances, they switch to a pathwidth based exponential time and exponential space dynamic programming approach introduced in [8]. In practical situations, exponential space seems to be a lot more restrictive than exponential time: when the space usage of an algorithm fully exhausts the computer’s main memory, the algorithm slows down tremendously because of the swapping with the hard drive. In practice, one would prefer (slightly) exponentially slower algorithms that only use limited space. In this paper, we will use the same approach as in [24] but restrict ourselves to using only polynomial space. We introduce a novel treewidth based annotation procedure that allows us to deal with sparse instances in polynomial space with reasonable efficiency. This procedure acts as a set of reduction rules while it does not remove anything from the instance: it just annotates parts of it. When the unannotated part of the instance is simple enough, we remove the annotations. Because of the specific way used to annotate vertices, we can prove that the resulting instance has treewidth at most two, i.e., it is a generalised series-parallel graph. On such graphs, the problem can be solved in polynomial time. In this way, we obtain the first non-trivial polynomial space algorithm that counts the number of dominating sets of each size κ in a graph. Theorem 1. There exists an algorithm that counts the number of dominating set of each cardinality κ in a graph in O(1.5673n ) time and polynomial space. This result also gives the fastest polynomial space algorithm that counts all minimum dominating sets. It improves a direct consequence of the minimal dominating sets enumeration algorithm by Fomin et al. [9]. Using this algorithm, one could count all minimum dominating sets in O(1.7159n) time and polynomial space by enumerating the minimal dominating sets and counting the number of such sets of minimum cardinality seen thus far. The same algorithm can be used to count weighted dominating sets of each weight given that the number of possible weight sums is polynomially bounded. For this case, our algorithm also gives the fastest polynomial space algorithm for the minimum weight dominating set problem. The second problem we consider is the Domatic Number problem. The first exponential time algorithm related to this problem is by Reige and Rothe [18]: they give an O(2.9416n ) time and polynomial space algorithm to decide whether the domatic number of a graph is at least three (this is also known as the
Polynomial Space Algorithms for Counting Dominating Sets
75
3-Domatic Number problem). Later, Fomin et al. gave an O(2.8718n ) time and exponential space algorithm for Domatic Number in [9]. Using the set partitioning via inclusion/exclusion framework, Bj¨ orklund et al. have improved this to O(2n nO(1) ) time and space [2]. Using only polynomial space, they also give an O(2.8718n ) time algorithm that uses the minimal dominating set enumeration procedure of Fomin et al. [9]. Finally, Reige et al. [19] show that the 3-Domatic Number can be computed in O(2.695n ) time and polynomial space. We use the underlying set cover algorithm used to prove Theorem 1 and apply it in the framework of Bj¨ orklund et al. to compute the Domatic Number. Theorem 2. The domatic number of a graph can be computed in O(2.7139n) time and polynomial space. This improves previous results using polynomial space; its running time nears that of the best know result on the special case of the 3-Domatic Number [19]. This paper is organised in the following way. We start with some preliminaries in Section 2. Then, we give an algorithm to count set covers in Section 3. In Section 4, we show that the algorithm of Section 3 can be used to count the number of dominating sets of each size κ in O(1.5673n ) time and polynomial space. And, in Section 5, we use the algorithm of Section 3 to give an O(2.7139n) time and polynomial space for the Domatic Number.
2 2.1
Preliminaries Graphs, Dominating Sets, Domatic Partitions, Domatic Numbers
Let G = (V, E) be an n-vertex simple graph. Let N (v) = {u ∈ V | (v, u) ∈ E} and N [v] = N (v) ∪ {v} be the open and closed neighbourhood of v ∈ V , respectively. The degree d(v) of a vertex v ∈ V is its number of neighbours: d(v) = |N (v)|. Furthermore, for S ⊆ V , let G[S] be the subgraph of G induced by S, i.e., G[S] = (S, (S × S) ∩ E), and let dS (v) denote the degree of v in G[S]. A k-partition of a set U is a sequence k of k disjoint subsets S1 , . . . , Sk ⊆ U such that Si ∩ Sj = ∅ for all i = j and i=1 Si = U . A subset D ⊆ V of the vertices is called a dominating set if every vertex v ∈ V is either in D or adjacent to a vertex in D, i.e., a set such that v∈D N [v] = V . A domatic k-partition of a graph G is a partition V1 , . . . , Vk of the vertices V such that each Vi is a dominating set in G. The domatic number of G is the largest k ∈ N for which there exists a domatic k-partition, that is, it is the maximum number of disjoint dominating sets in G. In the Domatic Number problem, we are given a graph G, and are asked to compute the domatic number of G. Every graph has domatic number at least one, since the set of all vertices V is a dominating set in G. Moreover, every graph that has no isolated vertices has domatic number of at least two. This follows from the following simple observation: take any maximal independent I set in G (such a set must clearly exist), now, I is dominating set because I is maximal, and V \ I is a dominating set because I is an independent set and there are no isolated vertices. Deciding whether the domatic number of G is at least k for k ≥ 3 is N P-hard [12].
76
2.2
J.M.M. van Rooij
Set Covers and the Relation to Dominating Sets
Given a multiset of sets S, a set cover C of S is a subset C ⊆ S such that every element in any of the sets in S occurs in some set in C. I.e., a set cover C of S is a set of sets such that S∈C S= S∈S S. The universe U of S is the set of all elements in any set in S: U = S∈S S. Grandoni observed that exact algorithms for dominating set benefit from the following relation between the dominating sets in G and the set covers of S = {N [v] | v ∈ V } over the universe U = V [13]. Every set cover of S corresponds exactly to a dominating set in G of the same size and vice versa, i.e., there exists an intuitive size preserving bijection between both. Note that S is defined to be a multiset of sets because distinct vertices in u, v ∈ V can have N [u] = N [v]. The incidence graph I of the tuple (S, U) is defined to be the bipartite graph (S ∪U, E) with partitions S and U which has an edge (S, e) ∈ E between vertices representing a set S ∈ S and an element e ∈ U if and only if e ∈ S. 2.3
Tree Decompositions
A tree decomposition T of a graph G is a tree in which every node i ∈ T has an associated set of vertices Xi ⊆ V such that i∈t Xi = V with the properties: 1. for all (u, v) ∈ E, there exists an i ∈ T such that {u, v} ⊆ Xi . 2. if v ∈ Xi and v ∈ Xj , then v ∈ Xk for all k on the path from i to j in T . The treewidth of T is the size of the largest Xi associated with T minus one: maxi∈T |Xi | − 1. The treewidth of a graph is the minimum treewidth of all possible tree decompositions of G. We use the following well known fact on the treewidth of a graph, e.g, see [4]. Proposition 1. Let G be a graph of treewidth at least two. The following operations do not increase the treewidth of G: – – – –
duplicating an edge, adding a vertex of degree one, subdividing an edge, contracting an edge incident to a vertex of degree two.
Furthermore, we use the fact that many problems can be solved in linear time on graphs whose treewidth is bounded by a constant. See for example [5].
3
An Algorithm for Counting Set Covers
In this section, we will give an exponential time and polynomial space algorithm that counts the number of set covers of a multiset S over a universe U of each size κ: Algorithm 1. This algorithm will be used to prove Theorems 1 and 2. We will first describe Algorithm 1 and argue its correctness. Thereafter, we will consider the treewidth based annotation procedure used by the algorithm to deal with low degree vertices and sparse instances in more detail.
Polynomial Space Algorithms for Counting Dominating Sets
77
Algorithm 1. An algorithm counting the number of set covers of each size κ Input: The incidence graph I = (S ∪ U, E) of S and a set of annotated vertices A Output: A list containing the number of set covers of S of each cardinality κ #SC(I, A): 1: if there exists a vertex v ∈ (S ∪ U) of degree at most one in I[(S ∪ U) \ A] then 2: return #SC(I, A ∪ {v}) 3: else if there exist two vertices v1 , v2 ∈ (S ∪ U) both of degree two in I[(S ∪ U)\A] that have the same two neighbours then 4: return #SC(I, A ∪ {v1 }) 5: else 6: Let s ∈ S and e ∈ U be a set vertex and an element vertex of maximum degree in I[(S ∪ U)\A] 7: if d(S∪U )\A (s) ≤ 2 and d(S∪U )\A (e) ≤ 2 then 8: return #SC-DP(I) 9: else if d(S∪U )\A (s) > d(S∪U )\A (e) then 10: Let Ltake = #SC(I[V \ N [s]], A \ N (s)) and increase all cardinalities by one 11: Let Ldiscard = #SC(I[V \ {s}], A) 12: return Ltake + Ldiscard 13: else 14: Let Loptional = #SC(I[V \ {e}], A) 15: Let Lforbidden = #SC(I[V \ N [e]], A \ N (e)) 16: return Loptional − Lforbidden
Algorithm 1 considers the incidence graph I of the multiset S over the universe U. It uses a set of annotated vertices A which is initially empty. Intuitively, annotating a vertex corresponds to ignoring the vertex in the selection of vertex to branch on, not only by not considering it for branching, but also by ignoring it as a neighbour for vertices that can be branched on. However, annotated vertices are not ignored when the algorithm branches; in this case, they are treated as ordinary vertices. During the execution of the algorithm, Algorithm 1 annotates any vertex of degree one in I[(S ∪U)\ A]. Furthermore, it annotates a degree two vertex in I[(S ∪ U) \ A] if there exists another degree two vertex in I[(S ∪ U) \ A] with the same two neighbours. The annotation procedure replaces a standard branch-and-reduce algorithm’s reduction rules. Alternatively, we could have used rules dealing with elements of frequency one or identical sets (using a more complicated counting mechanism) similar to [24]. However, this leads to worse running times as we want to remove sets of size one also: these cannot be removed because we are counting solutions. If no vertex can be annotated, Algorithm 1 selects an element vertex and a set vertex of maximum degree in I[(S ∪ U) \ A]. If the degree in I[(S ∪ U) \ A] of any vertex is at most two, then the algorithm calls the proceduce #SC-DP(I). This procedure generates a list containing the number of set covers of S of each cardinality κ in polynomial time and will be described later. For now it suffices to say that the annotation procedure guarantees that any incidence graph I on which #SC-DP(I) is called is simple enough to be dealt with efficiently. Otherwise, if the maximum degree in I[(S ∪ U) \ A] is at least three, Algorithm 1
78
J.M.M. van Rooij
branches on a vertex of maximum degree I[(S ∪ U) \ A], but prefers the element vertex if both degrees are equal. If Algorithm 1 decides to branch on a set vertex s ∈ S, then it considers two subproblems: one in which it takes the set corresponding to s in the set cover, and one in which it discards it. It is clear that the number of set covers of each cardinality κ corresponds to the sum of the numbers computed in both branches: it is the sum of the number of set covers containing the set corresponding to s and the number of set covers that do not contain this set. In the first subproblem, s can be removed together with all vertices corresponding to elements contained in set corresponding to s since they are now covered; this corresponds to removing N [s] from I. In the second subproblem, only s can be removed. Notice, that this only works if one increases the cardinalities in the first branch by one because we have taken a set in the set cover: this is done by the algorithm accordingly. If Algorithm 1 decides to branch on an element vertex e ∈ U, then branching corresponds to using inclusion/exclusion [24]. An element corresponds to a requirement: namely, covering the element corresponding to e. Using this terminology, we can say that the number of solutions satisfying the requirement equals the number of solutions to the problem where this requirement is removed (it is now optional to satisfy it), minus the number of solutions in which it is forbidden to satisfy it. In other words, the number of sets covers of S equals the number of set covers of the subproblem in which we remove e, i.e. the total number of covers of S that either cover the element or not, minus the number of sets covers of the subproblem in which we remove e and all sets containing it, i.e., the the number of covers of S that do not cover the element corresponding to e. Consider what happens when the algorithm branches on e. In one branch, e is removed. In the other branch, e and all vertices representing sets containing e are removed, i.e., N [e] is removed. For each cardinality κ, it subtracts the result from the second branch from the result of the first branch, correctly computing the number of set covers of each size κ. This concludes the description of the algorithm. Since the annotation procedure does not affect the output of the Algorithm 1, we can conclude that the algorithm is correct based on the correctness of the branching procedure. We will now further explain the function of the annotation procedure and give the details on the procedure #SC-DP(I). Lemma 1. When Algorithm 1 makes a call to #SC-DP(I), then the treewidth of I is bounded by two. Proof. Let A be the set of annotated vertices maintained by Algorithm 1 when calling #SC-DP(I). At this point, I[(S ∪ U) \ A] consists of degree two vertices only because it is of maximum degree two and any vertex of degree at most one would have been annotated. Hence, I[(S ∪ U) \ A] has treewidth at most two since it is a (possibly empty) collection of cycles. We remove the annotations from the remaining vertices of I in reverse order of their moment of annotation. By doing so, each step consists of either adding a vertex of degree at most one to I[(S ∪ U) \ A], or adding a degree two vertex v to I[(S ∪ U) \ A] for which there exist another degree two vertex u ∈ A with
Polynomial Space Algorithms for Counting Dominating Sets
79
N (u) = N (v) in I[(S ∪U)\ A]. We notice that the operation of adding the degree two vertex is identical to first contracting an edge incident to v, then doubling the contracted edge, and then subdividing both copies of the edge again. Hence, both operations do not increase the treewidth of I[(S ∪ U) \ A] above two by Proposition 1. We conclude that I has treewidth at most two.
Alternatively, one could say that when Algorithm 1 calls #SC-DP(I), then the incidence graph I is a generalised series-parallel graph. Corollary 1. The procedure #SC-DP(I) in Algorithm 1 can be implemented in linear time. Proof. Standard dynamic programming on tree decompositions or generalised series-parallel graphs, e.g., see [5].
Since the running time of Algorithm 1 depends on the specific shape of input that we give it, we postpone the running time analysis to Sections 4 and 5.
4
Counting Dominating Sets in Polynomial Space
We will give the first application of Algorithm 1 in this section, namely, computing the number of dominating sets of each size κ. We will do so by proving Theorem 1. We note that the annotation procedure used in the algorithm plays an important role in the running time analysis. Theorem 1. There exists an algorithm that counts the number of dominating set of each cardinality κ in a graph in O(1.5673n ) time and polynomial space. Proof. One can use Algorithm 1 to count the number of set covers of S = {N [v] |v ∈ V } of each cardinality κ. Remind that these numbers correspond to the number of dominating sets of each cardinality κ in G, see Section 2.2. For the running time analysis, we use measure and conquer [11]. To this end, we use a variant of the measure on the size of a subproblem from [11]. We introduce weight functions v, w : N → R+ and use the following measure k on a subproblem (I, A) with I = (S ∪ U, E): v(d(S∪U )\A (e)) + w(d(S∪U )\A (s)) k= e∈U ,e ∈A
s∈S,s ∈A
Furthermore, we define Δv(i) = v(i) − v(i − 1), Δw(i) = w(i) − w(i − 1), and impose the following constraints on the weights functions v, w: 1. 2. 3. 4.
v(0) = v(1) = 0 Δv(i) ≥ 0 for all i ≥ 2 Δv(i) ≥ Δv(i + 1) for all i ≥ 2 2Δv(3) ≤ v(2)
5. 6. 7. 8.
w(0) = w(1) = 0 Δw(i) ≥ 0 for all i ≥ 2 Δw(i) ≥ Δw(i + 1) for all i ≥ 2 2Δw(4) ≤ w(2)
80
J.M.M. van Rooij
Notice that annotating a vertex reduces the measure, and that annotated vertices have zero measure. Constraints 1 and 5 represent the fact that if a vertex gets degree at most one, then it is annotated; hence, we can give it zero measure. Constraints 2 and 6 represent the fact that we want vertices with a higher degree to contribute more to the complexity of an instance. Furthermore, Constraints 3 and 7 are non-restricting inequalities that make the formulation of the problem easier, and the function of Constraints 4 and 8 is explained later. We will now formulate a series of recurrence relations representing the branching of the algorithm. Consider branching on a set vertex s of degree d in I[(S ∪ U) \ A] and with ri neighbours of degree i in I[(S ∪ U) \ A]. In the branch where we take the set corresponding to s in the set cover, we remove s reducing ∞the measure by w(d), we remove all its neighbours reducing the measure by i=2 ri v(i), and we reduce the degrees of all vertices ∞at distance two from s. If d ≥ 4, we can bound this last reduction by Δw(d) i=2 ri (i − 1) because of Constraint 7 and the fact that s is of maximum degree. Notice that if we reduce another set vertex to degree at most one in this way, then we do not remove to much measure by Constraints 7 and 8. If d = 3, then the situation is different. Because Algorithm 1 prefers to branch on elements vertices, all neighbours of v are of degree two. When branching on the set vertex, no two of its degree two neighbours in I[(S ∪ U) \ A] can have the same neighbours by the annotation procedure. Hence, the above formula is correct. In the other branch, we remove s reducing the measure by w(d), and we reduce the degrees of the neighbours of s reducing the measure by ∞ i=2 ri Δv(i). Let Δtake and Δdiscard be the reduction of the measure in the branch where we take the set corresponding to s and where we discard it, respectively. We have shown that: Δtake ≥ w(d) + Δdiscard ≥ w(d) +
∞ i=2 ∞
ri v(i) + Δw(d)
∞
ri (i − 1)
i=2
ri Δv(i)
i=2
Now consider branching on a element vertex e of degree d in I[(S ∪ U) \ A] and with ri neighbours of degree i in I[(S ∪ U) \ A]. Let Δoptional and Δforbidden be the reduction of the measure in the branch where it is optional of cover the element corresponding to e and forbidden to cover it, respectively. In almost the same way, we deduce: Δoptional ≥ v(d) + Δforbidden ≥ v(d) +
∞ i=2 ∞ i=2
ri Δw(i) ri w(i) + Δv(d)
∞
ri (i − 1)
i=2
This gives us the following set of recurrence relations. Let N (k) be the number of subproblems generated on a problem of measure k. For all d ≥ 3 and ri such
Polynomial Space Algorithms for Counting Dominating Sets
81
d−1 d that, i=2 ri = d if we consider branching on a set, and i=2 ri = d if we consider branching on an element, we have: N (k) ≤ N (k − Δtake ) + N (k − Δdiscard ) N (k) ≤ N (k − Δoptional ) + N (k − Δforbidden) The solution to this set of recurrence relations is of the form αk . Let vmax = maxi∈N v(i) and wmax = maxi∈N w(i). The graph G is transformed into a multiset S of measure at most (vmax + wmax )n. Therefore, we have proven that Algorithm 1 can be used to count the number of dominating sets of each cardinality κ in G in O(α(vmax +wmax )n ) time and polynomial space. We compute the weight functions v and w minimising αvmax +wmax by computer. In this way, we have obtained α = 1.205693 using the following weights: i 2 3 4 5 6 >6 v(i) 0.640171 0.888601 0.969491 0.998628 1.000000 1.000000 w(i) 0.819150 1.218997 1.362801 1.402265 1.402265 1.402265 This proves a running time of O(1.205693(1+1.402265)n) = O(1.5673n ).
We can easily modify Algorithm 1 such that it counts weighted set covers of each weight κ given that the set of possible weight sums is polynomially bounded. This gives us the following corollary. Corollary 2. There is an algorithm solving the minimum weight dominating set problem in O(1.5673n) time and polynomial space.
5
Computing the Domatic Number in Polynomial Space
Our second result is a faster polynomial space algorithm for computing the domatic number of a graph G. This will be shown in this section. To this end, we will first introduce reader in the set partitioning via inclusion/exclusion framework of Bj¨ orklund et al. [2]. Thereafter, we will show how Algorithm 1 can be used in this framework to prove Theorem 2. Bj¨ orklund et al. use the following result to compute the domatic number. Proposition 2 ([2]). Let D be a set of sets over the universe V, and let k ∈ N. The number of ways pκ (D) to partition V into k sets from D equals: pk (D) =
(−1)|X| ak (X)
X⊆V
where ak (X) equals the number of k-tuples (S1 , . . . , Sk ) with Si ∈ {D ∈ D | D ∩ k X = ∅} and for which i=1 |Si | = |V|. Proof. By a direct application of the inclusion/exclusion formula, see [2].
82
J.M.M. van Rooij
If we let V = V and let D be the set of dominating sets in G, then Proposition 2 can be used to check whether there exist a domatic k-partition, i.e., whether the domatic number of a graph is at least k, by checking whether pk (D) > 0 or not. To do so, we would need to compute the numbers ak (X). In other words, for every X ⊆ V , we would need to compute the number of k-tuples (S1 , . . . , Sk ) k with Si ∈ {D ∈ D | D ∩ X = ∅} and for which i=1 |Si | = n. Let dκ (V ) be the number of dominating sets of size κ in G using only vertices from V ⊆ V . Bj¨ orklund et al. [2] show how to compute the values ak (X) required to use Proposition 2 from the numbers dκ (V ). To this end, they give the following recurrence that can be used for dynamic programming. Let aX (i, j) be the number of i-tuples (S1 , . . . , Si ) where each Si is a dom inating set in G using only vertices from V \ X and such that ki=1 |Si | = j. The values aX (i, j) can be computed by dynamic programming over the following recursion summing over the possible sizes for the i-th part of the i-tuple (S1 , . . . , Si ): j aX (i − 1, j − l)dl (V \ X) aX (i, j) = l=0
Bj¨ orklund et al. observe that ak (X) = aX (k, n) to obtain the required values. We are now ready to prove Theorem 2. Theorem 2. The domatic number of a graph can be computed in O(2.7139n) time and polynomial space. Proof. We can use Proposition 2 for increasing k = 3, 4, . . . to find the domatic number of G. To do so, we need to compute the required values ak (X). For each V ⊆ V , we use Algorithm 1 on S = {N [v] | v ∈ V } to produce a list containing, for each 0 ≤ κ ≤ n, the number of dominating sets of G of size κ using only vertices in V . We observe that each such list can be used to compute a single value ak (X) from the formula in Proposition 2 by the dynamic programming procedure shown above. We obtain a polynomial space algorithm for the domatic number by producing these lists one at a time and summing their corresponding contributions to the formula. Since the 2n calls to Algorithm 1 are on instances of different sizes, the total time required is a polynomial times: n n vmax n+wmax i n = (αvmax (1 + αwmax )) α i i=0 where we use the notation from the proof of Theorem 1. We recompute the weight functions used in Theorem 1 minimising αvmax (1 + wmax α ) and obtain α = 1.099437 using the following set of weights: i 2 3 4 5 6 7 >7 v(i) 0.822647 0.971653 1.000000 1.000000 1.000000 1.000000 1.000000 w(i) 2.039702 3.220610 3.711808 3.919500 4.016990 4.052718 4.052729 The running time is O (1.099437(1+1.0994374.052729))n = O(2.7139n).
Polynomial Space Algorithms for Counting Dominating Sets
6
83
Conclusion
We have given several several new polynomial space results using inclusion/exclusion in combination with measure and conquer. The main new tool to obtain reasonably efficient running times is a novel treewidth based annotation procedure dealing with sparse instances. We notice that one can construct the associated domatic partitions (or dominating sets) by repeating the counting algorithms a polynomial number of times in the following way. First compute the maximum size k of a domatic partition. Then, assign a vertex to a partition and test if this alters the domatic number: this can be done by cleverly merging the output of calls to Algorithm 1 on a different input corresponding to each of the k thus far constructed partitions. If the domatic number changes, we try assigning the vertex to another partition, otherwise, we repeat this process. As an open problem, we ask to improve the fastest polynomial space algorithms for the 3-Domatic Number, i.e., for the problem whether the domatic number of a graph is at least three. For this problem, inclusion/exclusion based branching approaches may very well lead to faster algorithms also.
Acknowledgements The author thanks Andreas Bj¨ orklund for useful discussions on the topic. The author is grateful one of the anonymous referees for finding an error the weights in the measure and conquer analysis in an earlier version.
References 1. Bax, E.T.: Inclusion and exclusion algorithm for the Hamiltonian path problem. Information Processing Letters 47(4), 203–207 (1993) 2. Bj¨ orklund, A., Husfeldt, T., Koivisto, M.: Set partitioning via inclusion-exclusion. SIAM Journal on Computing 39, 546–563 (2009) 3. Bj¨ orklund, A., Husfeldt, T.: Exact graph coloring using inclusion-exclusion. Encyclopedia of Algorithms (2008) 4. Bodlaender, H.L.: A partial k-arboretum of graphs with bounded treewidth. Theoretical Computer Science 209, 1–45 (1998) 5. Bodlaender, H.L., Koster, A.M.C.A.: Combinatorial optimization on graphs of bounded treewidth. The Computer Journal 51(3), 255–269 (2008) 6. Bourgeois, N., Della Croce, F., Escoffier, B., Paschos, V.T.: Exact algorithms for dominating clique problems. In: Dong, Y., Du, D.-Z., Ibarra, O. (eds.) ISAAC 2009. LNCS, vol. 5878, pp. 4–13. Springer, Heidelberg (2009) 7. Fomin, F.V., Gaspers, S., Pyatkin, A.V.: Finding a minimum feedback vertex set in time O(1.7548n ). In: Bodlaender, H.L., Langston, M.A. (eds.) IWPEC 2006. LNCS, vol. 4169, pp. 184–191. Springer, Heidelberg (2009) 8. Fomin, F.V., Gaspers, S., Saurabh, S., Stepanov, A.A.: On two techniques of combining branching and treewidth. Algorithmica 54, 181–207 (2009)
84
J.M.M. van Rooij
9. Fomin, F.V., Grandoni, F., Pyatkin, A., Stepanov, A.A.: Combinatorial bounds via measure and conquer: bounding minimal dominating sets and applications. ACM Transactions on Algorithms 5, 9 (2008) 10. Fomin, F.V., Grandoni, F., Kratsch, D.: Some new techniques in design and analysis of exact (exponential) algorithms. Bulletin of the EATCS 87, 47–77 (2005) 11. Fomin, F.V., Grandoni, F., Kratsch, D.: A measure & conquer approach for the analysis of exact algorithms. Journal of the ACM 56, 25 (2009) 12. Garey, M.R., Johnson, D.S.: Computers and Intractability, A Guide to the Theory of NP-Completeness. W.H. Freeman and Company, New York (1979) 13. Grandoni, F.: A note on the complexity of minimum dominating set. Journal of Discrete Algorithms 4, 209–214 (2006) 14. Held, M., Karp, R.M.: A dynamic programming approach to sequencing problems. Journal of the SIAM 10, 196–210 (1962) 15. Iwama, K.: Worst-case upper bounds for k-sat. Bulletin of the EATCS 82, 61–71 (2004) 16. Karp, R.M.: Dynamic programming meets the principle of inclusion-exclusion. Operations Research Letters 1, 49–51 (1982) 17. Kratsch, D., Liedloff, M.: An exact algorithm for the minimum dominating clique problem. Theoretical Computer Science 385, 226–240 (2007) 18. Riege, T., Rothe, J.: An exact 2.9416n algorithm for the three domatic number problem. In: Jedrzejowicz, J., Szepietowski, A. (eds.) MFCS 2005. LNCS, vol. 3618, pp. 733–744. Springer, Heidelberg (2005) 19. Riege, T., Rothe, J., Spakowski, H., Yamamoto, M.: An improved exact algorithm for the domatic number problem. Information Processing Letters 101, 101–106 (2007) 20. Sch¨ oning, U.: Algorithmics in exponential time. In: Diekert, V., Durand, B. (eds.) STACS 2005. LNCS, vol. 3404, pp. 36–43. Springer, Heidelberg (2006) 21. Tarjan, R.E.: Finding a maximum clique. Technical report, Department of Computer Science, Cornell University, Ithaca, NY (1972) 22. Tarjan, R.E., Trojanowski, A.: Finding a maximum independent set. SIAM Journal on Computing 6, 537–546 (1977) 23. van Rooij, J.M.M., Bodlaender, H.L.: Design by measure and conquer: a faster exact algorithm for dominating set. In: Proceedings of the 25th Annual Symposium on Theoretical Aspects of Computer Science, STACS 2008. Schloss Dagstuhl Leibniz-Zentrum fuer Informatik, Leibniz International Proceedings in Infomatics, vol. 1, pp. 657–668 (2008) 24. van Rooij, J.M.M., Nederlof, J., van Dijk, T.C.: Inclusion/exclusion meets measure and conquer: exact algorithms for counting dominating sets. In: Fiat, A., Sanders, P. (eds.) ESA 2009. LNCS, vol. 5757, pp. 554–565. Springer, Heidelberg (2009) 25. Woeginger, G.J.: Exact algorithms for NP-hard problems: A survey. In: J¨ unger, M., Reinelt, G., Rinaldi, G. (eds.) Combinatorial Optimization - Eureka, You Shrink! LNCS, vol. 2570, pp. 185–207. Springer, Heidelberg (2003) 26. Woeginger, G.J.: Space and time complexity of exact algorithms: some open problems. In: Downey, R.G., Fellows, M.R., Dehne, F. (eds.) IWPEC 2004. LNCS, vol. 3162, pp. 281–290. Springer, Heidelberg (2004)
Parameterized Complexity of Even/Odd Subgraph Problems Leizhen Cai1 and Boting Yang2 1
Department of Computer Science and Engineering The Chinese University of Hong Kong
[email protected] 2 Department of Computer Science University of Regina
[email protected]
Abstract. In this paper, we investigate the parameterized complexity of the problem of finding k edges (vertices) in a graph G to form a subgraph (respectively, induced subgraph) H such that H belongs to one the following four classes of graphs: even graphs, Eulerian graphs, odd graphs, and connected odd graphs. We also study the parameterized complexity of their parametric dual problems. Among these sixteen problems, we show that eight of them are fixed parameter tractable and four are W[1]hard. Our main techniques are the color-coding method of Alon, Yuster and Zwick, and the random separation method of Cai, Chan and Chan.
1
Introduction
The initial motivation of this paper comes from Eulerian graphs, which are often regarded as the cradle of graph theory: How to find k edges in a graph to form an Eulerian graph? As with most subgraph problems, the problem is NP-hard. This in turn motivates us to study the problem using the framework of parameterized complexity [4]: regard some part of the input as a parameter k to form a parameterized problem and determine whether the problem can be solved by an FPT algorithm, i.e., an algorithm that runs in time f (k)nO(1) for some function f (k), where n is the input size. A parameterized problem is fixedparameter tractable (FPT) if it admits an FPT algorithm. Subgraph problems (or equivalently, edge-deletion and vertex-deletion problems) have been studied extensively in the literature under the framework of traditional complexity. Among others, a well-known result of Lewis and Yannakakis [7] states that for any “interesting” hereditary property1 Π, it is NP-hard to decide whether a graph G contains at least k vertices that induce a Π-graph, and Natanzon, Shamir and Sharan [9] have given complexity classification of a large number of edge-deletion problems. Parameterized complexity of subgraph problems has also been considered in the literature. Khot and Raman [6] have shown that, for any hereditary property 1
A property Π is hereditary if every induced subgraph of a Π-graph is also a Π-graph.
T. Calamoneri and J. Diaz (Eds.): CIAC 2010, LNCS 6078, pp. 85–96, 2010. c Springer-Verlag Berlin Heidelberg 2010
86
L. Cai and B. Yang
Π, the problem of finding k vertices to induce a Π-graph is FPT if Π includes all trivial graphs (i.e., graphs with no edges) and all complete graphs or excludes some trivial graphs and some complete graphs, and W[1]-hard if Π includes all trivial graphs but not all complete graphs or vice versa. Cai [2] has studied parametric duals of subgraph problems and shown that graph modification problems that allow k vertex/edge additions and deletions are FPT for any hereditary property Π that admits a finite forbidden set. In this paper, we study parameterized complexity of subgraph problems related to Eulerian subgraphs. Note that the properties we consider are not hereditary, and therefore the theorems of Khot and Raman, and Cai are not applicable to our problems. An even (resp. odd) graph is a graph such that each vertex has even (resp. odd) degree. An Eulerian graph is a connected even graph. It is easy to see that the class of even graphs, odd graphs, or Eulerian graphs is not hereditary. Let Γ be one of the four graph classes: even graphs, Eulerian graphs, odd graphs, and connected odd graphs. We will consider the parameterized even/odd subgraph problems, that is, choosing k edges (resp. vertices) from graph G such that they form an edge-induced (resp. vertex-induced) Γ subgraph of G, which is called k-Edge Γ Subgraph (resp. k-Vertex Γ Subgraph) problem. Let n be the number of vertices and m be the number of edges in G. For the kEdge Γ Subgraph (resp. k-Vertex Γ Subgraph) problem, its parametric dual is to choose m − k edges (resp. n − k vertices) from graph G such that they form an edge-induced (resp. vertex-induced) Γ subgraph of G, which is called (m − k)-Edge Γ Subgraph (resp. (n − k)-Vertex Γ Subgraph) problem. Table 1 summaries the results of the parameterized complexity in this paper. Since (n − k)-Vertex Eulerian Subgraph, (n − k)-Vertex Even Subgraph, (n − k)-Vertex Odd Subgraph, and (n − k)-Vertex Connected Odd Subgraph are W[1]-hard, the NP-completeness of their corresponding unparameterized problems follows immediately. Except the Even Subgraph and Odd Subgraph problems (defined in Section 2), we will show that all other problems are also NP-complete. The basic techniques used to design the fixed parameter algorithms in this paper are the color-coding method [1] and the random separation method [3].
Table 1. The parameterized complexity of the sixteen problems k-Edge Even/Odd Subgraph (m − k)-Edge Even/Odd Subgraph k-Vertex Even/Odd Subgraph (n − k)-Vertex Even/Odd Subgraph k-Edge Eulerian/Connected Odd Subgraph (m − k)-Edge Eulerian/Connected Odd Subgraph k-Vertex Eulerian/Connected Odd Subgraph (n − k)-Vertex Eulerian/Connected Odd Subgraph
FPT / FPT FPT / FPT FPT / FPT W[1]-hard/W[1]-hard FPT / ? ?/? ? / FPT W[1]-hard/W[1]-hard
Parameterized Complexity of Even/Odd Subgraph Problems
87
This paper is organized as follows. We give some definitions and notation in Section 2. We show NP-hardness and parameterized tractability of Eulerian graphs, even graphs, odd graphs, and connected odd graphs in Sections 3, 4, 5 and 6, respectively. Finally, we propose open problems in Section 7.
2
Definitions and Notation
Unless otherwise stated, all graphs in this paper will be finite, undirected and without loops or multiple edges. Throughout this paper, we use G = (V, E) to denote a graph with vertex set V and edge set E, and we also use V (G) and E(G) to denote the vertex set and edge set of G respectively. The number of vertices in the graph is called its order and the number of edges in the graph is called its size. In the case with no ambiguity, we use m to denote the size and n to denote the order of the graph. A vertex-induced subgraph is one that consists of some of the vertices of the original graph and all of the edges among them in the original. An edge-induced subgraph consists of some of the edges of the original graph and the vertices that are their endpoints. For a graph G = (V, E), a subset V ⊆ V , and E ⊆ E, we use G[V ] to denote a vertex-induced subgraph induced by V and G[E ] to denote an edge-induced subgraph induced by E . For a graph G = (V, E) and a vertex v ∈ V , the degree of v, denoted by degG (v), is the number of edges incident on v. The set {u : uv ∈ E} is the open neighborhood of v, denoted as NG (v), and NG (v) ∪ {v} is the closed neighborhood of v, denoted as NG [v]. In the case with no ambiguity, we use deg(v), N (v) and N [v] without subscripts. For a subset V ⊂ V , we define NG (V ) = (∪v∈V NG (v)) \ V and NG [V ] = NG (V ) ∪ V . A walk is a list v0 , e1 , v1 , . . . , ek , vk of vertices and edges such that each edge ei , 1 ≤ i ≤ k, has endpoints vi−1 and vi . A path is a walk that does not include any vertex twice, except that its first vertex might be the same as its last. A path that contains k edges is called a k-path. A cycle is a path that begins and ends on the same vertex. A trail is a walk that does not pass over the same edge twice. A trail that contains k edges is called a k-trail. An Eulerian trail is a trail that visits every edge of the graph exactly once. It can end on a vertex different from the one on which it began. A circuit is a trail that begins and ends on the same vertex. An Eulerian circuit is an Eulerian trail that starts and ends on the same vertex. A graph is called Eulerian if it contains an Eulerian circuit. Let Γ be any one of the four graph classes: even graphs, Eulerian graphs, odd graphs, and connected odd graphs. In each of the following four sections, we will first consider the following complexity problems. Γ Subgraph (resp. Induced Γ Subgraph) Instance: Graph G = (V, E) and nonnegative integer . Question: Does G have a Γ subgraph of edges (resp. induced by vertices)?
88
L. Cai and B. Yang
We will then consider the following parameterized complexity problems. k-Edge Γ Subgraph (resp. k-Vertex Γ Subgraph) Instance: Graph G = (V, E) and nonnegative integer k. Parameter: k. Question: Does G have a Γ subgraph of k edges (resp. Does G contain k vertices that induce a Γ subgraph)? (m − k)-Edge Γ Subgraph (resp. (n − k)-Vertex Γ Subgraph) Instance: Graph G = (V, E) and nonnegative integer k. Parameter: k. Question: Does G have a Γ subgraph of m − k edges (resp. Does G contain n − k vertices that induce a Γ subgraph)?
3
Eulerian Subgraphs
In this section, we consider the parameterized Eulerian subgraph problems. Since the class of Eulerian graphs is not hereditary, we cannot use the traditional methods for hereditary properties. We will first consider the edge-induced Eulerian subgraphs, and then the vertex-induced Eulerian subgraphs. Note that an Eulerian graph is a connected even graph. Theorem 1. Eulerian Subgraph is NP-complete, and remains NP-complete for cubic graphs. Proof. Given a cubic graph G, it is easy to see that G contains a Hamilton cycle if and only if G has an Eulerian subgraph of size n. Thus, we can show that Eulerian Subgraph is NP-hard by a reduction from the Hamilton Cycle problem on cubic graphs. Theorem 2. k-Edge Eulerian Subgraph can be solved in 2O(k) mn log n time. Proof. We solve this problem using the color-coding method [1]. Suppose that G has an Eulerian subgraph of size k. We first randomly color each edge of G by one of the k colors {1, 2, . . . , k} to obtain a k-colored graph G. A subgraph of G is colorful if every edge in this subgraph is colored by a different color. We now show how to find a colorful k-edge Eulerian subgraph from a k-colored graph G. Let a be an arbitrary vertex in G. We check if a is a vertex in a colorful k-edge Eulerian subgraph of G. For a trail P in G, let c(P ) denote the set of colors used in P . For each vertex v in G, let C i (v) = {c(P ): P is a colorful i-trail connecting a to v}. Note that G has a colorful k-edge Eulerian subgraph containing a if and = ∅. Initially, define C 0 (a) = ∅. For each i from 0 to k − 1, consider only if C k (a) the following process: For each vertex v that has at least one neighbor u having been labeled C i (u), compute C i+1 (v) = {c(uv) ∪ C : u ∈ NG (v), C ∈ C i (u), and c(uv) ∩ C = ∅}.
Parameterized Complexity of Even/Odd Subgraph Problems
89
Thus, a colorful k-edge subgraph of G containing a, if it exists, can be k Eulerian found in time O( i=1 i ki |E|) = O(k2k m). Hence, a colorful k-edge Eulerian subgraph of a k-colored graph G, if it exists, can be found in O(k2k mn) time. To derandomize this algorithm, we need a list of k-colorings C such that for every k-subset E ⊆ E, there is at least one coloring in C that assigns each edge in E a different color. A family F of functions mapping a domain of size m into a range of size k is an (m, k)-family of perfect hash functions if for every subset S of size k from the domain there is a function in F that is 1-to-1 on S. From [10], an (m, k)-family of perfect hash functions of size 2O(k) log m can be deterministically constructed in linear time. Therefore, we can obtain a deterministic algorithm by using an (m, k)-family of perfect hash functions to find a k-edge Eulerian subgraph of G, if it exists, in O(k2k mn2O(k) log m) = 2O(k) mn log n time. In order to show W[1]-hardness of (n − k)-Vertex Eulerian Subgraph, we introduce the exact odd set problem. Let G = (R, B, E) be a red/blue bipartite graph and R ⊆ R be a nonempty set of red vertices. We say that R is an odd set if every vertex in B has an odd number of neighbors in R . The exact odd set problem is defined as follows: Exact Odd Set Instance: A red/blue bipartite graph G = (R, B, E) with no isolated vertices and an integer k. Parameter: k. Question: Is there a subset R ⊆ R of k vertices that is an odd set in G? Downey et al. [5] showed that Exact Odd Set is W[1]-hard. Theorem 3. (n − k)-Vertex Eulerian Subgraph is W[1]-hard. Proof. We will show that (n−k)-Vertex Eulerian Subgraph is W[1]-hard by a reduction from Exact Odd Set. For an instance of Exact Odd Set, that is, a red/blue bipartite graph G = (R, B, E) with no isolated vertices and a positive integer k, we make 2k copies of B and connect them to R to obtain a bipartite 2k graph G = (R, ∪2k i=1 Bi , ∪i=1 Ei ) such that each subgraph Gi = (R, Bi , Ei ), 1 ≤ i ≤ 2k, is isomorphic to G = (R, B, E). We add vertices v and v to G and connect them to each vertex in ∪2k i=1 Bi using a path of length k + 1, respectively, to obtain a connected graph G . If Bi contains even vertices, then we add a vertex u to G and connect u to each even vertex in ∪2k i=1 Bi using a path of length k + 1. The new graph, denoted by G∗ , is an instance of (n − k)-Vertex Eulerian Subgraph, which can be constructed in polynomial time. We will show that there is a subset R ⊆ R of k vertices that is an odd set in G if and only if there is a subset V ⊆ V (G∗ ) of k vertices such that G∗ −V is an Eulerian subgraph. Since G∗ contains 2k copies of B, we know that degG∗ (u), degG∗ (v) and degG∗ (v ) are all even. Thus, in graph G∗ , each vertex of Bi has odd degree and all other vertices are even. If there is a subset R ⊆ R of k vertices that is an odd set in G, then it is easy to see that G∗ − R is an Eulerian subgraph. Conversely,
90
L. Cai and B. Yang
suppose that there is a subset V ⊆ V (G∗ ) of k vertices such that G∗ − V is an Eulerian subgraph. Note that if V contains any vertex in V (G∗ ) \ R, then there are at least two leaves in G∗ − V because each one of vertices u, v and v connects to a vertex of Bi by a suspension path of length of k + 1. Thus, V must be a subset of R. Since G∗ − V is Eulerian, we know that every vertex in Bi has an odd number of neighbors in V . Hence, V is an odd set in G.
4
Even Subgraphs
In this section, we consider the parameterized even subgraph problems. We will first consider the edge-induced even subgraphs, and then the vertex-induced even subgraphs. Note that an even subgraph may be disconnected, even contain some isolated vertices. The kth Bell number is the number of different partitions of a set with k elements. Theorem 4. k-Edge Even Subgraph can be solved in Bk 2O(k) mn log n time, where Bk is the kth Bell number. Proof. We solve this problem using the color-coding method. Suppose that G has an even subgraph of size k. We first randomly color each edge of G by one of the k colors {1, 2, . . . , k} to obtain a k-colored graph G. Let G be a colorful k-edge even subgraph of G and be the number of connected components in G . Let Si , 1 ≤ i ≤ , be the set of colors used in the ith connected component of G . Because G is colorful, sets Si , 1 ≤ i ≤ , is a partition of the whole color set {1, 2, . . . , k}. We use {S1 , . . . , S } as a representation of G . Note that for different colorings of G using k colors, a k-edge even subgraph of G may have different representations. Let R be the set of all possible representations of colorful k-edge even subgraphs. For a k-colored graph G, let S ⊆ {1, 2, . . . , k} be a subset of k colors. Since each connected component of an even graph is Eulerian, we consider the problem of finding a colorful k -edge Eulerian subgraph of G such that every edge of this subgraph has a different color from S. After deleting every edge of G that is not colored by a color from S, we obtain a k -colored graph H. If the colors in {1, 2, . . . , k} are sorted, then H can be computed in O((m + n) log k) time. From the proof of Theorem 2, we know that a colorful k -edge Eulerian subgraph of a k -colored graph H, if it exists, can be found in O(k 2k |E(H)||V (H)|) time. Thus, the problem of finding a colorful k -edge Eulerian subgraph of G can be solved in O((m + n) log k + k 2k |E(H)||V (H)|) time. Given a k-colored graph G and a representation {S1 , . . . , S } ∈ R, for each i from 1 to , we use the above algorithm to compute a colorful |Si |-edge Eulerian subgraph if it exists. Note that all color sets in {S1 , . . . , S } are disjoint. Thus, a colorful k-edge even subgraph with representation {S1 , . . . , S }, if it exists, can be found in time O((m + n) log k + k2k mn) = O(k2k mn). Since G is a simple graph without loops or multiple edges, we know that the smallest color subset in any representation in R has size at least 3. Hence, we
Parameterized Complexity of Even/Odd Subgraph Problems
91
have |R| < Bk , where Bk is the kth Bell number. Thus, a colorful k-edge even subgraph, if it exists, in a k-colored graph can be found in O(Bk k2k mn) time. Similar to the proof of Theorem 2, we can design a deterministic algorithm to find a k-edge even subgraph of G, if it exists, in O(Bk k2k mn2O(k) log m) = Bk 2O(k) mn log n time. Lemma 1. For a graph G, let Vodd be the set of all odd vertices in G. If Vodd = ∅, then there are |Vodd |/2 edge-disjoint paths in G such that the graph obtained from G by deleting all edges of these paths is an even graph. Theorem 5. (m − k)-Edge Even Subgraph can be solved in Bk 2O(k) (k!)mn log n time, where Bk is the kth Bell number. Proof. We solve this problem using the color-coding method. Randomly color each edge of G = (V, E) by one of the k colors {1, 2, . . . , k}. We want to decide if G has a colorful k-edge subgraph G such that G contains all odd vertices of G and a subset of even vertices of G, and every vertex of G has the same parity as that in G (such a subgraph is called parity-keeping). Let Vodd be the set of all odd vertices in G (also in G ) and β = |Vodd |/2. If β > k, then (m − k)-Edge Even Subgraph has no solution. Thus, we suppose that β ≤ k. From Lemma 1, there are β edge-disjoint paths in G such that the graph G obtained from G by deleting all edges of these paths is an even graph. Let be the number of connected components in G . Note that the graph G consists of β edge-disjoint paths and Eulerian subgraphs. Correspondingly, let Si , 1 ≤ i ≤ β, be the set of colors used in the ith path in G , and Sβ+i , 1 ≤ i ≤ , be the set of colors used in the ith Eulerian subgraph in G . Because G is colorful, sets Si , 1 ≤ i ≤ β + , form a partition of the whole color set {1, 2, . . . , k}. Similar to the proof of Theorem 4, we use {S1 , . . . , Sβ+ } as a representation of G . Note that for different colorings of G using k colors, a k-edge paritykeeping subgraph of G may have different representations. Let R be the set of all possible representations of colorful k-edge parity-keeping subgraphs. For a k-colored graph G, let S ⊆ {1, 2, . . . , k} be a subset of k colors used in G. After deleting every edge of G that is not colored by a color from S, we obtain a k -colored graph H. From the proof of Theorem 2, we know that it takes O(k 2k |E(H)||V (H)|) time to find a colorful k -edge Eulerian subgraph of H such that every edge of this subgraph has a different color from S. From [1], it takes O(k 2k |E(H)|) time to find a colorful k -path between a pair of odd vertices in H such that every edge of this path has a different color from S. For a k-colored graph G and a representation R ∈ R, since R is a partition of the color set {1, 2, . . . , k}, a colorful k-edge parity-keeping subgraph with representation R, if it exists, can be found in time O((β + )(m + n) log k + k2k mn) = that the of different matchings between vertices of Vodd O(k2k mn). Note number 2 k/2 · · · = (k!)/(2 is bounded by k2 k−2 ), and |R| < Bk , where Bk is the kth 2 2 Bell number. Hence, a colorful k-edge parity-keeping subgraph, if it exists, in a k-colored graph can be found in O(Bk k2k/2 (k!)mn) time.
92
L. Cai and B. Yang
Similar to the proof of Theorem 2, we can design a deterministic algorithm to find a k-edge parity-keeping subgraph of G, if it exists, in Bk 2O(k) (k!)mn log n time. Theorem 6. k-Vertex Even Subgraph can be solved in 2(d+1)k (dk + k)O(log(dk+k)) ((d + k)n + m) log n time, where d = R(k − 1, k − 1) − 1 and R(k − 1, k − 1) is the Ramsey number. Proof. We first consider the case that k is odd. If |V | ≥ R(k, k), it follows from Ramsey’s Theorem that G must contain either a clique of order k or an independent set of size k. It is easy to see that an independent set and a clique of order k both are even graphs. If |V | < R(k, k), then we can simply consider all vertex-induced subgraphs of order k. We now consider the case that k is even. If there is a vertex v in G such that |V \ N [v]| ≥ R(k − 1, k − 1), then from Ramsey’s Theorem, G − N [v] must contain either a clique of order k − 1 or an independent set of size k − 1. Thus, there exists a vertex-induced subgraph in G which is an even graph of order k. If |V \ N [u]| < R(k − 1, k − 1) for every vertex u in G, we will use ¯ be the complement of G and random separation [3] to solve the problem. Let G ¯ is bounded d = R(k − 1, k − 1) − 1. Notice that the degree of each vertex in G by d. We first randomly color each vertex of G by either green or red to form a random partition (Vg , Vr ) of V . Let G be a k-vertex-induced even subgraph of G. A partition of V is a “good partition” for G if all vertices in G are green and all vertices in NG¯ (V (G )) are red. Note that NG¯ (V (G )) has at most dk vertices. Therefore, the probability that a random partition is a good partition for G is at least 2−(d+1)k . Thus, with at least 2−(d+1)k probability, G is the union of some green connected components. For a partition (Vg , Vr ) of V , we first compute a set S of green connected components such that each component in S is a vertex-induced even subgraph of G with at most k vertices. To find a k-vertex-induced even subgraph of G, we only need to find a subset S ⊆ S such that the total number of vertices in S is k. This can be solved in O(kn + m) time by using the standard dynamic programming algorithm. Therefore, with probability at least 2−(d+1)k , we can find a k-vertex-induced even subgraph of G, if it exists, in O((d + k)n + m) time. To derandomize the algorithm, we need a family of partitions such that for every partition P of any (d + 1)k vertices into k vertices and dk vertices, there is a partition in the family that is consistent with P. Thus, any family of (n, (d + 1)k)-universal sets can be used as the required family of partitions. Using the method of Naor, Schulman and Srinivasan [8], we can construct a required family of partitions of size 2(d+1)k (dk + k)O(log(dk+k)) log n, which can be listed in linear time. Hence, we obtain a deterministic algorithm that runs in 2(d+1)k (dk + k)O(log(dk+k)) ((d + k)n + m) log n time. Therefore, we can find a k-vertex-induced even subgraph of G if it exists, or report the non-existence of such a subgraph, in 2(d+1)k (dk + k)O(log(dk+k)) ((d + k)n + m) log n time.
Parameterized Complexity of Even/Odd Subgraph Problems
93
Similar to Theorem 3, we can show that (n − k)-Vertex Even Subgraph is W[1]-hard by a reduction from Exact Odd Set. Theorem 7. (n − k)-Vertex Even Subgraph is W[1]-hard.
5
Odd Subgraphs 2
Theorem 8. k-Edge Odd Subgraph can be solved in 2k k O(log k) (kn+m) log n time. Proof. Suppose that there is a vertex v in G with deg(v) ≥ k + 1, then G must contain a star with center v and at least k + 1 leaves. If k is odd, then a star with k leaves is an odd subgraph in G. If k is even, we have three cases: If there is an edge ab ∈ E(G) such that a ∈ N [v], then edge ab combining with a star with center v and k − 1 leaves forms a k-edge-induced odd subgraph in G; if there is an edge ab ∈ E(G) such that a, b ∈ N (v), then edge ab combining with a star with center v and k − 1 leaves forms a k-edge-induced odd subgraph in G; otherwise, k-Edge Odd Subgraph has no solution. We now suppose that the largest degree in G is k. By the random separation method, we first randomly color each edge of G by either green or red to form a random partition (Eg , Er ) of E. Let G be a k-edge odd subgraph of G. A partition of E is a “good partition” for G if all edges in G are green and all edges in E = {e ∈ E \ E(G ): e is incident on a vertex of V (G )} are red. Note that E has at most k(k − 1) edges. Therefore, the probability that a 2 random partition is a good partition for G is at least 2−k . Thus, with at least −k2 2 probability, G is a green connected component. For a partition (Eg , Er ) of E, it takes O(kn + m) time to find a k-edge-induced odd subgraph if it 2 exists. Therefore, with probability at least 2−k , we can find a k-edge-induced odd subgraph of G, if it exists, in O(kn + m) time. Similar to Theorem 6, we can derandomize the algorithm by using (m, k 2 )-universal sets to obtain a 2 deterministic algorithm that runs in 2k k O(log k) (kn + m) log n time. Theorem 9. (m − k)-Edge Odd Subgraph can be solved in Bk 2O(k) nm log n time, where Bk is the kth Bell number. Proof. We will solve this problem using the color-coding method. Randomly color each edge of G = (V, E) by one of the k colors {1, 2, . . . , k}. We want to decide if G has a colorful k-edge subgraph G such that G contains all even vertices of G and a subset of odd vertices of G, and every vertex of G has the inverse parity as that in G (such a subgraph is called parity-inverse). Let Veven be the set of all even vertices in G. If |Veven | is odd, then (m − k)-Edge Odd Subgraph has no solution. So we assume that |Veven | is even and let β = |Veven |/2. If β > k, then (m − k)-Edge Odd Subgraph has no solution. Thus, we suppose that β ≤ k. For a k-colored graph G, we use a collection of color subsets {S1 , . . . , Sβ , . . . , Sβ+ } to represent a colorful k-edge parity-inverse subgraph G such that each Si , 1 ≤ i ≤ β, is a color subset of the corresponding
94
L. Cai and B. Yang
path between two even vertices in G , each Sβ+i , 1 ≤ i ≤ , is a color subset of the corresponding Eulerian subgraph in G , and all these paths and Eulerian subgraphs are edge-disjoint. Then, similar to the proof of Theorem 5, we can show that (m − k)-Edge Odd Subgraph can be solved in Bk 2O(k) nm log n time, where Bk is the kth Bell number. Theorem 10. k-Vertex Odd Subgraph can be solved in 2(d+1)k (dk + k)O(log(dk+k)) ((d + k)n + m) log n time, where d = R(k − 1, k − 1) − 1 and R(k − 1, k − 1) is the Ramsey number. Proof. When k is odd, if there is a k-vertex-induced odd subgraph G in G, then the sum of the total degrees in G must be odd. This contradicts to the fact that this sum is equal to the twice of the number of edges in G . Thus, when k is odd, there does not exist a k-vertex-induced odd subgraph. Suppose that k is even. If there is a vertex v in G with at least R(k − 1, k − 1) neighbors, then from Ramsey’s Theorem, there is either an independent set of size k −1 in G[N (v)] or a clique of order k −1 in G[N (v)]. Thus, G[N [v]] contains either a star in G with k − 1 leaves or a clique of order k in G. Since k is even, we know both a star with k − 1 leaves and a clique of order k are k-vertexinduced odd subgraph in G. Otherwise, every vertex of G has degree at most R(k − 1, k − 1) − 1. We can use random separation to find a k-vertex-induced odd subgraph. Let d = R(k−1, k−1)−1 and G be a k-vertex-induced odd subgraph of G. For a random partition (Vg , Vr ) of V , with at least 2−(d+1)k probability, each vertex of G is green and each vertex of N (V (G )) is red. Thus, with probability at least 2−(d+1)k , we can find a k-vertex-induced odd subgraph of G, if it exists, in O((d+k)n+m) time. Similar to Theorem 6, we can derandomize the algorithm by using (n, (d+1)k)-universal sets to obtain a deterministic algorithm that runs in 2(d+1)k (dk + k)O(log(dk+k)) ((d + k)n + m) log n time to find a k-vertex-induced odd subgraph of G if it exists, or report the non-existence of such a subgraph. Theorem 11. (n − k)-Vertex Odd Subgraph is W[1]-hard. Proof. We show that (n − k)-Vertex Odd Subgraph is W[1]-hard by a reduction from the Exact Odd Set problem. For a red/blue bipartite graph G = (R, B, E) and a positive integer k, we make 2k copies of B and connect 2k them to R to obtain a bipartite graph G = (R, ∪2k i=1 Bi , ∪i=1 Ei ) such that each subgraph Gi = (R, Bi , Ei ), 1 ≤ i ≤ 2k, is isomorphic to G = (R, B, E). If Bi contains odd vertices, then we add 2k vertices ui , 1 ≤ i ≤ 2k, to G and connect ui to each odd vertex in Bi using an edge. If the degree of ui is even, then we add 2k vertices ui , 1 ≤ i ≤ 2k, and connect ui to ui using an edge. If R contains even vertices, then we add a vertex a and connect a to each even vertex in R using a path of length two. If the degree of a is even, then we add a vertex a and connect a to a using an edge. Then we obtain a new graph, denoted by G∗ , which is an instance of (n − k)-Vertex Odd Subgraph. It is easy to see that G∗ can be constructed in polynomial time. Similar to Theorem 7, we can show that there is a subset R ⊆ R of k vertices that is an odd set in G if and only if there is a subset V ⊆ V (G∗ ) of k vertices such that G∗ − V is an odd subgraph.
Parameterized Complexity of Even/Odd Subgraph Problems
6
95
Connected Odd Subgraphs
Theorem 12. Connected Odd Subgraph is NP-complete. Proof. We show that Connected Odd Subgraph is NP-hard by a reduction from the Hamilton Cycle problem on cubic graphs. Given a cubic graph G = (V, E) with n vertices, for each vertex v ∈ V , we add a vertex v and connect v to v using an edge. Let G = (V ∪ V , E ∪ E ) be the resulting graph with |V | = |E | = n. We will prove that G contains a Hamilton cycle if and only if G has a connected odd subgraph of 2n edges. Suppose that G contains a Hamilton cycle H. Since |E| = 3n/2, we know that n is an even number. For the subgraph G = (V ∪ V , E(H) ∪ E ), every vertex in V has degree 3 and every vertex in V has degree 1. Thus G is a connected odd subgraph of G with 2n edges. Conversely, suppose that G has a connected odd subgraph G of 2n edges. Since |E(G )| − 2n = n/2, each vertex v ∈ V has even degree in G and |V | = n, we know that the edge set E(G ) \ E(G ) must be a perfect matching of G. Thus, every vertex of v ∈ V has degree 3 in G . Since G is connected, we know that G [V ] is a cycle of length n. Thus, it is a Hamilton cycle of G. Similar to Theorem 10, we can prove the following result. Theorem 13. k-Vertex Connected Odd Subgraph can be solved in 2(d+1)k (dk + k)O(log(dk+k)) (n + m) log n time, where d = R(k − 1, k − 1) − 1 and R(k − 1, k − 1) is the Ramsey number. Proof. Since when k is odd, there does not exist a k-vertex-induced connected odd subgraph, we only consider the case that k is even. If there is a vertex v in G with at least R(k − 1, k − 1) neighbors, then from Ramsey’s Theorem, there is either an independent set of size k − 1 in G[N (v)] or a clique of order k − 1 in G[N (v)]. Thus, G[N [v]] contains either a star in G with k − 1 leaves or a clique of order k in G, which is a k-vertex-induced connected odd subgraph in G. Otherwise, every vertex of G has degree at most R(k − 1, k − 1) − 1. Let d = R(k−1, k−1)−1 and G be a k-vertex-induced connected odd subgraph of G. In the random separation method, for a random partition (Vg , Vr ) of V , with at least 2−(d+1)k probability, each vertex of G is green and each vertex of N (V (G )) is red. Thus, with probability at least 2−(d+1)k , we can find a k-vertex-induced connected odd subgraph of G, if it exists, in O(n+m) time. Similar to Theorem 6, we can derandomize the algorithm by using (n, (d + 1)k)-universal sets to obtain a deterministic algorithm that runs in 2(d+1)k (dk + k)O(log(dk+k)) (n + m) log n time to find a k-vertex-induced connected odd subgraph of G if it exists, or report the non-existence of such a subgraph. Similar to Theorem 11, we can show that (n − k)-Vertex Connected Odd Subgraph is W[1]-hard by a reduction from Exact Odd Set.
96
L. Cai and B. Yang
Theorem 14. (n − k)-Vertex Connected Odd Subgraph is W[1]-hard. Proof. Similar to the proof of Theorem 11, we first construct the graph G∗ . In order to guarantee the remaining graph is connected after k vertices are deleted, we add two vertices x and y to G∗ and connect each of them to every vertex in G∗ by an edge. Thus, deg(x) = deg(y) = |V (G∗ )|. If deg(x) is even, then connect x with y by an edge. We finally obtain a new graph, denoted by G∗1 , which is an instance of (n − k)-Vertex Connected Odd Subgraph. Similar to Theorem 7, we can show that there is a subset R ⊆ R of k vertices that is an odd set in G if and only if there is a subset V ⊆ V (G∗1 ) of k vertices such that G∗1 − V is a connected odd subgraph.
7
Conclusions
We conjecture that Even Subgraph and Odd Subgraph are NP-complete. The parameterized complexity of the following problems are still unknown: (m − k)-Edge Eulerian Subgraph, k-Vertex Eulerian Subgraph, (m − k)-Edge Connected Odd Subgraph and k-Edge Connected Odd Subgraph. Many variants of the problems considered in this paper are also open. For example, finding k-edge (connected) subgraph with maximum/minimum number of even/odd vertices and finding k-vertex (connected) subgraph with maximum/minimum number of even/odd vertices.
References 1. Alon, N., Yuster, R., Zwick, U.: Color-coding. Journal of ACM 42, 844–856 (1995) 2. Cai, L.: Fixed-parameter tractability of graph modification problems for hereditary properties. Information Processing Letters 58(4), 171–176 (1996) 3. Cai, L., Chan, S.M., Chan, S.O.: Random separation: a new method for solving fixed-cardinality optimization problems. In: Bodlaender, H.L., Langston, M.A. (eds.) IWPEC 2006. LNCS, vol. 4169, pp. 239–250. Springer, Heidelberg (2006) 4. Downey, R.G., Fellows, M.R.: Parameterized Complexity. Springer, Heidelberg (1999) 5. Downey, R.G., Fellows, M.R., Vardy, A., Whittle, G.: The parameterized complexity of some fundamental problems in coding theory. SIAM Journal on Computing 29, 545–570 (1999) 6. Khot, S., Raman, V.: Parameterized complexity of finding subgraphs with hereditary properties. Theoretical Computer Science 289(2), 997–1008 (2002) 7. Lewis, J.M., Yannakakis, M.: The node-deletion problem for hereditary properties is NP-complete. J. of Computer System Science 20(2), 219–230 (1980) 8. Naor, M., Schulman, L.J., Srinivasan, A.: Splitters and near-optimal derandomization. In: Proceedings of 36th Annual Symposium of Foundations of Computer Science (FOCS), pp. 182–191 (1995) 9. Natanzon, A., Shamir, R., Sharan, R.: Complexity classification of some edge modification problems. Discrete Applied Mathematics 113, 109–128 (2001) 10. Schmidt, J.P., Siegel, A.: The spatial complexity of oblivious k-probe hash functions. SIAM Journal of Computing 19, 775–786 (1990)
Popular Matchings in the Marriage and Roommates Problems P´eter Bir´ o , Robert W. Irving, and David F. Manlove Department of Computing Science, University of Glasgow, Glasgow G12 8QQ, UK {pbiro,rwi,davidm}@dcs.gla.ac.uk
Abstract. Popular matchings have recently been a subject of study in the context of the so-called House Allocation Problem, where the objective is to match applicants to houses over which the applicants have preferences. A matching M is called popular if there is no other matching M with the property that more applicants prefer their allocation in M to their allocation in M . In this paper we study popular matchings in the context of the Roommates Problem, including its special (bipartite) case, the Marriage Problem. We investigate the relationship between popularity and stability, and describe efficient algorithms to test a matching for popularity in these settings. We also show that, when ties are permitted in the preferences, it is NP-hard to determine whether a popular matching exists in both the Roommates and Marriage cases.
1
Introduction
Background. Stable matching problems have a long history, dating back to the seminal paper of Gale and Shapley [9], and these problems continue as an area of active research among computer scientists, mathematicians and economists [13,25]. An instance of the classical Stable Marriage problem (sm) involves sets of n men and n women, and each person has a strict order of preference (their preference list) over all of the members of the opposite sex. A stable matching M is a set of n disjoint man-woman pairs such that no man m and woman w who do not form a pair prefer each other to their partners in M . The Stable Roommates problem (sr) is the generalisation of sm to the non-bipartite case, where each person has a strict order of preference over all of the others. Gale and Shapley [9] showed that every instance of sm admits a stable matching, and such a matching can be found in O(n2 ) time, whereas, by contrast, some sr instances admit no stable matching. Irving [15] gave an O(n2 ) time algorithm to find a stable matching in an sr instance, when one exists. A wide range of extensions of these fundamental problems have been studied. For instance, the existence results and efficient algorithms extend to the case where preference lists are incomplete, i.e., when participants can declare some of the others to be unacceptable as partners. In this case, both the Gale-Shapley
This work was supported by EPSRC grant EP/E011993/1. This work was supported by OTKA grant K69027.
T. Calamoneri and J. Diaz (Eds.): CIAC 2010, LNCS 6078, pp. 97–108, 2010. c Springer-Verlag Berlin Heidelberg 2010
98
P. Bir´ o, R.W. Irving, and D.F. Manlove
algorithm and Irving’s algorithm can be adapted to run in O(m) time, where m is the sum of the lengths of the preference lists [13]. Furthermore, in this case, it is known that all stable matchings have the same size and match exactly the same people [10,13]. If, in addition, ties are permitted in an individual’s preferences, then the situation becomes more complex. Here, a stable matching always exists, but different stable matchings can have different sizes, and it is NP-hard to find a stable matching of maximum (or minimum) size [16,18]. In the Roommates case it is NP-complete to determine whether a stable matching exists (even if preference lists are complete) [24]. Here, we are interested in the Marriage and Roommates scenarios, where each participant expresses preferences over some or all of the others, but we focus on matchings that are popular rather than stable. A matching M is popular if there is no other matching M with the property that more participants prefer M to M than prefer M to M . M is strongly popular if, for any other matching M , more participants prefer M to M than prefer M to M . These concepts were introduced in the Marriage context by G¨ ardenfors [11]. Recently, popular matchings have been studied in the context of the so-called House Allocation problem (ha). An instance of ha involves a set of applicants and a set of houses. Each applicant has a strict order of preference over the houses that are acceptable to him, but houses have no preference over applicants. Abraham et al. [1] described an O(n + m) time algorithm to find a popular matching, if one exists, in an instance of ha, where n is the total number of applicants and houses, and m is the total number of acceptable applicant-house pairs. √ In the case that ties are allowed in the preference lists, they gave an O( nm) time algorithm. These results motivated the present study. The contribution of this paper. Our prime focus in this paper is the problem of finding popular matchings in the Roommates and Marriage contexts. In Section 2 we formalise the problem descriptions and give the necessary terminology and notation. In Section 3 we focus on strict preferences. We describe some basic properties of popular matchings, and the more restrictive strongly popular matchings, and their relation to stable matchings. We give a linear time algorithm to test for and to find a strongly popular matching for Roommates instances without ties. We show that, given a Roommates instance (with or without ties) and a matching M , we can test whether M is popular in O( nα(n, m)m log3/2 n) time (where α is the inverse Ackermann’s √ function), and in the Marriage case we show how this√can be improved to O( nm) time. This latter result generalises a previous O( nm) algorithm for the special case where preference lists may include ties and are symmetric (i.e., a man m ranks a woman w in kth place if and only if w ranks m in kth place) [26]. In Section 4 we first investigate which of the results of Section 3 can be extended to the case of ties. Then we establish an NP-completeness result for the problem of determining whether a popular matching exists for a Marriage (or Roommates) instance with ties. We conclude with some open problems in Section 5.
Popular Matchings in the Marriage and Roommates Problems
99
Related work. G¨ ardenfors [11] introduced the notions of a (strong) majority assignment, which is equivalent to a (strongly) popular matching in our terminology. He proved that every stable matching is popular in the Marriage case with strict preferences. Also, he showed that a strongly popular matching is stable in the Marriage case, even if there are ties in the preference lists. The results of Abraham et al. [1] mentioned above led to a number of subsequent papers exploring further aspects and extensions of popular matchings in ha. Manlove and Sng [19] studied the extension in which each house has a capacity, the maximum number of applicants that can be assigned to it in any √ matching, and gave a O( Cn1 + m) time algorithm for this variant, where C is the sum of the capacities of the houses and n1 is the number of applicants. Mestre [22] gave a linear time algorithm for a version of the problem in which each applicant has an associated weight. This algorithm, which assumes that all houses have capacity 1, was extended by Sng and Manlove [27] to the case where houses can have non-unitary capacities. Mahdian [17] showed that, for random instances of ha, popular matchings exist with high probability if the number of houses exceeds the number of applicants by a small constant multiplicative factor. Abraham and Kavitha [2] studied a dynamic version of ha allowing for applicants and houses to enter and leave the market, and for applicants to arbitrarily change their preference lists. They showed the existence of a 2-step voting path to compute a new popular matching after every such change, assuming that a popular matching exists. McCutchen [20] focused on instances of ha for which no popular matching exists, defining two notions of ‘near popularity’, and proving that, for each of these, finding a matching that is as near to popular as possible is NP-hard. Huang et al. [14] built upon the work of McCutchen with a study of approximation algorithms in the context of near popularity. McDermid and Irving [21] characterised the structure of the set of popular matchings for an ha instance, and gave efficient algorithms to count and enumerate the popular matchings, and to find several kinds of optimal popular matchings. In voting theory, a well-established concept of majority equilibrium is the following. Let S = {1, 2, . . . , n} be a society of n individuals, and let X be a set of alternatives. Each individual i ∈ S has a preference order, ≥i , on X. An alternative x ∈ X is called a weak Condorcet winner if for every y ∈ X distinct of x, |{i ∈ S : x >i y}| ≥ |{i ∈ S : y >i x}|; x is a strong Condorcet winner if for every y ∈ X distinct of x, |{i ∈ S : x >i y}| > |{i ∈ S : y >i x}|. It is easy to see that if the set of alternatives is the set of all possible matchings of the individuals then a matching is a weak (respectively strong) Condorcet winner if and only if it is popular (respectively strongly popular). Therefore recent papers of Chen et al., see e.g. [4], which deal with the problems of finding a weak and strong Concordet winner for special graph models, are related to our work.
2
Problem Descriptions, Terminology and Notation
Since the Roommates problem can be seen as an extension of the Marriage problem, we introduce our notation and terminology in the former setting. An instance I of the Roommates Problem (rp) comprises a set of agents A =
100
P. Bir´ o, R.W. Irving, and D.F. Manlove
{a1 , . . . , an }. For each agent ai there is a subset Ai of A \ {ai } containing ai ’s acceptable partners, and ai has a linear order over Ai , which we refer to as ai ’s preference list. If aj precedes ak in ai ’s preference list, we say that ai prefers aj to ak . We are also interested in the extension of rp, called the Roommates Problem with Ties (rpt), in which preference lists may contain tied entries, so that ai prefers aj to ak if and only if aj is a strict predecessor of ak in ai ’s preference list. We say that agent ai is indifferent between aj and ak if aj and ak are tied in his preference list. An instance I of rp may also be viewed as a graph G = (A, E) where {ai , aj } forms an edge in E if and only if ai and aj are each acceptable to the other. We assume that G contains no isolated vertices, and we let m = |E|. We refer to G as the underlying graph of I. A matching in I is a set of disjoint edges in the underlying graph G. An instance of the Marriage Problem with Ties (mpt) may be viewed as an instance of rpt in which the underlying graph G is bipartite. The Marriage Problem (mp) is the analogous restriction of rp. In either case, the two sets of the bipartition are known as the men and the women. Let I be an instance of rpt. Let M denote the set of matchings in I, and let M ∈ M. Given any ai ∈ A, if {ai , aj } ∈ M for some aj ∈ A, we say that ai is matched in M and M (ai ) denotes aj , otherwise ai is unmatched in M . We define the preferences of an agent over matchings as follows. Given two matchings M and M in M, we say that an agent ai prefers M to M if either (i) ai is matched in M and unmatched in M , or (ii) ai is matched in both M and M and prefers M (ai ) to M (ai ). Let P (M , M ) denote the set of agents who prefer M to M , and let I(M , M ) be the set of agents who are indifferent between M and M (i.e., ai ∈ I(M , M ) if and only if either (i) ai is matched in both M and M and either (a) M (ai ) = M (ai ) or (b) ai is indifferent between M (ai ) and M (ai ), or (ii) ai is unmatched in both M and M ). Then P (M, M ), P (M , M ) and I(M , M ) (=I(M, M )) partition A. A blocking pair with respect to a matching M ∈ M is an edge {ai , aj } ∈ E\M such that each of ai and aj prefers {{ai , aj }} to M . A matching is stable if it admits no blocking pair. As observed earlier, an instance of rp or rpt may or may not admit a stable matching, whereas every instance of mp or mpt admits at least one such matching. Given two matchings M and M in M, define D(M, M ) = |P (M, M )| − |P (M , M )|. Clearly D(M, M ) = −D(M , M ). We say that M is more popular than M , denoted M M , if D(M, M ) > 0. M is popular if D(M, M ) ≥ 0 for all matchings M ∈ M. Also M is strongly popular if D(M, M ) > 0 for all matchings M ∈ M\{M }.1 Furthermore, for a set of agents S ⊆ V (G), let PS (M, M ) denote the subset of S whose members prefer M to M . Let DS (M, M ) = |PS (M, M )| − |PS (M , M )|. We say that M S M if DS (M, M ) > 0. We will also use the 1
In fact it is not difficult to see that M is popular if D(M, M ) ≥ 0 for all maximal matchings M ∈ M, and M is strongly popular if D(M, M ) > 0 for all maximal matchings M ∈ M\{M }.
Popular Matchings in the Marriage and Roommates Problems
101
standard notation M |S for the restriction of a matching M to the set of agents S, where v ∈ S is considered to be unmatched in M |S if he is matched in M but M (v) is not in S.
3
The Case of Strict Preferences
In this section we investigate popular matchings in instances of rp and mp where, by definition, every agent’s preference list is strictly ordered. 3.1
Relationships between Strongly Popular, Popular and Stable Matchings
Let S1 , S2 , . . . Sk be a partition of V (G). Then for any two matchings M and M , k P (M, M ) = ∪ki=1 PSi (M, M ) and D(M, M ) = i=1 DSi (M, M ) by definition. We will prove some useful lemmas by using the above identity for two particular partitions. First, let us consider the component-wise partition of V (G) for the symmetric difference of two matchings M and M . For each component Gi of M ⊕ M let Ci = V (Gi ). We consider the following equation: D(M, M ) =
k
DCi (M, M )
(1)
i=1
Note that if |Ci | = 1 then it must be the case that DCi (M, M ) = 0 since the corresponding agent is either unmatched in both M and M or has the same partner in M and M . Lemma 1. For a given instance of rp, a matching M is popular if and only if, for any other matching M , DCi (M, M ) ≥ 0 for each component Gi of M ⊕ M , where Ci = V (Gi ). The proof of Lemma 1 can be found in our corresponding technical report [3]. A similar statement holds for strongly popular matchings, as follows. Lemma 2. For a given instance of rp, a matching M is strongly popular if and only if, for any other matching M , DCi (M, M ) > 0 for each component Gi of M ⊕ M , where Ci = V (Gi ) and |Ci | ≥ 2. See [3] for the proof of Lemma 2. Now, let M , M be any two matchings and let F = M \M = {e1 , e2 , . . . , ek }. Further let X ⊆ V (G) be the set of agents covered ¯ = V (G)\X. Considering the partition {E1 , E2 , . . . Ek , X}, ¯ where by F and let X Ei represents the end vertices of the edge ei , we have D(M , M ) =
k
DEi (M , M ) + DX¯ (M , M ).
i=1
This identity leads to the following lemma.
(2)
102
P. Bir´ o, R.W. Irving, and D.F. Manlove
Lemma 3. Suppose that we are given an instance of rp and two matchings M and M . a) If M M then M must contain an edge that is blocking for M . b) If M is stable then M is popular. c) If M is stable and M is popular then M covers all the vertices that M covers, implying |M | ≥ |M |, and DEi (M , M ) = 0 for each ei ∈ M \ M (i.e., in each pair corresponding to an edge of M \ M exactly one agent prefers M to M and the other prefers M to M ). The proof of Lemma 3 can be found in [3]. We note that the result of Lemma 3(b) was proved by G¨ ardenfors [11] for mp. It is straightforward to verify that if I is an instance of rp and M is a strongly popular matching in I then M is the only popular matching in I. This implies that an instance of rp admits at most one strongly popular matching. The following proposition was proved by G¨ ardenfors [11] for mp. Here we generalise the result to the rp context. Proposition 4. Let I be an instance of rp and let M be a strongly popular matching in I. Then M is stable in I. Proof. If M is not stable then let {ai , aj } be a blocking pair of M . Let M be a matching formed from M as follows: (i) remove the edge {ai , M (ai )} if ai is matched in M , (ii) remove the edge {aj , M (aj )} if aj is matched in M , then (iii) add the edge {ai , aj }. Then |P (M , M )| = 2 whilst |P (M, M )| ≤ 2, contradicting the strong popularity of M . Hence M is stable in I.
Lemma 3(b) and Proposition 4 thus give the following chain of implications involving properties of a matching M in an instance I of rp: strongly popular ⇒ stable ⇒ popular ⇒ maximal Examples to illustrate the following facts are given in [3]. An instance of rp may not admit a popular matching, but a popular matching may exist even if the instance does not admit a stable matching. Moreover, a unique stable matching (which is also a unique popular matching) is not necessarily strongly popular. Therefore the converse to each of the above implications is not true in general. In the case of MP, examples are given to show that a popular matching can be larger than a stable matching, a maximum cardinality matching need not be popular, and the relation can cycle (even if a stable matching exists). 3.2
Testing for and Finding a Strongly Popular Matching
We begin this section by giving an O(m) algorithm that tests a given stable matching for strong popularity. Let I be an instance of rp and let M be a stable matching in I. Define the graph HM = (A, EM ), where a is unmatched in M or prefers aj to M (ai ) ∨ EM = {ai , aj } ∈ E : i . aj is unmatched in M or prefers ai to M (aj )
Popular Matchings in the Marriage and Roommates Problems
103
Lemma 5. Let I be an instance of rp and let M be a stable matching in I. Let HM be the graph defined above. Then M is strongly popular in I if and only if HM contains no alternating cycle or augmenting path relative to M . Proof. Strong popularity implies that no such alternating cycle or augmenting path exists in HM relative to M by Lemma 2. This is because if M is the matching obtained by switching edges along this alternating path (or cycle) and Ci denotes the set of agents involved then it would be the case that DCi (M, M ) ≤ 0 in this component. On the other hand, suppose that M is stable but not strongly popular, i.e., there is a matching M such that D(M , M ) = 0. The statements of Lemma 3(c) hold in this case too by the very same argument used in the proof of that result. The fact that M covers all the vertices that are covered by M means that each component of M ⊕ M is either an alternating cycle or an augmenting path. And since DEi (M , M ) = 0 for each ei ∈ M \ M , every edge in M \ M must belong to HM .
Based on Lemma 5 we can give a linear time algorithm for the problem of finding a strongly popular matching as indicated by the following theorem. Theorem 6. Given an instance I of rp, we may find a strongly popular matching or report that none exists in O(m) time. Proof. We firstly test whether I admits a stable matching in O(m) time [13, Section 4.5.2]. If no such matching exists, I does not admit a strongly popular matching by Proposition 4. Now suppose that I admits a stable matching M . Then I admits a strongly popular matching if and only if M is strongly popular. For, suppose that I admits a strongly popular matching M = M . Then M is certainly popular, and M is popular by Lemma 3(b), a contradiction to the fact that if a strongly popular matching exists then no other popular matching exists for the instance. By Lemma 5, M is strongly popular if and only if HM contains no augmenting path or alternating cycle relative to M . Clearly HM has O(n) vertices and O(m) edges. We may test for the existence of each of these structures in O(m) time (see [5,7] and [6] respectively).
3.3
Testing for Popularity
In order to test a matching M in a given instance of rp for popularity, we form a weighted graph HM as follows. The vertices of HM are A ∪ A , where A = {a1 , . . . , an }. The edges of HM are E ∪ E ∪ E , where E = {{ai , aj } : {ai , aj } ∈ E} and E = {{ai , ai } : 1 ≤ i ≤ n}. For each edge {ai , aj } ∈ E, we define δi,j as follows: ⎧ ⎨ 0, if {ai , aj } ∈ M 1 , if ai is unmatched in M or prefers aj to M (ai ) δi,j = ⎩ 21 − 2 , otherwise For each edge {ai , aj } ∈ E, we define the weight of {ai , aj } in HM to be δi,j +δj,i . Similarly, for each edge {ai , aj } ∈ E , we define the weight of {ai , aj } in HM
104
P. Bir´ o, R.W. Irving, and D.F. Manlove
to be δi,j + δj,i . Finally, for each edge {ai , ai } ∈ E , we define the weight of {ai , ai } in HM to be −1 if ai is matched in M , and 0 otherwise. It is clear that the weight of each edge belongs to the set {−1, 0, 1}. In what follows, given a matching M in G, we define M to be a matching in HM such that M = {{ai , aj } : {ai , aj } ∈ M }. Lemma 7. Let I be an instance of rp and let M be a matching in I. Let HM be the weighted graph defined above. Then M is popular if and only if a maximum weight perfect matching in HM has weight 0. Proof. Let M1 be any matching in I, and let AM1 denote the agents in A who are matched in M1 . Define the matching S(M1 ) = M1 ∪ M1 ∪ {{ai , ai } : ai ∈ A\AM1 }. We claim that wt(S(M1 )) = D(M1 , M ), where wt(M ∼ ) is the weight of a matching M ∼ in HM . To show this let M1 = {{ai , ai } : ai ∈ A \ AM1 }. Also let X = M1 \ M . Define n− , n0 , n+ to be the numbers of edges of weight −1, 0, 1 in X respectively. Also define n− to be the number of edges of weight −1 in M1 . Then wt(S(M1 )) = 2(n+ − n− ) − n− . Also |P (M1 , M )| = n0 + 2n+ and |P (M, M1 )| = n0 + 2n− + n− . So wt(S(M1 )) = D(M1 , M ) as claimed. Now suppose that a maximum weight perfect matching in HM has weight 0. Suppose M is not popular. Then there is a matching M1 such that D(M1 , M ) > 0. But wt(S(M1 )) = D(M1 , M ), a contradiction. Conversely suppose that M is popular. By the above claim, wt(S(M )) = D(M, M ) = 0. Suppose that S(M ) is not a maximum weight perfect matching in HM . Let M ∗ be a perfect matching in HM such that wt(M ∗ ) > 0. Then either S(M1 ) or S(M2 ) has positive weight, where M1 = M ∗ |A and M2 = {{ai , aj } : {ai , aj } ∈ M ∗ |A }. Hence by the above claim, it follows that either M1 or M2 respectively is more popular than M , a contradiction.
Theorem 8. Given an instance I of rp and a matching M in I, we can test whether M is popular in O( nα(n, m)m log3/2 n) time. Proof. Clearly HM has O(n) vertices and O(m) edges. The current fastest algorithm for finding a maximum weight perfect matching in a weighted graph with
weights {−1, 0, 1} has complexity O( nα(n, m)m log3/2 n) [8]. It is clear that a perfect matching M ∗ of positive weight exists in HM if and only if HM admits an alternating cycle (relative to S(M )) of positive weight. It is an open question whether testing for such an alternating cycle is possible in a better running time than finding a maximum weight perfect matching in the general case. However, this is possible in the mp case. First we observe that if G is bipartite then HM is also bipartite. Then the problem of finding an alternating cycle of positive weight can be reduced to the problem of finding a directed cycle of positive weight in DM , where DM is a directed graph obtained by orienting the edges of HM in the following way: all the edges of S(M ) are directed from the
Popular Matchings in the Marriage and Roommates Problems
105
men to the women and all the other edges are directed from the women to the men. The problem of finding a directed cycle of positive weight in a directed graph √ with weights {−1, 0, 1} (or reporting that none exists) can be solved in O( nm) time by the algorithm of Goldberg [12]. This implies the following result. Theorem 9. Given an instance I of mp and a matching M in I, we can test √ whether M is popular in O( nm) time.
4
The Case of Preferences with Ties
In this section we consider popular matchings in instances of rpt and mpt. 4.1
Some Results Extended to the Case of Ties
It is not hard to see that Proposition 4 continues to hold in the presence of ties. However, one of the key differences is that stability no longer necessarily implies popularity, so that, in particular, it is not necessarily the case that an instance of mpt admits a popular matching (this is illustrated with an example in [3]). The algorithm for testing the popularity of a matching in an instance of rp can be extended to the ties case in a natural way, namely by setting δi,j to be 0 if {ai , aj } ∈ M or if ai is indifferent between aj and M (ai ). As a result we will have weights {−1, − 21 , 0, 12 , 1} in HM but the technique and the complexity of the popularity checking algorithm (in both the rpt and mpt cases) does not change. On the other hand, the algorithm for finding a strongly popular matching no longer works for the case of ties. However we can still check the strong popularity of a matching, using a similar technique to that used for popularity checking, in the following way. A matching M is strongly popular if and only if every perfect matching in HM , excluding S(M ), has negative weight. That is, if every perfect matching M ∗ = S(M ) in HM has weight at most − 12 . We can reduce this decision problem to another maximum weight perfect matching problem, where wε (e) = w(e) − ε = −ε for every edge e ∈ S(M ) (and wε (e) = w(e) for every edge e of HM not in S(M )) 1 where ε < 2n . Here S(M ) is the only perfect matching of weight 0 for w if and only if the maximum weight of a perfect matching in HM is −εn for wε . To facilitate description of some of the subsequent results in this section, we introduce some shorthand notation for variants of the popular matching problem, as follows: pop-mpt/rpt: the problem of determining whether a popular matching exists, given an instance of mpt/rpt; perfect-pop-mpt/rpt: the problem of determining whether there exists a perfect popular matching, given an instance of mpt/rpt.
106
4.2
P. Bir´ o, R.W. Irving, and D.F. Manlove
Popular Matchings in the Marriage Problem with Ties
We next show that the problem of deciding whether a perfect popular matching exists, given an instance of mpt, is NP-complete. Theorem 10. perfect-pop-mpt is NP-complete. Proof (The construction only). We reduce from exact-mm, that is the problem of deciding, given a graph G and an integer K, whether G admits a maximal matching of size exactly K. exact-mm is NP-complete even for subdivision graphs of cubic graphs [23]. Suppose that we are given an instance I of exact-mm with the above restriction on a graph G = (A ∪ B, E), where A = {u1 , . . . , un1 } and B = {v1 , . . . , vn2 } satisfying 3n1 = 3|A| = 2|B| = 2n2 . We construct an instance I of perfect-pop-mpt with a graph G = (U ∪V, E ), where U and V are referred to as women and men respectively, as follows. Initially we let U = A and V = B. The proper part of I is the exact copy of I such that all neighbours of each agent ui ∈ A (and vj ∈ B) are in a tie in ui ’s (and vj ’s) preference list. The agents of the proper part are called proper agents. For each edge {ui , vj } ∈ E(G), we create two vertices, si,j ∈ V and ti,j ∈ U with three edges, {ui , si,j }, {si,j , ti,j }, {ti,j , vj } in E , where ui (and vj ) prefers her (his) proper neighbours to si,j (to ti,j ) respectively, si,j prefers ui to ti,j , whilst ti,j is indifferent between si,j and vj . Moreover, for a given ui ∈ A, all agents of the form si,j such that {ui , vj } ∈ E are tied in ui ’s list in I , and similarly, for a given vj ∈ B, all agents of the form ti,j such that {ui , vj } ∈ E are tied in vj ’s list in I . We complete the construction by adding two sets of garbage collectors to V and U , namely X = {x1 , . . . , xn1 −K } of size n1 − K and Y = {y1 , . . . , yn2 −K } of size n2 − K, respectively, such that these sets of agents appear in a tie at the end of each proper agent’s list. That is, each ui ∈ A has the members of X in a tie at the tail of her list and each vj ∈ B has the members of Y in a tie at the tail of his list. The members of the garbage collectors are indifferent between the proper agents. We need to show that I admits a maximal matching of size K if and only if I admits a perfect popular matching. This part of the proof can be found in [3].
It is possible to extend the result of Theorem 10 to the case where we do not require a popular matching to be perfect. This leads to the following result, the proof of which can be found in [3]. Theorem 11. pop-mpt is NP-complete. These results imply the NP-completeness of perfect-pop-rpt and pop-rpt.
5
Open Problems
In this paper we proved that the problem of finding a perfect popular matching (or reporting that none exists) given an mpt instance is NP-hard, and that the
Popular Matchings in the Marriage and Roommates Problems
107
problem remains NP-hard even if we merely seek a popular matching (of arbitrary size). However, the complexity of the problem of constructing a maximum cardinality popular matching in an mp instance remains open. The other main open problem is whether finding a popular matching (or reporting that none exists) is possible in polynomial time for an instance of rp. A third open problem is the complexity of finding a strongly popular matching (or reporting that none exists), for an instance of rpt. Finally we remark that the above-mentioned NPhardness results were established for mpt instances with incomplete lists, and it is open as to whether the same results hold for complete lists. Our results and the main open problems are summarised in Table 1. Table 1. Complexity results for problems of finding popular matchings The problem of finding a popular matching that is arbitrary maximum
Marriage instances strict with ties P [9,11] NPC open NPC
Roommates instances strict with ties open NPC open NPC
Acknowledgement We would like to thank an anonymous referee for giving helpful comments.
References 1. Abraham, D.J., Irving, R.W., Kavitha, T., Mehlhorn, K.: Popular matchings. SIAM Journal on Computing 37, 1030–1045 (2007) 2. Abraham, D.J., Kavitha, T.: Dynamic matching markets and voting paths. In: Arge, L., Freivalds, R. (eds.) SWAT 2006. LNCS, vol. 4059, pp. 65–76. Springer, Heidelberg (2006) 3. Bir´ o, P., Irving, R.W., Manlove, D.F.: Popular matchings in the Marriage and Roommates problems. Technical Report TR-2009-306, University of Glasgow, Department of Computing Science (December 2009) 4. Chen, L.: An optimal utility value method with majority equilibrium for public facility allocation. Pacific Journal of Optimization 3(2), 227–234 (2007) 5. Gabow, H.N.: An efficient implementations of Edmonds’ algorithm for maximum matching on graphs. Journal of the ACM 23(2), 221–234 (1976) 6. Gabow, H.N., Kaplan, H., Tarjan, R.E.: Unique maximum matching algorithms. Journal of Algorithms 40, 159–183 (2001) 7. Gabow, H.N., Tarjan, R.E.: A linear-time algorithm for a special case of disjoint set union. Journal of Computer and System Sciences 30, 209–221 (1985) 8. Gabow, H.N., Tarjan, R.E.: Faster scaling algorithms for general graph-matching problems. Journal of the ACM 38(4), 815–853 (1991) 9. Gale, D., Shapley, L.S.: College admissions and the stability of marriage. American Mathematical Monthly 69, 9–15 (1962) 10. Gale, D., Sotomayor, M.: Some remarks on the stable matching problem. Discrete Applied Mathematics 11, 223–232 (1985)
108
P. Bir´ o, R.W. Irving, and D.F. Manlove
11. G¨ ardenfors, P.: Match making: assignments based on bilateral preferences. Behavioural Science 20, 166–173 (1975) 12. Goldberg, A.V.: Scaling algorithms for the shortest paths problem. SIAM Journal on Computing 24(3), 494–504 (1995) 13. Gusfield, D., Irving, R.W.: The Stable Marriage Problem: Structure and Algorithms. MIT Press, Cambridge (1989) 14. Huang, C.-C., Kavitha, T., Michail, D., Nasre, M.: Bounded unpopularity matchings. In: Gudmundsson, J. (ed.) SWAT 2008. LNCS, vol. 5124, pp. 127–137. Springer, Heidelberg (2008) 15. Irving, R.W.: An efficient algorithm for the “stable roommates” problem. Journal of Algorithms 6, 577–595 (1985) 16. Iwama, K., Manlove, D., Miyazaki, S., Morita, Y.: Stable marriage with incomplete lists and ties. In: Wiedermann, J., Van Emde Boas, P., Nielsen, M. (eds.) ICALP 1999. LNCS, vol. 1644, pp. 443–452. Springer, Heidelberg (1999) 17. Mahdian, M.: Random popular matchings. In: Proceedings of EC 2006: the 7th ACM Conference on Electronic Commerce, pp. 238–242. ACM, New York (2006) 18. Manlove, D.F., Irving, R.W., Iwama, K., Miyazaki, S., Morita, Y.: Hard variants of stable marriage. Theoretical Computer Science 276(1-2), 261–279 (2002) 19. Manlove, D.F., Sng, C.T.S.: Popular matchings in the Capacitated House Allocation problem. In: Azar, Y., Erlebach, T. (eds.) ESA 2006. LNCS, vol. 4168, pp. 492–503. Springer, Heidelberg (2006) 20. McCutchen, R.M.: The least-unpopularity-factor and least-unpopularity-margin criteria for matching problems with one-sided preferences. In: Laber, E.S., Bornstein, C., Nogueira, L.T., Faria, L. (eds.) LATIN 2008. LNCS, vol. 4957, pp. 593–604. Springer, Heidelberg (2008) 21. McDermid, E., Irving, R.W.: Popular matchings: Structure and algorithms. In: Ngo, H.Q. (ed.) COCOON 2009. LNCS, vol. 5609, pp. 506–515. Springer, Heidelberg (2009) 22. Mestre, J.: Weighted popular matchings. In: Bugliesi, M., Preneel, B., Sassone, V., Wegener, I. (eds.) ICALP 2006. LNCS, vol. 4051, pp. 715–726. Springer, Heidelberg (2006) 23. O’Malley, G.: Algorithmic Aspects of Stable Matching Problems. PhD thesis, University of Glasgow, Department of Computing Science (2007) 24. Ronn, E.: NP-complete stable matching problems. Journal of Algorithms 11, 285–304 (1990) 25. Roth, A.E., Sotomayor, M.A.O.: Two-sided matching: a study in game-theoretic modeling and analysis. Econometric Society Monographs, vol. 18. Cambridge University Press, Cambridge (1990) 26. Sng, C.T.S.: Efficient Algorithms for Bipartite Matching Problems with Preferences. PhD thesis, University of Glasgow, Department of Computing Science (2008) 27. Sng, C.T.S., Manlove, D.F.: Popular matchings in the weighted capacitated house allocation problem. Journal of Discrete Algorithms 8, 102–116 (2010)
Bounding the Number of Tolerable Faults in Majority-Based Systems Ching-Lueh Chang1 and Yuh-Dauh Lyuu1,2 1
2
Department of Computer Science and Information Engineering, National Taiwan University, Taipei, Taiwan Department of Finance, National Taiwan University, Taipei, Taiwan
Abstract. Consider the following coloring process in a simple directed graph G(V, E) with positive indegrees. Initially, a set S of vertices are white. Thereafter, a black vertex is colored white whenever the majority of its in-neighbors are white. The coloring process ends when no additional vertices can be colored white. If all vertices end up white, we call S an irreversible dynamic monopoly (or dynamo for short). We derive upper bounds of 0.7732|V | and 0.727|V | on the minimum sizes of irreversible dynamos depending on whether the majority is strict or simple. When G is an undirected connected graph without isolated vertices, upper bounds of |V |/2 and |V |/2 are given on the minimum sizes of irreversible dynamos depending on whether the majority is strict or simple. Let > 0 be any constant. We also show that, unless NP ⊆ TIME(nO(ln ln n) ), no polynomial-time, ((1/2 − ) ln |V |)-approximation algorithms exist for finding a minimum irreversible dynamo.
1
Introduction
Let G(V, E) be a simple directed graph (or digraph for short) with positive indegrees. The following coloring process models the propagation of faults in majority-based fault-tolerant systems [3], [4], [5], [9], [12]. Initially, all vertices in a set S ⊆ V are white, whereas all the others are black. Thereafter, a black vertex is colored white when more than half of its in-neighbors are white. The coloring process proceeds asynchronously until no additional vertices can be colored white. If all vertices end up white, then S is called an irreversible dynamo under the strict-majority scenario. An irreversible dynamo under the simple-majority scenario is defined similarly except that a black vertex is colored white when at least half of its in-neighbors are white. Optimal or nearly optimal bounds on the minimum size of irreversible dynamos are known when G is a toroidal mesh [5], [13], torus cordalis, torus serpentinus [5], butterfly, wrapped butterfly, cube-connected cycle, hypercube, DeBruijn, shuffle-exchange, complete tree, ring [4], [9] and chordal ring [3].
The authors are supported in part by the National Science Council of Taiwan under grant 97-2221-E-002-096-MY3 and Excellent Research Projects of National Taiwan University under grant 98R0062-05.
T. Calamoneri and J. Diaz (Eds.): CIAC 2010, LNCS 6078, pp. 109–119, 2010. c Springer-Verlag Berlin Heidelberg 2010
110
C.-L. Chang and Y.-D. Lyuu
Chang and Lyuu [1] show that G(V, E) has an irreversible dynamo of size at most (23/27)|V | under the strict-majority scenario. This paper improves their (23/27)|V | bound to 0.7732|V |. Moreover, if G is undirected and connected, our 0.7732|V | upper bound can be further lowered to |V |/2. Under the simplemajority scenario, we show that every digraph with positive indegrees has an irreversible dynamo of size at most 0.727|V | and every undirected graph without isolated vertices has an irreversible dynamo of size at most |V |/2. Watts’ model [15] of global cascades assumes a random graph. There is also a random variable distributed in [0, 1], from which every vertex independently draws a ratio. Initially, a uniformly random set of vertices are white. Thereafter, a black vertex becomes white when the fraction of its white neighbors exceeds the above ratio. Finally, the coloring process ends when no additional vertices can be colored white. Watts studies the fraction of white vertices at the end. Gleeson and Cahalane [6] extend Watts’ work by deriving an analytical solution for the fraction of white vertices at the end in tree-like graphs. Samuelsson and Socolar [14] study a more general process called the unordered binary avalanche, which allows coloring mechanisms beyond the threshold-driven ones. Under several randomized mechanisms for coloring the vertices, Kempe et al. [7], [8] and Mossel and Roch [10] show (1 − (1/e) − )-approximation algorithms for allocating a given number of seeds to color the most vertices white, where > 0 is any constant. Kempe et al. [7] also show inapproximability results for the same problem. This paper considers the related problem of finding a minimum irreversible dynamo given an undirected graph, which arises naturally because an extensive literature has been investigating the minimum size of irreversible dynamos. We show that, unless NP ⊆ TIME(nO(ln ln n) ), no polynomial-time, ((1/2 − ) ln |V |)-approximation algorithms exist for the minimum irreversible dynamo, either under the strict or the simple-majority scenario.
2
Definitions
Let G(V, E) be a simple directed graph (or digraph for short) [11] with positive indegrees. For v ∈ V, we denote by N in (v) ⊆ V \ {v} and N out (v) ⊆ V \ {v} the sets of in- and out-neighbors of v, respectively. Then write degin (v) = |N in (v)| and degout (v) = |N out (v)|. For X, Y ⊆ V, we write e(X, Y ) = |(X × Y ) ∩ E|. For a vertex v of an undirected graph, let deg(v) = degin (v) and N (v) = N in (v). Furthermore, define N ∗ (v) = N (v) ∪ {v}. For any two vertices x and y of an undirected connected graph, let d(x, y) be their distance. For any v ∈ V and nonempty U ⊆ V, denote d(v, U ) = minu∈U d(v, u). For any V ⊆ V, the subgraph of G induced by V is denoted by G[V ]. All graphs in this paper are simple and have positive indegrees. A network N (G, φ) consists of a digraph G(V, E) with positive indegrees and a function φ : V → N. The coloring process in N (G, φ) proceeds asynchronously. Initially, a set S ⊆ V of vertices, called the seeds, are white whereas all the others are black. Thereafter, a vertex v becomes white when at least φ(v) of the vertices in N in (v) are white. The coloring process ends when no additional vertices can be
Bounding the Number of Tolerable Faults in Majority-Based Systems
111
colored white. Let c(S, G, φ) ⊆ V be the set of vertices that are white at the end given that S is the set of seeds. Define min-seed(G, φ) = minU⊆V,c(U,G,φ)=V |U |. Let φstrict (v) ≡ (degin (v) + 1)/2 and φsimple (v) ≡ degin (v)/2 for v ∈ V . A set S ⊆ V is called an irreversible dynamic monopoly (or irreversible dynamo for short) of N (G, φstrict ) if c(S, G, φstrict ) = V [12]. Similarly, it is an irreversible dynamo of N (G, φsimple ) if c(S, G, φsimple ) = V . Given an undirected graph G(V, E), the problem irreversible dynamo (strict majority) asks for a minimum irreversible dynamo under the strict-majority scenario. Similarly, irreversible dynamo (simple majority) asks for one under the simplemajority scenario. For p ∈ (0, 1) and integers 0 ≤ j ≤ k, define j k i fp (k, j) ≡ (1 − p) p (1 − p)k−i . i i=0 Fact 1. (Implicit in [1]) Let p ∈ (0, 1) be arbitrary. In any network N (G, φ), in min-seed(G, φ) ≤ p|V | + fp deg (v), φ(v) − 1 . v∈V
3
Irreversible Dynamos of Directed Graphs
This section deals with irreversible dynamos of digraphs. Lemma 1. Let p ∈ (0, 1) and D be a positive integer. Then any network N (G, φstrict ) has an irreversible dynamo of size at most
D+1 d−1 max p + sup fp d, , D+12 · |V |. 2 +1 d≥D+1 2 Proof. We proceed by induction on |V |. The lemma can be easily verified for |V | ≤ 2. Now assume that the lemma holds for all digraphs with fewer than |V | vertices. We shall show that the lemma is true for G(V, E) as well. If degin (v) ≥ D + 1 for all v ∈ V, then the lemma easily follows from Fact 1. Now assume the existence of a vertex u ∈ V with degin (u) ≤ D. Let S ⊆ N in (u) have size φstrict (u) = (degin (u) + 1)/2. Clearly, S ∪ {u} ⊆ c(S, G, φstrict ). Therefore,
D+1
φstrict (u) · |S ∪ {u}| ≤ D+12 (1) |S| = strict · c S, G, φstrict . φ (u) + 1 +1 2 If c(S, G, φstrict ) = V, then (1) completes the proof by taking S as the set of seeds. Now assume that c(S, G, φstrict ) = V and take H = G[V \ c(S, G, φstrict )]. strict By the induction hypothesis, N (H, φH ) has an irreversible dynamo T with size at most
D+1 d−1 (2) max p + sup fp d, , D+12 |V \ c S, G, φstrict |. 2 +1 d≥D+1 2
112
C.-L. Chang and Y.-D. Lyuu
It is not hard to see that c(S ∪ T, G, φstrict ) = V . The proof is complete by G summing (1)–(2) for an upper bound on |S ∪ T |. Theorem 2. Any network N (G, φstrict ) has an irreversible dynamo of size at most 0.7732|V |. Proof. Set p = 0.662210. By Lemma 1 with D = 5, we only need to show d−1 3 max p + sup fp d, , < 0.7732, 2 4 d≥6
which can be numerically verified.
Theorem 3. Any network N (G, φsimple ) has an irreversible dynamo of size at most 0.727|V |. Proof. Similar to the proof of Theorem 2.
4
Irreversible Dynamos of Undirected Graphs
Let G(V, E) be an undirected connected graph. A cut is an unordered pair (S, V \ S) with S ⊆ V . We call a cut (S, V \ S) proper if |N (v) ∩ S| ≤ |N (v) \ S| , ∀v ∈ S,
(3)
|N (v) \ S| ≤ |N (v) ∩ S| , ∀v ∈ V \ S,
(4)
and improper otherwise. Fact 4. (Implicit in [11, pp. 303–304]) Given an undirected graph G(V, E) and an improper cut (S, V \ S), a proper cut (T, V \ T ) with e(T, V \ T ) > e(S, V \ S) can be found in polynomial time. A vertex v ∈ V is said to be bad with respect to (abbreviated w.r.t.) a cut (S, V \ S) if |N (v) ∩ S| = |N (v) \ S|; it is good w.r.t. (S, V \ S) otherwise. A connected component of G[S] or G[V \ S] is bad w.r.t. (S, V \ S) if all its vertices are bad w.r.t. (S, V \ S); it is good w.r.t. (S, V \ S) otherwise. The set of connected components of G[S] that are bad w.r.t. (S, V \ S) is denoted B(S). Similarly, B(V \ S) is the set of bad (w.r.t. (S, V \ S)) connected components of G[V \ S]. For v ∗ ∈ V and S ⊆ V, define ψ (S, v ∗ ) ≡ e (S, V \ S) · |V |2 − d v ∗ , Vˆ . (5) ˆ V ˆ ,E)∈B(S)∪B(V ˆ G( \S)
Lemma 2. Let G(V, E) be an undirected connected graph and v ∗ ∈ V . If two cuts (A, V \ A) and (B, V \ B) satisfy e(A, V \ A) > e(B, V \ B), then ψ(A, v ∗ ) > ψ(B, v ∗ ).
Bounding the Number of Tolerable Faults in Majority-Based Systems
113
Proof. In (5), the e(S, V \ S) term is multiplied by |V |2 > |V |(|V | − 1). But the summations within the brackets of (5) evaluate to be at most |V |(|V | − 1) because |B(S)| + |B(V \ S)| ≤ |V | and d(v ∗ , U ) ≤ |V | − 1 for any ∅ U ⊆ V . Lemma 3. Let G(V, E) be an undirected connected graph, (S, V \ S) be a proper cut, G (V , E ) be a connected component of G[S] and v ∈ V . Then B(S \{v}) ⊆ B(S) \ {G }. Proof. Let G1 (V1 , E1 ) = G (V , E ), . . . , Gk (Vk , Ek ) be the connected components of G[S]. For u ∈ NG (v) ∩ S, |NG (u) ∩ S| ≤ |NG (u) \ S| because (S, V \ S) is proper. Consequently, for every u ∈ NG (v) ∩ S, |NG (u) ∩ (S \ {v})| < |NG (u) \ (S \ {v})| .
(6)
Let G11 , . . . , G1h be the connected components of G[V1 \ {v}], where h ≥ 0. Obviously, the connected components of G[S \ {v}] are G11 , . . . , G1h , G2 , . . . , Gk . Clearly, each of G11 , . . . , G1h has a vertex in NG (v)∩S. Hence each of G11 , . . . , G1h has a vertex satisfying (6), implying that G11 , . . . , G1h are all good w.r.t. (S \ ∗ {v}, (V \ S) ∪ {v}). Therefore, B(S \ {v}) ⊆ {G2 , . . . , Gk }. As NG (v) ∩ Vi = ∅ for 2 ≤ i ≤ k, Gi ∈ B(S \ {v}) only if Gi ∈ B(S), completing the proof. Lemma 4. Let G(V, E) be an undirected connected graph, (S, V \ S) be a proper ¯ V¯ , E) ¯ be the connected component of G[(V \ S) ∪ {v}] that cut, v ∈ S and G( ¯ contains v. Then B((V \ S) ∪ {v}) ⊆ B(V \ S) ∪ {G}. Proof. Let Gˆ1 (Vˆ1 , Eˆ1 ), . . . , Gˆ (Vˆ , Eˆ ) be the connected components of G[V \ S] and t = |{1 ≤ i ≤ | Vˆi ∩ NG (v) = ∅}|. Without loss of generality, suppose = ∅ for 1 ≤ i ≤ t and Vˆi ∩ NG (v) = ∅ for t + 1 ≤ i ≤ . that Vˆi ∩ NG (v) ¯ = G[{v} ∪ Vˆ1 ∪ · · · ∪ Vˆt ]. Besides G, ¯ the other connected components Clearly, G ∗ ˆ ˆ of G[(V \ S) ∪ {v}] are Gt+1 , . . . , G . As NG (v) ∩ Vˆi = ∅ for t + 1 ≤ i ≤ , ˆ i ∈ B((V \ S) ∪ {v}) only if G ˆ i ∈ B(V \ S). G Lemma 5. Let G(V, E) be an undirected connected graph, (S, V \ S) be a proper cut, G (V , E ) ∈ B(S), v ∈ V and v ∗ ∈ V \ V . If d(v ∗ , v) = d(v ∗ , V ), then ψ(S \ {v}, v ∗ ) > ψ(S, v ∗ ). Proof. As v ∈ V and v ∗ ∈ / V , d(v ∗ , v) > 0. As G is connected, there exists a / V because vertex w ∈ NG (v) with d(v ∗ , w) = d(v ∗ , v) − 1. We must have w ∈ ∗ ∗ d(v , v) = d(v , V ). Suppose for contradiction that w ∈ S. Then the facts that v ∈ V , w ∈ NG (v) and G (V , E ) is a connected component of G[S] force / S, which together with the fact that w ∈ NG (v) w ∈ V , a contradiction. So w ∈ put w and v in the same connected component of G[(V \ S) ∪ {v}], denoted ¯ V¯ , E). ¯ Note that G( d v ∗ , V¯ ≤ d (v ∗ , w) = d (v ∗ , v) − 1 = d (v ∗ , V ) − 1.
(7)
114
C.-L. Chang and Y.-D. Lyuu
By Lemmas 3–4 and (7),
d v ∗ , Vˆ +
ˆ V ˆ ,E)∈B(S\{v}) ˆ G(
⎛ ≤⎝
ˆ V ˆ ,E)∈B(S) ˆ G(
d v ∗ , Vˆ +
d v ∗ , Vˆ
ˆ V ˆ ,E)∈B((V ˆ G( \S)∪{v})
⎞
d v ∗ , Vˆ ⎠ − 1.
(8)
ˆ V ˆ ,E)∈B(V ˆ G( \S)
As G is bad w.r.t. (S, V \ S) and v ∈ V , e(S, V \ S) = e(S \ {v}, (V \ S) ∪ {v}), which together with (8) shows that ψ(S \ {v}, v ∗ ) > ψ(S, v ∗ ). Lemma 6. Given an undirected connected graph G(V, E), a proper cut (S, V \S) with |B(S) ∪ B(V \ S)| ≤ 1 can be found in polynomial time. Proof. Fix v ∗ ∈ V arbitrarily. By Fact 4, a proper cut (S0 , V \ S0 ) can be found in polynomial time. If |B(S0 ) ∪ B(V \ S0 )| ≤ 1, taking S = S0 proves the lemma. Inductively, let (Si , V \ Si ) be a proper cut with |B(Si ) ∪ B (V \ Si )| > 1,
(9)
where i ≥ 0. We show how to compute a proper cut (Si+1 , V \ Si+1 ) with ψ (Si+1 , v ∗ ) > ψ (Si , v ∗ )
(10)
in polynomial time. The connected components of G[Si ] and G[V \ Si ] can be found in polynomial time. By (9), we can pick an arbitrary G (V , E ) ∈ B(Si ) ∪ / V . Assume without loss of generality that G ∈ B(Si ); B(V \ Si ) with v ∗ ∈ otherwise we switch Si and V \ Si from the beginning. Now find a v ∈ V with d(v ∗ , v) = d(v ∗ , V ) in polynomial time. As v ∈ V and G ∈ B(Si ) is bad w.r.t. (Si , V \ Si ), e (Si , V \ Si ) = e (Si \ {v}, (V \ Si ) ∪ {v}) .
(11)
By Lemma 5, ψ(Si \ {v}, v ∗ ) > ψ(Si , v ∗ ). Therefore, if (Si \ {v}, (V \ Si ) ∪ {v}) is proper, then (10) holds for a proper cut (Si+1 , V \ Si+1 ) by taking Si+1 = Si \{v}. Otherwise, Fact 4 implies that a proper cut (T, V \T ) with e(T, V \T ) > e(Si \ {v}, (V \ Si ) ∪ {v}) can be found in polynomial time. Hence by (11), e(T, V \ T ) > e(Si , V \ Si ), implying ψ(T, v ∗ ) > ψ(Si , v ∗ ) by Lemma 2. Again, (10) holds for a proper cut (Si+1 , V \ Si+1 ) by taking Si+1 = T . Continue computing a proper cut (Si+1 , V \Si+1 ) with ψ(Si+1 , v ∗ ) > ψ(Si , v ∗ ) from (Si , V \ Si ) until (9) fails for some i ≥ 0. As |ψ(·, ·)| ≤ poly(|V |), there is a k ≤ poly(|V |) with |B(Sk ) ∪ B(V \ Sk )| ≤ 1. Theorem 5. Given an undirected connected graph G(V, E), an irreversible dynamo of N (G, φstrict ) with size at most |V |/2 can be found in polynomial time. Proof. Lemma 6 says a proper cut (S, V \ S) with |B(S) ∪ B(V \ S)| ≤ 1 can be found in polynomial time. (i) If |B(S) ∪ B(V \ S)| = 1, let x ∈ V be an arbitrary vertex of the unique member of B(S) ∪ B(V \ S). (ii) Otherwise, take any x ∈ V .
Bounding the Number of Tolerable Faults in Majority-Based Systems
115
Pick any connected component H(VH , EH ) of G[V \ S]. We next show VH ∩ c S ∪ {x}, G, φstrict = ∅.
(12)
If H ∈ B(S) ∪ B(V \ S), then x ∈ VH by our choice of x in case (i) above, proving (12). Otherwise, H must be a good (w.r.t. (S, V \ S)) connected component of G[V \ S]. So there exists a vertex u ∈ VH with |NG (u) \ S| = |NG (u) ∩ S|, which together with the properness of (S, V \ S) yields |NG (u) \ S| < |NG (u) ∩ S|, implying u ∈ c(S ∪ {x}, G, φstrict ) and thus (12). Next, we prove that V \ S ⊆ c(S ∪ {x}, G, φstrict ). For this purpose, we need only show that every w ∈ VH belongs to c(S ∪ {x}, G, φstrict ). Let u ∈ VH ∩ c(S ∪ {x}, G, φstrict ), whose existence is guaranteed by (12). As w, u ∈ VH and H is a connected component of G[V \ S], there is a path x0 = u, . . . , xt = w whose vertices are in VH . We already have x0 ∈ c(S ∪ {x}, G, φstrict ). As (S, V \ S) is proper, more than half of the neighbors of xi+1 are in S ∪ {xi }, 0 ≤ i < t. As a result, xi ∈ c(S ∪ {x}, G, φstrict ) for all 0 ≤ i ≤ t. We have shown that V \S ⊆ c(S ∪{x}, G, φstrict ), which yields V = c(S ∪{x}, G, φstrict ). By symmetry, V = c((V \ S) ∪ {x}, G, φstrict ). So both S ∪ {x} and (V \ S) ∪ {x} are irreversible dynamos of N (G, φstrict ), the smaller of which clearly has size at most |V |/2. Theorem 6. Given any network N (G, φsimple ) with an undirected graph G(V, E), an irreversible dynamo of N (G, φsimple ) with size at most |V |/2 can be found in polynomial time. Proof. By Fact 4, a proper cut (S, V \ S) can be found in polynomial time. Both S and V \ S are irreversible dynamos of N (G, φsimple ). Table 1 summarizes our upper bounds on the minimum sizes of irreversible dynamos. Table 1. Our upper bounds on the minimum sizes of irreversible dynamos. Conditions Previous upper bounds Our upper bounds connected undirected G(V, E), φ = |V |/2 φstrict undirected G(V, E) without isolated ver|V |/2 tices, φ = φsimple directed G(V, E) with positive indegrees, (23/27)|V | (in [1]) 0.7732|V | φ = φstrict directed G(V, E) with positive indegrees, (3/4)|V | (implicit in [1]) 0.727|V | φ = φsimple
5
Inapproximability
Given any undirected graph G(V, E), we define an undirected graph G(V, E) as follows. First, define
116
C.-L. Chang and Y.-D. Lyuu
Xv ≡ {xv,i | 1 ≤ i ≤ degG (v)} , v ∈ V, Yv ≡ {yv,i | 1 ≤ i ≤ degG (v)} , v ∈ V, X ≡ ∪v∈V Xv , Y ≡ ∪v∈V Yv , W ≡ ∪v∈V {wv }. Then define G(V, E) by V ≡ V ∪ W ∪ X ∪ Y ∪ {z1 , z2 } ∪ {g1 , g2 } , E ≡ {(v, x) | v ∈ V, x ∈ Xv } ∗ (v)} ∪ {(wv , u) | v ∈ V, u ∈ NG ∪ {(wv , y) | v ∈ V, y ∈ Yv } ∪ {(y, z1 ) | y ∈ Y} ∪ {(y, z2 ) | y ∈ Y} ∪ {(z1 , g1 )} ∪ {(z2 , g2 )} . For convenience, define ⎛ ∗ (v) ∪ ⎝ Bv ≡ {wv } ∪ NG
⎞
Xu ⎠ , v ∈ V.
∗ (v) u∈NG
See Fig. 1 for illustration.
Y
Y
Y
w v1
g1
g2
z1
z2
Y
Y
w v2
Y
Y
w v3
Y
wv
Y
degG (v) degG (v) + 1 degG (v) + 1
v1
v2
v3
v degG (v)
X
X
X
X
X
X
X
X
X
Fig. 1. An illustration with NG (v) = {v1 , v2 , v3 }. The vertices in Bv are filled
with light gray.
Bounding the Number of Tolerable Faults in Majority-Based Systems
117
Lemma 7. If D ⊆ V is a dominating set of an undirected graph G(V, E), then c(D ∪ {z1 , z2 }, G, φstrict ) = V. G Proof. With D ∪ {z1 , z2 } as the set of seeds, the vertices in {g1 , g2 }, Y, W, V and X can be colored white, in that order. Lemma 8. For each v ∈ V, every irreversible dynamo S of N (G, φstrict ) satisfies G = ∅. S ∩ Bv Proof. It can be verified that every α ∈ Bv satisfies |NG (α) ∩ Bv | > degG (α)/2. Consequently, c(V \ Bv , G, φstrict ) = V \ Bv = V; so no irreversible dynamos of G N (G, φstrict ) can be a subset of V \ B . v G Fact 7. ([2]) Let > 0 be any constant. If dominating set has a polynomialtime, ((1 − ) ln N )-approximation algorithm for N -vertex graphs, then NP ⊆ TIME(nO(ln ln n) ). Theorem 8. Let > 0 be any constant. If irreversible dynamo (strict majority) has a polynomial-time, ((1/2 − ) ln N )-approximation algorithm for N -vertex graphs, then NP ⊆ TIME(nO(ln ln n) ). Proof. Assume that irreversible dynamo (strict majority) has a polynomial-time, ((1/2 − ) ln N )-approximation algorithm for N -vertex graphs. Then, given an undirected graph G(V, E), an irreversible dynamo S of N (G, φstrict ) G can be computed in polynomial time such that |S| 1 ≤ − · ln |V| ≤ [(1 − 2) · ln |V | + O(1)] . (13) 2 min-seed G, φstrict G Above, the second inequality follows from the easily verifiable fact |V| = O(|V |2 ). Denote by γ(G) the size of any minimum dominating set of G. By Lemma 7, min-seed G, φstrict ≤ γ(G) + 2. (14) G With G and S in hand, ˜ ≡ {u ∈ V | S ∩ ({wu } ∪ {u} ∪ Xu ) D = ∅}
(15)
can clearly be constructed in polynomial time. For each v ∈ V, Lemma 8 says ∗ S ∩ Bv = ∅. Hence there exists a u∗ ∈ NG (v) with S ∩ ({wu∗ } ∪ {u∗ } ∪ Xu∗ ) = ∅, ∗ ˜ Consequently, D ˜ ∩ N ∗ (v) ˜ is a equivalently, u ∈ D. = ∅ for all v ∈ V, i.e., D G dominating set of G. Now,
Eq. (15)
˜ 1 ≤ |S ∩ ({wu } ∪ {u} ∪ Xu )| ≤ |S|.
D = ˜ v∈D
(16)
˜ u∈D
By (13)–(14) and (16),
˜
D ≤ [(1 − 2) · ln |V | + O(1)] · (γ(G) + 2) ,
(17)
118
C.-L. Chang and Y.-D. Lyuu
˜ ≤ (1 − ) · ln |V | · γ(G) for implying the existence of a constant C with |D| min{|V |, γ(G)} > C. ˜ can be found in polynomial time, (ii) D ˜ is a domWe have shown that (i) D ˜ inating set of G and (iii) |D| ≤ (1 − ) · ln |V | · γ(G) for min{|V |, γ(G)} > C. When min{|V |, γ(G)} ≤ C, a minimum dominating set of G can be found by brute force in polynomial time. Hence NP ⊆ TIME(nO(ln ln n) ) by Fact 7. Theorem 9. Let > 0 be any constant. If irreversible dynamo (simple majority) has a polynomial-time, ((1/2 − ) ln N )-approximation algorithm for N -vertex graphs, then NP ⊆ TIME(nO(ln ln n) ). Proof. Invoke Theorem 8 and observe that φstrict ≡ φsimple . G G
Acknowledgments The authors are grateful to Shou-De Lin for his helpful comments.
References 1. Chang, C.-L., Lyuu, Y.-D.: Spreading Messages. Theor. Comp. Sci. 410, 2714–2724 (2009) 2. Feige, U.: A Threshold of ln n for Approximating Set Cover. J. ACM 45, 634–652 (1998) 3. Flocchini, P., Geurts, F., Santoro, N.: Optimal Irreversible Dynamos in Chordal Rings. Disc. Appl. Math. 113, 23–42 (2001) 4. Flocchini, P., Kr´ aloviˇc, R., Ruˇziˇcka, P., Roncato, A., Santoro, N.: On Time Versus Size for Monotone Dynamic Monopolies in Regular Topologies. J. Disc. Alg. 1, 129–150 (2003) 5. Flocchini, P., Lodi, E., Luccio, F., Pagli, L., Santoro, N.: Dynamic Monopolies in Tori. Disc. Appl. Math. 137, 197–212 (2004) 6. Gleeson, J.P., Cahalane, D.J.: Seed Size Strongly Affects Cascades on Random Networks. Phys. Rev. E 75, 056103 (2007) ´ Maximizing the Spread of Influence Through 7. Kempe, D., Kleinberg, J., Tardos, E.: a Social Network. In: 9th ACM SIGKDD International Conference on Knowledge Discovery and Data Mining, pp. 137–146. ACM, Washington (2003) ´ Influential Nodes in a Diffusion Model for So8. Kempe, D., Kleinberg, J., Tardos, E.: cial Networks. In: Caires, L., Italiano, G.F., Monteiro, L., Palamidessi, C., Yung, M. (eds.) ICALP 2005. LNCS, vol. 3580, pp. 1127–1138. Springer, Heidelberg (2005) 9. Luccio, E., Pagli, F., Sanossian, H.: Irreversible Dynamos in Butterflies. In: 6th International Colloquium on Structural Information & Communication Complexity, pp. 204–218. Carleton Scientific, Lacanau-Ocean (1999) 10. Mossel, E., Roch, S.: On the Submodularity of Influence in Social Networks. In: 39th Annual ACM Symposium on Theory of Computing, pp. 128–134. ACM, San Diego (2007) 11. Papadimitriou, C.H.: Computational Complexity. Addison-Wesley, Reading (1994) 12. Peleg, D.: Local Majorities, Coalitions and Monopolies in Graphs: A Review. Theor. Comp. Sci. 282, 231–257 (2002)
Bounding the Number of Tolerable Faults in Majority-Based Systems
119
13. Pike, D.A., Zou, Y.: Decycling Cartesian Products of Two Cycles. SIAM J. Disc. Math. 19, 651–663 (2005) 14. Samuelsson, B., Socolar, J.: Exhaustive Percolation on Random Networks. Phys. Rev. E. 74, 036113 (2006) 15. Watts, D.J.: A Simple Model of Global Cascades on Random Networks. Proc. Nat. Acad. Sci. 99, 5766–5771 (2002)
A Parameterized Algorithm for Chordal Sandwich Pinar Heggernes, Federico Mancini, Jesper Nederlof, and Yngve Villanger Department of Informatics, University of Bergen, N-5020 Bergen, Norway {pinar.heggernes,federico.mancini}@ii.uib.no, {jesper.nederlof,yngve.villanger}@ii.uib.no
Abstract. Given an arbitrary graph G = (V, E) and an additional set of admissible edges F , the Chordal Sandwich problem asks whether there exists a chordal graph (V, E ∪ F ) such that F ⊆ F . This problem arises from perfect phylogeny in evolution and from sparse matrix computations in numerical analysis, and it generalizes the widely studied problems of completions and deletions of arbitrary graphs into chordal graphs. As many related problems, Chordal Sandwich is NP-complete. In this paper we show that the problem becomes tractable when parameterized with a suitable natural measure on the set of admissible edges F . In particular, we give an algorithm with running time O(2k n5 ) to solve this problem, where k is the size of a minimum vertex cover of the graph (V, F ). Hence we show that the problem is fixed parameter tractable when parameterized by k. Note that the parameter does not assume any restriction on the input graph, and it concerns only the additional edge set F .
1
Introduction
After arising from practical problems and appearing in various papers under different names, graph sandwich problems were formalized into a general framework by Golumbic et al. [16]. For a given graph class Π, the Π-Sandwich problem takes as input a pair (G, F ), where G = (V, E) is a graph and F ⊆ (V × V ) \ E is a set of additional edges, and asks whether there is a subset F of F such that the graph (V, E ∪ F ) belongs to the class Π. Taking H = (V, E ∪ F ), we say informally that we look for a graph belonging to class Π sandwiched between G and H. The Π-Sandwich problem is NP-complete when Π is one of the following graph classes: chordal, interval, circle, circular arc, comparability, permutation, strongly chordal, and chordal bipartite [1,16,21], whereas it can be solved in polynomial time when Π is the class of split graphs, threshold graphs or cographs [16]. The Π-Sandwich problem has also been studied with respect to other graph classes and properties Π [8,18,22,31], and on hypergraphs [17]. Chordal graphs are the class of graphs that do not contain any chordless cycle of length greater than 3 as induced subgraphs. In general, chordal graphs constitute one of the most studied graph classes, since problems from many different
This work is supported by the Research Council of Norway.
T. Calamoneri and J. Diaz (Eds.): CIAC 2010, LNCS 6078, pp. 120–130, 2010. c Springer-Verlag Berlin Heidelberg 2010
A Parameterized Algorithm for Chordal Sandwich
121
fields can be interpreted as chordal graph problems [15]. The Chordal Sandwich problem is one of the sandwich problems with most applications. It arises in particular in sparse matrix computations [16] and in perfect phylogeny since it has the problem of triangulating colored graphs as a special case [1,2]. It can also be seen as a generalization of the problems of adding or deleting edges in a minimum or minimal way in an arbitrary input graph to obtain a chordal graph, which have attracted considerable attention [13,14,19,20,23,24,26,27]. The NPcompleteness of the problem follows from the results of several papers [1,6,32]. After being proved NP-complete, the only tractability result on Chordal Sandwich on arbitrary inputs is an algorithm by Lokshtanov [25]. Combining this with a result of [14] gives an algorithm with running time O∗ (1.7347n), where the O∗ -notation suppresses the terms that are polynomial in the size of the input. We attack the Chordal Sandwich problem from a parameterized perspective. A graph problem is called Fixed Parameter Tractable, or FPT for short, if we can identify a parameter k, typically an integer, such that there is an algorithm solving the problem with running time f (k) · nO(1) , where n is the number of vertices in G, and f is a computable function depending only on the parameter k. The choice of a suitable parameter is very important in the design of parameterized algorithms. The most notable example is treewidth. Many hard graph problems become FPT when parameterized by the treewidth of the input graph [10,12,28], but our problem is harder than so. In fact, when parameterized by the treewidth of G, it follows from the results of Bodlaender et al. [2] that the Chordal Sandwich problem is W [t]-hard for every integer t ≥ 1. Regarding the applications of Chordal Sandwich, it is reasonable to assume that one has some bound or control on the additional set of admissible edges F , since these represent the unreliable data. However, parameterizing by |F | is not really interesting, as the problem then becomes trivially FPT, since we can try all possible ways of adding subsets of F to G. Another parameterization could be |F |, the number of edges we end up adding to G to make it chordal within the restrictions given by F ⊆ F . But also this case is easily FPT, following the fixed parameter tractability of the Minimum Fill-In problem [3,7,23,24], since one can simply discard the solutions that do not fit into F while computing all chordal completions that add at most |F | edges. For completeness, it should be mentioned that when we parameterize by the treewidth of H = (V, E ∪ F ), the problem is again easily shown to be FPT, as also noted in [25]. We study the following parameterization: k-Chordal Sandwich Instance: A graph G = (V, E) and a set F ⊆ (V × V ) \ E. Parameter: An integer k such that there exists a vertex cover of the graph (V, F ) of size at most k. Question: Is there a chordal graph M = (V, E ∪ F ) where F ⊆ F ? Notice that deciding whether a given graph has a vertex cover of size at most k is FPT [10]. Based on the above discussion, our parameter k seems natural for this problem; it is never larger than |F | and in most cases it is much smaller, thus as
122
P. Heggernes et al.
parameter it gives less restriction than |F | on the admissible edges. Furthermore it gives no restriction on the input graph G. In this paper we give an algorithm with running time O(2k n5 ) that solves the k-Chordal Sandwich problem. Consequently, we show that k-Chordal Sandwich is FPT. We achieve our results by bounding the number of combinatorial objects that need to be handled. In particular, we show that the number of minimal separators and potential maximal cliques that can be useful to achieve a solution is bounded by O(2k n2 ). Combining this with a similar approach to that of [13] in such a way that we only consider potential maximal cliques that can lead to a solution, gives the running time O(2k n5 ). It should be mentioned that in general, the number of minimal separators and the number of potential maximal cliques of a graph can be as large as 3(n−2)/3 . The construction is simple, and can for instance be found in [13]. It is thus interesting to see that the set F of admissible edges implies a strong enough restriction to be able to bound the number of such objects that are useful in a solution to a function that is only exponential in the size of the minimum vertex cover of F . To our knowledge this technique has not been used before to prove a problem to be FPT.
2
Preliminaries
All graphs in this work are undirected and simple. A graph is denoted by G = (V, E), with vertex set V = V (G) and edge set E = E(G). We let n = |V | and m = |E|. A set R of vertices is a vertex cover of a graph if every edge of the graph has an endpoint in R. For a vertex subset S ⊆ V , the subgraph of G induced by S is denoted by G[S]. If a subset D ⊆ E of the edges is given, we will denote by G[D] the subgraph of G induced by the set of endpoints of all edges in D. We denote the neighborhood of S in G by NG (S) = {v ∈ (V \ S) | ∃w ∈ S : {v, w} ∈ E}. We write NG (v) = NG ({v}) for a single vertex v, and NG [S] = NG (S) ∪ S. Subscripts are omitted when not necessary. A vertex set is a clique if every pair of vertices in it is adjacent. A clique is maximal in G if it is not a proper subset of another clique in G. A vertex subset S ⊆ V is a separator in G if G[V \S] has at least two connected components. A connected component C is a full component associated to S if N (C) = S. A vertex set S is a uv-separator for G if u and v are in different connected components of G[V \S], and a minimal uv-separator for G if no proper subset of S is a uv-separator. In general, a vertex subset S is a minimal separator of G if there exist u and v in V such that S is a minimal uv-separator. A set of vertices that is both a clique and a separator is called a clique separator. Proposition 1 (Folklore). A set S of vertices in a graph G is a minimal uvseparator if and only if u and v are in different full components associated to S. In particular, S is a minimal separator if and only if there are at least two distinct full components associated to S.
A Parameterized Algorithm for Chordal Sandwich
123
A chord in a cycle (path) is an edge between two non-consecutive vertices of the cycle (path). A graph is chordal if every cycle on four or more vertices has a chord. A graph M = (V, E ∪ F ) is a triangulation or chordal completion of a graph G = (V, E) if M is chordal. The edges in F \ E are called fill edges. M is a minimal triangulation of G if there is no triangulation M = (V, F ) of G with F ⊂ F . It is known that if a triangulation M = (V, E ∪ F ) is not minimal, then there exists an edge {u, v} ∈ F such that M = (V, E ∪ (F \ {(u, v)})) is chordal [30]. As a consequence, this implies that for every F ⊆ E, there exists a chordal graph M = (V, E ∪ F ) where F ⊆ F if and only if there exists a minimal triangulation M = (V, E ∪ F ) of G where F ⊆ F . Thus, the chordal sandwich problem is equivalent to asking if there exists a minimal triangulation M = (V, E ∪ F ) of G where F ⊆ F . Two separators S1 and S2 are said to be crossing if S1 is a uv-separator for two vertices u, v ∈ S2 , in which case S2 is an xy-separator for two vertices x, y in S1 [29]. The following characterization of minimal triangulations related to minimal separators is important for understanding our results. Theorem 1 ([29]). Given an arbitrary graph G, a chordal graph M is a minimal triangulation of G if and only if M is the result of making a maximal set of pairwise non-crossing minimal separators into cliques (by adding necessary edges to G to achieve this). A potential maximal clique of a graph G is defined as a maximal clique in a minimal triangulation of G. Fortunately it is easy to check if a vertex set is a maximal clique of some minimal triangulation. Theorem 2 ([5]). Let Ω ⊆ V be a set of vertices of the graph G = (V, E), and let C1 , . . . , Cp be the set of connected components of G[V \ Ω]. Then Ω is a potential maximal clique if and only if : 1. G[V \ Ω] has no full component associated to Ω, and 2. for every pair of vertices x, y ∈ Ω, {x, y} ∈ E or x, y ∈ N (Ci ) for some i ∈ {1, . . . , p}. Proposition 2. For a potential maximal clique Ω of the graph G, let X be the connected component containing vertex x ∈ Ω in the graph G[V \ (Ω \ {x})]. Then G[X] is connected, and Ω = N (X) ∪ {x}. Proof. This follows more or less directly from Property 2 of Theorem 2. By definition of X, N (X) ⊂ Ω. Every connected component C of G[V \ Ω] where x ∈ N (C), C ⊂ X, and by Theorem 2 vertex {x, y} ∈ E or x, y ∈ N (C) for some connected component C of G[V \ Ω], so N (X) = Ω \ {x}. A tree decomposition of a graph G = (V, E) is a tree T whose nodes correspond to subsets of V , called bags, that satisfy the following: every vertex of V appears in a bag; for all {u, v} ∈ E, there is a bag where u and v appear together; for any vertex u ∈ V , the nodes of T corresponding to the bags that contain u induce a connected subtree of T . (We will simply use bags to denote both bags and nodes.) It follows
124
P. Heggernes et al.
that for two bags X and Y of a tree decomposition T , X ∩ Y is contained in every bag on the unique path between X and Y in T . A clique tree is a special kind of tree decomposition with a bijection between the nodes of the tree and the maximal cliques of G. A graph G has a clique tree if and only if G is chordal [6]. Minimal triangulations are chordal graphs, and a potential maximal cliques is defined as maximal clique of a minimal triangulation. Thus, we can rephrase the Chordal Sandwich problem once again: There exists a chordal graph sandwiched between G and H if and only if a tree decomposition of G can be obtained by only using bags that are potential maximal cliques of G and cliques in H. If we view each edge of a clique tree as the intersection of its endpoint maximal cliques, every edge of a clique tree of G corresponds to a minimal separator of G, and every minimal separator of G appears as an edge in every clique tree of G [6]. This also implies that every minimal separator is a clique [9]. It is also important to note that chordal graphs have at most n maximal cliques [9], and hence at most n − 1 minimal separators. Chordal graphs can be recognized and clique trees can be computed in linear time [15]. Induced subgraphs of chordal graphs are also chordal.
3
Bounding the Number of Useful Minimal Separators and Potential Maximal Cliques
Assume that we are given a graph G = (V, E), and an additional graph H = (V, E ∪ F ) where E ∩ F = ∅. Let R be a minimum vertex cover of (V, F ), with k = |R|. We want to answer the question whether there exists an edge set F ⊆ F such that (V, E ∪F ) is chordal. Let us define U = V \R; hence F contains no edge with both endpoints in U . We can therefore observe that G[U ] has to be chordal, since any induced cycle in G[U ] cannot be triangulated by adding edges from F . By the results of [13], we can “search through” all minimal triangulations of a graph if we have a list of all its minimal separators and potential maximal cliques. This search is linear in the number of minimal separators and potential maximal cliques but requires an additional factor of O(n3 ) time. In general graphs the number of minimal separators and potential maximal cliques might be exponential in the number of vertices; O∗ (3n/3 ) is the best known lower bound, and O∗ (1.6181n) and O∗ (1.7347n) are the best known upper bounds for respectively the number of minimal separators and the number of potential maximal cliques [14]. Here, we will show that the restrictions given by F imply enough structure to bound the number of useful minimal separators and potential maximal cliques by a smaller function. First we will turn our attention towards listing minimal separators. Instead of finding the minimal separator directly we will find one of the two full components associated to the minimal separator, and retrieve the minimal separator from the neighborhood of this vertex set. Due to Theorem 1, we can only use minimal separators of G that are cliques in H. Every minimal separator S of G, which is a clique in H, has the property that G[S ∩ U ] is a clique, since we explained that no edge of F has two endpoints in U . Thus, we are interested in listing only such minimal separators.
A Parameterized Algorithm for Chordal Sandwich
125
Lemma 1. The number of minimal separators S in G such that G[U ∩ S] is a clique is at most 2k n2 , and these can be listed in O(2k n4 ) time. Proof. By Proposition 1 we can uniquely define the vertex set of a minimal separator by obtaining one of the two full components associated to the minimal separator. The minimal separator can then be retrieved from the neighborhood of this vertex set. Hence, to proof the Lemma, it suffices to list a set of full components such that for each minimal separator S, at least one full component associated to S is listed. Let S be a minimal separator such that G[U ∩ S] is a complete graph, and let X be a maximal clique of G[U ], such that S ∩ U ⊆ X. Vertex set X \ S induces a clique, and is thus contained in the same connected component of G[V \ S]. A result of this is that one of the two full connected components associated to S has an empty intersection with X. Let C be the vertex set of this full component, let RC = R∩C, and let x be a vertex contained in C. The connected component C of S will now be the connected component of G[V \ (X ∪ (R \ RC ))] which contains the vertex x. Now the set of minimal separators can be listed in the following way. For each triple X, RC , x where X is a maximal clique of G[U ], RC is a subset of R, and x ∈ V , we define Z as N (C ) for the connected component C of G[V \(X ∪(R\RC ))] containing vertex x. Vertex set Z can be obtained in O(n2 ) time. In the same time we can check if G[V \ Z] contains two full components associated to Z, and thus verifying if Z is a minimal separator. If Z is a minimal separator we add it to the output list. The induced graph G[U ] is chordal, and thus G[U ] contains at most |U | ≤ n maximal cliques. Moreover, there are at most 2k choices for RC and at most n choices for x, hence this procedure requires O(2k n4 ) time. In a similar way we will now bound the number of potential maximal cliques Ω, where G[U ∩ Ω] is a complete graph. Analogous to the explanation on minimal separators above, a potential maximal clique Ω can be a maximal clique in a solution sandwich graph that we are looking for, only if Ω is a clique in H. Since no edges can be added to G with both endpoints in U , this is equivalent to saying that G[U ∩ Ω] is a complete graph. For a vertex x ∈ Ω, define Z to be the connected component of G[V \ (Ω \ {x})] that contains x. By Proposition 2, Ω = N (Z)∪{x}. The pair (Z, x) will be referred to as a vertex representation of Ω. For vertex set Y = N (Z) ∪ {x} we can use the properties of Theorem 2 as described in [5] to verify that there are no full components associated to Y , and that for every pair of vertices x, y ∈ Y , {x, y} ∈ E or x, y ∈ N (C) for some connected component of G[V \ Y ] in time O(nm). For a minimal separator it was enough to know one of the full components associated to the minimal separator. In a similar way we will show that it is enough to find one of the |Ω| vertex representations of Ω. Lemma 2. The number of potential maximal cliques Ω in G such that G[U ∩Ω] is a clique is at most 2k n2 , and these can be listed in O(2k n5 ) time.
126
P. Heggernes et al.
Proof. Let X be a maximal clique of G[U ] such that Ω ∩ U ⊆ X. In the same way as in the proof for the minimal separators, we can argue that X \ Ω is a clique in G, and thus X \ Ω intersects only one connected component C of G[V \ Ω]. By the first Property of Theorem 2, N (C) ⊂ Ω, so let x be a vertex in Ω \ N (C). Vertex representation (Z, x) of Ω will now have an empty intersection with X, that is Z ∩ X = ∅. Let RZ be the intersection Z ∩ R, and notice that the connected component of G[V \ (((R \ RZ ) ∪ X) \ {x})] containing x is exactly Z, where (Z, x) is the vertex representation for Ω. The set of potential maximal cliques are listed in the same was as we listed minimal separators. For each triple X, RZ , x where X is a maximal clique of G[U ], RZ is a subset of R, and x ∈ V , we define Z as the connected component of G[V \ ((X ∪ (R \ RC )) \ {x})] containing vertex x. Vertex set Y is defined as N (Z) ∪ {x}, and can be obtained in O(n2 ) time. Now use the algorithm defined in [5] to verify in time O(n3 ) if the vertex set Y is a potential maximal clique, and add it to the output list if this is the case. In total this requires at most O(2k n5 ) time. The bounds for the number of minimal separators and potential maximal cliques of the type bounded in Lemmas 1 and 2 are optimal up to a polynomial factor of n. This follows from the following graph G: Let U be vertex set u0 , u1 , . . . , uk and let R be vertex set v0 , v1 , . . . , vk . The graph G[U ] is a clique, {v0 , vi } ∈ E for every i ∈ {1, 2, . . . , k}, and {vi , ui } ∈ E for every i ∈ {1, 2, . . . , k}. Graph H is a complete graph. Let X be any of the 2k subsets of R \ {v0 }. Then N (X ∪ {v0 }) is a minimal v0 , u0 separator. It is not hard to verify that each such minimal separator also defines a unique potential maximal clique.
4
A Parameterized Algorithm for k-Chordal Sandwich
We will now use the list of minimal separators and potential maximal cliques to search for a minimal triangulations of G that can be created by adding edges from F . Our approach is similar to those of [13] and [25]. However, instead of searching through all minimal triangulations, we need only to search through minimal triangulations that fit into H, and hence we need only to consider the special types of minimal separators and potential maximal cliques that we studied in the previous section. For a minimal separator S of G, and a connected component C of G[V \ S] we define (C, S) as a block, and the block is refereed to as full if N (C) = S. Let α(C, S) be a function on the block (C, S), defined as follows: ⎧ 1, if H[S] is a complete graph, and there exists a chordal graph ⎪ ⎪ ⎨ sandwiched between G [C ∪ S] and H[C ∪ S], where G is α(C, S) = obtained from G by completing S into a clique, ⎪ ⎪ ⎩ 0, otherwise.
A Parameterized Algorithm for Chordal Sandwich
127
The α function will now tell us whether or not the block (C, S) can be used in a partial solution for the chordal sandwich problem. In addition to this we also need a way to describe a “big” block from several smaller blocks. This is obtained by using potential maximal cliques. For a full block (C, S) and a potential maximal clique Ω where S ⊂ Ω ⊆ C ∪ S, we define (C, S, Ω) as a good triple. In addition to this we define function β(C, S, Ω) as follows: ⎧ 1, if H[Ω] is a complete graph, and there exists a chordal ⎪ ⎪ ⎨ graph sandwiched between G [C ∪ S] and H[C ∪ S], where β(C, S, Ω) = G isobtained from G by completing Ω into a clique, ⎪ ⎪ ⎩ 0, otherwise. Remember that there exists a chordal graph (V, E ∪ F ) sandwiched between G and H, if and only if there exists a minimal triangulation M = (V, E ∪ F ) sandwiched between G and H. This implies that there exists a minimal separator S of G, such that H[S] is a clique and α(C, N (C)) = 1 for every connected component C of G[V \ S] if and only if there exists a minimal triangulation M = (V, E ∪ F ) sandwiched between G and H. The potential maximal clique Ω in a good triple (C, S, Ω) defines how the connected component C should be partitioned into smaller blocks. We can obtain the following formulas defining how α(C, S) can be computed using only values of the β function, and how β(C, S, Ω) can be computed using only values of the α function. First formula is quite simple, since α(C, S) = 1 if and only if there exists a minimal triangulation of G[C ∪ S] where G[S] is completed into a clique, which should imply that there exists a potential maximal clique Ω. Thus, 1, if β(C, S, Ω) = 1 for some good triple (C, S, Ω) α(C, S) = (1) 0, otherwise. The second formula comes from the observation that Ω defines how the connected component C should be decomposed further. So there exists a sandwiched minimal triangulation of G[C ∪ S] where Ω is a clique if and only if there exists a sandwiched minimal triangulation of G[C ∪ N (C )] for each connected component C of G[C \ Ω]. Thus, ⎧ ⎨ 1, if α(C , N (C )) = 1 for every connected component C ∈ G[C \ Ω] (2) β(C, S, Ω) = ⎩ 0, otherwise. Theorem 3. Given a graph G = (V, E), a graph H = (V, E ∪ F ), and a vertex cover R of (V, F ) where k = |R|, there is an algorithm for deciding whether there exists a chordal graph sandwiched between G and H, with running time O(2k n5 ). Such a solution can also be returned within the same time bound. Proof. By Lemmas 1 and 2 there are at most O(2k n2 ) possible vertex sets that are either a minimal separator or a potential maximal clique in G and a clique in H, and the two lists can be obtained in O(2k n5 ) time (Lemmas 1 and 2).
128
P. Heggernes et al.
Let P be the set of potential maximal cliques in G that induce cliques in H. Let B, T , S be empty sets storing respectively blocks, good triples, and minimal separators. Remember that P contains all the potential maximal cliques used in a potential solution, but it remains to check if a complete clique tree of a minimal triangulation can actually be build. For each potential maximal clique Ω ∈ P, and for each connected component C of G[V \ Ω], let C be the unique connected component of G[V \ N [C]] such that C ∩ Ω = ∅. Add the minimal separator N (C ) to S, add the full block (C , N (C )) to B, and add the good triple (C , N (C ), Ω) to T . Add also a bidirectional reference from the minimal separator S = N (C ) ∈ S to the full block (C , N (C )) in B and the good triple (C , N (C ), Ω) in T . As a result a minimal separator S ∈ S will have a reference to every full block (C, N (C)) where C is a connected component of G[V \ S], and a reference to every good triple (C, N (C), Ω). Sort the full blocks and the good triples into n bins on increasing cardinality of C. Now we will use dynamic programming to compute α(C, S) for all full blocks (C, S) of G and β(C, S, Ω) for all good triples (C, S, Ω) in the claimed time bound. Recall that checking whether there exists a chordal graph sandwiched between G and H is equivalent to checking whether there exists a minimal triangulation sandwiched between G and H. A minimal triangulation is a chordal graph, and every chordal graph has a clique tree representation, and we will now check whether a clique tree for such a minimal triangulation of G can be built from the set of potential maximal cliques in P. A leaf of a clique tree has the property that it can be defined by a single vertex only contained in the leaf clique of the tree. Let x be a vertex only contained in a leaf clique, then G[V \ N [x]] contains a single connected component C, and S = N (C) is a minimal separator. Let C be the connected component of G[V \ S] such that x ∈ C . Vertex x defines block (C , S) and the good triple (C , S, Ω) where Ω = S ∪ C . If (C , S) ∈ B set α(C , S) = 1, and 0 otherwise. If (C , S, Ω) ∈ T set β(C , S, Ω) = 1, and 0 otherwise. Completing this for every x ∈ V ensures that the value for α and β is set for all blocks and good triples representing leafs. Now on increasing size of the connected component C, compute β(C, S, Ω) using Equation 2 which only require values of α(C , S ) where C ⊂ C and |C | < |C|. If the value of β(C, S, Ω) = 1, then set α(C, S) = 1, like stated in Equation 1. Finally if α(C, N (C)) = 0 for at least one connected component C of G[V \ S] for every minimal separator S of G, then “no” can be returned since no chordal graph is sandwiched between G and H. In the opposite case backtracking, using the α and β functions enables us to return a triangulation M = (V, E ∪ F ). For the time analysis, building the lists S, B, T is linear in P and requires O(nm) time to find the connected components, and add the references. Computing the values for the leafs requires O(nm) time since we find connected components starting from each vertex of the graph. Computing α and β functions for larger components can be done in O(n2 ) time due to the references. Finally we test for each minimal separator, which there are at most 2k n2 of and for each of these we can check in O(n2 ) time by the references whether their α-function is set to 1. In total this will require O(2k n5 ) time is required, since |P| ≤ 2k n2 .
A Parameterized Algorithm for Chordal Sandwich
5
129
Concluding Remarks
A small vertex cover of the admissible edges does not give any restriction to the input graph G, and it restricts the set F of admissible edges in a less strict way than for example |F |. Surprisingly it suffices as a parameter to achieve fixed parameter tractability of the Chordal Sandwich problem in a non-trivial way. We find this interesting, especially considering that the problem (even a more restricted version of it) remains W -hard when parameterized by a powerful parameter like the treewidth of the input graph. Since we proved that k-Chordal Sandwich is FPT, a natural open problem is whether it admits a small kernel. Kernels that are of size polynomial in the parameter have attracted increasing attention recently, so it would be natural to look for such a kernel. However it might also be possible to prove that the problem does not admit a polynomial kernel thanks to the new tools developed in [4]. In this case also small exponential kernels or “cheat” kernels [11] become interesting. We suspect that k-Chordal Sandwich might not admit a polynomial kernel. Another interesting question is what other parameter concerning the set of admissible edges could be natural for Chordal Sandwich, with respect to a non-trivial and efficient parameterized algorithm. Finally we would like to mention that the algorithm could easily be adapted to finding the chordal graph sandwiched between G and H, using the smallest amount of edges from F . In the case where F is exactly the set of non-edges of G, this is equivalent to the Minimum Fill-in problem.
References 1. Bodlaender, H.L., Fellows, M.R., Warnow, T.: Two strikes against perfect phylogeny. In: Kuich, W. (ed.) ICALP 1992. LNCS, vol. 623, pp. 273–283. Springer, Heidelberg (1992) 2. Bodlaender, H.L., Fellows, M.R., Hallett, M.T., Wareham, T., Warnow, T.: The hardness of perfect phylogeny, feasible register assignment and other problems on thin colored graphs. Theor. Comput. Sci. 244(1-2), 167–188 (2000) 3. Bodlaender, H.L., Heggernes, P., Villanger, Y.: Faster parameterized algorithms for Minimum Fill-In. In: Hong, S.-H., Nagamochi, H., Fukunaga, T. (eds.) ISAAC 2008. LNCS, vol. 5369, pp. 282–293. Springer, Heidelberg (2008) 4. Bodlaender, H.L., Downey, R.G., Fellows, M.R., Hermelin, D.: On Problems without Polynomial Kernels (Extended Abstract). In: Aceto, L., Damg˚ ard, I., Goldberg, L.A., Halld´ orsson, M.M., Ing´ olfsd´ ottir, A., Walukiewicz, I. (eds.) ICALP 2008, Part I. LNCS, vol. 5125, pp. 563–574. Springer, Heidelberg (2008) 5. Bouchitt´e, V., Todinca, I.: Treewidth and minimum fill-in: Grouping the minimal separators. SIAM Journal on Computing 31, 212–232 (2002) 6. Buneman, P.: A characterization of rigid circuit graphs. Disc. Math. 9, 205–212 (1974) 7. Cai, L.: Fixed-parameter tractability of graph modification problems for hereditary properties. Inf. Process. Lett. 58, 171–176 (1996) 8. Cerioli, M.R., Everett, H., de Figueiredo, C.M.H., Klein, S.: The homogeneous set sandwich problem. Inf. Process. Lett. 67(1), 31–35 (1998)
130
P. Heggernes et al.
9. Dirac, G.A.: On rigid circuit graphs. Anh. Math. Sem. Univ. Hamburg 25, 71–76 (1961) 10. Downey, R.G., Fellows, M.R.: Parameterized complexity. Monographs in Computer Science. Springer, Heidelberg (1999) 11. Fernau, H., Fomin, F., Lokshtanov, D., Raible, D., Saurabh, S., Villanger, Y.: Kernel(s) for Problems With no Kernel: On Out-Trees With Many Leaves. In: STACS 2009, Dagstuhl Seminar Proceedings, vol. 09001, pp. 421–432 (2009) 12. Flum, J., Grohe, M.: Parameterized Complexity Theory. Springer, Heidelberg (2006) 13. Fomin, F.V., Kratsch, D., Todinca, I., Villanger, Y.: Exact algorithms for treewidth and minimum fill-in. SIAM J. Computing 38, 1058–1079 (2008) 14. Fomin, F.V., Villanger, Y.: Finding Induced Subgraphs via Minimal Triangulations. In: STACS 2010. INRIA 00455360-1, pp. 383–394 (2010) 15. Golumbic, M.C.: Algorithmic Graph Theory and Perfect Graphs, Annals of Discrete Mathematics, 2nd edn., vol. 57. Elsevier, Amsterdam (2004) 16. Golumbic, M.C., Kaplan, H., Shamir, R.: Graph sandwich problems. J. Algorithms 19(3), 449–473 (1995) 17. Golumbic, M.C., Wassermann, A.: Complexity and algorithms for graph and hypergraph sandwich problems. Graphs and Combinatorics 14, 223–239 (1998) 18. Habib, M., Kelly, D., Lebhar, E., Paul, C.: Can transitive orientation make sandwich problems easier? Disc. Math. 307(16), 2030–2041 (2007) 19. Heggernes, P.: Minimal triangulations of graphs: A survey. Disc. Math. 306, 297–317 (2006) 20. Heggernes, P., Telle, J.A., Villanger, Y.: Computing Minimal Triangulations in Time O(nα log n) = o(n2.376 ). In: SODA 2005, pp. 907–916 (2005) 21. de Figueiredo, C.M.H., Faria, L., Klein, S., Sritharan, R.: On the complexity of the sandwich problems for strongly chordal graphs and chordal bipartite graphs. Theor. Comput. Sci. 381(1-3), 57–67 (2007) 22. de Figueiredo, C.M.H., Klein, S., Vuskovic, K.: The graph sandwich problem for 1-join composition is NP-complete. Disc. Appl. Math. 121(1-3), 73–82 (2002) 23. Kaplan, H., Shamir, R., Tarjan, R.E.: Tractability of parameterized completion problems on chordal and interval graphs: Minimum fill-in and physical mapping. In: FOCS 1994, pp. 780–791 (1994) 24. Kaplan, H., Shamir, R., Tarjan, R.E.: Tractability of parameterized completion problems on chordal, strongly chordal, and proper interval graphs. SIAM J. Computing 28, 1906–1922 (1999) 25. Lokshtanov, D.: On the Complexity of Computing Treelength. In: Kuˇcera, L., Kuˇcera, A. (eds.) MFCS 2007. LNCS, vol. 4708, pp. 276–287. Springer, Heidelberg (2007) 26. Marx, D.: Chordal Deletion Is Fixed-Parameter Tractable. Algorithmica (to appear) 27. Natanzon, A., Shamir, R., Sharan, R.: A polynomial approximation algorithm for the minimum fill-in problem. SIAM J. Computing 30, 1067–1079 (2000) 28. Niedermeier, R.: Invitation to Fixed-Parameter Algorithms. Oxford University Press, Oxford (2006) 29. Parra, A., Scheffler, P.: Characterizations and algorithmic applications of chordal graph embeddings. Disc. Appl. Math. 79, 171–188 (1997) 30. Rose, D.J., Tarjan, R.E., Lueker, G.S.: Algorithmic aspects of vertex elimination on graphs. SIAM J. Comput. 5, 266–283 (1976) 31. Schaefer, M.: The graph sandwich problem for a coNP property. Tech. Report TR 06-011, DePaul University (2006) 32. Steel, M.: The complexity of reconstructing trees from qualitative characters and subtrees. J. of Classification 9, 91–116 (1992)
Testing Computability by Width-2 OBDDs Where the Variable Order is Unknown Dana Ron and Gilad Tsur School of Electrical Engineering, Tel Aviv University, Tel Aviv Israel
[email protected],
[email protected]
Abstract. Property testing is concerned with deciding whether an object (e.g. a graph or a function) has a certain property or is “far” (for a prespecified distance measure) from every object with that property. In this work we design and analyze an algorithm for testing functions for the property of being computable by a read-once width-2 Ordered Binary Decision Diagram (OBDD), also known as a branching program, where the order of the variables is not known to us. That is, we must accept a function f if there exists an order of the variables according to which a width-2 OBDD can compute f . The query complexity of ˜ our algorithm is O(log n)poly(1/). In previous work (in Proceedings of RANDOM, 2009 ) we designed an algorithm for testing computability by an OBDD with a fixed order, which is known to the algorithm. Thus, we extend our knowledge concerning testing of functions that are characterized by their computability using simple computation devices and in the process gain some insight concerning these devices.
1
Introduction
Property testing [1,2] is concerned with deciding whether an object (e.g. a graph or a function) has a certain property or is “far” (with respect to a prespecified distance measure) from every object with that property. Typical property testing algorithms are randomized, and perform queries regarding local properties of the object (e.g., the value of a function f on the input x), returning a correct answer with high probability. That is, the algorithm is given as input a distance parameter and is required to accept with high probability objects that have the property and to reject with high probability objects that are -far from having the property. The goal is to design such algorithms whose query complexity and running time are sublinear in the size of the object and where the dependence on 1/ is as small as possible. Our Results. In this work we design and analyze an algorithm for testing the property of being computable by a read-once width-2 Ordered Binary Decision Diagram (OBDD), also known as a read-once Oblivious Branching Program of width 2, where the order of the variables is not known to the algorithm. That is, the algorithm must accept (with high probability) a function f if there exists
This work was supported by the Israel Science Foundation (grant number 246/08).
T. Calamoneri and J. Diaz (Eds.): CIAC 2010, LNCS 6078, pp. 131–142, 2010. c Springer-Verlag Berlin Heidelberg 2010
132
D. Ron and G. Tsur
an order of the variables over which a width-2 OBDD can compute f , and it must reject f (with high probability) if every width-2 OBDD (over any order of variables) computes a function that is far from f . The query complexity of our ˜ algorithm is1 O(log n)poly(1/). Our interest in the class of functions computable by width-2 OBDDs stems in part from the fact that it generalizes two basic but important classes of functions that have been studied in the context of property testing - linear functions (over GF (2)) [1] and monomials [3]. In general, we are interested in furthering our knowledge concerning properties that can be tested efficiently, and one natural direction is the study of properties defined by the computability using simple computational devices such as OBDDs. In previous work [4] we studied computability by a width-2 OBDD where the order of the variables is fixed and known. Obviously, the family of functions computable by width-2 OBDDs over any order is a superset of the family computable over a particular order. Indeed, the minimum width of an OBDD that computes a certain function may depend strongly on the order of the variables in the OBDD. To illustrate this, consider a function over 2n variables of the form (x1 ∧ y1 ) ⊕ · · · ⊕ (xn ∧ yn ). It is easy to see that for the ordering x1 , y1 , x2 , y2 , . . . , xn , yn , only a constant width OBDD is required, while for the ordering x1 , x2 , . . . , xn , y1 , y2 , . . . , yn an OBDD must have width exponential in n. We note, however, that this fact does not imply that our previous work is superseded by the current work, since the existence of a testing algorithm for membership in a family of functions F does not necessarily imply that there is an algorithm with similar complexity for testing membership in F ⊂ F. Techniques and a comparison to our previous work [4]. Variables in functions that are computable by width-2 OBDDs (and which influence the value of the function) can be divided into two groups: Variables that the function is “linear” in, which we refer to as “xor” variables, and other, “nonlinear” variables, which we refer to as “and” and “or” variables. That is, a function f that is computable ¯i where g is a function by a width-2 OBDD is of the form f = g xi or f = g x computable by a width-2 OBDD over the variables {x1 , . . . , xi−1 , xi , . . . , xn }, and the operator is either ⊕ (xor) or ∧ (and) or ∨ (or). A simple but important observation (which was made in our previous work), is that if a width-2 OBDD has more than log(1/) nonlinear variables, then the variables preceding them can essentially be ignored, since they have very little influence on the function. Another basic observation is that once we find the last non-linear variable, we can continue the search for preceding nonlinear variables, by restricting this variable to a particular value. Both the algorithm presented in this work, and the algorithm in [4] attempt to locate the last O(log(1/)) nonlinear variables, and to use this structural information in order to determine whether the tested function is indeed (close to being) computable by a width-2 OBDD. However, the two algorithms differ quite significantly in the way this task is performed and in the verification concerning the 1
˜ The notation O(g(n)) represents an upper bound that is linear in g(n) up to a polylogarithmic factor.
Testing Computability by Width-2 OBDDs
133
computability by a width-2 OBDD given this information. Specifically, the algorithm in [4] explicitly relies on the known order of the variables. Say this order is x1 , . . . , xn . The algorithm in [4] has a subroutine for determining whether the last nonlinear variable belongs to {x1 , . . . , xn/2 } or to {xn/2+1 , . . . , xn } (or possibly detects that the function cannot be computed by an width-2 OBDD over this order of variables). Since in the current work the algorithm is not given an ordering of the variables, the procedure for locating the last O(log(1/)) nonlinear variables is more complex. We next give the high level ideas on which it is based. The procedure (repeatedly) constructs a “search-tree”, where each node of the search tree corresponds to a restriction of the tested function on a certain subset of the variables. In particular, the leaves of the tree correspond to restrictions on single variables. While we can’t actually refer to the last non-linear variable (since variables in a consecutive sequence of, say, and, variables are interchangeable), we can refer to the last series of nonlinear variables (this notion is formalized in Subsection 2.2). Ideally, each leaf in the tree corresponds to a variable that belongs to the last nonlinear series. However, under certain circumstances, it may belong to the previous series of nonlinear variables or may even be a linear variable. Nonetheless, we are able to deal with the different cases and to bound the number of such leaves in the search tree as well as the number of possible “dead-ends” that may be reached. Once we have found a set of (mostly) nonlinear variables, we can determine their ordering in a potential width-2 OBDD (or detect that no such OBDD exists). In the last stage we check whether there exists a subset of these variables that are the last nonlinear variables in a width-2 OBDD that is close to the tested function f (without actually determining what this OBDD is). This is done by employing a subroutine (which is simple, but may be of independent interest), that checks whether two linear functions have common variables. We mention that our algorithm has two-sided error, while the algorithm in [4] has one-sided error. We leave it as an open question whether our algorithm can be modified so as to achieve one-sided error. As noted previously, the complexity of ˜ ˜ n/)). our algorithm is O(log n/+1/5 ) (and that of the algorithm in [4] is O(log While it is possible that the dependence of the complexity of our algorithm on 1/ can be improved, the dependence on n must be logarithmic [5]. Additional related work. As noted previously, width-2 OBDDs generalize two classes of functions that have been studied in the context of property testing linear functions (over GF (2)) [1] and monomials [3]. In both these cases membership can be tested in time that is linear in 1/. Observe that in both cases the functions can be computed by a width-2 OBDD for any order of the variables. We next note that the type of question we ask differs from that studied by Newman [6]. Newman shows that a property testing algorithm exists for any property decidable by a constant width branching program. That is, in [6] the property is defined with respect to a particular branching program, and the algorithm tests membership in a language decidable by that program. In contrast, in our result, the language we test for membership in is one where every word is the truth table of a width-2 branching program.
134
D. Ron and G. Tsur
OBDDs and, in particular, bounded width OBDDs have been studied in the machine learning context rather extensively. In particular it has been shown that width-2 OBDDs are PAC-learnable, while width-3 and wider OBDDs are as hard to learn as DNF formulas [7]. These results were strengthened in [8,9]. When membership queries are allowed and the underlying distribution is uniform, width-2 branching programs with a single 0 sink are efficiently learnable [9]. When both membership and equivalence queries are allowed then there are several positive results for other restricted types of branching programs [10,11,12,13,9]. Organization. In Section 2 we provide some basic definitions and present several general claims regarding width-2 OBDDs. In Section 3 we give the testing algorithm and prove its correctness based on the correctness of the procedures that it uses. All missing details can be found in the full version of this paper [14].
2 2.1
Preliminaries Basic Definitions and Notations
Definition 1. The distance between a function f and a function g over the same range X, denoted d(f, g), is defined as Prx [f (x) = g(x)] where x is drawn uniformly at random from X. When d(f, g) > we say that f is -far from g, otherwise it is -close. For a family of functions G we let d(f, G) = ming∈G {d(f, g)}. If d(f, G) > , then we say that f is -far from G. Definition 2. A property testing algorithm T for membership in a function class F is given oracle access to a function f and a distance parameter 0 < < 1. If f ∈ F, then T accepts with probability at least 2/3, and if f is -far from F , then T rejects with probability at least 2/3. In both cases the probability is over the coin tosses of T . A property testing algorithm is said to have one-sided error if it accepts every f ∈ F with probability 1. Of course, if we wish to accept or reject incorrectly with probability at most δ, we can repeat the application of a property testing algorithm Θ(log(1/δ)) times and take a majority vote. Later in this work we will routinely “amplify” the probability of success for such algorithms as required. A property testing algorithm that we use as a basic building block in our algorithm is the linearity tester, proposed by Blum, Luby and Rubinfeld [15]. In [15] it is assumed that for a linear function f it holds that f (0n ) = 0. For our purposes, linearity allows for a “free” coefficient, and the BLR algorithm is easily adapted for such a case. Definition 3. We say that f : {0, 1}n → {0, 1} is a linear function if there exist coefficients b0 , b1 , . . . , bn ∈ {0, 1} such that for x = x1 , . . . , xn ∈ {0, 1}n , f (x) = n bi xi . b0 + Σi=1 Theorem 1 ([15]). There exists a one-sided error testing algorithm for linearity. Its query complexity is O(1/).
Testing Computability by Width-2 OBDDs
135
We now turn to defining (O)BDDs. Definition 4. A Binary Decision Diagram (BDD), also known as a branching program, is an acyclic directed graph with a single source where sinks are labeled 0 or 1, and each other node is labeled by a Boolean variable from X = {x1 , ....xn }. The Boolean function associated with a BDD is computed on a particular assignment to the variables in X by returning the label of the sink reached when these assignment values are used to trace a route through the graph. There are different definitions in the literature for Ordered Binary Decision Diagrams. Our results hold for the definition of a strict fixed width binary decision diagram: Definition 5. An Ordered Binary Decision Diagram (OBDD) is a BDD where each path from the root to a sink must pass through all variables in a fixed order (where each variable appears once). The width of an OBDD is the maximum number of nodes in a level of the rooted graph. In this work we are generally concerned with functions that are computable by a width-2 OBDD for some order of the variables x1 , . . . , xn , where this order is unknown to us. We will often find it useful to discuss the variables according to such an order. Unless stated otherwise, when we consider a width-2 OBDD M , then the order of the variables is denoted by z1 , . . . , zn = xπ(1) , . . . , xπ(n) where π is a permutation of 1, . . . , n. Throughout this work we will discuss functions that are restricted on some of their variables We denote by fxi =σ the function f with the variable xi restricted to the value σ. As a general rule it will make little difference for our work if we think of fxi =σ as a function of n variables or of n − 1. In a similar manner, when restricting a set of variables S to a value σ we will use the notation fS=σ . An additional issue worth addressing before we delve into the world of width-2 OBDDs over an unknown order of the variables is that of variables that don’t influence the function we’re discussing, that is, variables that are nominally an input to f but have no effect whatsoever on f ’s output. Namely, we define the = f (xi )] influence of a variable xi on f , denoted by inflf (xi ), as Prx∈{0,1}n [f (x) i where x is the value x with the i’th bit flipped. A variable xi is influential with respect to f if inflf (xi ) > 0, otherwise it is non-influential. For a function f computable by a width-2 OBDD over some order z1 , . . . , zn , we can change the location of all non-influential variables arbitrarily. We will assume, without loss of generality, that whenever we discuss an order z1 , . . . , zn where f is computable by a width-2 OBDD, the non-influential variables appear last. 2.2
Properties of OBDDs
In this subsection we provide several definitions and claims that set the ground for our algorithm and that are used in its analysis. In this work we will often find it convenient to discuss a partial traversal of an OBDD and not the full computation performed by it. We will routinely relate to one of the (at most) two vertices in a layer of the width-2 OBDD as 0 and
136
D. Ron and G. Tsur
to the other as 1. The state reached on the i’th level, after reading the variables z1 , . . . , zi−1 , will be denoted fi (z1 , . . . , zi−1 ). Definition 6. For a fixed order of the variables, and a fixed denotation of different states in an OBDD as being 0 states or 1 states, we say that the variable zi is an and variable if fi+1 (z1 , . . . , zi ) = fi (z1 , . . . , zi−1 ) ∧ i , where i is either zi or z i (and f0 is either 0 or 1). or variables and xor variables are defined in a similar manner. We call this description the type of a variable - thus, the type of a variable is either and, or or xor. Note that the first variable in an ordering can be considered, according to this definition, as any one of the three types of variables. We generally consider it to be the same type of variable as the one just following it. In the case where there is only a single variable with influence in f we consider it a xor variable. Let f be a function computable by a width-2 OBDD with the order of variables z1 , . . . , zn = xπ(1) , . . . , xπ(n) . Assume, without loss of generality, that this order has variables with 0 influence at the end, as zm , . . . , zn . Let zk , . . . , zk+ be a set of xor variables. It holds that fk++1 (z1 , . . . , zk+ ) is a linear function of fk (z1 , . . . , zk−1 ) and of zi , . . . , zk+ . If we restrict (as we shall) variables on both sides of these xor variables, we will have a linear function. This fact, combined with the following claim (which is proved in [4]), about variables of the other two types, will be a basic building block in our property-testing strategy. Claim 1. Let M be a width-2 OBDD, and let zi be an and variable or an or variable in M . For a variable zj where j < i it holds that inflfi (zj ) ≤ 1 2 inflfi−1 (zj ). The fact that there may exist width-2 OBDDs computing a function for different variable orderings is apparent - indeed any linear function is computable by a width-2 OBDD over any order of the variables. However, these possible reorderings are limited, as we establish in what follows. Definition 7. For a fixed order of the variables z1 , . . . , zn , a set of consecutive variables zi , . . . , zj is said to be a series of variables if they are all of the same type. Definition 8. A variable xi is blocking a variable xj (with regard to a function f ) if xj has no influence in fxi =σ (for some σ ∈ {0, 1}), but has influence in f . A variable xi that blocks some xj will be called a blocking variable. Note that the property of being a blocking variable relates to the function f and not to a specific representation of this function (e.g., as a width-2 OBDD). However, blocking variables are and variables or or variables. The next claim follows from the definition of blocking variables (as well as and and or variables). Claim 2. If xi is an and variable or an or variable, then xi is a blocking variable and blocks all variables in series preceding it, as well as the variables in the same series it belongs to. The oter direction holds as well.
Testing Computability by Width-2 OBDDs
137
Claim 3. Let xi be a variable blocking xj in f . In any width-2 OBDD computing f it holds that xi is either an and variable or an or variable. Furthermore, xi either appears in the same series as xj or in a series following it. For the following Claims we stress again that we assume without loss of generality that all the non-influential variables are grouped at the end of every ordering where f is computable by a width-2 OBDD. Claim 4. Let f be a function computable by a width-2 OBDD M . For every width-2 OBDD M computing f , if zi and z belong to the same series in M , then they belong to the same series in M . The following claim was also obtained in [12]. Claim 5. For a function f that is computable by a width-2 OBDD, there exists a unique order of series S1 , . . . , Sm such that f is only computable by width-2 OBDDs over that order. We observe that due to Claims 4 and 5, we may discuss the partition of the variables into series and the order of different series in a function f computable by a width-2 OBDD. That is, the partition into series and the order of the series is inherent to the function and not only to a specific implementation of it. We shall sometimes be interested in consecutive sequences of series of blocking variables (for an illustration see Figure 1).
x7
x2
x10
x3
x11
x8
x4
x6
x1
x5 0 states
1 states
S1 (Xor series) (Linear section)
S2 (And series)
S3 S4 (Or series) (Xor series)
(And/Or section)
(Linear section)
Fig. 1. An example of a width-2-OBDD and its partition into series and sections. The broken lines represent 0 transitions, the unbroken (thin) lines represent 1 transitions, and the wider lines represent 0/1 transitions.
Definition 9. A maximal consecutive sequence of series of and and or variables is referred to as a blocking section of the function f . We will use this term interchangeably to relate to the set of variables in a blocking section, as well. A series of xor variables is referred to as a linear section. The next claim follows from the definition of blocking variables (and sections thereof).
138
D. Ron and G. Tsur
Claim 6. Let f be a function computable by a width-2 OBDD that isn’t linear. For every variable xi in the last blocking series of f , there exists a value σ ∈ {0, 1} such that for every subset S of the variables where xi ∈ S, it holds that fS=σ is linear. The last claim in this section is central to our algorithm. Claim 7. Let f be a function computable by a width-2 OBDD that is -far from linear. Let S1 be the last blocking series in f , let S2 be the series preceding it (if such a series exists) and let S3 be the series preceding S2 (again, if such a series exists). Let S be a subset of the variables such that fS=σ is /2-close to linear for some σ ∈ {0, 1}, then one of the following holds: (1) S includes a variable from S1 ; (2) S includes all the variables in S2 ; (3) S includes a variable from S2 and S2 is of length at most log(1/); or (4) S contains all the variables in S3 . Furthermore, unless it is the first series in the OBDD, the length (size) of S1 is less than log(1/), and otherwise it is at most log(1/).
3
Testing Computability by Width-2 OBDDs with an Unknown Order
In order to gain intuition about our algorithm, we start by considering certain simple scenarios. Imagine first that we are promised that a function f to which we have query access, is either computable by a width-2 OBDD that has no blocking variables, or is far from any function computable by a width-2 OBDD. We could check which of the two holds using the BLR linearity test (see Theorem 1) on f , since a function computable by a width-2 OBDD that has no blocking variables is a linear function. Now, imagine we are promised that f is either far from any function computable by a width-2 OBDD, or that it is computable by a width-2 OBDD that has exactly one blocking variable, xi , where i is known. We could check to see which of the two cases holds by going through the following procedure. If f is computable by a width-2 OBDD with exactly one blocking variable, xi , then there exists a value σ ∈ {0, 1} such that fxi =σ is a linear function with a set S of influential variables, and fxi =¯σ is a linear function with a set T of influential variables where S ⊆ T . This corresponds to xi blocking all the variables preceding it when fxi =σ (and S being a series of xor variables following xi ), and to xi not blocking all variables before it (so that T is a series of xor variables in fxi =¯σ , which is a superset of S). We can use the linearity containment test, that we will describe subsequently, and restrictions of xi , to verify whether this is the case. As a final hypothetical scenario, consider the following promise: f is either far from every function computable by a width-2 OBDD, or it can be computed using a width-2 OBDD with a single unknown blocking variable. If we could locate the blocking variable, we could tell which of the two cases holds, as done in the previous paragraph. Note that any function that is computable by a width-2 OBDD with one blocking variable and isn’t linear, is far from linear (this can be verified using Claim 1). Therefore, we would like to check f and
Testing Computability by Width-2 OBDDs
139
see what variables in it, when restricted, give a linear function. Note that as a consequence of Claim 7, if the blocking variable isn’t restricted, assuming some other variables with influence aren’t restricted either, then the function will be far from linear. On the other hand, if the blocking variable is restricted, then we will have a linear function. That is, when it’s restricted to a blocking value, only variables following it (all xor variables) will have influence, and when it’s restricted to a non-blocking value, all the non-restricted variables will be xor variables as well. In order to test computability by a width-2 OBDD we will try to learn something of the structure of a width-2 OBDD that can compute f (if such an OBDD exists). If f is computable by a width-2 OBDD, then we will establish the identity of log(1/) variables that are members of the last blocking sections in f , exhausting all but possibly the first of these sections. Having done this, we then establish an order for these variables and finally test that f can in fact be computed by a width-2 OBDD with this order. Any function passing this procedure (with sufficiently high probability) will be shown to be close to one computable by a width-2 OBDD. Our algorithm is given in Figure 2, and our main theorem is stated next.
Test-width-2 Input: Oracle access to a function f ; Precision parameter . 1. Let b = log(1/) + 2 and let δ = 1/9 2. Run Detect-blocking-variablesf (b, δ) and let (i1 , ρ1 ), . . . , (ik , ρk ) be the pairs returned by the procedure 3. For all subsets of these pairs having size at most b, perform the following: (a) Run Sort-blocking-variables on the pairs in the subset with precision parameter and confidence parameter δ/(24b+4 ) (b) If Verify-blocking-variables executed on f with the ordered subset of variables and blocking values, with distance parameter and with confidence parameter δ/(24b+4 ) returns accept, then output accept. 4. Output reject. Fig. 2. Algorithm Test-width-2
Theorem 2. Given oracle access to a function computable by a width-2 OBDD, Test-width-2 will accept with probability at least 2/3, and given oracle access to a function that is -far from every function computable by a width-2 OBDD, Test-width-2 will reject with probability at least 2/3. The query complexity of ˜ Test-width-2 is O(log n/ + 1/5 ). Due to space constraints, we only state our main claims concerning the correctness of the subroutines used by the algorithm, and based on these claims prove Theorem 2. The details of the procedures, as well as their analysis, can be found in the full version of this paper [14].
140
D. Ron and G. Tsur
The claim concerning the correctness of Detect-blocking-variables is stated next (where we note that it is applied with b = log(1/) + 2). Claim 8. When given oracle access to a function f computable by a width2 OBDD and a maximum number of variables b, with probability at least 1 − δ, Detect-blocking-variables outputs a set of pairs containing indices and corresponding blocking values Λ = {(i1 , ρ1 ), . . . , (im , ρm )} such that one of the following holds: 1. The pairs in Λ contain a subset of size b of indices to variables that correspond to the last blocking variables in f . 2. The pairs in Λ contain a subset of size smaller than b of indices that correspond to the last blocking variables in f , and when all are restricted to a non-blocking value, the function f is 2−b -close to linear. Detect-blocking-variables never returns more than 4b + 4 indices of variables. The number of queries performed by Detect-blocking-variables is ˜ b log(n) log(1/δ)). O(2 The next claim established the correctness of the procedure Sort-blockingvariables. Claim 9. Given oracle access to a function f computable by a width-2 OBDD, and pairs of indices of blocking variables and the corresponding blocking values (i1 , ρ1 ), . . . , (ik , ρk ), with probability of error at most δ, Sort-blockingvariables will return the pairs ordered with indices j1 , . . . , jk such that j is blocked by j−1 for every 1 ≤ ≤ k − 1 such that xj has influence at least with ˜ log(1/δ)/) queries. respect to f . Sort-blocking-variables performs O(k Our claim concerning the verification procedure is stated next. Claim 10. When given oracle access to a function f , a precision parameter , and a confidence parameter δ, the procedure Verify-blocking-variables behaves as follows. 1. Suppose f is -far from every function computable by a width-2 OBDD. Then the probability that f passes Verify-blocking-variables given any set of variable indices and corresponding blocking values, is at most δ. 2. Suppose f is computable by a width-2 OBDD and Verify-blockingvariables is given one of the following: (a) Ordered pairs of indices and blocking variables (i1 , σ1 ), . . . , (im , σm ) that are those of the last log(1/) blocking variables in f , sorted correctly for some width-2 OBDD computing f . (b) Ordered pairs of indices and blocking variables (i1 , σ1 ), . . . , (im , σm ) that are those of fewer than log(1/) blocking variables in f , which are the last blocking variables in f and are sorted correctly for some width-2 OBDD computing f . Furthermore, when all are restricted to a nonblocking value, the resulting function is -close to linear. Then Verify-blocking-variables accepts with probability at least 1 − δ.
Testing Computability by Width-2 OBDDs
141
˜ log(δ)/) queries. Verify-blocking-variables performs O(k We are now ready to prove our main theorem. Before doing so we note that we have developed an additional test of independent interest, the use of which is hidden in the aforementioned subroutines. For two linear functions we say they intersect if they share at least one influential variable. Claim 11. The algorithm Test-Linear-Intersection has both soundness and completeness properties: For linear functions f and g, if they intersect, then the intersection test will return true with probability at least 1 − δ, and if they do not intersect, it will return false with probability 1. The algorithm performs Θ(log(1/δ)) queries. We further note that using the intersection test allows us to check whether the influential variables in one linear function are a subset of those used by another. Proof of Theorem 2: Both parts of the theorem will be proved by assuming that all the sub-procedures used by the algorithm do not fail, e.g., when we execute Verify-blocking-variables it works as specified (by Claim 10). We will show that conditioned on this, functions computable by width-2 OBDDs will be accepted, and functions that are -far from every function computable by a width-2 OBDD will be rejected. We note that the cumulative probability over all such sub-procedures of any of them failing, is less then 1/3 by a union bound, and thus the theorem will follow. We assume from this point on that indeed all subprocedures work as specified. The correctness of the soundness part of the theorem is a direct consequence of the specification of Verify-blocking-variables as stated in Claim 10 - if f passes, then it is -close to a function computable by a width-2 OBDD. We thus turn to the completeness part of the theorem. By the specification of Detect-blocking-variables in Claim 8, Detectblocking-variables will return one of the following: (1) A set of indices {i1 , . . . , im } that contains a subset of size b that corresponds to the last blocking variables in f ; or (2) a set of indices {i1 , . . . , im } that contains a subset of size smaller than b that corresponds to the last blocking variables in f , and when all are restricted to a non-blocking value, the resulting function is 2−b -close to linear. The algorithm Test-width-2 goes over all subsets of size at most b and, in particular, it considers a subset as described above. By the specification of Sortblocking-variables as stated in Claim 9, and the influence properties of blocking variables, this subset of variables will be sorted correctly by Sort-blockingvariables. Finally, by the specification of Verify-blocking-variables as stated in Claim 10, the function f with these variables will be accepted by Verifyblocking-variables, and the algorithm will accept, as required. The bound on the number of queries performed by the algorithm follows from Claims 8–10, and the fact that the number of subsets of variables that are
considered by the algorithm is at most 24b+4 = O(1/4 ).
142
D. Ron and G. Tsur
References 1. Rubinfeld, R., Sudan, M.: Robust characterization of polynomials with applications to program testing. SIAM Journal on Computing 25(2), 252–271 (1996) 2. Goldreich, O., Goldwasser, S., Ron, D.: Property testing and its connection to learning and approximation. Journal of the ACM 45(4), 653–750 (1998) 3. Parnas, M., Ron, D., Samorodnitsky, A.: Testing basic boolean formulae. SIAM Journal on Discrete Math. 16(1), 20–46 (2002) 4. Ron, D., Tsur, G.: Testing computability by width two OBDDs. In: Dinur, I., Jansen, K., Naor, J., Rolim, J. (eds.) Approximation, Randomization, and Combinatorial Optimization. Algorithms and Techniques. LNCS, vol. 5687, pp. 686–699. Springer, Heidelberg (2009) 5. Goldreich, O., Ron, D.: Private communications (2009) 6. Newman, I.: Testing membership in languages that have small width branching programs. SIAM Journal on Computing 31(5), 1557–1570 (2002) 7. Erg¨ un, F., Kumar, R.S., Rubinfeld, R.: On learning bounded-width branching programs. In: COLT 1995, pp. 361–368 (1995) 8. Bshouty, N., Tamon, C., Wilson, D.: On learning width two branching programs. Information Processing Letters 65, 217–222 (1998) 9. Bergadano, F., Bshouty, N., Tamon, C., Varricchio, S.: On learning branching programs and small depth circuits. In: COLT 1997, pp. 150–161 (1997) 10. RagHavan, V., Wilkins, D.: Learning branching programs with queries. In: COLT 1993, pp. 27–36 (1993) 11. Gavalda, R., Guijarro, D.: Learning ordered binary decision diagrams. In: Zeugmann, T., Shinohara, T., Jantke, K.P. (eds.) ALT 1995. LNCS, vol. 997, pp. 228– 238. Springer, Heidelberg (1995) 12. Nakamura, A.: Query learning of bounded-width OBDDs. Theoretical Computer Science 241, 83–114 (2000) 13. Nakamura, A.: An efficient query learning algorithm for OBDDs. Information and Computation 201, 178–198 (2005) 14. Ron, D., Tsur, G.: Testing computability by width two obdds where the variable order is unknown (2010), http://www.eng.tau.ac.il/~ danar 15. Blum, M., Luby, M., Rubinfeld, R.: Self-testing/correcting with applications to numerical problems. Journal of the ACM 47, 549–595 (1993)
Graph Unique-Maximum and Conflict-Free Colorings Panagiotis Cheilaris1 and G´eza T´oth2, 1
Center for Advanced Studies in Mathematics, Ben-Gurion University,
[email protected] 2 R´enyi Institute, Hungarian Academy of Sciences,
[email protected]
Abstract. We investigate the relationship between two kinds of vertex colorings of graphs: unique-maximum colorings and conflict-free colorings. In a unique-maximum coloring, the colors are ordered, and in every path of the graph the maximum color appears only once. In a conflictfree coloring, in every path of the graph there is a color that appears only once. We also study computational complexity aspects of conflictfree colorings and prove a completeness result. Finally, we improve lower bounds for those chromatic numbers of the grid graph.
1
Introduction
In this paper we study two types of vertex colorings of graphs, both related to paths. The first one is the following: Definition 1. A unique-maximum coloring with respect to paths of G = (V, E) with k colors is a function C : V → {1, . . . , k} such that for each path p in G the maximum color occurs exactly once on the vertices of p. The minimum k for which a graph G has a unique-maximum coloring with k colors is called the unique-maximum chromatic number of G and is denoted by χum (G). Unique maximum colorings are known alternatively in the literature as ordered colorings or vertex rankings. The problem of computing unique-maximum colorings is a well-known and widely studied problem with many applications including VLSI design [11] and parallel Cholesky factorization of matrices [12]. The problem is also interesting for the Operations Research community, because it has applications in planning efficient assembly of products in manufacturing systems [9]. In general, it seems that the vertex ranking problem can model situations where interrelated tasks have to be accomplished fast in parallel (assembly from parts, parallel query optimization in databases, etc.) The other type of vertex coloring can be seen as a relaxation of the uniquemaximum coloring.
Supported by OTKA T 038397 and 046246.
T. Calamoneri and J. Diaz (Eds.): CIAC 2010, LNCS 6078, pp. 143–154, 2010. c Springer-Verlag Berlin Heidelberg 2010
144
P. Cheilaris and G. T´ oth
Definition 2. A conflict-free coloring with respect to paths of G = (V, E) with k colors is a function C : V → {1, . . . , k} such that for each path p in G there is a color that occurs exactly once on the vertices of p. The minimum k for which a graph G has a conflict-free coloring with k colors is called the conflict-free chromatic number of G and is denoted by χcf (G). Conflict-free coloring of graphs with respect to paths is a special case of conflictfree colorings of hypergraphs, first studied in [8]. One of the applications of conflict-free colorings is that it represents a frequency assignment for cellular networks. A cellular network consists of two kinds of nodes: base stations and mobile agents. Base stations have fixed positions and provide the backbone of the network; they are represented by vertices in V . Mobile agents are the clients of the network and they are served by base stations. This is done as follows: Every base station has a fixed frequency; this is represented by the coloring C, i.e., colors represent frequencies. If an agent wants to establish a link with a base station it has to tune itself to this base station’s frequency. Since agents are mobile, they can be in the range of many different base stations. To avoid interference, the system must assign frequencies to base stations in the following way: For any range, there must be a base station in the range with a frequency that is not used by some other base station in the range. One can solve the problem by assigning n different frequencies to the n base stations. However, using many frequencies is expensive, and therefore, a scheme that reuses frequencies, where possible, is preferable. Conflict-free coloring problems have been the subject of many recent papers due to their practical and theoretical interest (see e.g. [13,6,7,2]). Most approaches in the conflict-free coloring literature use unique-maximum colorings (a notable exception is the ‘triples’ algorithm in [2]), because unique-maximum colorings are easier to argue about in proofs, due to their additional structure. Another advantage of unique-maximum colorings is the simplicity of computing the unique color in any range (it is always the maximum color), given a uniquemaximum coloring, which can be helpful if very simple mobile devices are used by the agents. For general graphs, finding the exact unique-maximum chromatic number of a graph is NP-complete [15] and there is a polynomial time O(log2 n) approximation algorithm [4], where n is the number of vertices. Since the problem is hard in general, it makes sense to study specific graphs. The m × m grid, Gm , is the cartesian product of two paths, each of length m − 1, that is, the vertex set of Gm is {0, . . . , m − 1} × {0, . . . , m − 1} and the edges are {{(x1 , y1 ), (x2 , y2 )} | |x1 − x2 | + |y1 − y2 | ≤ 1}. It is known [10] √ that for general planar graphs the unique-maximum chromatic number is O( n). Grid √ graphs are planar and therefore the O( n) bound applies. One might expect that, since the grid has a relatively simple and regular structure, it should not be hard to calculate its unique-maximum chromatic number. This is why it is rather striking that, even though it is not hard to show upper and lower bounds that are only a small constant multiplicative factor apart, the exact value of these chromatic numbers is not known, and has been the subject of [1].
Graph Unique-Maximum and Conflict-Free Colorings
145
Paper Organization. In the rest of this section we provide the necessary definitions and some earlier results. In section 2, we prove that it is coNP-complete to decide whether a given vertex coloring of a graph is conflict-free with respect to paths. In section 3, we show that for every graph χum (G) ≤ 2χcf (G) − 1 and provide a sequence of graphs for which the ratio χum (G)/χcf (G) tends to 2. In section 4, we introduce two games on graphs that help us relate the two chromatic numbers for the grid graph. In section 5, we show a lower bound on the unique-maximum chromatic number of the grid graph, improving previous results. Conclusions and open problems are presented in section 6. 1.1
Preliminaries
Definition 3. A graph X is a minor of Y , denoted as X Y , if X can be obtained from Y by a sequence of the following three operations: vertex deletion, edge deletion, and edge contraction. Edge contraction is the process of merging both endpoints of an edge into a new vertex, which is connected to all vertices adjacent to the two endpoints. Given a unique-maximum coloring C of Y , we get the induced coloring of X as follows. Take a sequence of vertex deletions, edge deletions, and edge contractions so that we obtain X from Y . For the vertex and edge deletion operations, just keep the colors of the remaining vertices. For the edge contraction operation, say along edge xy, which gives rise to the new vertex vxy , set C (vxy ) = max(C(x), C(y)), and keep the colors of all other vertices. Proposition 1. [3] If X Y , and C is a unique-maximum coloring of Y , then the induced coloring C is a unique-maximum coloring of X. Consequently, χum (X) ≤ χum (Y ). The (traditional) chromatic number of a graph is denoted by χ(G) and is the smallest number of colors in a vertex coloring for which adjacent vertices are assigned different colors. A simple relation between the chromatic numbers we have defined so far is the following. Proposition 2. For every graph G, χ(G) ≤ χcf (G) ≤ χum (G). Moreover, we prove that both conflict-free and unique-maximum chromatic numbers are monotone under taking subgraphs. Proposition 3. If X ⊆ Y , then χcf (X) ≤ χcf (Y ) and χum (X) ≤ χum (Y ). Proof. Take the restriction of any conflict-free or unique-maximum coloring of graph Y to the vertex set V (X). This is a conflict-free or unique maximum coloring of graph X, respectively, because the set of paths of graph X is a subset of all paths of Y . If v is a vertex (resp. S is a set of vertices) of graph G = (V, E), denote by G − v (resp. G − S) the graph obtained from G by deleting vertex v (resp. vertices of S) and adjacent edges. Definition 4. A subset S ⊆ V is a separator of a connected graph G = (V, E) if G − S is disconnected or empty.
146
2
P. Cheilaris and G. T´ oth
Deciding Whether a Coloring Is Conflict-Free
In this section, we show a difference between the two chromatic numbers χum and χcf , from the computational complexity aspect. For the notions of complexity classes, hardness, and completeness, we refer, for example, to [14]. As we mentioned before, in [15], it is shown that computing χum for general graphs is NP-complete. To be exact the following problem is NP-complete: “Given a graph G and an integer k, is it true that χum (G) ≤ k?”. The above fact implies that it is possible to check in polynomial time whether a given coloring of a graph is unique-maximum with respect to paths. We remark that both the conflict-free and the unique-maximum properties have to be true in every path of the graph. However, a graph with n vertices can have exponential in n number of distinct sets of vertices, each one of which is a vertex set of a path in the graph. For unique-maximum colorings we can find a shortcut as follows: Given a (connected) graph G and a vertex coloring of it, consider the set of vertices S of unique colors. Let u, v ∈ V \ S such that they both have the maximum color that appears in V \ S. If there is a path in G − S from u to v, then this path violates the unique maximum property. Therefore, S has to be a separator in G, which can be checked in polynomial time, otherwise the coloring is not unique-maximum. If G − S is not empty, we can proceed analogously for each of its components. For conflict-free colorings there is no such shortcut, unless coNP = P, as the following theorem implies. Theorem 1. It is coNP-complete to decide whether a given graph and a vertex coloring of it is conflict-free with respect to paths. Proof. In order to prove that the problem is coNP-complete, we prove that it is coNP-hard and also that it belongs to coNP. We show coNP-hardness by a reduction from the complement of the Hamiltonian path problem. For every graph G, we construct in polynomial time a graph G∗ of polynomial size together with a coloring C of its vertices such that G has no Hamiltonian path if and only if C is conflict-free with respect to paths of G∗ . Assume the vertices of graph G are v1 , v2 , . . . , vn . Then, graph G∗ consists ˆ and G, ˇ with vertex sets v 1 , v 2 , of two isomorphic copies of G, denoted by G . . . , v n and v 1 , v 2 , . . . , v n , respectively. Additionally, for every i ∈ {1, . . . , n}, G∗ contains the path Pi = (v i , vi,1 , vi,2 , . . . , vi,i−1 , vi,i+1 , . . . , vi,n , v i ), where, for every i, vi,1 , vi,2 , . . . , vi,i−1 , vi,i+1 , . . . , vi,n are new vertices. We use the following notation for the two possible directions to traverse the interior of this path: Pi↓ = (vi,1 , . . . , vi,i−1 , vi,i+1 , . . . , vi,n ),
Pi↑ = (vi,n , . . . , vi,i+1 , vi,i−1 , . . . , vi,1 ).
We call paths Pi connecting paths. We now describe the coloring of V (G∗ ). For every i,we set C(v i ) = C(v i ) = i. For every i > j, we set C(vi,j ) = C(vj,i ) = n + i−1 + j. Observe that every 2 color occurs exactly in two vertices of G∗ . If G has a Hamiltonian path, say v1 v2 . . . vn , then there is a path through all vertices of G∗ ,
Graph Unique-Maximum and Conflict-Free Colorings
147
↓ either v 1 P1↓ v 1 v 2 P2↑ v 2 . . . v n−1 Pn−1 v n−1 v n Pn↑ v n , if n is even, ↑ v n−1 v n Pn↓ v n , if n is odd. or v 1 P1↓ v 1 v 2 P2↑ v 2 . . . v n−1 Pn−1
But then, this path has no uniquely occurring color and thus C is not conflict-free. Suppose now that C is not a conflict-free coloring. We prove that G has a Hamiltonian path. By the assumption, there is a path P in G∗ which is not conflict-free. This path must contain none or both vertices of each color. Therefore, P can not be ˆ or in G, ˇ or in some Pi . Also, P can not contain only completely contained in G, one of v i and v i , for some i. Therefore, P must contain both v i and v i for a non-empty subset of indices i. ˆ and G ˇ can Then, it must contain completely some Pi , because vertices in G only be connected with some complete Pi . But since each one of the n − 1 colors of this Pi occurs in a different connecting paths, P must contain a vertex in every connecting path. But then P must contain every v i and v i , because vertices in Pi can only be connected to the rest of the graph through one of v i or v i . Suppose that P is not a Hamiltonian path of G∗ . Observe that if P does not contain all vertices of some connecting path Pi , then one of its end vertices should be there. If P does not contain vertex vi,j , then it can not contain vj,i either. But then one end vertex of P should be on Pi , the other one on Pj , and all other vertices of G∗ are on P . Therefore, we can extend P such that it contains vi,j and vj,i as well. So assume in the sequel that P is a Hamiltonian path of G∗ . Now we modify P , if necessary, so that both of its end-vertices e and f lie in ˆ ∪ V (G). ˇ If e and f are adjacent in G∗ , then add the edge ef to P and we V (G) get a Hamiltonian cycle of G∗ . Now remove one of its edges which is either in ˆ or in G ˇ and get the desired Hamiltonian path. Suppose now that e and f are G, not adjacent, and e is on one of the connecting paths. Then e should be adjacent ˆ or in G. ˇ Add edge to the end vertex e of that connecting path, which is in G ee to P . We get a cycle and a path joined in e . Remove the other edge of the cycle adjacent to e . We have a Hamiltonian path now, whose end vertex is e instead of e. Proceed analogously for f , if necessary. ˆ ∪ V (G). ˇ Now we have a Hamiltonian path P of G∗ with end-vertices in V (G) Then, P is in the form, say, ↓ either v 1 P1↓ v 1 v 2 P2↑ v 2 . . . v n−1 Pn−1 v n−1 v n Pn↑ v n , if n is even, ↑ v n−1 v n Pn↓ v n , if n is odd. or v 1 P1↓ v 1 v 2 P2↑ v 2 . . . v n−1 Pn−1
But then, v1 v2 . . . vn is a Hamiltonian path in G. Finally, the problem is in coNP because an algorithm can verify that a coloring of a given graph is not conflict-free in polynomial time, if given a path with no vertex of unique color.
3
The Two Chromatic Numbers of General Graphs
We have seen that χum (G) ≥ χcf (G) (proposition 2). In this section we show that χum (G) is bounded by an exponential function of χcf (G). We also provide a sequence of graphs {Hk }∞ k=0 , for which limk→∞ (χum (Hk )/χcf (Hk )) = 2.
148
P. Cheilaris and G. T´ oth
The path of n vertices is denoted by Pn . It is known (see for example [8]) that χcf (Pn ) = log2 n + 1. Moreover, we are going to use the following result (lemma 5.1 of [10]): If the longest path of G has k vertices, then χum (G) ≤ k. Proposition 4. For every graph G, χum (G) ≤ 2χcf (G) − 1. Proof. Set j = χcf (G). For any path P ⊆ G, χcf (P ) ≤ j, therefore the longest path has at most 2j − 1 vertices, so by lemma 5.1 of [10], χum (G) ≤ 2j − 1. We define recursively the following sequence of graphs: Graph H0 is a single vertex. Suppose that we have already defined Hk−1 . Then Hk consists of (a) a K2k+1 −1 , (b) 2k+1 − 1 copies of Hk−1 , and (c) for for each i ∈ {1, . . . , 2k+1 − 1}, the i-th vertex of the K2k+1 −1 is connected by an edge to one of the vertices of the i-th copy of Hk−1 . Lemma 1. For k ≥ 0, χcf (Hk ) = 2k+1 − 1. Proof. By induction on k. For k = 0, χcf (H0 ) = 1. For k > 0, we have Hk ⊇ K2k+1 −1 , therefore, χcf (Hk ) ≥ 2k+1 − 1. In order to prove that χcf (Hk ) ≤ 2k+1 − 1, it is enough to describe a conflictfree coloring of Hk with 2k+1 − 1 colors, given a conflict-free coloring of Hk−1 with 2k − 1 colors: We color the vertices of the clique K2k+1 −1 with colors 1, 2, . . . , 2k+1 − 1 such that the i-th vertex is colored with color i. Consider these colors mod 2k+1 − 1, e. g. color 2k+1 is identical to color 1. Recall that the i-th copy of Hk−1 has a vertex connected to the i-th vertex of K2k+1 −1 , and by induction we know that χcf (Hk−1 ) = 2k − 1. Color the i-th copy of Hk−1 , with colors i + 1, i + 2, . . . , i + 2k − 1. We claim that this vertex coloring of Hk is conflict-free. If a path is completely contained in a copy of Hk−1 , then it is conflict-free by induction. If a path is completely contained in the clique K2k+1 −1 , then it is also conflict-free, because all colors in the clique part are different. If a path contains vertices from a single copy of Hk−1 , say, the i-th copy, and the clique, then the i-th vertex of the clique is on the path and uniquely colored. The last case is when a path contains vertices from exactly two copies of Hk−1 . Suppose that these are the i-th and j-th copies of Hk−1 , with 1 ≤ i < j ≤ 2k+1 − 1. If i + 2k − 1 < j, then color j is unique in the path; indeed, the i-th copy of Hk−1 is colored with colors i + 1, . . . i + 2k − 1, and the j-th copy of Hk−1 is colored with colors j + 1, . . . j + 2k − 1, while color j appears only once in K2k+1 −1 . Similarly, if i + 2k − 1 ≥ j, then color i is unique in the path. Lemma 2. For k ≥ 0, χum (Hk ) ≤ 2k+2 − k − 3. Proof. By induction. For k = 0, χum (H0 ) = 1. For k > 0, in order to color Hk use the 2k+1 − 1 different highest colors for the clique part. By the inductive hypothesis χum (Hk−1 ) ≤ 2k+1 − k − 2. For each copy of Hk−1 , use the same coloring with the 2k+1 − k − 2 lowest colors. This coloring of Hk is unique maximum. Indeed, if a path is contained in a copy of Hk−1 then it is unique maximum by induction, and if it contains a vertex in the clique part, then it is also unique maximum. The total number of colors is 2k+2 − k − 3.
Graph Unique-Maximum and Conflict-Free Colorings
149
Lemma 3. Let Y be a graph that consists of a K and isomorphic copies of a connected graph X, such that for every i ∈ {1, . . . , }, a vertex of the i-th copy is connected to the i-th vertex of K by an edge. Then, χum (Y ) ≥ − 1 + χum (X). Proof. By induction on . For = 1, we have that χum (Y ) ≥ χum (X), because Y ⊇ X. For the inductive step, for > 1, if Y consists of a K and copies of X, then Y is connected, and thus contains a vertex v with unique color. But then, Y − v ⊇ Y , where Y is a graph that consists of a K−1 and − 1 isomorphic copies of a X, each connected to a different vertex of K−1 , and thus χum (Y ) = 1 + χum (Y ) ≥ − 1 + χum (X). Lemma 4. For k ≥ 0, χum (Hk ) ≥ 2k+2 − 2k − 3. Proof. By induction. For k = 0, χum (H0 ) = 1. For k > 0, by the inductive hypothesis and lemma 3, χum (Hk ) ≥ 2k+1 − 1 − 1 + 2k+1 − 2(k − 1) − 3 = 2k+2 − 2k − 3. Theorem 2. The limit limk→∞ (χum (Hk )/χcf (Hk )) = 2. Proof. From lemmas 1, 2, 4, we have 2k+2 − 2k − 3 χum (Hk ) 2k+2 − k − 3 ≤ ≤ 2k+1 − 1 χcf (Hk ) 2k+1 − 1 which implies that the ratio tends to 2.
4
The Two Chromatic Numbers of the Grid
In this section, we define two games on graphs, each played by two players. The first game characterizes completely the unique-maximum chromatic number of the graph. The second game is related to the conflict-free chromatic number of the graph. We use the two games to prove that the conflict-free chromatic number of the grid is a function of the unique-maximum chromatic number of the grid. This is useful because it allows to translate existing lower bounds on the unique-maximum chromatic number of the grid to lower bounds on the corresponding conflict-free chromatic number. For any graph G, and subset of its vertices V ⊂ V (G), let G[V ] denote the subgraph of G induced by V . The first game is the connected component game. It is played on a graph G by two players. i ← 0; G0 ← G while V (Gi ) = ∅: increment i by 1 Player 1 chooses a connected component S i of Gi−1 Player 2 chooses a vertex vi ∈ S i Gi ← Gi−1 [S i \ {vi }]
150
P. Cheilaris and G. T´ oth
The game is finite, because if Gi is not empty, then Gi+1 is a strict subgraph of Gi . The result of the game is its length, that is, the final value of i. Player 1 tries to make the final value of i as large as possible and thus is the maximizer player. Player 2 tries to make the final value of i as small as possible and thus is the minimizer player. If both players play optimally, then the result is the value of the connected component game on graph G, which is denoted by v cs (G). Proposition 5. In the connected component game, there is a strategy for player 2 (the minimizer), so that the result of the game is at most χum (G), that is, v cs (G) ≤ χum (G). Proof. By induction on χum (G): If χum (G) = 0, i.e., the graph is empty, the value of the game is 0. If χum (G) = k > 0, then in the first turn some connected component S1 is chosen by player 1. Then, the strategy of player 2 is to take an optimal unique-maximum coloring C of G and choose a vertex v1 in S 1 that has a unique color in S 1 . Then, G1 = G[S 1 \ {v1 }] ⊂ G0 and the restriction of C to S 1 \ {v1 } is a unique-maximum coloring of G1 that is using at most k − 1 colors. Thus, χum (G1 ) ≤ k − 1, and by the inductive hypothesis player 2 has a strategy so that the result of the game on G1 is at most k − 1. Therefore, player 2 has a strategy so that the result of the game on G0 = G is at most 1 + k − 1 = k. Lemma 5. For every v ∈ V (G), χum (G − v) ≥ χum (G) − 1. Proof. Assume for the sake of contradiction that there exists a v ∈ V (G) for which χum (G − v) < χum (G) − 1. Then an optimal coloring of G − v can be extended to a coloring of G, where v has a new unique maximum color. Therefore there is a coloring of G that uses less than χum (G) − 1 + 1 = χum (G) colors; a contradiction. Proposition 6. In the connected component game, there is a strategy for player 1 (the maximizer), so that the result of the game is at least χum (G), that is, v cs (G) ≥ χum (G). Proof. By induction on χum (G): If χum (G) = 0, i.e., the graph is empty, the result of the game is zero. If χum (G) = k > 0, the strategy of player 1 is to choose a connected component S 1 such that χum (G[S 1 ]) = k. For every choice of v1 by Player 2, by lemma 5, χum (G1 ) ≥ k − 1, and thus, by the inductive hypothesis player 1 has a strategy so that the result of the game on G1 is at least k − 1. Therefore, the result of the game on G0 = G is at least 1 + k − 1 = k. Corollary 1. For every graph, v cs (G) = χum (G). The second game is the path game. i ← 0; G0 ← G while V (Gi ) = ∅: increment i by 1 Player 1 chooses the set of vertices S i of a path of Gi−1 Player 2 chooses a vertex vi ∈ S i Gi ← Gi−1 [S i \ {vi }]
Graph Unique-Maximum and Conflict-Free Colorings
151
The only difference with the connected component game is that in the path game the vertex set S i that maximizer chooses is the vertex set of a path of the graph Gi−1 . If both players play optimally, then the result is the value of the path game on graph G, which is denoted by v p (G). Proposition 7. In the path game, there is a strategy for player 2 (the minimizer), so that the result of the game is at most χcf (G), i.e., v p (G) ≤ χcf (G). Proof. By induction on χcf (G): If χcf (G) = 0, i.e., the graph is empty, the value of the game is 0. If χcf (G) = k > 0, then in the first turn some vertex set S 1 of a path of G is chosen by player 1. Then, the strategy of player 2 is to find an optimal conflict-free coloring C of G and choose a vertex v1 in S 1 that has a unique color in S 1 . Then, G1 = G[S 1 \ {v1 }] ⊂ G0 and the restriction of C to S 1 \ {v1 } is a conflict-free coloring of G1 that is using at most k − 1 colors. Thus, χcf (G1 ) ≤ k − 1, and by the inductive hypothesis player 2 has a strategy so that the result of the game is at most k − 1. Therefore, player 2 has a strategy so that the result of the game is at most 1 + k − 1 = k. A proposition analogous to 6 for the path game is not true. For example, for the complete binary tree of four levels (with 15 vertices, 8 of which are leaves), B4 , it is not difficult to check that v p (B4 ) = v p (P7 ) = 3, but χcf (B4 ) = 4. Now, we are going to concentrate on the grid graph. Assume that m is even. We intend to translate a strategy of player 1 (the maximizer) on the connected component game for graph Gm/2 to a strategy for player on the path game for graph Gm . Observe that for every connected graph G, there is an ordering of its vertices, v1 , v2 , . . . , vn such that the subgraph induced by the first k vertices (for every k ∈ {1, . . . , n}) is also connected. Just pick a vertex to be v1 , and add the other vertices one by one such that the new vertex vi is connected to the graph induced by v1 , . . . , vi−1 . This is possible, since G itself is connected. We call such an ordering of the vertices an always-connected ordering. Now we decompose the vertex set of Gm into groups of four vertices, Qx,y = {(2x, 2y), (2x + 1, 2y), (2x, 2y + 1), (2x + 1, 2y + 1)}, for 0 ≤ x, y < m/2, called special quadruples, or briefly quadruples. Let Wm = {Qx,y | 0 ≤ x, y < m/2} and let τ (x, y) = Qx,y , a bijection between vertices of V (Gm/2 ) and Wm . Extend τ for subsets of vertices of Gm/2 in a natural way, for any S ⊆ V (Gm/2 ), τ (S) = (x,y)∈S τ (x, y). Define also a kind of inverse τ of τ as τ (x, y) = ( x/2 , y/2 ) for any 0 ≤ x, y < m, and for any S ⊆ V (Gm ), τ (S) = {τ (x, y) | (x, y) ∈ S}. Let (x, y) ∈ V (Gm/2 ). We call vertices (x, y + 1), (x, y − 1), (x − 1, y), and (x + 1, y), if they exist, the upper, lower, left, and right neighbors of (x, y), respectively. Similarly, quadruples Qx,y+1 , Qx,y−1 , Qx−1,y , and Qx+1,y the upper, lower, left, and right neighbors of Qx,y , respectively. Quadruple Qx,y induces four edges in Gm , {(2x + 1, 2y), (2x + 1, 2y + 1)}, {(2x, 2y), (2x, 2y + 1)}, {(2x, 2y), (2x, 2y + 1)}, {(2x + 1, 2y), (2x + 1, 2y + 1)}, we call them upper, lower, left, and right edges of Qx,y .
152
P. Cheilaris and G. T´ oth
By direction d, we mean one of the four basic directions, up, down, left, right. For a given set S ⊆ V (Gm/2 ), we say that v ∈ S is open in S in direction d, if its neighbor in direction d is not in S. In this case we also say that τ (v) is open in τ (S) in direction d. Lemma 6. If S ⊆ V (Gm/2 ) induces a connected subgraph in Gm/2 , then there exists a path in Gm whose vertex set is τ (S). Proof. We prove a stronger statement: If S induces a connected subgraph in Gm/2 , then there is a cycle C in Gm whose vertex set is τ (S), and if v ∈ S is open in direction d in S, then C contains the d-edge of τ (v). The proof is by induction on |S| = k. For k = 1, τ (S) is one quadruple and we can take its four edges. Suppose that the statement has been proved for |S| < k, and assume that |S| = k. Consider an always-connected ordering v1 , v2 , . . . , vk of S. Let S = S \ vk . By the induction hypothesis, there is a cycle C satisfying the requirements. Vertex vk has at least one neighbor in S , say, vk is the neighbor of vi in direction d. But then, vi is open in direction d in S , therefore, C contains the d-edge of τ (vi ). Remove this edge from C and substitute by a path of length 5, passing through all four vertices of τ (vk ). The resulting cycle, C, contains all vertices of τ (S), it contains each edge of τ (vk ), except the one in the opposite direction to d, and it contains all edges of C , except the d-edge of τ (vk ), but vk is not open in S in direction d. This concludes the induction step, and the proof. Proposition 8. For every m > 1, v p (Gm ) ≥ v cs (G m/2 ). Proof. Assume, without loss of generality that m is even (if not work with graph Gm−1 instead). In order, to prove that v p (Gm ) ≥ v cs (G m/2 ) it is enough, given a strategy for player 1 in the connected component game for Gm/2 , to construct a strategy for player 1 (the maximizer) in the path game for Gm , so that the result of the path game is at least as much as the result of the connected component game. We present the argument as if player 1, apart from the path game, plays in parallel a connected component game on Gm/2 (for which player 1 has a given strategy to choose a connected component in every round), where player 1 also chooses the moves of player 2 in the connected component game. At round i of the path game on Gm , player 1 simulates round i of the connected component game on Gm/2 . At the start of round i, player 1 has a graph Gi−1 ⊆ ˆ i−1 ⊆ Gm/2 in the connected component Gm in the path game and a graph G i ˆ game. Player 1 chooses a set S in the simulated connected component game from his given strategy, and then constructs the path-spanned set S i = τ (Sˆi ) (by lemma 6) and plays it in the path game. Then player 2 chooses a vertex vi ∈ S i . Player 1 computes vˆi = τ (vi ) and simulates the move vˆi of player 2 in the connected component game. This is a legal move for player 2 in the connected component game because vˆi ∈ Sˆi . We just have to prove that S i = τ (Sˆi ) is a legal move for player 1 in the path game, i.e., S i ⊆ V (Gi−1 ). We also have to prove S i = τ (Sˆi ) is spanned by a path in Gi−1 but this is always true by lemma 6, since Sˆi is a connected
Graph Unique-Maximum and Conflict-Free Colorings
153
ˆ i−1 . Since S i ⊆ τ (V (G ˆ i−1 )), it is enough to prove that at round vertex set in G i−1 i−1 ˆ i, τ (V (G )) ⊆ V (G ). The proof is by induction on i. For i = 1, G0 = Gm , ˆ 0 = Gm/2 , and thus τ (V (G ˆ 0 )) = V (G0 ). At the start of round i with i > 1, G i−1 i−1 ˆ )) ⊆ V (G ), by the inductive hypothesis. Then, τ (Sˆi ) = S i and τ (V (G i τ (Sˆ \ {ˆ vi }) = τ (Sˆi ) \ τ (ˆ vi ) = S i \ τ (ˆ vi ) ⊆ S i \ {vi }, because vi ∈ τ (ˆ vi ). Thus, i−1 i i−1 i ˆ [Sˆ \ {ˆ ˆ i )) ⊆ V (Gi ). τ (V (G vi }])) ⊆ V (G [S \ {vi }]), i.e., τ (V (G Theorem 3. For every m > 1, χcf (Gm ) ≥ χum (G m/2 ). Proof. We have χcf (Gm ) ≥ v p (Gm ) ≥ v cs (G m/2 ) ≥ χum (G m/2 ), using propositions 7, 8, and 6.
5
Chromatic Numbers Lower Bounds for the Grid
It was shown in [1] that for the m × m grid graph Gm , χum (Gm ) ≤ 2.519m. The best known lower bound is χum (Gm ) ≥ 3m/2, also from [1]. We improve the lower bound as follows. Theorem 4. For m ≥ 2, χum (Gm ) ≥ 53 m − o(m). We do not include our proof here, because of space considerations, but we refer the interested reader to our preprint [5]. An immediate corollary (also using theorem 3) is the following. Corollary 2. For m ≥ 2, χcf (Gm ) ≥ 56 m − o(m).
6
Discussion and Open Problems
As we mentioned in the introduction, conflict-free and unique-maximum colorings can be defined for hypergraphs. In the literature of conflict-free colorings, hypergraphs that are induced by geometric shapes have been in the focus. It would be interesting to show possible relations of the respective chromatic numbers in this setting. An interesting open problem is to determine the exact value of the uniquemaximum chromatic number for the grid Gm . Although we improved the lower bound asymptotically to 5m/3, we believe that this bound is still far from optimal. Another area for improvement is the relation between the two chromatic numbers for general graphs. We have only found graphs which have unique-maximum chromatic number about twice the conflict-free chromatic number, but the only bound we have proved on χum (G) is exponential in χcf (G). Finally, the coNP-completeness of checking whether a coloring is conflictfree, implies that the decision problem for the conflict-free chromatic number is in complexity class Π2p (at the second level of the polynomial hierarchy). An interesting direction for research would be to attempt a proof of Π2p -completeness for this last decision problem.
154
P. Cheilaris and G. T´ oth
References 1. Bar-Noy, A., Cheilaris, P., Lampis, M., Mitsou, V., Zachos, S.: Ordered coloring of grids and related graphs. Submitted to a journal (2009) 2. Bar-Noy, A., Cheilaris, P., Smorodinsky, S.: Deterministic conflict-free coloring for intervals: from offline to online. ACM Transactions on Algorithms 4(4), 44:1–44:18 (2008) 3. Bodlaender, H.L., Deogun, J.S., Jansen, K., Kloks, T., Kratsch, D., M¨ uller, H., Tuza, Z.: Rankings of graphs. SIAM Journal on Discrete Mathematics 11(1), 168– 181 (1998) 4. Bodlaender, H.L., Gilbert, J.R., Hafsteinsson, H., Kloks, T.: Approximating treewidth, pathwidth, frontsize, and shortest elimination tree. Journal of Algorithms 18(2), 238–255 (1995) 5. Cheilaris, P., T´ oth, G.: Graph unique-maximum and conflict-free colorings. CoRR abs/0912.3004 (2009) 6. Chen, K., Fiat, A., Kaplan, H., Levy, M., Matouˇsek, J., Mossel, E., Pach, J., Sharir, M., Smorodinsky, S., Wagner, U., Welzl, E.: Online conflict-free coloring for intervals. SIAM Journal on Computing 36(5), 1342–1359 (2007) 7. Elbassioni, K., Mustafa, N.H.: Conflict-free colorings of rectangles ranges. In: Durand, B., Thomas, W. (eds.) STACS 2006. LNCS, vol. 3884, pp. 254–263. Springer, Heidelberg (2006) 8. Even, G., Lotker, Z., Ron, D., Smorodinsky, S.: Conflict-free colorings of simple geometric regions with applications to frequency assignment in cellular networks. SIAM Journal on Computing 33, 94–136 (2003) 9. Iyer, A.V., Ratliff, H.R., Vijayan, G.: Optimal node ranking of trees. Information Processing Letters 28, 225–229 (1988) 10. Katchalski, M., McCuaig, W., Seager, S.: Ordered colourings. Discrete Mathematics 142, 141–154 (1995) 11. Leiserson, C.E.: Area-efficient graph layouts (for VLSI). In: Proceedings of the 21st Annual IEEE Symposium on Foundations of Computer Science (FOCS), pp. 270–281 (1980) 12. Liu, J.W.: The role of elimination trees in sparse factorization. SIAM Journal on Matrix Analysis and Applications 11(1), 134–172 (1990) 13. Pach, J., T´ oth, G.: Conflict free colorings. In: Discrete and Computational Geometry, The Goodman-Pollack Festschrift, pp. 665–671. Springer, Heidelberg (2003) 14. Papadimitriou, C.: Computational Complexity. Addison-Wesley, Reading (1993) 15. Pothen, A.: The complexity of optimal elimination trees. Tech. Rep. CS-88-16, Department of Computer Science, Pennsylvania State University (1988)
Strategic Coloring of a Graph Bruno Escoffier1,2 , Laurent Gourv`es1,2, and J´erˆome Monnot1,2 1 CNRS, FRE 3234, F-75775 Paris, France Universit´e de Paris-Dauphine, LAMSADE, F-75775 Paris, France {bruno.escoffier,laurent.gourves,jerome.monnot}@dauphine.fr 2
Abstract. We study a strategic game where every node of a graph is owned by a player who has to choose a color. A player’s payoff is 0 if at least one neighbor selected the same color, otherwise it is the number of players who selected the same color. The social cost of a state is defined as the number of distinct colors that the players use. It is ideally equal to the chromatic number of the graph but it can substantially deviate because every player cares about his own payoff, whatever how bad the social cost is. Following a previous work done by Panagopoulou and Spirakis [1] on the Nash equilibria of the coloring game, we give worst case bounds on the social cost of stable states. Our main contribution is an improved (tight) bound for the worst case social cost of a Nash equilibrium, and the study of strong equilibria, their existence and how far they are from social optima.
1
Introduction
We study a vertex coloring game is defined as follows: given a simple graph G = (V, E), each vertex is a player who has to choose (deterministically) one color out of n = |V |. A player’s payoff is 0 if he selects the same color as one of his neighbors, otherwise it is the number of vertices with same color. Panagopoulou and Spirakis [1] introduced the game and studied its set of pure strategy Nash equilibria, denoted by P N E(G). Nash equilibria (NE in short) are sustainable and rational states of the game. Interestingly, P N E(G) is nonempty for every graph G and there exists a polynomial time procedure to compute an element of P N E(G) [1]. However Nash equilibria are known to deviate from a socially optimal state in many situations (e.g. the prisoner’s dilemma). The social cost associated with a graph G and a strategy profile σ, denoted by SC(G, σ), is defined as the number of distinct colors selected by the players. Panagopoulou and Spirakis give upper bounds on SC(G, σ) when σ ∈ P N E(G). These bounds depend on several parameters of the graph and often match known bounds on the chromatic number of G. We continue the work done by Panagopoulou and Spirakis [1] and give improved bounds on SC(G, σ) when σ ∈ P N E(G). We also study the set of pure strong equilibria of the vertex coloring game, denoted by P SE(G). A strong
This work is supported by French National Agency (ANR), project COCA ANR-09JCJC-0066-01.
T. Calamoneri and J. Diaz (Eds.): CIAC 2010, LNCS 6078, pp. 155–166, 2010. c Springer-Verlag Berlin Heidelberg 2010
156
B. Escoffier, L. Gourv`es, and J. Monnot
equilibrium (SE in short) [2] is a state where no unilateral deviation by a non empty coalition of players is profitable to all its members. This solution concept refines the pure strategy Nash equilibrium, and it is more sustainable. In this paper we mainly show that a strong equilibrium always exists but it is NP-hard to compute one. In addition we provide upper bounds on the social cost SC(G, σ) when σ ∈ P SE(G). 1.1
Previous Work and Contribution
The vertex coloring problem is a central optimization problem in graph theory (see for instance [3,4]) and several games defined upon it exist in the literature. Bodlaender [5] study a 2-player game where, given a graph, an ordering on the set of vertices, and a finite set of colors C, the players alternatively assign a color c ∈ C to the uncolored vertex that comes first in the ordering, and such that two neighbors have distinct colors. Bodlaender considers several variants of the game (e.g. a player looses if he cannot move) and focuses on the existence of a winning strategy. In [6] Chaudhuri, Chung and Jamall study a coloring game defined by a set of available colors and a graph G = (V, E) where each node represents a player. The game is played in rounds; each round, the players choose a color simultaneously. A player’s payoff is 0 if one of his neighbors uses the same color, and 1 otherwise. The main result in [6] is that for a coloring game played on a network on n vertices with maximum degree Δ, if the number of colors available to each vertex is Δ+ 2 or more, and if each player plays a simple greedy strategy, then the coloring game converges in O(log n) steps with high probability. The game adressed by Chaudhuri, Chung and Jamall was initiated by Kearns, Suri and Montfort [7] who performed an experimental study. A possible motivation of the game is a scenario where faculty members wish to schedule classes in a limited number of classrooms, and must avoid conflicts with other faculty members [7]. The coloring game studied by Panagopoulou and Spirakis [1] and the game introduced by Kearns et al [7,6] mainly differ in the definition of a player’s payoff. In [1] a player gets 0 if one of his neighbors selects the same color, otherwise his payoff is the number of players using the same color. The other difference is that n colors are available to each node. This paper is mainly dedicated to this model (an edge coloring game is also investigated). The motivation given in [1] is the analysis of a local search algorithm for the vertex coloring problem with provably good worst case distance of local optima to global optima. Interestingly they choose to illustrate their results via a game-theoretic analysis where local optima correspond to the Nash equilibria of the coloring game. Nevertheless the coloring game has applications in selfish routing in particular networks [8,9,10,11] where every player has to choose a facility (i.e. a wavelength, a time-slot, etc) that is not used by another player with which he is incompatible. Then most results in [1] are seen as bounds on the loss of efficiency in stable states of a strategic game, and it is the topic of many papers since the seminal papers [12] and [13].
Strategic Coloring of a Graph
157
Panagopoulou and Spirakis [1] prove that every NE of the vertex coloring game is a feasible, and locally optimum, vertex coloring of G. It is noteworthy that a feasible coloring (in particular a social optimum) is not necessarily a NE. However at least one social optimum of the vertex coloring game is a NE. As we will see later, this property does not hold for strong equilibria. It is also shown in [1] that a Nash equilibrium σ of the vertex coloring game on a graph G = (V, E) satisfies: n + ω(G) 1 + SC(G, σ) ≤ min{Δ2 (G) + 1, , 2
√ 1 + 8m , n − α(G) + 1} 2
(1)
where n = |V |, ω(G) is the clique number of G (maximum size of a clique), m = |E|, α(G) is the stability number of G (maximum size of a stable set), NG (v) is the neighborhood of a vertex v (its set of adjacent vertices in G), dG (v) is the degree of v in G, Δ(G) is the maximum degree and Δ2 (G) = maxv∈V max{dG (u) : u ∈ NG (v) and dG (u) ≤ dG (v)}. We separate the bounds given in (1) into three groups according to the dominant parameter: (a) Δ2 (G), (b) n and (c) m. Hence, we obtain (a) SC(G, σ) ≤ , n − α(G) + 1} and (c) SC(G, σ) ≤ Δ2 (G) + 1, (b) SC(G, σ) ≤ min{ n+ω(G) 2 √ 1+ 1+8m . It is not difficult to prove that the bounds given in (a) and (b) are 2 tight for every value of Δ2 (G) ≥ 2, ω(G) ≥ 2 or α(G) ≥ 2. Since a NE must be a social optimum if the following (independent) cases: Δ2 (G) = 1, ω(G) ≤ 1 and α(G) = 1, we will always assume χ(G) ≥ 2 (the case χ(G) = 1 corresponds to ω(G) = 0). However the bound (c) is not sharp as we will see in Theorem 2. In this article, we first deal with NE in Section 3. We propose a graph characterization of NE and, based on this characterization, we propose tight bounds depending on m and χ(G) for the number of colors used in a NE, improving the one of [1]. Then, we show that the situation greatly improves in trees, since in this case the number of colors in a NE is only logarithmic. In Section 4, we study SE in the same spirit: we propose a graph characterization and show almost tight bounds on the number of colors used in a SE. This allows us to derive that the strong price of anarchy, the worst case value of SC(G, σ)/χ(G) for σ ∈ P SE(G), is logarithmic. We conclude this article in Section 5 by some additional results dealing with k-strong equilibria (strong equilibria for coalition of size a most k) for the vertex coloring game, new payoff functions that can alleviate the social cost and an edge coloring game (the same game up to the fact that we want to color the edges of the input graph). Due to space limitations, some proofs are omitted.
2
Notations and Definitions
Graph Theory. We use standard notations in graph theory. A stable set is a subset of pairwise non adjacent vertices. A stable set S is maximal if, for every vertex x ∈ V \ S, S ∪ {x} is not a stable set. The stability number α(G) is the
158
B. Escoffier, L. Gourv`es, and J. Monnot
maximum size of a stable set. A coloring is a partition of V into stable sets S = (S1 , . . . , Sq ). The chromatic number χ(G) is the minimum size of a coloring. It is well known (see for instance [14]) that χ(G) ≥ ω(G) and χ(G)α(G) ≥ n
(2)
Strategic games. A strategic game Γ is a tuple N, (Σi )i∈N , (ui )i∈N where N is the set of players and Σi is the strategy set of player i. Each player i has to choose a strategy in Σi . Then ×i∈N Σi is the set of all possible pure states (or strategy profiles) of the game. We only study pure strategy states, so we often omit the word ”pure”. ui : ×i∈N Σi → R is the utility function of player i (the higher the better). σi denotes the strategy of player i in the strategy profile σ ∈ ×i∈N Σi . For a subset of players N ⊂ N , σN (resp., σ−N ) refers to σ, restricted to (resp., without) the strategies of N . Hence, given two states σ and σ, σ = (σ−N , σN ) denotes the state where σi = σi if i ∈ N \ N and σi = σi if i ∈ N . We often use the following abusive notations: σi and σ−i instead of σ{i} and σ−{i} respectively. Finally σ = (σ−i , j) denotes the state where σi = j and σi = σi for every i = i. A state σ is a pure Nash equilibrium (NE in short) if for any i ∈ N and any strategy j ∈ Σi , ui (σ−i , j) ≤ ui (σ). Hence no player has an incentive to deviate unilaterally from a NE. A strategy profile σ is a strong equilibrium if for every non empty subset of players S and every assignment σ , at least one player i ∈ S satisfies ui (σ−S , σS ) ≤ ui (σ). In other words, any joint deviation by a coalition can not be profitable to all its members. A k-strong equilibrium is defined similarly for coalitions involving at most k players. In particular, Nash equilibria and strong equilibria are respectively 1-strong and |N |-strong equilibria. The social cost of a strategy profile σ for the game Γ is a real number which characterizes how costly to the whole set of players σ is. It is denoted by SC(Γ, σ) (we will sometimes omit Γ if not necessary). Hence the social cost is minimized for some states called social optima. The price of anarchy (PoA) [12] for pure Nash equilibria is defined as the worst case value of maxσ∈P N E(Γ ) SC(Γ, σ)/SC(Γ, σ ∗ ), over all instances of the game, where P N E(Γ ) is the set of all pure NE of Γ and σ ∗ is a social optimum. The PoA captures the lack of coordination between independent players. The strong price of anarchy (SPoA) [15] is defined similarly, just replace P N E(Γ ) by P SE(Γ ) (the set of all pure strategy strong equilibria of Γ ) in the previous definition. The vertex coloring game. The vertex coloring game is a strategic game where N = V and Σi = {1, · · · , n} for all i. The utility of player i in σ is ui (σ) = |{i ∈ V : σi = σi }| if the set {i ∈ N (i) : σi = σi } = ∅ and ui (σ) = 0 otherwise. To any state σ corresponds a coloring S(σ) defined as (S1 (σ), . . . , Sq (σ)), where Sj (σ) = {i ∈ V : σi = j}. Let P N E(G) (resp., P SE(G)) be the set of all pure Nash equilibria (resp., pure strong Nash equilibria) of the vertex coloring game for a simple graph G. It is known that P N E(G) = ∅ but, up to our knowledge, nothing is known about the existence of a strong equilibrium.
Strategic Coloring of a Graph
159
Given a simple graph G = (V, E), a social optimum of the vertex coloring game is an optimal coloring. Hence, the optimal social cost is the chromatic number χ(G). We always assume that |S1 (σ)| ≥ · · · ≥ |Sq (σ)| and for any j = 1, . . . , q, fσ (j) denotes a player with strategy j in σ (if one exists). Then by definition we have: Property 1. For any NE σ of a simple graph G, the following (in)equalities hold: (i) For any j = 1, . . . , q, for any i ∈ Sj (σ), ui (σ) = |Sj (σ)|. We deduce that ufσ (1) (σ) ≥ · · · ≥ ufσ (q) (σ). (ii) For any j, j ∈ {1, . . . , q}, for any i ∈ Sj (σ), i ∈ Sj (σ), j ≤ j implies that ui (σ)≥ ui (σ). q (iii) n = j=1 ufσ (j) (σ).
3
Nash Equilibria
We propose a graph-characterization of the Nash equilibria of the vertex coloring game which will be useful in the following. Given a coloring S = (S1 , . . . , Sq ) where |S1 | ≥ · · · ≥ |Sq |, the mapping g (depending on S) from {1, . . . , q} to {1, . . . , q} is defined as g(j) = min{i : |Si | = |Sj |}. For instance, we get g(1) = 1 and if the stable sets of S have distinct sizes, then g(j) = j. Theorem 1. Let G = (V, E) be a simple graph. The state σ is a NE of G for the vertex coloring game iff for every i = 1, . . . , q the stable set Si (σ) is maximal in Gg(i) where Gt is defined as the subgraph of G induced by St (σ) ∪ · · · ∪ Sq (σ). Proof. Consider a simple graph G = (V, E), instance of the vertex coloring game. Let σ be a NE with corresponding coloring S(σ) = (S1 (σ), . . . , Sq (σ)). Let i ∈ {1, . . . , q} and consider a player j ∈ Sk for some k ≥ g(i), k = i. Since |Si (σ)| = |Sg(i) (σ)| ≥ |Sk (σ)|, the fact that player j does not want to deviate to set Si (σ) implies that j is adjacent to some vertex in Si (σ). Then we deduce that Si (σ) is a stable set maximal in Gg(i) . Conversely, let S = (S1 , . . . , Sq ) be a coloring of G with |S1 | ≥ · · · ≥ |Sq | and such that Si is a stable set maximal in Gg(i) . Consider the state σ where player j ∈ Si plays strategy σj = i (thus, Si (σ) = Si ) and assume by contradiction that σ is not a NE. This means that there is a player j ∈ Si who can unilaterally replace his strategy by k such that uj (σ−j , k) > uj (σ). Hence, we deduce that Sk ∪ {j} is a stable set of G and |Sk | ≥ |Si |. We obtain a contradiction, since on the one hand g(k) ≤ k ≤ i and on the other hand Sk (σ) is supposed to be a stable set maximal in Gg(k) .
Using Theorem 1, we can improve the bound of the PoA given in [1] according to the parameter m (see inequalities (1) and (c)). Theorem 2. For simple graphs G on m edges with chromatic number χ(G) ≥ 2, the social cost of a NE σ verifies: SC(G, σ) ≤
χ(G) + 1 + m − (χ(G) + 1)(χ(G) − 1)/4 2
(3)
160
B. Escoffier, L. Gourv`es, and J. Monnot
This bound is tight for any χ(G) ≥ 2 and arbitrarily large m. Proof. Consider a simple graph G = (V, E) on m edges and with chromatic number χ(G) ≥ 2, instance of the vertex coloring game. Let σ be a NE with corresponding coloring S(σ) = (S1 (σ), . . . , Sq (σ)) and social cost SC(G, σ) = q. We suppose that q ≥ χ(G) + 1 since otherwise P oA = 1. Assume r = |S1 (σ)| ≥ · · · ≥ |Sq (σ)|. For i = 1, . . . , r, let Gi be the subgraph of G induced by the stable sets of S(σ) of size i (Gi can be empty for some i) and let pi be the number of the stable sets of S(σ) of size i. Using Theorem 1, the number of edges of G is at least: ⎛ ⎞ r r i ipi (pi − 1) + ipi ⎝q − pj ⎠ m≥ (4) 2 i=1 i=1 j=1 Actually, since the pi stable sets of size i of S(σ) are also maximal in Gi (using Gi ⊆ Gg(j) where |Sj (σ)| = i and Theorem 1), there are at least ipi (pi − 1)/2 edges in Gi (for any v ∈ V (Gi ), dGi (v) ≥ pi − 1). Moreover, each stable set Sj (σ) of S(σ) of size i is maximal in Gg(j) , leading to the conclusion that there i are at least i(q − j=1 pj ) edges between the vertices of Sj (σ) and the graph Gi+1 ∪ · · · ∪ Gr . Now, let p2 = ri=2 pi ; one can see that the left part of inequality (4) is greater than p2 (p2 − 1) + p1 (p21 −1) + p1 (q − p1 ). In fact, for every i ∈ {1, . . . , r − 1} one can check that we (i + 1)p have:
i+1 (pi+1 − 1)/2 + (i + i+1
i 1)pi+1 q − j=1 pj +ipi (pi −1)/2+ipi q − j=1 pj ≥ i(pi +pi+1 )(pi +pi+1 −
1)/2 + i(pi + pi+1 ) q − i+1 j=1 pj . Thus, the inequality follows by induction. Finally, observe that we get: p1 + p2 = q by construction and p1 ≤ ω(G) ≤ χ(G) ≤ q − 1 since G1 is a clique from Theorem 1 (thus, p1 = ω(G1 ) ≤ ω(G), q ≥ χ(G) + 1 by hypothesis and χ(G) ≥ ω(G) from inequality (2)). Hence, we deduce: p2
m ≥ p2 (p2 − 1) + p1 (p21 −1) + p1 (q − p1 ) = (p1 + p2 )2 + 21 − p1 (q − 12 ) − q 2 p2 = q 2 + 21 − p1 (q − 12 ) − q ≥ q 2 − q + χ(G) − χ(G)(q − 12 ) 2
2 ) + (χ(G)+1)(χ(G)−1) = q − ( χ(G)+1 2 4 2
In fact, the mapping z(x) = q 2 + x2 − x(q − 12 ) − q (see second line in the above inequalities with x = p1 ) is decreasing for x ≤ q − 1/2. Since, p1 ≤ χ(G) ≤ q − 1 ≤ q − 1/2, we deduce z(p1 ) ≥ z(χ(G)). Hence, we obtain SC(G, σ) ≤ χ(G)+1 + m − (χ(G) + 1)(χ(G) − 1)/4 and 2 the inequality (3) follows. Tight examples exist but they are not given due to the limitation of pages.
For instance, for connected bipartite graphs with m ≥ 1 edges we obtain SC(G, σ) ≤
3 2
+
m−
3 4
which is an improvement on the bound given in [1].
Strategic Coloring of a Graph
161
Theorem 2 states that the bound of 32 + m − 34 is tight in bipartite graphs (the lower bound is obtained with a bipartite graph). To conclude this section, we tackle the problem when thegraph G is a tree and show that the social cost drops significantly: from 3/2 + m − 3/4 in bipartite graphs to log(n) + 1. This bound being tight, we obtain as a conclusion that the PoA in trees is log(n)+1 . 2 Theorem 3. In trees, the social cost of a NE is at most log(n) + 1. This bound is tight for arbitrarily large n.
4
Strong Equilibria
First of all, note that when studying strong equilibria, we can restrict ourselves to coalitions where all the players of the coalition choose the same color (in their new strategy) since any coalition S for this game can be decomposed into several coalitions Si which group the players that switch to the same color. Moreover, the coalition S is improving (i.e., the utility of each member of the coalition increases) iff each coalition Si is improving. As a consequence, we only need to consider coalitions of size at most α(G). For SE, we can state a graph-characterization similar to Theorem 1, by replacing “maximal stable set” by “maximum stable set”. Actually, we do not need the mapping g anymore. Theorem 4. Let G = (V, E) be a simple graph. The state σ is a SE of G for the vertex coloring game iff for every i = 1, . . . , q, for every j ∈ Si (σ), we get uj (σ) = α(Gi ) where Gi is the subgraph of G induced by Si (σ) ∪ · · · ∪ Sq (σ). In particular, Theorem 4 gives a proof of the existence of SE and a procedure to find it. On the other hand, it also shows that finding a SE within polynomial time is impossible unless P=NP. Corollary 1. Finding a SE of the vertex coloring game is NP-hard. Note that we will tackle in Section 5.1 the case of k-strong equilibra, i.e. strong equilibria restricted to coalitions of size at most k. We will show in particular that for k = 2, 3, finding such an equilibrium is polynomial, while the problem is left open for k ≥ 4. When the chromatic number is one, that is when G contains no edge, the PoA (and then the SPoA) of the vertex coloring game is 1. Thus, we focus on graphs G with χ(G) ≥ 2. In [1] it is shown that at least one optimal coloring is a NE. For the strong equilibrium, it is not the case. Proposition 1. For every k ≥ 2, there are some graphs with chromatic number k where no optimal coloring is a SE. Proof. For any k ≥ 2, consider the following split graph Gk = (Kk , S2k ; Ek ) on 3k vertices where Kk = {x1 , . . . , xk } is a clique of size k and S2k = {y1 , z1 , . . . , yk , zk } is a stable set of size 2k. Moreover, each vertex xi ∈ Kk is linked to 2 vertices yi , zi ∈ S2k . See Figure 1 for an example of graphs G2 and G3 .
162
B. Escoffier, L. Gourv`es, and J. Monnot
S4
S6
K2
K3 G2
G3
Fig. 1. Graphs G2 and G3
Clearly, S2k is the only maximum stable set of Gk . Indeed, a stable set of Gk has at most one vertex of Kk since Kk is a clique and if a stable set has one such a vertex, then it has at most 2k − 2 vertices of S2k . Thus, using Theorem 4, the strategy profile σ defined by σi = 1 if vi ∈ S2k and σxj = 1 + j for j = 1, . . . , k, is the only SE using k + 1 colors. On the other hand, χ(Gk ) = k since χ(Gk ) ≥ ω(Gk ) = |Kk | = k and a coloring using k colors is given for instance by S ∗ = ((S2k \ {y1 , z1 }) ∪ {x1 }, {y1 , z1 } ∪ {x2 }, {x3 } . . . , {xk }).
Now, we study the SPoA of the vertex coloring game according to param(G)+1 eters Δ2 (G), n or m. From inequality (1), we deduce that P oA ≤ Δ2χ(G) for
graphs with chromatic number χ(G) and P oA ≤ Δ2 (G)+1 for general (non triv2 ial) graphs. Actually, as a corollary of Proposition 2 (see below), we deduce that this bound is tight for χ(G) = 2 and for any value Δ2 (G) ≥ 2. More precisely, we prove that according to the parameter Δ2 (G), the SPoA and the PoA of the vertex coloring game are equal. Proposition 2. The social cost of a SE of the vertex coloring game is at most Δ2 (G) + 1 for simple bipartite graphs G on n vertices. This bound is tight even if we consider the class of trees and arbitrarily large values of Δ2 (G). However, note that Proposition 2 does not imply that in trees every NE are SE. For instance in the P2k+1 (the induced path on n = 2k + 1 vertices), from Theorem 4 it is easy to prove that there is only one SE corresponding to the optimal coloring (i.e., SP oA(P2k+1 ) = 1 for any k ≥ 1). On the other hand, in the P6k+1 on vertex set {1, . . . , 6k + 1} for every k ≥ 1, the state σ defined by σ3i+1 = 1 for i = 0, . . . , 2k, σ3i+2 = 2 and σ3i+3 = 3 for i = 0, . . . , 2k − 1, is a NE using 3 colors (and then, it is not a SE). Now, we analyze the SPoA of the vertex coloring game according to the parameter n (the number of vertices). In [1], it is indicated that unless NP⊆coRP, the PoA of the vertex coloring game is at least n1−ε for simple graphs on n vertices and for every ε ∈ (0; 1). Here, we prove that the SPoA of the vertex coloring game is much better. In trees, we already know that the SPoA is exactly (1 + log(n))/2. We prove in the following that this bound of O(log n) is in fact also an upper bound for the SPoA of the vertex coloring game in general graphs.
Strategic Coloring of a Graph
163
Theorem 5. The social
cost of a SE in the vertex coloring game is at most χ(G) n χ(G)− 1 + loga χ(G)−1 where a = χ(G)−1 for any simple graph G on n vertices with chromatic number χ(G) ≥ 2. Consequently, considering graphs of n vertices, the SPoA is at most ln(n) + o(ln(n)). Since in a simple graphs on n vertices there are m ≤ n(n− 1)/2 edges, we deduce from Theorem 5 that the SPoA is at most 2 ln(m) + o(ln(m)). From the lower bound in trees, we also get that in (connected) graphs on m edges the SPoA is at least log(m)/2 + o(log(m)). Using Theorem 5 and the lower bound in trees, we deduce that the SPoA of the vertex coloring game equals 12 log n + 12 in bipartite graphs on n vertices. It is a notable improvement relatively to the PoA since it is noticed in [1] that the PoA at least n4 + 12 for bipartite graphs. Dealing with the bound of Theorem 5 depending on both χ(G) and n, we can produce a lower bound which is not tight but closed to being so. Proposition 3. For any χ(G) ≥ 2, there are some simple graphs G on n vertices admitting a SE with social cost at least 1 + (χ(G) − 1) logχ n.
5 5.1
Final Results and Concluding Remarks k-Strong Equilibria
In Sections 3 and 4, we provided a characterization of NE and SE respectively. A natural question is to provide such a characterization for k-Strong equilibria, a solution concept which is in between NE and SE. We answer this question by giving a slightly more complex characterization. Given a coloring S = (S1 , · · · , Sq ) (sorted in non increasing size order), let us ˜ i,j as the subgraph of define for any j = 1, · · · , q and for any i ≤ j the graph G G induced by Si ∪ Si+1 ∪ . . . ∪ Sj . Let us also remind that Gj is the subgraph of G induced by Sj (σ) ∪ · · · ∪ Sq (σ) and g(j) is the smallest index i such that |Si | = |Sj |. Theorem 6. Let G = (V, E) be a simple graph. The state σ corresponding to a coloring S = (S1 , · · · , Sq ) is a k-SE of G for the vertex coloring game iff for every j = 1, . . . , q we have the following conditions: – For any i < j such that |Si | ≤ |Sj | + k − 1, the size of a maximum stable set ˜ i,j is at most |Si |; containing Sj in G – If |Sj | < k then Sj is a maximum stable set in Gj ; – If |Sj | ≥ k then Sj is a maximal stable set in Gg(j) . Note that all the items given in the characterization can be tested in polynomial time provided that k is a fixed constant.
164
B. Escoffier, L. Gourv`es, and J. Monnot
Now, we prove that starting from a feasible coloring, computing a 3-strong equilibrium can be done in O(n3 ) steps, each step corresponding to an improvement for a coalition of at most 3 players. So, computing a k-strong equilibrium for k = 1, 2, 3 can be done in polynomial time. For k = 1, the result was already known from [1] since the authors proved that a NE (i.e., a 1-strong equilibrium) can be found in O(nα(G)) steps. Actually, we believe that the result holds for any constant k ≥ 1, but we are not able to prove this. Proposition 4. A 3-strong equilibrium of the vertex coloring game can be computed in polynomial time. Proposition 4 is proved via a potential function argument, i.e. one can assign a real positive value to every state that is O(n3 ). Interestingly enough, it can be shown that a similar approach would not work for coalitions of size at most k, where k ≥ 4. Indeed, in this case the weight associated to an independent set of size i has to be exponential in i. 5.2
Alleviating the Social Cost with a New Utility Function
In the model of Kearns et al [7,6] a player’s payoff is 0 if one of his neighbors uses the same color and 1 otherwise. Then a player is satisfied if he is in an independent set, whatever how large the set is. With social cost considerations in mind (and supposing that an unbounded number of colors is available), this payoff function would be very expensive (n actually). In the model of Panagopoulou and Spirakis [1], the players are incentivized to be in a large independent set because their payoff grows with the size of their set. As we have seen this payoff function ensures better bounds on the social cost (compared to previous the model). An interesting question would be to provide a different utility function in order to improve the global efficiency of the system1 . Trying to overcome the limits of the adopted utility function, we propose the following one. Instead of considering the size of a stable set, we consider the number of edges incident to a stable set. Formally, given a simple graph G = (V, E) and a strategy profile σ, the utility of player i in σ now becomes ui (σ) = vj :σj =σi d(vj ) if {vj : σj = σi } is a stable set and 0 otherwise. It is easy to see that the characterization of a SE is the same for this new utility function: instead of considering maximum stable set, we just have to consider maximum weight stable set, where the weight of a stable set is the sum of the degree of the vertices it contains. More precisely, a state σ corresponding to a coloring S(σ) = (S1 (σ), · · · , Sq (σ)) (the sets being in non decreasing weight order) is a SE iff for any i Si (σ) is a maximum weight stable set in Gi . Using this utility function, we get a simple but nice result for bipartite graphs. Proposition 5. Using the above utility function, any SE is an optimum coloring in bipartite graphs. 1
We exclude the following solution which requires to solve an NP-hard problem: compute an optimal coloring, give 1 to the players who follow this optimum and give 0 to the others.
Strategic Coloring of a Graph
165
This is a nice improvement compared to the bound of θ(log(n)) for the initial utility function. Unfortunately, this does not generalize as soon as χ(G) ≥ 3. Proposition 6. Using the above utility function, the SPoA is at least (log(n/3) +1)/3 in 3-colorable graphs. In our opinion, finding a utility function that alleviates the social cost is an interesting question that deserves further research. 5.3
An Edge Coloring Game
The edge coloring problem on a simple graph G = (V, E) can be viewed as the vertex coloring problem on L(G) where L(G) is the line graph of G (each edge ei ∈ E becomes a vertex xi of L(G) and there is an edge [xi , xj ] in L(G) if ei and ej are adjacent in G). Here, for simplicity, we refer to the edge model. Thus, an edge coloring M = (M1 , . . . , Mq ) of a simple graph G = (V, E) is a partition of E into matchings Mi . The minimum number of matchings partitioning the edges of G is called chromatic index of G and is denoted by χi (G). It is well known that the chromatic index of any simple graph G of maximum degree Δ(G) verifies: Δ(G) ≤ χi (G) ≤ Δ(G) + 1
(5)
Hence, the edge coloring game is the vertex coloring game on line graphs. In particular, Theorems 1 and 4 are valid when we replace vertex coloring S(σ) = (S1 (σ), . . . , Sq (σ)) by edge coloring M(σ) = (M1 (σ), . . . , Mq (σ)). Also, Gi becomes the partial subgraph of G induced by Mi (σ) ∪ · · · ∪ Mq (σ). However, now computing a SE of the edge coloring game is polynomial (using the characterization of Theorem 4) since it consists of finding inductively a maximum matching of the current graph which is polynomial [14]. Finally, we always assume that Δ(G) ≥ 2 since otherwise SC(G, σ) = χi (G) for every NE σ of the edge coloring game for graphs G with Δ(G) = 1. 1 Theorem 7. The PoA and the SPoA of the edge coloring game are 2− Δ(G) for simple bipartite graphs G. Moreover, these results hold even if we consider the class of trees with arbitrarily large values of Δ(G).
On the other hand, if we restrict ourselves to regular bipartite graphs, any SE is a social optimum for the edge coloring game. Proposition 7. A SE for the edge coloring game is a social optimum for simple regular bipartite graphs G. 1 Theorem 8. The SPoA of the edge coloring game is at most 1 − Δ(G)+1 +
Δ(G)+1 1 m where a = Δ(G) for simple graphs G on m edges and of Δ(G) loga Δ(G)−1
maximum degree Δ(G) ≥ 2.
166
B. Escoffier, L. Gourv`es, and J. Monnot
References 1. Panagopoulou, P.N., Spirakis, P.G.: A game theoretic approach for efficient graph coloring. In: Hong, S.-H., Nagamochi, H., Fukunaga, T. (eds.) ISAAC 2008. LNCS, vol. 5369, pp. 183–195. Springer, Heidelberg (2008) 2. Aumann, R.J.: Acceptable points in games of perfect information. Pacific Journal of Mathematics 10, 381–417 (1960) 3. Krarup, J., de Werra, D.: Chromatic optimisation: Limitations, objectives, uses, references (invited review). European Journal of Operational Research 11, 1–19 (1982) 4. de Werra, D., Gay, Y.: Chromatic scheduling and frequency assignment. Discrete Applied Mathematics 49, 165–174 (1994) 5. Bodlaender, H.L.: On the complexity of some coloring games. International Journal of Foundations of Computer Science 2, 133–147 (1991) 6. Chaudhuri, K., Chung, F., Jamall, M.S.: A network coloring game. In: Papadimitriou, C., Zhang, S. (eds.) WINE 2008. LNCS, vol. 5385, pp. 522–530. Springer, Heidelberg (2008) 7. Kearns, M., Suri, S., Montfort, N.: An experimental study of the coloring problem on human subject networks. Science 313, 824–827 (2006) 8. Crescenzi, P., Deng, X., Papadimitriou, C.H.: On approximating a scheduling problem. Journal of Combinatorial Optimization 5(3), 287–297 (2001) 9. Afrati, F.N., Aslanidis, T., Bampis, E., Milis, I.: Scheduling in switching networks with set-up delays. Journal of Combinatorial Optimization 9, 49–57 (2005) 10. Erlebach, T., Jansen, K.: Maximizing the number of connections in optical tree networks. In: Chwa, K.-Y., Ibarra, O.H. (eds.) ISAAC 1998. LNCS, vol. 1533, pp. 179–188. Springer, Heidelberg (1998) 11. Bampas, E., Pagourtzis, A., Pierrakos, G., Syrgkanis, V.: Colored resource allocation games. In: Proc. of the 8th Cologne-Twente Workshop on Graphs and Combinatorial Optimization, pp. 68–72 (2009) 12. Koutsoupias, E., Papadimitriou, C.: Worst case equilibria. In: Meinel, C., Tison, S. (eds.) STACS 1999. LNCS, vol. 1563, pp. 404–413. Springer, Heidelberg (1999) ´ How bad is selfish routing? J. ACM 49, 236–259 13. Roughgarden, T., Tardos, E.: (2002) 14. Berge, C.: Graphs and hypergraphs. North Holland, Amsterdam (1973) 15. Andelman, N., Feldman, M., Mansour, Y.: Strong price of anarchy. Games and Economic Behavior 65, 289–317 (2009)
Multicut Algorithms via Tree Decompositions Reinhard Pichler, Stefan R¨ ummele, and Stefan Woltran Vienna University of Technology
Abstract. Various forms of multicut problems are of great importance in the area of network design. In general, these problems are intractable. However, several parameters have been identified which lead to fixedparameter tractability (FPT). Recently, Gottlob and Lee have proposed the treewidth of the structure representing the graph and the set of pairs of terminal vertices as one such parameter. In this work, we show how this theoretical FPT result can be turned into efficient algorithms for optimization, counting, and enumeration problems in this area.
1
Introduction
Multicut problems [1] are of great importance in the area of network design – with applications to telecommunications, routing, VLSI design and transportation. An instance of a multicut problem is given by an undirected graph G = (V, E) and a set H of pairs of terminal vertices. A solution of the Edge Multicut (EMC) problem is a set of edges whose removal disconnects each terminal pair. In case of the Restricted (resp. Unrestricted) Vertex Multicut problem, the solutions are sets of non-terminal vertices (resp. of arbitrary vertices) whose removal disconnects each terminal pair. Each notion of solutions naturally gives rise to an optimization problem (“find the cardinality of a minimal solution”). Equipping, in addition, edges (resp. vertices) with some positive integer naturally leads to weighted versions of this optimization problem (“find the total weight of a minimal solution”). All these variants of multicut problems are intractable (the corresponding decision problems whether a solution with a given cardinality resp. total weight exists are NP-complete [2,3]), even for graphs of bounded treewidth [2,4]. For planar graphs with outer terminals and fixed cardinality |H|, EMC is solvable in polynomial-time [5]. An important approach in dealing with intractable problems is to search for fixed-parameter tractability (FPT), see e.g. [6]. Thereby one tries to confine the combinatorial explosion to certain problem parameters. More formally, we speak of FPT w.r.t. a parameter k, if a problem is solvable in time f (k) · nO(1) , where n denotes the size of the input instance. The function f is usually exponential but only depends on k. In case of multicut problems, various such parameters have been studied like solution size [7,8], cardinality |H| plus solution size [9,10], |H| plus the treewidth of the graph G [11,12], or the treewidth of the structure representing both G and H [13]. The result in [13] was proved by showing
Supported by the Austrian Science Fund (FWF), project P20704-N18, and the Vienna Science and Technology Fund (WWTF), project ICT08-028.
T. Calamoneri and J. Diaz (Eds.): CIAC 2010, LNCS 6078, pp. 167–179, 2010. c Springer-Verlag Berlin Heidelberg 2010
168
R. Pichler, S. R¨ ummele, and S. Woltran
that the solutions to any of the above multicut problems can be described by a monadic second-order (MSO) formula over the structure representing G and H. The FPT follows by an extension of Courcelle’s Theorem [14] proved in [15]: optimization problems expressible by an MSO formula over the input structures are fixed-parameter tractable w.r.t. the treewidth of these structures. The proof of this result in [15] is constructive – yielding algorithms whose running time is non-elementary in terms of the number of quantifier alternations of the MSO formula. For the MSO formula in [13], we would thus end up with time and space requirements which are at least double exponential in the treewidth. The goal of our paper is to construct more efficient algorithms in case of bounded treewidth of the structure representing G and H. Our main results are as follows (Due to space constraints, we omit proofs in this paper; full proofs are given in [16]): • Optimization Problem. We present a new dynamic-programming based algorithm for computing the optimal value of the Edge Multicut problem which works by partitioning the vertices into disconnected parts. The resulting algo∗ ∗ rithm runs in time O(22w log w · (G, H)), where w∗ denotes the treewidth of the input structure and (G, H) denotes its size. Therefore this algorithm is in fixed-parameter linear time and single exponential in terms of the treewidth. • Counting and Enumeration. We come up with a refinement of the optimization algorithm in order to count the number of optimal solutions and also to enumerate all optimal solutions. Determining the number of optimal solutions ∗ 2 ∗ ∗ is possible in time O(22((w ) +w log w ) · (G, H)). Moreover, the enumeration of all optimal solutions is feasible with a delay (i.e., the time needed to compute the first respectively the next solution) that also fits into this bound.
2
Preliminaries
We briefly recall some basic definitions on treewidth and multicut problems. Tree Decomposition and Treewidth. A tree decomposition of a graph G = (V, E) is a pair (T, χ), where T is a tree and χ maps each node n of T (we use n ∈ T as a shorthand below) to a bag χ(n) ⊆ V with the following properties: (1) for each v ∈ V , there is an n ∈ T , s.t. v ∈ χ(n); (2) for each {v, w} ∈ E, there is an n ∈ T , s.t. v, w ∈ χ(n); (3) for each n1 , n2 , n3 ∈ T , s.t. n2 lies on the path from n1 to n3 , χ(n1 ) ∩ χ(n3 ) ⊆ χ(n2 ) holds. A rooted tree decomposition (T, χ) is called normalized (or nice) [17], if (1) each n ∈ T has at most two children; (2) for each n ∈ T with two children n1 , n2 , χ(n) = χ(n1 ) = χ(n2 ); and (3) for each n ∈ T with one child n , χ(n) and χ(n ) differ in exactly one element; in other words the symmetric set-difference of χ(n) and χ(n ) is a singleton {v} with v ∈ V . The width of a tree decomposition is defined as the cardinality of its largest bag minus one. The treewidth of a graph G, denoted as tw (G), is the minimum width over all tree decompositions of G. For arbitrary but fixed w ≥ 1, it is feasible in linear time (with huge constants though) to decide if a graph has treewidth ≤ w and, if so, to compute a tree decomposition of width w [18]. Moreover, there exist
Multicut Algorithms via Tree Decompositions
Gex :
Tex :
a
n8 c, e, f n7 c, f
b c
169
n6 b, c, f d
n5 b, c
e
n3 b, c
n4 b, c
f
n1 b, c, d
n2 a, b, c
Fig. 1. Example graph Gex and normalized tree decomposition Tex of Gex
sophisticated heuristics to efficiently construct tree decompositions of small width [19,20]. W.l.o.g., we may assume that every tree decomposition is normalized, since this normalization can be obtained in linear time without increasing the width [17]. We thus distinguish between four types of nodes: (vertex) introduction (I), (vertex) removal (R), branch (B), and leaf (L) nodes. The first two types will usually be augmented with the vertex v which is removed or added compared to the bag of the child node, i.e., (vR) and (vI). Example 1. Figure 1 shows an example graph Gex together with a normalized tree decomposition Tex of width 2. Note that the treewidth of Gex is indeed 2, since only trees (or forests) have treewidth = 1. Examples for node types are n1 as (L) node, n3 as (dR) node, n5 as (B) node, and n6 , as (f I) node. Multicut Problems. Since we are dealing with undirected graphs G = (V, E), we consider terminal pairs h ∈ H as sets h ⊆ V of cardinality two. In [13], the treewidth w∗ of a structure representing both the graph G and the set H of pairs of terminals was introduced as a parameter of the multicut problems. Alternatively, w∗ can also be defined as w∗ = tw(G ) with G = (V, E ∪ H). In this paper, we focus on the edge multicut problem (EMC) without weights. Given an instance (G, H) of the EMC problem with G = (V, E), we define a cut for (G, H) as a set F ⊆ E of edges, such that for each {h1 , h2 } ∈ H, h1 and h2 are disconnected in (V, E \ F ). Cuts(G, H) will denote the set of cuts for (G, H) and MinCuts(G, H) is the set of minimum cuts for (G, H), i.e. MinCuts(G, H) = {F ∈ Cuts(G, H) : ∀F ∈ Cuts(G, H) : |F | ≤ |F |}. Example 2. Consider the instance (Gex , Hex ) of the EMC problem, where Gex = (V, E) is the graph in Figure 1 and Hex = {{a, b}, {c, d}}. As is easily verified, the sets {{a, b}, {b, c}, {c, d}} and {{a, b}, {b, d}, {c, d}} are the minimum cuts for (Gex , Hex ). In this simple example, we have (V, E ∪ Hex ) = (V, E). Hence, the treewidth w∗ of (Gex , Hex ) is equal to the treewidth of Gex . We thus can use the tree decomposition of Gex in Figure 1 also as a tree decomposition of (Gex , Hex ). For the remainder of the paper, we fix some notation: G = (V, E) and H always refer to the currently considered instance (G, H) of a multicut problem and we denote the size of a reasonable representation by (G, H). T = (T, χ) denotes
170
R. Pichler, S. R¨ ummele, and S. Woltran
a normalized tree decomposition of (G, H) and nroot refers to the root node of T . For any node n ∈ T , we denote by Tn the subtree of T rooted at n and we use χ(Tn ) := m∈Tn χ(m). Hence, we always have V = χ(Tnroot ).
3
Dynamic Programming for Edge Multicut
In this section, we give a dynamic programming algorithm for the EMC problem to compute the number of edges a minimum cut requires. As well, we will sketch at the end of the section, how this algorithm can be used to compute one solution of a given EMC problem. However, we will also observe that the algorithm is not powerful enough to count or enumerate (without repetitions) all solutions of the given EMC problem. We will overcome this problem later in Section 4. Our central objects in this section are so-called colorings (i.e., a special form of partitions), which partition subsets of V into several sets (colors), such that no terminal pair (h1 , h2 ) ∈ H appears in the same color. The intended meaning of a coloring is thus a separation of the vertices into components. Indeed, such a separation induces a cut in a natural way. For our considerations in Section 4, note that vertices of the same color are not necessarily connected in such a graph. Definition 1. A coloring over a set W ⊆ V of vertices is a partition C = / H. Moreover, we {C1 , . . . , Ck } of W , such that u, v ∈ Ci implies {u, v} ∈ denote the set of all colorings over W by C(W ). Finally, we define Γ(C) = = j} as the cut induced by C. E ∩ {{u, v} : u ∈ Ci , v ∈ Cj , i
Proposition 1. Cuts(G, H) = C∈C(V ) {F : Γ (C) ⊆ F ⊆ E}. For our purposes, colorings related to the bags of the tree decomposition are of particular interest. For a coloring C over χ(n), it is natural to extend C to a coloring over χ(Tn ). We will thus later be able to extend colorings over χ(nroot ) to colorings over V . The necessary concepts are introduced below. Definition 2. Given sets W ⊆ W ⊆ V , C ∈ C(W ), and C ∈ C(W ). We say that C extends C, in symbols C ≤ C , in case C = {C ∩ W : C ∈ C } \ {∅}. Definition 3. Given a node n ∈ T , we call a coloring over χ(n) also a coloring of n and we write C(n) instead of C(χ(n)). For C ∈ C(n), we define extn (C) = {C ∈ C(χ(Tn )) : C ≤ C } σn (C) = min{|Γ (C )| : C ∈ extn (C)} En (C) = {Γ (C ) : C ∈ extn (C) s.t. |Γ (C )| = σn (C)}. Intuitively, extn (C) yields all colorings over χ(Tn ) which extend the coloring C. Note that such an extension always exists: Indeed, for nodes {u, v} ∈ H contained in χ(n) this is assured by definition of colorings. Moreover, for nodes {u, v} ∈ H which appear below n, we just have to assign different colors to u and v. Furthermore, σn (C) gives the cardinality of the smallest induced cut among these extended colorings; and En (C) actually yields all these minimum cuts.
Multicut Algorithms via Tree Decompositions
171
Example 3. The first three columns of the table in Figure 2 show the colorings C = {C1 , C2 , . . .} for all nodes n of our example tree decomposition, together with the value σn (C). Due to space limitations, we will reuse this table in Section 4. Until then, the other columns can be ignored. Note that for the root node, n8 , coloring C = {c, e, f } with minimal value σn8 (C) = 3 yields the minimum cuts of our example. In fact, En8 (C) = {{{a, b}, {b, c}, {c, d}}, {{a, b}, {b, d}, {c, d}}}. The last observation in the above example leads us to the following lemma. Lemma 1. Let Cmin be the set of all C ∈ C(nroot ) such that noother coloring C of nroot satisfies σnroot (C ) < σnroot (C). Then, MinCuts(G, H) = C∈Cmin Enroot (C). In other words, to compute the size of a minimum cut, it is sufficient to derive the values σnroot (C) of all colorings C ∈ C(nroot ). However, we do not want to compute σnroot (C) directly with the help of Definition 3, but establish σn (C) for all nodes n ∈ T in a bottom-up fashion. We use the following concept. Definition 4. For C ∈ C(n) with n ∈ T , define πn (C) recursively as follows: – If n is an (L) node, πn (C) = |Γ(C)|; – If n is a (vR) node with child n , πn (C) = min{πn (C ) : C ∈ C(n ), C ≤ C }; – If n is a (vI) node with child n , πn (C) = πn (C ) + |{u : {u, v} ∈ Γ(C)}|, where C ∈ C(n ) is the unique coloring with C ≤ C; – If n is a (B) node with children n , n , πn (C) = πn (C) + πn (C) − |Γ(C)|. Lemma 2. For any node n ∈ T and any C ∈ C(n), σn (C) = πn (C). This lemma (together with Definition 4) naturally yields an algorithm to determine the size of an optimal solution by computing πn (C) for all colorings C of all nodes n in the tree decomposition. We start by determining πn (C) for all colorings C of leaf nodes n. For all remaining nodes n ∈ T , the values πn (C) of all colorings C are computed in a bottom-up fashion along the tree decomposition. Finally, we obtain the cardinality of the minimum cuts as the minimal value πnroot (C) among the colorings C at the root node nroot . Example 4. We illustrate some aspects of this algorithm on our example problem using Figure 2. Consider, for instance, coloring C = {{b}, {c}} for node n3 . We have two colorings for n1 (the child node of n3 ) which extend C, namely, C = {{b, d}, {c}} and C = {{b}, {c}, {d}}. We know σn1 (C ) = πn1 (C ) = |Γ(C )| = 2, σn1 (C ) = πn1 (C ) = |Γ(C )| = 3, and thus we select the smaller number and assign πn3 (C) = 2. For the branch node n5 , consider coloring C = {{b}, {c}}. In a bottom-up traversal, we already know πn3 (C) = πn4 (C) = 2, and we clearly have |Γ(C)| = 1. Thus, πn5 (C) = 2 + 2 − 1 = 3, which equals σn5 (C) as expected. Theorem 1. Given an instance (G, H) of EMC and a tree decomposition of (G, H) of width w∗ , the cardinality |F | of the solutions F ∈ MinCuts(G, H) can ∗ ∗ be computed in time O(22w log w · (G, H)), assuming unit cost for arithmetic operations.
172
R. Pichler, S. R¨ ummele, and S. Woltran C1 n1 {b, c} {b, d} {b} n2 {a} {a, c} {a} n3 {b, c} {b} n4 {b, c} {b} n5 {b, c} {b} n6 {b, c, f } {b} {b, c} {b, f } {b} n7 {c, f } {c} n8 {c, e, f } {c} {c, e} {c, f } {c}
C2 C3 {d} {c} {c} {d} {b, c} {b} {b} {c}
σ 2 2 3 1 2 2 2 {c} 2 1 {c} 2 3 {c} 3 3 {c, f } 3 {f } 3 {c} 3 {c} {f } 3 3 {f } 3 3 {e, f } 4 {f } 4 {e} 5 {e} {f } 5
Δ1 : σ : # Δ2 : σ : # {{C1 , C2 }} : 2 : 1 {{C1 , C2 }} : 2 : 1 {{C2 , C3 }} : 3 : 1 {{C1 , C2 }} : 1 : 1 {{C1 , C2 }} : 2 : 1 ∅:2:1 {{C1 , C2 }} : 2 : 1 ∅:1:1 ∅:2:1 ∅:3:1 {{C1 , C2 }} : 3 : 1
∅:3:1
∅:4:1
∅:3:1 {{C1 , C2 }} : 3 : 1
∅:4:1
∅:3:2 ∅:3:2 ∅:4:2 ∅:4:2 ∅:5:2
Fig. 2. Colorings of the tree decomposition of Example 2
The algorithm presented above allows us to compute a minimum cut F in a simple postprocessing step. This can be done by a recursive procedure which proceeds by a top-down traversal of the tree decomposition. This procedure takes as input a node n and a coloring C at n and returns a set of edges (which are part of the cut F ). Initially, we choose an arbitrary coloring C with minimal value σnroot (C) among the colorings for nroot . The recursion starts with the root node nroot and this coloring C. This initial call to the recursion returns a minimum cut. Depending on the type of each node n, the following action is performed. (a) in case n is a (vI)-node, there is a unique coloring C for the child node n of n, such that C ≤ C. We continue the recursion with n and C . Let the return value for (n , C ) be Γ . Then, the return value for (n, C) is Γ ∪ Γ (C); (b) in case n is a (vR)-node with child node n , we choose a coloring C for n with C ≤ C , such that πn (C ) = πn (C). We continue the recursion with n and C and the return value for (n , C ) is also the return value for (n, C); (c) in case n is a (B)-node with children n and n , we continue the recursion for both children with n and C, resp. with n and C. The return value for (n, C) is the union of the return values of these two calls. (d) for a leaf node n, we just return Γ(C).
Multicut Algorithms via Tree Decompositions
173
Example 5. For our example problem, we thus have to start with the coloring C = {{c, e, f }} of n8 . C extends coloring {{c, f }} of n7 , which is an (R)-node. We have to choose a coloring of n6 which extends {{c, f }}. Two such colorings exist, {{b, c, f }} and {{b}, {c, f }}, and both have the same π-value as {{c, f }}. Let us select C = {{b}, {c, f }}, We then have to proceed with C = {{b}, {c}} at n5 , which is a (B)-node. At the (B) node, we proceed as follows: We first continue with C in n3 which is a (dR)-node. There are two colorings of n1 which extend C , namely {{b, d}, {c}} and {{b}, {c}, {d}}. However, only the former has the same π-value as C and is thus selected. Since we are now at a leaf node, we return the induced cut Γ1 = {{b, c}, {c, d}} of {{b, d}, {c}}. Now we go into the second recursion with C in n4 which is an (aR)-node. There are two colorings for the child n2 which extend C , namely {{a, c}, {b}} and {{a}, {b}, {c}}. Both have the same π-value, so we can use either of them. Let us select {{a, c}, {b}}; we return its induced cut Γ2 = {{a, b}, {b, c}}. Back at the branch node, we have to combine the return values and obtain Γ = Γ1 ∪ Γ2 = {{a, b}, {b, c}, {c, d}} which is the return value at n6 . For the return value here, we observe Γ ∪ Γ (C ) = Γ and thus return Γ which is passed on unchanged by (R)-node n7 . We compute the final return value at n8 as Γ ∪ Γ (C) = Γ ∪ ∅ = Γ . Indeed, Γ is a minimum cut of our problem. As this example shows, our postprocessing step would have yielded the same solution, if we had selected {{a}, {b}, {c}} instead of {{a, c}, {b}} at node n2 . This is due to the fact that our data model does not guarantee that two distinct colorings C, C of some node n, satisfy En (C)∩En (C ) = ∅. This, in particular, causes problems for giving a general enumeration algorithm (it would yield duplicate results) and is also a serious obstacle for counting the number of solutions.
4
Counting and Enumeration
In the previous section, the key objects to maintain during the bottom-up traversal of the tree decompositions were the colorings C ∈ C(n) for each node n ∈ T . As we have seen, it is possible that two distinct colorings C1 , C2 ∈ C(n) share some solutions, i.e. En (C1 ) ∩ En (C2 ) = ∅ does not necessarily hold. The reason is, that we guarantee for two distinct colors Ci , Cj ∈ C, only that the cut disconnects all vertices v ∈ Ci from the vertices w ∈ Cj . No statement was made about the connectedness of vertices contained in the same partition Ci . We now modify our approach so as to guarantee this connectedness. Definition 5. A parsimonious coloring ( pcoloring, for short) over a set W ⊆ V of vertices is a tuple (C, Δ), where C ∈ C(W ) and Δ is a set of unordered pairs {Ci , Cj } of distinct colors Ci , Cj ∈ C, such that for each {u, v} ∈ H it holds that {Ci , Cj } ∈ Δ, whenever u ∈ Ci and v ∈ Cj . Δ is called the disconnection relation of the pcoloring P = (C, Δ). We shall use Pc to identify the coloring C and Pd to identify the disconnection relation Δ. Moreover, we denote by P(W ) the set of all pcolorings over W and write P(n) as a shorthand for P(χ(n)).
174
R. Pichler, S. R¨ ummele, and S. Woltran
Given P ∈ P(n), Pc is simply a coloring of n. Ultimately, we are only interested in colorings Pc , s.t. (in some extension of Pc ) the vertices in each color are indeed connected in the subgraph of G induced by the vertices χ(Tn ). In contrast to the previous section, we now allow that two different colors Ci , Cj get melted to a single color during the bottom-up traversal of T ; this happens, e.g., at a (vI)-node if v has edges to some vertices vi ∈ Ci and vj ∈ Cj and if none of these edges is added to the cut. However, if for some terminal pair {h1 , h2 } ∈ H, we have h1 ∈ Ci and h2 ∈ Cj , then these colors Ci , Cj must never get melted as the bottom-up traversal continues. The very purpose of the second component Pd of P is to keep track of such pairs which must not get melted. Clearly, for each coloring C, there exists a relation Δ, s.t. (C, Δ) is a pcoloring. Below, we overload the concepts from Definitions 2 and 3 for pcolorings. Definition 6. Let W ⊆ W ⊆ V , P ∈ P(W ) and P ∈ P(W ). Then, P ≤ P , if Pc ≤ Pc and Pd = {{Ci ∩ W, Cj ∩ W } : {Ci , Cj } ∈ Pd } \ {{∅, ·}, {·, ∅}}. For a node n ∈ T , let us denote by Gn the subgraph induced by the vertices χ(Tn ), i.e. Gn = (χ(Tn ), En ) where En = E ∩ {{v, u} : v, u ∈ χ(Tn )}. Moreover, for a graph Gn , let κ(Gn ) denote the set of connected components of Gn , and, for a set of edges F , let Gn \ F = (χ(Tn ), En \ F ) as expected. Definition 7. Let Δ(C) = {{Ci , Cj } ⊆ C : {u, v} ∈ H, u ∈ Ci , v ∈ Cj } for coloring C. Given a node n ∈ T and P ∈ P(n), we define extn (P) = {P ∈ P(χ(Tn )) : P ≤ P , κ(Gn \ Γ(Pc )) = Pc , Pd = Δ(Pc )}. P is called valid (in n) if extn (P)
= ∅. The remaining two concepts are now only defined for valid pcolorings. σn (P) = min{|Γ (Pc )| : P ∈ extn (P)} En (P) = {Γ (Pc ) : P ∈ extn (P) s.t. |Γ (Pc )| = σn (P)}. The modified definition of extensions guarantees that the vertices in each color are indeed connected in the subgraph of G induced by the vertices χ(Tn ) and that this connectedness is still fulfilled after removing the edges contained in the cut. This property is ensured by the condition κ(Gn \ Γ(Pc )) = Pc in the definition of extn (P). The condition Pd = Δ(Pc ) ensures that Pd contains only disconnection pairs that are justified by some terminal pair in H. As a consequence, Pd is uniquely determined by Pc , which will be crucial for Lemma 4 below. Of course, extn (P) may be empty. For instance, consider the coloring C = {{a, c}, {b}} at node n2 of our running example. Since b is in a different color than a and c, both edges (a, b) and (b, c) are contained in the induced cut Γ (C). But then {a, c} is disconnected in the corresponding subgraph Gn2 \ Γ (C). Hence, there exists no Δ to turn (C, Δ) into a valid pcoloring. Actually, all rows in Figure 2 where the last two columns are empty contain colorings that cannot be part of a valid pcoloring. Analogously to Lemma 1, particular pcolorings for nroot characterize the minimum cuts of a given problem instance.
Multicut Algorithms via Tree Decompositions
175
Lemma 3. Let Pmin be the set of all valid pcolorings P of nroot , for which there exists no other valid pcoloring P of nroot , such that σnroot (P ) < σnroot (P). Then, MinCuts(G, H) = P∈Pmin Enroot (P). Lemma 4. Given a node n ∈ T and distinct valid pcolorings P1 and P2 of n, it holds that En (P1 ) ∩ En (P2 ) = ∅. Next, we define two operations on pcolorings which we need for the bottom-up traversal of T . The melting operation is denoted as P S . It takes a pcoloring P and some set S of vertices and melts all colors containing at least one vertex from S to a single color. This operation will be needed at (vI)-nodes where all colors containing some vertex vi adjacent to v get melted into a single color (unless we add the edge connecting v and vi to the cut). The second operation is the composition of two pcolorings P, P , denoted as P ∪ P . Intuitively, the first component of P ∪P is obtained as the connected components of a graph of which we know that all vertices jointly occurring in some color of P or P are connected. The composition operation will be needed at (B)-nodes. For both operations, the disconnection relation has to be adapted correspondingly. We first introduce the following notation for a pcoloring P ∈ P(W ) and a set S ⊆ W ⊆ V : P|S = {C ∈ Pc : C ∩ S
= ∅} and [P, S] = C∈P|S C. Moreover, for a vertex u we write [P, u] instead of [P, {u}] which simply denotes the color C ∈ Pc with u ∈ C. Definition 8. Let W ⊆ V , P ∈ P(W ) and S ⊆ W . Then P S = (C, Δ) where C = {[P, S]} ∪ (Pc \ P|S ) and Δ = {[P, S], C } : C ∈ Pc \ P|S , C ∈ P|S , {C, C } ∈ Pd ∪ {C, C } : C, C ∈ C, {C, C } ∈ Pd . Definition 9. Let W ⊆ V , P, P ∈ P(W ), and for each w ∈ W , let Cw be the smallest set such that w ∈ Cw and, for each u ∈ Cw , [P, u] ∪ [P , u] ⊆ Cw . We define P ∪ P = (C, Δ) where C = {Cw : w ∈ W } and = C2 , C1 ⊆ C1 , C2 ⊆ C2 , {C1 , C2 } ∈ Pd ∪ Pd }. Δ = {{C1 , C2 } : C1 , C2 ∈ C, C1
For S = ∅, or a singleton S, we get P S = P as expected. Note that P S is possibly not a pcoloring. This is the case if h ⊆ [P, S] for some terminal pair h ∈ H. Moreover, for a valid pcoloring P, the pcoloring P S may be invalid , if (C1 ∪ C2 ) ⊆ [P, S] for some pair {C1 , C2 } ∈ Pd . Likewise, P ∪ P may be not a pcoloring. This is the case if a pair {h1 , h2 } of terminal vertices ends up in a joint color. Just consider the simple situation that Pc contains a color {h1 , v} and Pc contains a color {h2 , v} for some vertex v. It may also happen that two valid pcolorings P and P lead to an invalid pcoloring P ∪ P if P ∪ P contains a color C, s.t. C1 ∪ C2 ⊆ C for some pair {C1 , C2 } in Pd or Pd . Next, we define relations between pcolorings over adjacent nodes in the tree decomposition. These relations will be used to traverse the tree decomposition.
176
R. Pichler, S. R¨ ummele, and S. Woltran
Definition 10. Let n ∈ T , P ∈ P(n), P ∈ P(n ), and P ∈ P(n ). Then, the following pairs are contained in relation ≺n . 1. P ≺n P, if n is a (vI)-node with child n , and there exists a set S ⊆ χ(n ) ∩ {u : {v, u} ∈ E}, such that (P )S ≤ P, [P , S] ∪ {v} = [P, v], and for each {C , D } ∈ (P )d , there is a {C, D} ∈ Pd with C ⊆ C and D ⊆ D. 2. P ≺n P, if n is an (R)-node with child n , and P ≤ P . 3. (P , P ) ≺n P, if n has two children n , n , P = P ∪ P , and for each {C , D } ∈ (P )d ∪ (P )d , there is a {C, D} ∈ Pd with C ⊆ C and D ⊆ D. As already mentioned above, some colorings at a child node may get melted at (I)-nodes or (B)-nodes. For a (vI)-node, S in the above definition denotes an arbitrarily chosen subset of all vertices adjacent to v, s.t. all colors containing a vertex in S are then melted into a single color Ci on the transition from P to P. The neighbors of v not selected in S may end up in a different color Cj . Implicitly, the edges connecting v with these neighbors are thus added to the cut. For (B)-nodes, the condition P = P ∪ P forces P ∪ P to be a pcoloring. Moreover, the existence of {C , D } ∈ Pd with C ⊆ C and D ⊆ D makes sure that no “disconnected pair” in either Pd or Pd gets melted into a single color. Lemma 5. If P ∈ P(n ) is valid in n (and P ∈ P(n ) is valid in n ), then each P ∈ P(n) with P ≺n P (resp. (P , P ) ≺n P) is valid in n. If P ∈ P(n) is valid in n, then there exists P ∈ P(n ) (and P ∈ P(n )) with P ≺n P (resp. (P , P ) ≺n P), s.t. P is valid in n (and P is valid in n ). Similarly to Section 3, we can compute σn (P) for valid pcolorings P by a bottomup traversal of T . The cases of (vI) and (B) nodes are slightly more complicated, since different pcolorings might collapse into the same pcoloring. Definition 11. For a valid pcoloring P ∈ P(n) and n ∈ T (possibly with children n ,n ), we define πn (P) recursively, depending on the node type of n. – – – –
(L)-node: πn (P) = |Γ(Pc )|; (vR)-node: πn (P) = min{πn (P ) : P ≺n P}; (vI)-node: πn (P) = min{πn (P ) : P ≺n P} + |{u : {u, v} ∈ Γ(Pc )|; (B)-node: πn (P) = min{πn (P ) + πn (P ) : (P , P ) ≺n P} − |Γ(Pc )|.
Lemma 6. For any node n ∈ T and any valid pcoloring P of n, σn (P) = πn (P). We are now ready to construct an algorithm to count the solutions of an EMC instance. One further notation is required: We restrict the relation ≺n on pcol min P (resp. (P , P ) ≺min P) only holds if orings to a relation ≺min n , s.t. P ≺n n πn (P) is determined by πn (P ) (resp. by πn (P ) and πn (P )) in Definition 11. I.e., P ≺min P holds iff P ≺n P and either πn (P) = min{πn (P ) : P ≺n P} n (for (R)-nodes) or πn (P) = min{πn (P ) : P ≺n P} + |{u : {u, v} ∈ Γ(Pc )| (for (I)-nodes) holds. Likewise, (P , P ) ≺min P holds iff (P , P ) ≺n P and n πn (P) = min{πn (P ) + πn (P ) : (P , P ) ≺n P} − |Γ(Pc )|.
Multicut Algorithms via Tree Decompositions
Definition 12. For P ∈ P(n) and n ∈ T (possibly ⎧ ⎪ ⎨1 #n (P ) #n (P) = P ≺min n P ⎪ ⎩ #n (P ) · #n (P ) (P ,P )≺min n P
177
with children n ,n ), let n is (L)-node n is (I)- or (R)-node n is (B)-node
Lemma 7. For each n ∈ T and each valid pcoloring P of n, |En (P)| = #n (P). By combining Lemmas 3, 4, and 7, we immediately get the following theorem. Theorem 2. Let Pmin be the set of all valid pcolorings P of nroot , for which there exists no other pcoloring P of nroot , such that σnroot (P ) < σnroot (P). Then, |MinCuts(G, H)| = P∈Pmin #nroot (P). Example 6. We revisit the instance of the EMC problem from Example 2. In Figure 2, the result of computing σn (P) and #n (P) for all valid pcolorings P at all nodes n is shown. Only the rows with an entry in one of the last two columns correspond to a valid pcoloring P. In this case, the sets in the second column (with heading C1 , C2 , C3 ) define the coloring Pc and the column labeled Δ1 : σ : # contains the set of “disconnected pairs” Pd together with the size of the corresponding cuts in En (P) and the number #n (P) of such cuts. Some colorings Pc admit two possible sets of “disconnected pairs” in order to form a valid pcoloring. In these cases, the last column contains the second possibility – again together with the corresponding size of the cuts and the counter #n (P). The minimum cuts correspond to the valid pcolorings at the root node n8 with minimal value of σn8 (P). In our example, the only such pcoloring is P = ({{c, e, f }}, ∅). Thereby the cuts corresponding to P consist of three edges and there are, in total, two minimum cuts (see Example 2). We conclude this section by outlining an algorithm for enumerating all solutions with fixed-parameter linear delay by extending the computation of a single solution in the previous section. The basic idea is to traverse the tree decomposition in top-down direction several times – namely once for each solution. In the recursive algorithm described in Section 3, we made arbitrary choices at the root node (for selecting one coloring with optimal value σnroot (C)) and at internal nodes (e.g., at an (R)-node n, for selecting some coloring C at the child node n with C ≤ C ). For enumerating all solutions, we have to maintain lists to keep track of all possible choices at each node in the tree decomposition. These lists allow us to iterate through all possible choices. Hence, at the root, we iterate through all valid pcolorings P of nroot with minimal value σnroot (P). Likewise, for a valid pcoloring P at some (R)- or (I)-node n, we eventually have to process P. Finally, also for a all pcolorings P at the child node n of n, s.t. P ≺min n valid pcoloring P at some (B)-node n, we eventually have to process all pairs P. (P , P ) of pcolorings at the child nodes n and n of n, s.t. (P , P ) ≺min n Only at (L)-nodes, no iterating of several possible pcolorings is required. In [16], we state the full algorithm, which crucially depends on Lemma 4, guaranteeing that no duplicates are produced. Note that this algorithm could also be used for the optimization problem, but this would result in a loss of efficiency.
178
R. Pichler, S. R¨ ummele, and S. Woltran
Theorem 3. Given an instance (G, H) of the EMC problem together with a tree decomposition T of (G, H) having width w∗ . Assuming unit cost for arith∗ 2 ∗ ∗ metic operations, O(22((w ) +w log w ) · (G, H)) bounds the time to compute |MinCuts(G, H)| as well as the delay to enumerate MinCuts(G, H).
5
Conclusion
We have presented novel algorithms for the optimization and counting problem of Edge Multicut. Moreover, we have outlined how the counting algorithm can be extended to an enumeration algorithm. It is now straightforward to adapt these algorithms to the (Restricted or Unrestricted) Vertex Multicut problem. Indeed, for the optimization problem, we can proceed as in Section 3. The main modification required is to allow colorings where some vertices possibly do not get a color assigned. The intended meaning is that colorless vertices are exactly those which are part of the cut. The pcolorings introduced in Section 4 for the counting and enumeration problem have to be adapted analogously. The details of these algorithms are left for future work. Further extending these algorithms to the weighted multicut problems is even simpler: Rather than maintaining the cardinality πn as in Definitions 4 and 11, we would now have to keep track of the total weight of a (p)coloring. Note that the upper bounds on the constants of our algorithms (in Theorems 1 and 3) are obtained by very coarse estimates – assuming straightforward methods for storing and manipulating partitions, etc. For future work, we plan to implement our multicut algorithms – using more sophisticated data structures and algorithms – which should also improve the upper bounds.
References 1. Costa, M.C., L´etocart, L., Roupin, F.: Minimal multicut and maximal integer multiflow: A survey. European Journal of Operational Research 162, 55–69 (2005) 2. C˘ alinescu, G., Fernandes, C.G., Reed, B.A.: Multicuts in unweighted graphs and digraphs with bounded degree and bounded tree-width. J. Alg. 48, 333–359 (2003) 3. Dahlhaus, E., Johnson, D.S., Papadimitriou, C.H., Seymour, P.D., Yannakakis, M.: The complexity of multiterminal cuts. SIAM J. Comput. 23, 864–894 (1994) 4. Garg, N., Vazirani, V.V., Yannakakis, M.: Primal-dual approximation algorithms for integral flow and multicut in trees. Algorithmica 18, 3–20 (1997) 5. Bentz, C.: A simple algorithm for multicuts in planar graphs with outer terminals. Discrete Applied Mathematics 157, 1959–1964 (2009) 6. Flum, J., Grohe, M.: Parameterized Complexity Theory. Springer, Heidelberg (2006) 7. Bousquet, N., Daligault, J., Thomass´e, S., Yeo, A.: A polynomial kernel for multicut in trees. In: Proc. STACS 2009. LIPIcs, vol. 3, pp. 183–194 (2009) 8. Marx, D., Razgon, I.: Constant ratio fixed-parameter approximation of the edge multicut problem. In: Fiat, A., Sanders, P. (eds.) ESA 2009. LNCS, vol. 5757, pp. 647–658. Springer, Heidelberg (2009) 9. Marx, D.: Parameterized graph separation problems. Theor. Comput. Sci. 351, 394–406 (2006)
Multicut Algorithms via Tree Decompositions
179
10. Xiao, M.: Simple and improved parameterized algorithms for multiterminal cuts. Theory Comput. Syst. (to appear, 2010) 11. Guo, J., H¨ uffner, F., Kenar, E., Niedermeier, R., Uhlmann, J.: Complexity and exact algorithms for vertex multicut in interval and bounded treewidth graphs. European Journal of Operational Research 186, 542–553 (2008) 12. Bentz, C.: On the complexity of the multicut problem in bounded tree-width graphs and digraphs. Discrete Applied Mathematics 156, 1908–1917 (2008) 13. Gottlob, G., Lee, S.T.: A logical approach to multicut problems. Inf. Process. Lett. 103, 136–141 (2007) 14. Courcelle, B.: Graph rewriting: An algebraic and logic approach. In: Handbook of Theor. Comp. Sci., vol. B, pp. 193–242. Elsevier Science Publishers, Amsterdam (1990) 15. Arnborg, S., Lagergren, J., Seese, D.: Easy problems for tree-decomposable graphs. J. Algorithms 12, 308–340 (1991) 16. Pichler, R., R¨ ummele, S., Woltran, S.: Multicut algorithms via tree decompositions. Technical Report DBAI-TR-2010-67, Technische Universit¨ at Wien (2010) 17. Kloks, T.: Treewidth: Computations and Approximations. Springer, Berlin (1994) 18. Bodlaender, H.L.: A linear-time algorithm for finding tree-decompositions of small treewidth. SIAM J. Comput. 25, 1305–1317 (1996) 19. van den Eijkhof, F., Bodlaender, H.L., Koster, A.M.C.A.: Safe reduction rules for weighted treewidth. Algorithmica 47, 139–158 (2007) 20. Bodlaender, H.L., Koster, A.M.C.A.: Combinatorial optimization on graphs of bounded treewidth. Comput. J. 51, 255–269 (2008)
The Steiner Tree Reoptimization Problem with Sharpened Triangle Inequality (Extended Abstract) Hans-Joachim B¨ockenhauer, Karin Freiermuth, Juraj Hromkoviˇc, Tobias M¨ omke, Andreas Sprock, and Bj¨ orn Steffen Department of Computer Science, ETH Zurich, Switzerland {hjb,fkarin,jhromkov,tmoemke,asprock,bjoern.steffen}@inf.ethz.ch
Abstract. In this paper, we deal with several reoptimization variants of the Steiner tree problem in graphs obeying a sharpened β-triangle inequality. A reoptimization algorithm exploits the knowledge of an optimal solution to a problem instance for finding good solutions for a locally modified instance. We show that, in graphs satisfying a sharpened triangle inequality (and even in graphs where edge-costs are restricted to the values 1 and 1 + γ for an arbitrary small γ > 0), Steiner tree reoptimization still is NP-hard for several different types of local modifications, and even APX-hard for some of them. As for the upper bounds, for some local modifications, we design linear-time (1/2 + β)-approximation algorithms, and even polynomialtime approximation schemes, whereas for metric graphs (β = 1), none of these reoptimization variants is known to permit a PTAS. As a building block for some of these algorithms, we employ a 2β-approximation algorithm for the classical Steiner tree problem on such instances, which might be of independent interest since it improves over the previously best known ratio for any β < 1/2 + ln(3)/4 ≈ 0.775.
1
Introduction
The Steiner tree problem is a very prominent optimization problem with many practical applications, especially in network design, see for example [16,18]. Given a complete weighted graph G = (V, E) with edge cost function c and a set S ⊆ V of vertices called terminals, the Steiner tree problem consists of finding a minimum-cost connected subgraph of G containing all vertices from S. The problem is known to be APX-hard, even if the edge costs are restricted to 1 and 2 [4]. A minimum spanning tree on the terminal vertices is sufficient for achieving a 2-approximation (see, e. g., [18]), and the best currently known approximation ratio for the Steiner tree problem is 1 + ln(3)/2 ≈ 1.55 for general edge costs and 1.28 for edge costs 1 and 2 [19].
This work was partially supported by SNF grants 200021-109252/1 and 200021121745/1.
T. Calamoneri and J. Diaz (Eds.): CIAC 2010, LNCS 6078, pp. 180–191, 2010. c Springer-Verlag Berlin Heidelberg 2010
The Steiner Tree Reoptimization Problem
181
In this paper, we analyze the hardness of even more restricted input instances. More precisely, we consider all instances where the edge costs are restricted to the values 1 and 1 + γ for any 0 < γ ≤ 1. Also this restricted problem variant is known to be APX-hard [15]. In particular, restricting the edge costs in the described way also covers the class of Steiner tree problems where the edge-costs satisfy the sharpened β-triangle inequality, i. e., where the cost function c satisfies the condition c({v1 , v2 }) ≤ β · (c({v1 , v3 }) + c({v3 , v2 })), for some 1/2 ≤ β < 1 and for all vertices v1 , v2 , and v3 . The graphs satisfying a sharpened triangle inequality form a subclass of the class of all metric graphs. Intuitively speaking, for vertices that are points in the Euclidean plane, a parameter value β < 1 prevents that three vertices can be placed on the same line. For more details and motivation of the sharpened triangle inequality, see [9]. For analyzing how the transition from metric Steiner graphs (β = 1) to Steiner graphs with sharpened β-triangle inequality influences the computational hardness, we consider the question whether additional knowledge about the input is helpful for finding a good solution. More precisely, we consider the model of reoptimization algorithms which handles problems where an instance together with one of its optimal solutions is given and the problem is to find a good solution for a locally modified instance. This concept of reoptimization was mentioned for the first time in [20] in the context of postoptimality analysis for a scheduling problem. Since then, the concept of reoptimization has been investigated for several different problems like the traveling salesman problem [1,3,8,12], knapsack problems [2], covering problems [7], and the shortest common superstring problem [6]. In these papers, it was shown that, for some problems, the reoptimization variant is exactly as hard as the original problem, whereas reoptimization can help a lot for improving the approximation ratio for other problems, for an overview of some results see also [11]. These results show that the reoptimization concept gives new insight into the hardness of the underlying optimization problems and allows for a more fine-grained complexity analysis. The Steiner tree reoptimization problem in general weighted graphs was previously investigated in [5,10,13] for various types of local modifications. We show that eight reoptimization variants (insertion and deletion of terminal or nonterminal vertices, increasing and decreasing edge costs, and changing the status of vertices from terminal to non-terminal and vice versa) are NP-hard on graphs with edge costs restricted to 1 and 1 + γ. The best approximation algorithms for the four reoptimization variants considered in [5] (a terminal becomes a nonterminal or vice versa; the cost of an edge increases or decreases) achieve a constant approximation ratio in metric graphs. Here, we show that, on β-metric graphs, all of these four cases permit, in contrast to the non-reoptimization problem, a PTAS for any β < 1. When the local modification, however, consists in removing vertices, we show that the Steiner tree reoptimization is as hard to approximate as the original problem. The two algorithmically most interesting reoptimization variants are the addition of terminal and of nonterminal vertices. For these modifications, we prove the APX-hardness of the corresponding reoptimization variants, which solves
182
H.-J. B¨ ockenhauer et al.
also the analogous open problem for reoptimization in Steiner trees with arbitrary edge costs. Escoffier et al. [13] designed simple linear-time algorithms for metric input instances (β = 1) which achieve an approximation ratio of 3/2. Using the same algorithms, but a much more complex and technically involved analysis, we prove a (1/2 + β)-approximation for graphs satisfying a sharpened β-triangle inequality. Note that the ratio (1/2 + β) tends to 3/2 for β tending to 1 and to 1 for β tending to 1/2. These proofs employ a 2β-approximation algorithm for the classical non-reoptimization version of the Steiner tree problem in β-metric graphs which may be of independent interest since it improves over the previously best known ratio for any β < 1/2 + ln(3)/4 ≈ 0.775. Due to space limitations, some of the proofs are omitted in this extended abstract.
2
Preliminaries
Given a graph G = (V, E) and a subset S ⊆ V of vertices, called terminals, a Steiner tree for (G, S) is a subtree T of G spanning all terminals, i. e., T = (V (T ), E(T )) is a tree such that S ⊆ V (T ) ⊆ V and E(T ) ⊆ E. The vertices in V − S are called non-terminals. , a minimum In a weighted graph G = (V, E) with cost function c : E → Q+ Steiner tree is a Steiner tree T of minimum cost, i. e., minimizing e∈E(T ) c(e) over all Steiner trees of G. In the remainder of the paper, we denote by G = (V, E) a complete, undirected edge-weighted graph with a cost function c. The vertex set V of G is also denoted by V (G) and the edge set E of G is also denoted by E(G). Furthermore, we denote by S ⊆ V (G) the set of terminals of G. The sum of the costs of all edges in a subgraph H of G is defined by c(H) = e∈E(H) c(e). For the cost of an edge {x, y}, we use the notation c(x, y) instead of c({x, y}). The minimum Steiner tree problem (Min-STP) in connected edge-weighted graphs is the problem of finding a minimum Steiner tree for an input instance (G, S, c). If the cost function c satisfies the β-triangle inequality, the minimum Steiner tree problem on the the input instance (G, S, c) is called Min-Δβ -STP. Similar to the Min-Δβ -STP, we consider the problem Min-(1, 1 + γ)-STP, where only edges of cost 1 and 1 + γ are allowed. The relation of the Min-Δβ -STP and the Min-(1, 1 + γ)-STP is as follows. Lemma 1. For any graph G = (V, E) and any 0 < γ ≤ 1, any cost function c : E → {1, 1 + γ} satisfies also the (1 + γ)/2-triangle inequality. Definition 1. The minimum Steiner tree reoptimization problem with the local modification lm (Min-STRP-lm) is the following optimization problem. The goal is to find a minimum Steiner tree for an input instance (G , S , c ), given an optimal Steiner tree TOld for the instance (G, S, c), where (G , S , c ) = lm((G, S, c)). We consider the following local modifications. When adding a non-terminal (AddNonTerm), V (G ) = V (G) {vNew }, S = S, and c is the restriction of c to V (G). When adding a terminal vertex (AddTerm), V (G ) = V (G) {vNew }, S = S {vNew }, and c is the restriction of c to V (G). When removing a
The Steiner Tree Reoptimization Problem
183
terminal or non-terminal vertex v (RemNonTerm, RemTerm), V (G ) = V (G)\v, S = S\v, and c is the restriction of c to V (G ). When increasing or decreasing the cost of one edge e (IncEdge, DecEdge), G = G, S = S, c (f ) = c(f ) for all f ∈ E(G)\{e}, and c (e) is larger or smaller than c(e), respectively. When changing the status of a vertex v (Term→NonTerm, NonTerm→Term), G = G, S = S\v or S = S ∪ {v}, respectively, and c = c. The corresponding problem variants where the edge cost function c satisfies the sharpened β-triangle inequality for some 1/2 ≤ β ≤ 1 and the variant with edge costs in {1, 1 + γ} are Min-Δβ -STRP-lm and Min-(1, 1 + γ)-STRP-lm.
3
Reoptimization Hardness
All reductions in this paper require a transformation of an instance of the satisfiability problem into a (1, 1 + γ)-Steiner tree instance. The following transformation extends the one used in the NP-hardness proof for the Steiner tree problem in [17]. Φ Transformation 1. Let Φ be a SAT instance with m clauses C1Φ , C2Φ , . . . , Cm Φ Φ Φ and n variables x1 , x2 , . . . , xn . We construct from Φ a (1, 1 + γ)-Steiner tree instance (G = (V, E), S ⊂ V, c : E → {1, 1 + γ}). In the construction, we say that two vertices are connected, if and only if the edge between these vertices has cost one. In V , there are m terminal vertices C1 , C2 , . . . , Cm representing the clauses and 2 · n nonterminal vertices x1 , x¯1 , x2 , x ¯2 , . . . , xn , x ¯n representing the positive and negative variables. Each Ci is connected to the k nonterminal vertices that represent the literals within the clause CiΦ . For connecting the variables, we introduce a terminal vertex y. For every i, xi and x ¯i are connected to y (see Figure 1). The idea of the construction is to build a Steiner tree by connecting each clause-vertex of a satisfied clause with exactly one variable-vertex. We have to ensure, however, that for every i, either xi or x¯i is in an optimal Steiner tree. To this end, we introduce auxiliary terminal vertices ai,j for i = 1, 2, . . . , n and j = 1, 2, . . . , 1/γ. For any i and j, ai,j is connected to xi and to x ¯i . Furthermore, xi and x ¯i are connected. All remaining edges have cost 1 + γ.
Normal Form. Given a (1, 1 + γ)-Steiner tree instance (G = (V, E), S, c) that was constructed from a SAT formula using Transformation 1 and a Steiner tree T within that instance, we construct a new Steiner tree T that is at most as expensive as T and satisfies some structural properties. In the following, we refer to vertices xi and x¯i as variable-vertices and to the vertices Cj as clause-vertices. In the Steiner tree in normal form, for each i, either xi or x ¯i is connected to the terminal vertex y and to all auxiliary vertices ai,j . Furthermore, all auxiliary vertices are leaves. This way, the edges incident to the auxiliary vertices define an assignment of the variables. We define X as the set of all variable-vertices that are adjacent to auxiliary variables. Moreover, each clause-vertex Ci is a leaf ¯j and there is no clause-vertex that that is connected to a variable-vertex xj or x is connected to a variable-vertex outside of X via an edge of cost 1 + γ.
184
H.-J. B¨ ockenhauer et al.
Lemma 2. Let Φ be a Boolean formula with m clauses and n variables. Then the Steiner tree instance (G, S, c) obtained by applying Transformation 1 has an optimal solution of cost (1 + 1/γ)n + m if and only if Φ is satisfiable and, if Φ is not satisfiable, the cost of any solution is higher than that value. Furthermore, from a satisfying assignment for Φ one can efficiently compute an optimal Steiner tree in (G, S, c). For showing the hardness of approximation of the (1, 1 + γ)-Steiner tree reoptimization problem with adding vertices, we use a gap-preserving reduction from Es-OCC-MaxEkSAT, i. e., maximum satisfiability, where each variable occurs in exactly s clauses and each clause consists of exactly k literals. We use formalisms similar to [21]. Lemma 3. There is a gap-preserving reduction from Es-OCC-MaxEkSAT to the (1, 1 + γ)-Steiner tree reoptimization problem with adding a single vertex by transforming a Boolean formula Φ into a reoptimization instance consisting of an old instance (GO , SO , cO ), an optimal Steiner tree TO , and a modified instance (GN , SN , cN ), such that – if an optimal assignment for Φ satisfies at least p · m clauses, then there is a Steiner tree in G of cost at most m · ((1 + 1/γ)k/s + 1 + (1 − p) · γ) + m · 1/γ + 1, and – if an optimal assignment for Φ satisfies less than (p − ε) · m clauses, then any Steiner tree in G costs at least m · ((1 + 1/γ)k/s + 1 + (1 − (p − ε)) min{γ, 2/s}) + m · 1/γ + 1, where m is the number of clauses and ε > 0 is a constant. Proof. Our proof is structured as follows. For any input instance Φ of Es-OCCMaxEkSAT, we consider the input instance (Gt , St , ct ) created by applying Transformation 1. In (Gt , St , ct ), we replace the clause-vertices by gadgets, which leads to a new Steiner tree instance (G, S, c) (see Figure 1). Within this instance, we can efficiently compute an optimal Steiner tree. By adding a terminal or nonterminal vertex z, however, we obtain a new input instance (GN , SN , cN ). For this instance, we give an upper and a lower bound on the cost of an optimal Steiner tree depending on the number of clauses that are satisfiable within Φ. With these bounds, the gap between p and p − ε translates into a new gap by applying the computed lower bound for p and the upper bound for p − ε. Note that all intermediate instances and solutions can be computed from Φ in polynomial time and thus they do not significantly help to solve (GN , SN , cN ). Let n be the number of different variables in Φ. For distinguishing the clauses and literals of Φ from the corresponding vertices in the Steiner tree instance, we ¯Φ denote the clauses by CiΦ and the literals by xΦ i and x i . Furthermore, let σ be the value such that σ · m clauses of Φ are satisfied by an optimal assignment ϕ ∈ {0, 1}n.
The Steiner Tree Reoptimization Problem
185
y
terminal
x1
x ¯1
x2
x ¯ 3 x4
x ¯ 2 x3
x ¯4
a1,1
a2,1
a3,1
a4,1
a1,2
a2,2
a3,2
a4,2
.. .
.. .
.. .
.. .
a1,1/γ
a2,1/γ
non-terminal
C1
C1 s1,1
...
a3,1/γ
a4,1/γ
C2
C3
C4
C2
C3
C4
...
...
...
s4,1/γ
z
Fig. 1. Example of a Steiner tree as used in Lemma 3
For each clause-vertex Ci , we introduce a nonterminal vertex Ci and 1/γ terminal vertices si,1 , si,2 , . . . , si,1/γ . In the following, we refer to these terminal vertices as split-vertices. Each vertex Ci is connected to all vertices belonging to the gadget of its clause. Furthermore, for 1 ≤ i < m, the vertex si,1 is connected to si+1,1 . As before, all remaining edges have a cost of 1 + γ. Using a similar argumentation as for the auxiliary vertices, we conclude that there is an optimal Steiner tree that, for each i, contains all edges between Ci and its split-vertices. Furthermore, each such component has to be connected to the remaining graph with a cost of at least 1. Thus each of these gadgets adds a cost of at least 1 + 1/γ to any solution, which sums up to at least m · (1 + 1/γ) additional cost to an optimal solution for (G, S, c). Therefore, applying Lemma 2, the cost of an optimal solution for (G, S, c) is at least (1 +
1/γ)n + m + m · (1 + 1/γ). Now, we construct an optimal Steiner tree TO for (G, S, c). Without loss of generality, let us assume that the clauses and variables are labelled in such a way that C1Φ contains xΦ 1 . Then TO contains, for i = 1, 2, . . . , n, j = 1, 2, . . . , 1/γ, and k = 1, 2, . . . , m, all edges {y, xi }, {ai,j , xi }, {x1 , C1 }, {Ck , Ck }, {Ck , sk,j }, and, for k = 1, 2, . . . , m − 1, {sk,1 , sk+1,1 }. This way, TO is a valid Steiner tree and, since each of its edges is of cost 1, the cost of TO is (1 + 1/γ)n + 1 + (m − 1) + m · (1 + 1/γ), which we have already shown to be optimal. Now, the local modification is to add the vertex z in such a way that z is connected to all vertices sk,j and to y. This way, we obtain the new, locally modified instance (GN , SN , cN ) with one added vertex.
186
H.-J. B¨ ockenhauer et al.
We begin with the upper bound. To this end, we construct the following Steiner tree. For each variable xΦ i , if ϕi = 1, then we connect all auxiliary variables ai,j as well as y to the vertex xi . Otherwise, if ϕi = 0, then we connect these vertices to x ¯i . This way, the variable-vertices in the constructed tree correspond to the assignment ϕ. Let X be the set of variable-vertices that are now part of the constructed tree. For any clause CiΦ that is satisfied by ϕ, we use one edge of cost 1 to connect the clause-vertex Ci to a vertex from X. We connect all clause-vertices of non-satisfied clauses to an arbitrary vertex from X with cost 1 + γ. Furthermore, we use all m · 1/γ + 1 edges of cost 1 from z. The overall cost of that Steiner tree is (1 + 1/γ)n + m + (1 − σ)m · γ + m · 1/γ + 1. Note that the upper bound decreases with growing σ. For the lower bound, note that, since we assume γ ≤ 1, there is an optimal solution in normal form for (GN , SN , cN ) that contains z and all its edges of cost 1. Suppose that, in some optimal solution in normal form, there is a vertex sk,j that is not connected to z. Then, according to our argumentation above, we can assume this vertex to be connected to Ck . But then, connecting all splittingvertices of Ck to z instead of to Ck does not increase the cost of the solution. We still have to ensure that the modified solution is connected. If the solution already contains the edge {y, z}, then either Ck is connected to the remaining tree and we are done or Ck is only connected to Ck . In the latter case, there must be an edge e in the given optimal Steiner tree that connects the gadget of clause k to the remaining graph. By removing the two edges e and {Ck , Ck } and adding an edge between Ck and a vertex from X, however, we obtain a connected solution of at most the same cost. For amortizing the cost of {y, z}, we only need one clause gadget where its clause-vertex can be connected to X with cost 1, which always exists in an optimal solution in normal form. It is not hard to verify that an optimal solution does not need the vertices Ci . Let T be an optimal Steiner tree for the given instance in normal form that contains z and all of its incident edges of cost 1 and none of the vertices Ci . The subtree T induced by the auxiliary variables, the vertex y, and the variablevertices that are connected to auxiliary variables has a fixed cost of (1 + 1/γ)n. Additionally, all clause-vertices have to be in T . For each of them, there is an edge of cost at least 1. There are at most σm clause-vertices connected to T with cost 1, since more such clause-vertices would imply that there is an assignment ϕ that satisfies more than σm clauses in Φ. The remaining clause-vertices are either connected with cost 1 + γ to T , or they are connected to variable vertices outside of T with cost 1. In the latter case, however, the number of clausevertices connected to the same variable-vertex v is limited, because there are exactly s clauses in Φ with the same variable. Furthermore, there cannot be more than s/2 different clauses connected to v, since otherwise changing ϕ such that v is in T would satisfy additional clauses, contradicting the optimality of ϕ. For connecting v to T , an edge of cost 1 is necessary. Therefore, the average cost for connecting a clause-vertex to a variable-vertex outside of T is at least (s/2 + 1)/(s/2) = 1 + 2/s. Altogether, a lower bound on the cost of the optimal Steiner tree is (1 + 1/γ)n + m + (1 − σ)m min{γ, 2/s} + m · 1/γ + 1.
The Steiner Tree Reoptimization Problem
187
Note that there are k ·m literals in Φ, and each variable occurs exactly s times, and therefore n = km/s. Therefore, the upper bound is m · ((1 + 1/γ)k/s + 1 + (1 − (p − ε)) · γ) + m · 1/γ + 1 and the lower bound is m · ((1 + 1/γ)k/s + 1 + (1 − p) min{γ, 2/s}) + m · 1/γ + 1.
With this preparation, showing the APX-hardness for adding vertices can be done by using the APX-hardness of E5-OCC-MaxE3SAT [14]. For removing a terminal or a non-terminal, a simple argumentation shows the corresponding reoptimization problem to be as hard as the original problem. Theorem 1. The Min-(1, 1 + γ)-STRP-lm for γ > 0 and the Min-Δβ -STRP-lm for β > 1/2 and lm ∈ {AddT erm, AddN onT erm, RemT erm, RemN onT erm} are APX-hard. Note that Theorem 1 implicitly provides an alternative proof for the APXhardness of the problems Min-(1, 1 + γ)-STP and Min-Δβ -STP. Based on the observations above, we can show that also the remaining reoptimization problems from Definition 1 are NP-hard. Theorem 2. The Steiner tree reoptimization problem Min-(1, 1 + γ)-STRP-lm is NP-hard for all local modifications from Definition 1.
4
Approximation Algorithms
We start this section with an approximation algorithm for the Min-Δβ -STP. This algorithm, besides being interesting by itself, will be useful for some of the subsequent approximation algorithms for reoptimization. In any instance (G, S, c) consisting of terminals only, i. e., if S = V (G), the minimum spanning tree is an optimal solution to the minimum Steiner tree problem. Intuitively speaking, the minimum Steiner tree problem can be viewed as the problem of finding a subset Y of non-terminals which minimizes the cost of a minimum spanning tree on S ∪ Y over all possible choices of Y . But also in those graphs in which the optimal solutions contain non-terminal vertices, the minimum spanning tree on the set of terminals gives a useful approximation of the minimum Steiner tree. To estimate the quality of this approximation, we need the following technical lemma for the subsequent approximability result. Lemma 4. Given an input instance (G, S, c) for Min-Δβ -STP, for some 1/2 ≤ β ≤ 1, and a minimum Steiner tree TOpt for this instance, let T1 , . . . , Tk be the maximal subtrees of TOpt consisting of non-terminals only. For any Ti , let N (Ti ) be the set of neighbors of Ti in TOpt . Then there exists a connected subgraph H of G with the following properties. 1.) V (H) = S, 2.) H contains a cycle on the vertices of N (Ti ) for all i ∈ {1, . . . , k}, and 3.) c(H) ≤ 2β · c(TOpt ). Theorem 3. Let G be graph with cost function c satisfying the β-triangle inequality for 1/2 ≤ β ≤ 1. Let S be a set of terminals. Then the minimum spanning tree on S is a 2β-approximation of the minimum Steiner tree for the instance (G, S, c).
188
H.-J. B¨ ockenhauer et al.
Algorithm 1. Approximation algorithm for Min-Δβ -STRP-AddNonTerm Input: (G = (V, E), S, c), TOld , (GNew = (V ∪ vNew , E ∪ {{vNew , x} | x ∈ V }), S, c) 1: Compute the minimum spanning tree TMST on the vertex set S ∪ {vNew }. 2: Compute the best solution TAlg between TOld and TMST . Output: The Steiner tree TAlg .
Polynomial-Time Approximation Schemes. Here, we present polynomialtime approximation schemes for some of the reoptimization variants. The concept in all cases relies on the properties of graphs with sharpened triangle inequality. Theorem 4. Let (G, S, c) be a Steiner tree instance where c satisfies the sharpened β-triangle inequality for some 1/2 < β < 1. Then there is a PTAS for the reoptimization variants of the Min-Δβ -STP when the edge-costs are increased or decreased and when the status of vertices is changed, i. e., when a terminal becomes a non-terminal or vice versa. Adding a Non-Terminal. Now, we consider the Steiner tree reoptimization problem with the local modification of adding a non-terminal to the graph. We assume that the new instance satisfies the β-triangle inequality for the same β as the old instance. We design an algorithm for Min-Δβ -STRP-AddNonTerm that outputs the better of the following two feasible solutions: The first feasible solution is simply the given optimal solution to the old instance, the second is obtained by computing a minimum spanning tree on the terminals together with the newly inserted vertex. This procedure is shown in Algorithm 1. For analyzing the cost of TMST as computed in Algorithm 1, we want to compare it to an optimal solution TOpt for the new instance. For this comparison, we deal with every subtree of TOpt rooted in a neighbor of vNew , together with its connection to vNew , separately. For our estimations, we need the following technical lemma which is a generalization of Lemma 4. Lemma 5. Let G be a graph and let S ⊆ V be a set of terminals in G. Let T be a subtree of G rooted in some non-terminal vertex x of degree ≥ 2, and let ST = S ∩ V (T ) be the set of terminals in T . Let vNew ∈ V − V (T ) be one additional vertex. Let xlast be the last terminal in T as found by a depth-first search starting from x. Then there exists a connected subgraph H with V (H) = {vNew } ∪ ST with costs c(H) ≤ β · c(vNew , x) + 2β · c(T ) − β · c(x, xlast ). Theorem 5. For any 1/2 ≤ β ≤ 1, Algorithm 1 is a linear-time 12 + β approximation algorithm for Min-Δβ -STRP-AddNonTerm. Adding a Terminal. In this section, we consider the case where the inserted vertex is a terminal. Here, the old optimal solution is not feasible for the new instance. Therefore, we analyze two different candidates for a good feasible solution. The first candidate is a minimum spanning tree for the new instance on all terminals including the newly added one. The second candidate is obtained by connecting the inserted terminal to a vertex in the old optimal solution by the cheapest edge possible. This procedure is shown in Algorithm 2.
The Steiner Tree Reoptimization Problem
189
Algorithm 2. Approximation algorithm for Min-Δβ -STRP-AddTerm Input: (G = (V, E), S, c), TOld , (GNew = (V ∪ vNew , E ∪ {{vNew , x} | x ∈ V }), S ∪ {vNew }, c) 1: Compute the minimum spanning tree TMST over the set of vertices S ∪ {vNew }. 2: Compute TOld+ from TOld by choosing the cheapest edge connecting vNew with S. 3: Compute the best solution TAlg between TOld and TMST . Output: The Steiner tree TAlg .
For analyzing the approximation ratio of Algorithm 2, we compare the costs of the computed solutions TMST and TOld+ to the costs of an optimal solution for the new instance. We distinguish two cases for the proof according to whether there exists a non-terminal among the neighbors of vNew in an optimal solution TOpt for the new instance or not. The proof for the case where there is a neighboring non-terminal will again make use of Lemma 5. Theorem 6. For any 12 ≤ β ≤ 1, Algorithm 2 is a linear-time 12 + β -approximation algorithm for Min-Δβ -STRP-AddTerm. Proof. The construction of both TMST and TOld+ is obviously possible in linear time. Let TOpt be an optimal solution of the new minimum Steiner tree instance. As in the proof of Theorem 5, let TOld be the optimal solution of the old instance and let TMST and TOld+ be the outputs of step 2 and step 3 of Algorithm 2, respectively. Let {x1 , . . . , xk } be the neighbors of vNew in TOpt . By deleting vNew from TOpt , we get a set of trees T1 , . . . , Tk . In the following, we denote the set of terminal neighbors of vNew in TOpt by ΓT and the set of non-terminal neighbors by ΓN . We denote by γ1 the sum of the costs of edges connecting vNew with a terminal in TOpt , i. e., γ1 = xi ∈ΓT c(vNew , xi ), and by γ2 the with a non-terminal in TOpt , i. e., γ2 = sum of costs of edges connecting v New c(v , x ). Let γ be the sum of the costs of all trees Ti where the root New i 3 xi ∈ΓN xi ∈ ΓT , and let γ4 be the sum of the costs of all trees Tj where the root xj ∈ ΓN (see Fig. 2). Hence, c(TOpt ) = γ1 + γ2 + γ3 + γ4 . Tj terminal non-terminal
γ4 xj
ΓN
γ2
vNew γ1 ΓT
γ3 Fig. 2. The structure of the new optimal solution in the proof of Theorem 6
190
H.-J. B¨ ockenhauer et al.
Case 1: |ΓN | = 0, (γ2 = γ4 = 0). First we look at the case where all vertices xi in the neighbourhood of vNew are terminals. This implies c(TNew ) = γ1 + γ3 . In the case, where there is only one terminal x in the neighborhood of vNew in TOpt , Algorithm 2 connects vNew by the edge {vNew , x} in step 3 and finds the optimal solution. Thus, we may assume that |ΓT | ≥ 2. In order to estimate c(TMST ), for each tree Ti , we first construct a graph Hi containing the terminals of Ti . By connecting vNew to Hi by the edge {vNew , xi }, we get a graph H which consists of all terminals in GNew , i. e., V (H) = S ∪ {vNew }. It is obvious that the cost of TMST is smaller than c(H). Now we can estimate c(TMST ) as follows: c(TMST ) ≤
k
c(vNew , xi ) +
i=1
k
c(Hi ).
(1)
i=1
According to Lemma 4, the cost of Hi satisfies c(Hi ) ≤ 2β · c(Ti ), and thus k i=1 c(Hi ) ≤ 2β · γ3 . Together with Equation (1), we get c(TMST ) ≤ γ1 + 2β · γ3 .
(2)
From this, we get c(TOld+ ) = c(TOld ) + c(vNew , xfirst ), where {vNew , xfirst } is the cheapest edge from vNew to a terminal in G. To estimate TOld+ , we connect the terminals x1 , . . . , xk by a path P . The union of P with the trees Ti constitutes a feasible solution for the old instance. So we know that the cost of the old optimal solution is at most the cost of the union of P and all Ti , i. e., c(TOld ) ≤ k k c(P ) + i=1 c(Ti ). For the cost of P , this implies c(P ) ≤ 2β · i=1 c(vNew , xi ) − β · c(vNew , xl ) − β · c(vNew , xm ), where xl = xm , and thus c(TOld ) ≤ 2β · γ1 + γ3 − β · c(vNew , xl ) − β · c(vNew , xm ). Without loss of generality, let c(vNew , xl ) < c(vNew , xm ). Then we can estimate c(TOld+ ) as c(TOld+ ) ≤ 2β · γ1 + γ3 − 2β · c(vNew , xl ) + c(vNew , xl ) ≤ 2β · γ1 + γ3 .
(3)
By adding Equations (2) and (3), we get 2 · c(TAlg ) ≤ c(TMST ) + c(TOld+ ) ≤ γ1 + 2β · γ3 + 2β · γ1 + γ3 ≤ (1 + 2β) · (γ1 + γ3 ) = (1 + 2β) · c(TNew ) and thus c(TAlg ) ≤ (1 + 2β)/2 · c(TNew ) = (1/2 + β) · c(TNew ). Case 2: |ΓN | ≥ 1. This case follows by Lemma 5 and a similar argumentation as in Case 1.
References 1. Archetti, C., Bertazzi, L., Speranza, M.G.: Reoptimizing the traveling salesman problem. Networks 42(3), 154–159 (2003) 2. Archetti, C., Bertazzi, L., Speranza, M.G.: Reoptimizing the 0-1 knapsack problem. Tech. Rep. 267, University of Brescia (2006) 3. Ausiello, G., Escoffier, B., Monnot, J., Paschos, V.T.: Reoptimization of minimum and maximum traveling salesman’s tours. In: Arge, L., Freivalds, R.V. (eds.) SWAT 2006. LNCS, vol. 4059, pp. 196–207. Springer, Heidelberg (2006)
The Steiner Tree Reoptimization Problem
191
4. Bern, M.W., Plassmann, P.E.: The Steiner problem with edge lengths 1 and 2. Inf. Process. Lett. 32(4), 171–176 (1989) 5. Bil` o, D., B¨ ockenhauer, H.J., Hromkoviˇc, J., Kr´ aloviˇc, R., M¨ omke, T., Widmayer, P., Zych, A.: Reoptimization of Steiner trees. In: Gudmundsson, J. (ed.) SWAT 2008. LNCS, vol. 5124, pp. 258–269. Springer, Heidelberg (2008) 6. Bil` o, D., B¨ ockenhauer, H.J., Komm, D., Kr´ aloviˇc, R., M¨ omke, T., Seibert, S., Zych, A.: Reoptimization of the shortest common superstring problem. In: Kucherov, G., Ukkonen, E. (eds.) CPM 2009. LNCS, vol. 5577, pp. 78–91. Springer, Heidelberg (2009) 7. Bil` o, D., Widmayer, P., Zych, A.: Reoptimization of weighted graph and covering problems. In: Bampis, E., Skutella, M. (eds.) WAOA 2008. LNCS, vol. 5426, pp. 201–213. Springer, Heidelberg (2009) 8. B¨ ockenhauer, H.J., Forlizzi, L., Hromkoviˇc, J., Kneis, J., Kupke, J., Proietti, G., Widmayer, P.: Reusing optimal TSP solutions for locally modified input instances (extended abstract). In: Navarro, G., Bertossi, L.E., Kohayakawa, Y. (eds.) Proc. of the 4th IFIP International Conference on Theoretical Computer Science (TCS 2006). IFIP., vol. 209, pp. 251–270. Springer, New York (2006) 9. B¨ ockenhauer, H.J., Hromkoviˇc, J., Klasing, R., Seibert, S., Unger, W.: Approximation algorithms for TSP with sharpened triangle inequality. Inf. Process. Lett. 75, 133–138 (2000) 10. B¨ ockenhauer, H.J., Hromkoviˇc, J., Kr´ aloviˇc, R., M¨ omke, T., Rossmanith, P.: Reoptimization of Steiner trees: Changing the terminal set. Theor. Comput. Sci. 410(36), 3428–3435 (2009) 11. B¨ ockenhauer, H.J., Hromkoviˇc, J., M¨ omke, T., Widmayer, P.: On the hardness of reoptimization. In: Geffert, V., Karhum¨ aki, J., Bertoni, A., Preneel, B., N´ avrat, P., Bielikov´ a, M. (eds.) SOFSEM 2008. LNCS, vol. 4910, pp. 50–65. Springer, Heidelberg (2008) 12. B¨ ockenhauer, H.J., Komm, D.: Reoptimization of the metric deadline TSP. In: Ochma´ nski, E., Tyszkiewicz, J. (eds.) MFCS 2008. LNCS, vol. 5162, pp. 156–167. Springer, Heidelberg (2008) 13. Escoffier, B., Milaniˇc, M., Paschos, V.T.: Simple and fast reoptimizations for the Steiner tree problem. Algorithmic Oper. Res. 4(2), 86–94 (2009) 14. Feige, U.: A threshold of ln n for approximating set cover. J. ACM 45(4), 634–652 (1998) 15. Halld´ orsson, M.M., Ueno, S., Nakao, H., Kajitani, Y.: Approximating Steiner trees in graphs with restricted weights. Networks 31(4), 283–292 (1998) 16. Hwang, F.K., Richards, D.S., Winter, P.: The Steiner Tree Problems. In: Annals of Discrete Mathematics, vol. 53. North-Holland, Amsterdam (1992) 17. Karp, R.M.: Reducibility among combinatorial problems. In: Miller, R.E., Thatcher, J.W. (eds.) Complexity of computer computations, pp. 85–103. Plenum, New York (1972) 18. Pr¨ omel, H.J., Steger, A.: The Steiner Tree Problem. In: Advanced Lectures in Mathematics, Friedr. Vieweg & Sohn, Braunschweig (2002) 19. Robins, G., Zelikovsky, A.Z.: Improved Steiner tree approximation in graphs. In: Proc. of the 11th Annual ACM-SIAM Symposium on Discrete Algorithms (SODA 2000), pp. 770–779. ACM/SIAM, New York (2000) 20. Sch¨ affter, M.W.: Scheduling with forbidden sets. Discrete Appl. Math. 72(1-2), 155–166 (1997) 21. Vazirani, V.V.: Approximation Algorithms. Springer, Heidelberg (2004)
Kernelization for Maximum Leaf Spanning Tree with Positive Vertex Weights Bart Jansen Utrecht University, P.O. Box 80.089, 3508 TB Utrecht, The Netherlands
[email protected] Abstract. In this paper we consider a natural generalization of the wellknown Max Leaf Spanning Tree problem. In the generalized Weighted Max Leaf problem we get as input an undirected connected graph G = (V, E), a rational number k ≥ 1 and a weight function w : V → Q≥1 on the vertices, and are asked whether a spanning tree T for G exists such that the combined weight of the leaves of T is at least k. We show that it is possible to transform an instance G, w, k of Weighted Max Leaf in linear time into an equivalent instance G , w , k such that |V | ≤ 5.5k and k ≤ k. In the context of fixed parameter complexity this means that Weighted Max Leaf admits a kernel with 5.5k vertices. The analysis of the kernel size is based on a new extremal result which shows that every graph G that excludes some simple substructures always contains a spanning tree with at least |V |/5.5 leaves.
1
Introduction
A parameterized problem is a language L ⊆ Σ ∗ × N. An instance (x, k) ∈ Σ ∗ × N is composed of x, the classical problem instance, and the parameter k that expresses some structural property of x. A kernelization algorithm (or kernel ) is a mapping that transforms an instance (x, k) into an equivalent instance (x , k ) in time p(|x| + k) for some polynomial p, such that (x, k) ∈ L ⇔ (x , k ) ∈ L and |x |, k ≤ f (k) for a computable function f . The function f is the size of the kernel. Kernelization can be seen as a form of preprocessing with a performance guarantee on the compression that is obtained with respect to the parameter value k. Consult the survey by Guo and Niedermeier [11] for more background on kernelization, and the book by Flum and Grohe [8] for the theory of fixed parameter complexity. The recent survey by Bodlaender [2] summarizes some exciting new developments in the area of problem kernelization. When a problem is hard from some computational perspective (e.g. it is NPcomplete or inapproximable), restrictions are often imposed on the problem to see if it remains hard. On the other hand, if a problem is easy from some point of view (e.g. it is in P, or it has a polynomial-size kernel) then it is interesting to study generalizations for which this still holds. A common way of generalizing graph problems is to assign weights to vertices or edges. Such weights will often
This work was supported by the Netherlands Organisation for Scientific Research (NWO), project “KERNELS: Combinatorial Analysis of Data Reduction”.
T. Calamoneri and J. Diaz (Eds.): CIAC 2010, LNCS 6078, pp. 192–203, 2010. c Springer-Verlag Berlin Heidelberg 2010
Kernelization for Maximum Leaf Spanning Tree
193
allow real-world problems to be modeled (and hence solved) more accurately. Weighted problems are frequently investigated in the context of polynomialtime approximation algorithms; many studies [9,4,20] have been undertaken to see which weighted generalizations of well-known problems are still approximable with good bounds on the error ratio. Given the practical applications of weighted problems and the empirically observed power of kernelization algorithms and data reduction, it is surprising to note that only few kernelization algorithms exist for weighted problems. The classic O(k 2 ) Vertex Cover kernelization by Buss can also be applied for Weighted Vertex Cover [16] if all weights are at least 1, and polynomial kernels for the higher-dimensional Weighted d-Hitting Set can be obtained by generalizing the approach based on the Sunflower Lemma [15,8]. The Weighted Cluster Editing problem where each edge is given a weight has a O(k 2 ) kernel as shown in [1]. Aside from these examples, no kernelization algorithms for weighted problems are known to us. In this work we will study a generalization of the well-known Maximum Leaf Spanning Tree problem (abbreviated as Max Leaf from now on). The Max Leaf problem asks, given an undirected, connected graph G = (V, E) and an integer k, whether G has a spanning tree with at least k leaves. The problem was originally proven NP-complete by Garey and Johnson, even when restricted to planar graphs of maximum degree 4. Max Leaf is APX-complete which means it has a polynomial-time constant-factor approximation algorithm [18], but no PTAS unless P = NP. The problem of finding a spanning tree with k leaves is equivalent to finding a connected dominating set with |V | − k vertices, and these problems have many applications in circuit layout [19] and network design. The Max Leaf problem has been a popular topic of research from the parameterized complexity standpoint. When parameterized by the requested number of leaves k, it has been shown that the problem has a kernel with 3.75k vertices [6] and that there is an algorithm to solve the problem in O(4k k 2 + nO(1) ) time [14], which was later improved to O(3.4575k · nO(1) ) [17]. Using a different type of analysis this line of research lead to a O(1.8966n ) algorithm for the classical (non-parameterized) problem [7]. The related problem on directed graphs is called Maximum Leaf Out-Branching [5,14]. Max Leaf has also been studied from the perspective of extremal graph theory [19,10,13,3]. This paper focuses on the following natural generalization: Weighted Max Leaf Instance: An undirected connected graph G = (V, E); a weight function w:V → Q≥1 on the vertices; a rational number k ≥ 1. Question: Does G have a spanning tree with leaf set L such that v∈L w(v) ≥ k? Parameter: The value k. Observe that this definition requires vertex weights to be rational numbers not smaller than 1. There is a good motivation for this restriction; when vertex weights are allowed to be arbitrarily small fractions then the problem is NPcomplete for k = 1, since an unweighted graph G has a spanning tree with k leaves if and only if that same graph has a spanning tree with leaf weight 1 if we
194
B. Jansen
set all vertex weights to 1/k. If a weight value of 0 is allowed then it can be shown by a reduction from Independent Set that the resulting problem is hard for W [1], a result which will be published elsewhere. Therefore we focus on weights that are at least 1. This may still lead to small (and hence practical) values for the parameter value k since the relative weight differences between vertices may be small, thus yielding a small parameter value for the overall target weight. Our Contribution. The main result of this paper is that the Weighted Max Leaf problem has a kernel with 5.5k vertices when every weight is a rational number not smaller than 1. The kernelization is achieved by a small set of simple reduction rules that can be applied in linear time. The reduction rules make nontrivial use of the vertex weights, thus giving an example of how kernelization can be applied to weighted problems. The existing 3.75k kernelization by EstivillCastro et al. [6] does not work in the weighted setting, because it relies on the fact that two adjacent degree-2 vertices can always be leaves in an optimal spanning tree if the edge between them is not a bridge - this no longer holds in the weighted variant. The analysis of the kernel size relies on a new extremal graph-theoretic result: we give a constructive proof that every connected undirected graph G = (V, E) that avoids some simple subgraphs (see Definition 1) has a spanning tree with at least |V |/5.5 leaves. To obtain this result we extend the technique of “amortized analysis by keeping track of dead leaves”, which was originally used by Griggs et al. [10] to show that every connected cubic graph G has a spanning tree with at least |V |/4 leaves. We also show that the multiplicative constant of 5.5 in the kernel size is best-possible with respect to the given set of reduction rules. Organization. We give some preliminaries in Section 2. In Section 3 we obtain a structural result on the existence of spanning trees with many leaves in graphs that avoid some simple subgraphs. Section 4 uses this structural result to present the kernelization algorithm.
2
Preliminaries
For a graph G = (V, E) we will also use V (G) and E(G) to denote the vertex and edge set of G, respectively. This will be convenient when discussing multiple graphs in the same context. All considered graphs are simple, undirected and connected. For v ∈ V we denote the open neighborhood of v by NG (v). Throughout this work we omit subscripts if these are clear from the context. The neighborhood of a set S ⊆ V is defined as NG (S) := ∪v∈S NG (v) \ S. The degree of a vertex v in graph G is denoted by degG (v). We write G ⊆ G if G is a subgraph of G. For X ⊆ V we denote by G − X the subgraph of G that is induced by the vertices not in X. A cutset for a connected graph G is a set S ⊆ V such that G − S is not connected. Vertex v is a cut vertex if {v} is a cutset. The leaf set of a graph G = (V, E) is the set of degree-1 vertices, denoted as w:V → Q≥1 Leaves(G) := {v ∈ V | degG (v) = 1}. If we have a weight function for graph G then we can define its leaf weight as lww (G) := v∈Leaves(G) w(v).
Kernelization for Maximum Leaf Spanning Tree
195
A path component in a graph G is a path P on vertices u, s1 , s2 , . . . , sq , v such that successive vertices are connected by an edge, all the vertices si are distinct and have degree 2, and such that deg(u), deg(v) = 2. Note that we explicitly allow u and v to be the same vertex. The vertices u, v are called the endpoints of the path component, and the vertices si are the inner vertices. We define the size of a path component to be equal to the number q of inner vertices. To simplify the exposition we use Kn to refer to the complete graph on n vertices. The set of rational numbers not smaller than 1 is denoted by Q≥1 . The following folklore lemma on spanning trees will help to verify the correctness of the reduction rules. Lemma 1 ([12]). If S ⊆ V forms a cutset for graph G = (V, E), then there is no spanning tree T ⊆ G in which all vertices in S are leaves.
3
Spanning Trees with Many Leaves in Graphs without Long Path Components
In this section we prove a lower bound on the number of leaves that can be obtained in spanning trees for graphs that do not contain long path components and which avoid some simple subgraphs. Definition 1. Let C be the class of graphs G = (V, E) that satisfy the following properties: (i) (ii) (iii) (iv)
Graph G is simple and connected. The graph is not isomorphic to a simple cycle. The maximum size of a path component in G is at most 3. Every vertex v ∈ V with deg(v) = 1 is adjacent to a vertex of degree at least 3. (v) If G contains a triangle on three vertices x, y, z (i.e. {xy, xz, yz} ⊆ E), then at least one of the vertices x, y, z has a degree in G of at least 4. = NG (y). (vi) If x, y are two distinct degree-2 vertices, then NG (x)
Theorem 1. Every graph G = (V, E) ∈ C has a spanning tree with at least |V |/5.5 leaves. Proof. Consider G = (V, E) ∈ C. Observe that connected graphs with fewer than 3 vertices do not satisfy Property (iv), so any graph G ∈ C must have |V | ≥ 3. Our proof uses the method of “amortized analysis by keeping track of dead leaves” as introduced by Griggs et al. [10]. The proof is constructive and consists of a series of operations that can be used to initialize a tree T ⊆ G, and to augment T if it does not yet span G. We will prove that the resulting tree T has enough leaves by showing for every augmentation step that the increase in the total size of the tree is balanced against the increase in the number of leaves of the tree. To analyze the number of leaves in the resulting spanning tree we use the notion of dead leaves. A leaf v ∈ Leaves(T ) is called dead if all its neighbors in G are also in T . More formally, leaf v is dead iff NG (v) ⊆ V (T ).
196
B. Jansen
Every leaf vertex that is not dead, is alive. We define the following abbreviation for the set of live leaves: LiveLeaves(T ) := {v ∈ Leaves(T ) | NG (v) \ V (T ) = ∅}. G
(1)
If vertex v ∈ V has a neighbor u ∈ NG (v) but the vertex u is not in T , then we say that v has a neighbor u outside the tree. If u ∈ NG (v) and u ∈ V (T ) then vertex v has a neighbor u inside the tree. A vertex x ∈ NG (V (T )) is said to be adjacent to the tree T . We also need the following concept. Definition 2. For a tree T ⊆ G, we say that a vertex v is a split vertex if and only if v is a live leaf of degree 2, and NG (v) \ V (T ) = {u} for some vertex u with degG (u) = 2. We denote the set of all split vertices of T with respect to G by SplitG (T ). Our analysis uses the following properties of the tree T that is under construction: – – – –
L, the number of leaves of T , D, number of dead leaves of T , S, the number of split vertices of T , N , the total number of vertices of T .
We will give a series of augmentation operations that satisfy the following incremental inequality: 4ΔL + 1.5ΔD + ΔS ≥ ΔN. (2) The Δ values in this inequality represent the changes in the respective quantities in the new tree compared to the old tree. For example, if the tree had 5 leaves before the augmentation operation and it has 7 leaves after the operation then ΔL = 7 − 5 = 2. Observe that in a spanning tree there can be no live leaves: all neighbors to all vertices must be in the tree. This means that all leaves must be dead and hence L = D. Since there are no live leaves in a spanning tree we also have S = 0 for such trees. It follows that if we grow a spanning tree such that every augmentation step satisfies the incremental inequality, then by summing the inequalities over the individual augmentation steps we find that the final tree satisfies 4L + 1.5D + S ≥ N ; using the fact that L = D and S = 0 on spanning trees we can then conclude that | Leaves(T )| ≥ |V |/5.5 for a tree T that is grown by operations that respect the incremental inequality. So to prove the claim all that remains is to show that there exists a set of augmentation operations that can grow a spanning tree while respecting the incremental inequality. The initialization of the tree T is simple: we just pick a vertex v of maximum degree in G as the root of the tree, and we add edges to all neighbors of v to the tree. So after initialization we have a tree with one internal vertex v and leaf set Leaves(T ) = NG (v). It is easy to verify that such an initialization always satisfies the incremental inequality since ΔS and ΔD are non-negative and ΔL = ΔN − 1 ≥ 1. We need the following definition to describe the operations that augment the tree.
Kernelization for Maximum Leaf Spanning Tree
(a)
(b) (4, 2, 0, 4)
(c) (1, 1, 1, 2)
(d) (0, 0, 1, 1)
197
(e) (0, 2, −2, 1)
Fig. 1. This sequence shows the effect of successive vertex expansions. Thin lines indicate edges in G but not in T , and thick lines represent edges that are in both. Each expansion is labeled with the corresponding vector (ΔL, ΔD, ΔS, ΔN ) of changes in the measured quantities. 1(a): the graph G without a tree subgraph. 1(b): initialized T as the star around vertex d, causing a, f to become dead leaves and b, g to become live leaves. 1(c): expanded g, adding i, h to T . Vertex h is now a split vertex. 1(d): expanded b, causing c to become a split vertex as well. 1(e): expanded c, which causes vertex h to transform from a split vertex into a dead leaf. CT →T = {h} for this step.
Definition 3 (Vertex Expansion). Let T ⊆ G be a tree. The expansion of a vertex v ∈ V (T ) yields an augmented tree T ⊆ G, where T is obtained by adding all edges vu ∈ E(G) with u ∈ NG (v) \ V (T ) to the tree T . Figure 1 shows an example of vertex expansions. It follows from the definition that the expansion of a vertex can never decrease the number of leaves in the tree: if v has a neighbor u ∈ NG (v) \ V (T ), then expansion of v will cause v to become internal (decreasing the number of leaves), but it will also cause u to become a new leaf. If v has no neighbors in G that are outside T then the expansion has no effect. The operations that we use to augment the tree consist of series of vertex expansions. This means that ΔL ≥ 0 for every augmentation step. Since the expansion of a vertex cannot change the fact that a leaf is dead, we also have ΔD ≥ 0 for all our augmentation operations. By growing the tree through augmentation operations we will maintain the invariant that for every internal vertex of T , all its neighbors in G are also in T . To simplify the bookkeeping we introduce the following concept. Definition 4. Let T ⊆ G be a tree subgraph of G, and let T ⊆ G be the tree that is obtained from T by a sequence of vertex expansions. We define the set CT →T of converted split vertices as the set of vertices that are split vertices in T , but dead leaves in T : CT →T := v ∈ V (G) | v ∈ Split(T ) ∧ v ∈ Leaves(T ) ∧ NG (v) \ V (T ) = ∅ G
G
Lemma 2. Let T ⊆ G be a tree subgraph of G, and let T be the tree that results after the successive expansion of vertices x1 , . . . , xk . Let c := | SplitG (T ) ∩ {x1 , . . . , xk }|. For this operation it holds that ΔS ≥ −|CT →T | − c and ΔD ≥ |CT →T |.
198
B. Jansen
We are now ready to present the augmentation operations. The order in which these operations are presented is important: if more than one operation is applicable, then the one with the smallest index must be applied. This allows augmentation operations to exploit the fact that certain structures are eliminated by earlier operations. Therefore we adopt the following convention: when describing an augmentation, we will always assume that no earlier augmentation is applicable. Here are the first six augmentation operations: 1. If there is a live leaf v ∈ LiveLeavesG (T ) with at least 2 neighbors outside of T , then expand v. 2. If there is a simple path P = x, y in G such that {x, y} ∩ V (T ) = {x} and |NG (y) \ V (T )| ≥ 2 then expand x and y. 3. If there is a vertex v ∈ NG (V (T )) with at least 2 neighbors x, y inside T , then expand the neighbor x. 4. If there is a vertex v ∈ LiveLeavesG (T ) that has a degree-1 neighbor u outside of T , then expand v. 5. If there is a simple path P = x, y, z in G such that {x, y, z} ∩ V (T ) = {x}, degG (x) ≥ 3 and degG (y) = degG (z) = 2, then expand vertex x. 6. If there is a simple path P = x, y, z in G such that {x, y, z} ∩ V (T ) = {x}, vertex x is not a split vertex and degG (z) ≥ 3, then expand vertices x, y, z. Lemma 3. If augmentation operations 1-6 cannot be applied, then every live leaf v ∈ LiveLeavesG (T ) is a split vertex.
The augmentation operations and Lemmas that we have presented form the main ingredients of the proof. Due to space restrictions much of the details have to be omitted from this section - we refer the interested reader to the full paper [12] for the complete proof. We give a sketch of the remaining steps. It can be shown that each of the six presented augmentation operations satisfies the incremental inequality. When none of those operations can be applied to augment the tree T ⊆ G, then the graph must have a very specific structure near the boundary of the tree. This structure is captured by Lemma 3, which shows that in such situations vertices of T can only be adjacent to vertices outside T on paths of degree-2 vertices. The full proof proceeds by a case analysis on the structure of the graph near the boundary of the tree, showing that for every possible structure there is a valid new augmentation operation that can augment the tree to this structure. By introducing 20 additional augmentation operations this leads to the conclusion that whenever the tree does not yet span G, there is always an applicable augmentation operation that satisfies the incremental inequality. Using the arguments given at the beginning of the proof the claim of Theorem 1 then follows: any graph G ∈ C must have a spanning tree with at least |V (G)|/5.5 leaves.
4
Kernelization
In this section we describe the kernelization for Weighted Max Leaf. We first specify a set of reduction rules, then show that these can be applied efficiently
Kernelization for Maximum Leaf Spanning Tree
199
and finally we analyze the resulting reduced instances. The reduction rules are presented in a structured, 3-stage format. They transform an instance G, w, k into an instance G , w , k such that G has a spanning tree with leaf weight at least k if and only if G has a spanning tree with leaf weight at least k . Any reduction rule that satisfies these properties is called safe. The reduction rules are illustrated by examples in Figure 2.
(a) Rule [1].
(c) Rule [3].
(b) Rule [2].
(d) Rule [4].
Fig. 2. Examples of the reduction rules. The reduced structure is shown below the original structure. The numbers represent vertex weights.
Reduction Rule 1. Shrink large path components Structure: A path component P = u, s1 , s2 , . . . , sq , v of size q ≥ 4 with endpoints u, v of degree at least 3, such that w(s1 ) ≥ w(sq ). Operation: Remove s2 , . . . , sq−1 and their incident edges from G. Add a new vertex s with NG (s ) := {s1 , sq }, and set w (s ) := maxq−1 i=1 (w(si )+ w(si+1 ) − w(s1 )). Justification: If a spanning tree avoids an edge with both endpoints inside the path component, it is always optimal to avoid an edge that maximizes the combined weight of its endpoints. The reduced graph offers the same connection and weighting possibilities as the original. Reduction Rule 2. Shrink paths leading to a degree-1 vertex Structure: Path component P = u, s1 , s2 , . . . , sq , v of length q ≥ 1 where degG (v) = 1. Operation: Replace vertices s1 , . . . , sq and their incident edges by a direct edge uv. Justification: Every vertex si is a cut vertex and will never be a leaf in a spanning tree.
200
B. Jansen
Reduction Rule 3. Reduce triangles with simple neighborhoods Structure: Triangle on three vertices x, y, z such that every vertex of the triangle has at most one neighbor not in the triangle, and G is not isomorphic to K3 . Let x have minimum weight among {x, y, z}. Operation: Remove all the edges between vertices x, y, z. Add a new vertex m with NG (m) := {x, y, z} and set w (m) := w(x). Justification: Any spanning tree must avoid at least one edge on the triangle. The reduced graph allows the same topology for spanning trees, but has fewer high-degree vertices. Reduction Rule 4. Reduce degree-2 vertices with identical neighborhoods Structure: Two vertices u, v with w(u) ≥ w(v) and NG (u) = NG (v) = {x, y} such that V \ {u, v, x, y} = ∅. Operation: Remove u and its incident edges, set k := k − w(u). Justification: There is always an optimal spanning tree in which u is a leaf. Although Rule [3] increases the number of vertices, it still effectively simplifies the instance. If vertex v is in a triangle that is reduced by this rule then the neighborhood of v is simplified by the reduction: if v had degree 3 then its degree is reduced to 2, and if it had degree 2 then its degree is reduced to 1. If no reduction rules are applicable to an instance, then such an instance is called reduced. The structure of reduced instances is captured by the class C (see Definition 1), which is formalized by the following theorem. Theorem 2. If G , w , k is a reduced instance of Weighted Max Leaf that is not isomorphic to a simple cycle and |V (G )| ≥ 3, then G ∈ C.
Since a kernelization algorithm must be a polynomial-time reduction, we now show that the reduction rules can be applied efficiently. It is easy to see that we can test in polynomial time whether a reduction rule is applicable to the graph, and apply the reduction if necessary. All reduction rules except Rule [3] reduce the number of vertices, and for Rule [3] it can be verified that once the rule has been applied to a triangle, it will never be applied to any vertex of that triangle again. These simple observations show that we can obtain a reduced instance in polynomial time. By a more careful and somewhat lengthy analysis it is actually possible to show that a reduced instance can be computed in O(|V | + |E|) time. Theorem 3. Given an instance G, w, k of Weighted Max Leaf with G = (V, E) encoded as an adjacency-list, it is possible to exhaustively apply the reduction rules in O(|V | + |E|) time to obtain an equivalent reduced instance
G , w , k . These ingredients allow us to obtain the main result.
Kernelization for Maximum Leaf Spanning Tree
201
Theorem 4. The Weighted Max Leaf problem has a kernel with at most 5.5k vertices: there is an algorithm that takes an instance G, w, k of Weighted Max Leaf as input, and computes an equivalent instance G , w , k such that |V (G )| ≤ 5.5k and k ≤ k, in linear time. Proof. We sketch the kernelization procedure. When supplied with an input
G, w, k the algorithm first computes a reduced instance G , w , k in linear time using Theorem 3. The safety of the reduction rules ensures that G, w, k is a yes-instance if and only if G , w , k is a yes-instance. By the definitions of the reduction rules we know that k ≤ k. If the graph G is isomorphic to a simple cycle then the problem can be decided in linear time: the maximum leaf weight that can be obtained by a spanning tree in a simple cycle is equal to the maximum over all edges of the combined weight of the edge endpoints. So when G is isomorphic to a simple cycle we can decide the problem and output a trivial 1-vertex instance that yields the same answer. Assume from now on that G is not a simple cycle. If k ≤ 1 then the algorithm outputs a trivial yes instance. If |V (G )| ≥ 5.5k ≥ 5.5 then the answer to the decision problem must be yes: since G is not isomorphic to a cycle Theorem 2 shows that G ∈ C, which implies by Theorem 1 that there is a spanning tree T ⊆ G with at least |V (G )|/5.5 ≥ k leaves. Noting that every vertex has a weight not smaller than 1, the leaf weight of T must be at least k which implies that
G , w , k is indeed a yes instance. We now output a trivial 1-vertex instance that yields this answer. If |V (G )| < 5.5k then the size of the output graph is bounded as required since k ≤ k, and we output G , w , k .
5
Conclusion
We have presented a simple problem kernel with 5.5k vertices for Weighted Max Leaf, using new weight-based reduction rules. This serves as an example of how to obtain effective and efficient data reduction on problems with vertex weights. A large part of this work was devoted to the proof of a combinatorial result that graphs excluding some simple substructures always have spanning trees with many leaves; using this result the kernelization effort reduces to eliminating those substructures in the input graph without blowing up the parameter value. The use of this kernelization algorithm is not restricted to solving the decision variant of Weighted Max Leaf, but it can also be used to construct a spanning tree with the desired leaf weight if one exists. This stems from the fact that all the reduction rules can be reversed to lift a spanning tree for the reduced graph back to the original graph, and from the fact that the combinatorial proof of the extremal result is constructive. When Theorem 1 assures there is a spanning tree with at least k leaves (and hence leaf weight at least k), then such a spanning tree can be found in polynomial time by executing the augmentation operations. The size of the resulting problem kernel directly corresponds to the extremal bound from Theorem 1. The factor 5.5 in this theorem is best-possible as shown
202
B. Jansen
Fig. 3. Component that shows that the factor 5.5 is best-possible: the graph obtained by replacing every vertex of a simple cycle of length n by this subgraph is a member of C. It has 11n vertices and at most 2n + 2 leaves in any spanning tree.
by the construction in Figure 3, which implies that the analysis of the kernel size is tight. It can be shown that Rule [1] and Rule [2] are sufficient to obtain a kernel of 7.5k vertices, and that successively adding Rule [3] and Rule [4] leads to kernels with 7k and 5.5k vertices, respectively. We found a reduction rule to eliminate the structure shown in Figure 3, but we chose not to incorporate this rule in the presentation since it does not lead to a kernel with less than 5.25k vertices while it significantly complicates the proof of the required strengthening of Theorem 1. The proof of the extremal result of Theorem 1 uses an extension of the method of “amortized analysis by keeping track of dead leaves”; we extended the method by incorporating a new term ΔS in the incremental inequality, which allows us to exploit the fact that the considered graphs do not have long path components. We believe that this technique may be of independent interest since it can be used to prove similar results about leafy spanning trees in graph classes that avoid other subgraphs. There is a simpler proof of a weaker form of Theorem 1 that gives a lower bound of |V |/7.5 leaves [12]. Assuming P = NP it can be shown that Weighted Max Leaf with positive integral vertex weights has no constant-factor approximation algorithm, thus yielding an example of a problem that admits a linear-vertex kernel but no constantfactor approximation algorithm [12]. If the maximum weight of a vertex is bounded by some constant c then the existing 2-approximation algorithm by Solis-oba [18] yields a constant factor 2c-approximation for Weighted Max Leaf. The kernelization procedure for Weighted Max Leaf raises the question whether the existing FPT algorithms for Max Leaf can be converted to the weighted setting. We have verified that this is indeed the case for the O(6.75k · nO(1) ) algorithm by Bonsma and Zickfeld [3], but it is an open problem whether the O(4k nO(1) ) FPT algorithm of Kneis et al. [14] can be adapted to solve the weighted variant. The effects of different parameterizations and weights of 0 on the fixed parameter complexity of Weighted Max Leaf will be reported in another paper. Acknowledgements. I would like to thank Hans Bodlaender for his guidance and advice, Peter Rossmanith for a brief but inspiring discussion about rationalvalued vertex weights during TACO day ’09 and finally Marinus Veldhorst for inspiring me to study spanning tree problems.
Kernelization for Maximum Leaf Spanning Tree
203
References 1. B¨ ocker, S., Briesemeister, S., Bui, Q.B., Truss, A.: A fixed-parameter approach for weighted cluster editing. In: Series on Advances in Bioinformatics and Computational Biology, vol. 5, pp. 211–220. Imperial College Press, London (2008) 2. Bodlaender, H.L.: Kernelization: New upper and lower bound techniques. In: Proc. 4th IWPEC, pp. 17–37 (2009) 3. Bonsma, P.S., Zickfeld, F.: Spanning trees with many leaves in graphs without diamonds and blossoms. In: Laber, E.S., Bornstein, C., Nogueira, L.T., Faria, L. (eds.) LATIN 2008. LNCS, vol. 4957, pp. 531–543. Springer, Heidelberg (2008) 4. Crescenzi, P., Silvestri, R., Trevisan, L.: On weighted vs unweighted versions of combinatorial optimization problems. Inf. Comput. 167(1), 10–26 (2001) 5. Daligault, J., Thomass´e, S.: On finding directed trees with many leaves. In: Proc. 4th IWPEC, pp. 86–97 (2009) 6. Estivill-Castro, V., Fellows, M., Langston, M., Rosamond, F.: FPT is P-time extremal structure I. In: Proc. 1st ACiD, pp. 1–41 (2005) 7. Fernau, H., Kneis, J., Kratsch, D., Langer, A., Liedloff, M., Raible, D., Rossmanith, P.: An exact algorithm for the maximum leaf spanning tree problem. In: Proc. 4th IWPEC, pp. 161–172 (2009) 8. Flum, J., Grohe, M.: Parameterized Complexity Theory (Texts in Theoretical Computer Science). An EATCS Series. Springer, New York (2006) 9. Fujito, T., Nagamochi, H.: A 2-approximation algorithm for the minimum weight edge dominating set problem. Discrete Appl. Math. 118(3), 199–207 (2002) 10. Griggs, J.R., Kleitman, D., Shastri, A.: Spanning trees with many leaves in cubic graphs. J. Graph Theory 13, 669–695 (1989) 11. Guo, J., Niedermeier, R.: Invitation to data reduction and problem kernelization. SIGACT News 38(1), 31–45 (2007) 12. Jansen, B.: Kernelization for maximum leaf spanning tree with positive vertex weights. Technical Report UU-CS-2009-027, Department of Information and Computing Sciences, Utrecht University (2009), http://www.cs.uu.nl/research/techreps/UU-CS-2009-027.html 13. Kleitman, D.J., West, D.B.: Spanning trees with many leaves. SIAM J. Discret. Math. 4(1), 99–106 (1991) 14. Kneis, J., Langer, A., Rossmanith, P.: A new algorithm for finding trees with many leaves. In: Hong, S.-H., Nagamochi, H., Fukunaga, T. (eds.) ISAAC 2008. LNCS, vol. 5369, pp. 270–281. Springer, Heidelberg (2008) 15. Kratsch, S.: Polynomial kernelizations for MIN F + Π1 and MAX NP. In: Albers, S., Marion, J.-Y. (eds.) 26th STACS, Leibniz-Zentrum fuer Informatik (March 2009) 16. Niedermeier, R., Rossmanith, P.: On efficient fixed-parameter algorithms for weighted vertex cover. J. Algorithms 47(2), 63–77 (2003) 17. Raible, D., Fernau, H.: An amortized search tree analysis for k-leaf spanning tree. In: Proc. 36th SOFSEM, pp. 672–684 (2010) 18. Solis-oba, R.: 2-approximation algorithm for finding a spanning tree with the maximum number of leaves. In: Bilardi, G., Pietracaprina, A., Italiano, G.F., Pucci, G. (eds.) ESA 1998. LNCS, vol. 1461, pp. 441–452. Springer, Heidelberg (1998) 19. Storer, J.A.: Constructing full spanning trees for cubic graphs. Information Processing Letters 13(1), 8–11 (1981) 20. Zimand, M.: Weighted NP optimization problems: Logical definability and approximation properties. SIAM J. Comput. 28(1), 36–56 (1999)
A Planar Linear Arboricity Conjecture Marek Cygan1 , L ukasz Kowalik1, and Borut Luˇzar2, 1
2
Institute of Informatics, University of Warsaw, Poland {cygan,kowalik}@mimuw.edu.pl Institute of Mathematics, Physics, and Mechanics, Ljubljana, Slovenia
[email protected]
Abstract. The linear arboricity la(G) of a graph G is the minimum number of linear forests (graphs where every connected component is a path) that partition the edges of G. In 1984, Akiyama et al. [1] stated the Linear Arboricity Conjecture (LAC), that the of any linear arboricity Δ+1 simple graph of maximum degree Δ is either Δ or . In [14,15] 2 2 it was proven that LAC holds for all planar graphs. LAC implies that for Δ odd, la(G) = Δ . We conjecture that for 2 planar graphs this equality is true also for any even Δ ≥ 6. In this paper we show that it is true for any Δ ≥ 10, leaving open only the cases Δ = 6, 8. We present also an O(n log n) algorithm for partitioning a planar graph into max{la(G), 5} linear forests, which is optimal when Δ ≥ 9.
1
Introduction
In this paper we consider only undirected and simple graphs. A linear forest is a forest in which every connected component is a path. The linear arboricity la(G) of a graph G is the minimum number of linear forests in G, whose union is the set of all edges of G. This one of the most natural graph covering notions was introduced by Harary [10] in 1970. Note that for any graph of maximum degree Δ one needs at least Δ 2 linear forests to cover all the edges. If Δ is even and the graph is regular, Δ 2 forests do not suffice, for otherwise every vertex in every forest has degree 2, a contradiction. Hence, for any Δ-regular graph G, we have la(G) ≥ Δ+1 2 . Akiyama, Exoo and Harary conjectured that this bound is always tight, i.e. for any regular graph, la(G) = Δ+1 . It is easy to see (check 2 e.g. [3]) that this conjecture is equivalent to Δ+1 Conjecture 1. For any graph G, Δ 2 ≤ la(G) ≤ 2 .
We note that Conjecture 1 resembles Vizing Theorem, and indeed, for odd Δ it can be treated as a generalization of Vizing Theorem (just color each linear
Supported in part by bilateral project BI-PL/08-09-008. M. Cygan and L . Kowalik were supported in part by Polish Ministry of Science and Higher Education grant N206 355636. Operation part financed by the European Union, European Social Fund.
T. Calamoneri and J. Diaz (Eds.): CIAC 2010, LNCS 6078, pp. 204–216, 2010. c Springer-Verlag Berlin Heidelberg 2010
A Planar Linear Arboricity Conjecture
205
forest with two new colors and get a (Δ + 1)-edge-coloring). However, despite many efforts, the conjecture is still open and the best known general upper bound is la(G) = d2 + O(d2/3 (log d)1/3 ), due to Alon, Teague and Wormald [4]. Conjecture 1 was proved only in several special cases: for Δ = 3, 4 in [1,2], for Δ = 5, 6, 8 in [8], Δ = 10 [9], for bipartite graphs [1] to mention a few. Finally, it was shown for planar graphs (for Δ = 7 by Jian-Liang Wu [14] and for Δ = 7 by Jian-Liang Wu and Yu-Wen Wu [15]). In this paper we focus on planar graphs. Note that for all odd Δ, we have Δ+1 Δ Δ 2 = 2 . Hence, the linear arboricity is 2 for planar graphs of odd Δ. Moreover, in [14], Wu showed that this is also true for Δ ≥ 13. In this paper we state the following conjecture. Conjecture 2. For any planar graph G of maximum degree Δ ≥ 6, we have la(G) = Δ 2 . It is easy to see that the above equality does not hold for Δ = 2, 4, since there are 2- and 4-regular planar graphs: e.g. the 3-cycle and the octahedron. Interestingly, if the equality holds for Δ = 6, then any planar graph with maximum degree 6 is 6-edge-colorable (just edge-color each of the three linear forests in two new colors). Hence, Conjecture 2 implies the Vizing Planar Graph Conjecture [13] (as currently it is open only for Δ = 6): Conjecture 3 (Vizing Planar Graph Conjecture). For any planar graph G of maximum degree Δ ≥ 6, we have χ (G) = Δ. The main result of this paper is the following theorem. Theorem 1. For every planar graph G of maximum degree Δ(G) ≥ 9, we have la(G) = Δ 2 . We note that Wu, Hou and Sun [17] verified Conjecture 2 for planar graphs without 4-cycles. For Δ ≥ 7 it is also known to be true for planar graphs without 3-cycles [14] and without 5-cycles [16]. Now we turn our atttention to computational complexity aspects of linear arboricity. Consider the following decision problem. Given a graph G and a number k, determine whether la(G) = k. Peroche [12] showed that this problem is NP-complete even for graphs of maximum degree Δ = 4. Our result settles the complexity of the decision problem for planar graphs of maximum degree Δ(G) ≥ 9. The discussion above implies that for planar graphs the decision problem is trivial also when Δ is odd. When Δ = 2 the problem is in P , as then the algorithm just checks whether there is a cycle in G. Hence, the remaining cases are Δ = 4, 6, 8. Conjecture 2, if true, excludes also cases Δ = 6, 8. We conjecture that the only remaining case Δ = 4 is NP-complete. Conjecture 4. It is NP-complete to determine whether a given planar graph of maximum degree 4 has linear arboricity 2. Finally, even when one knows the linear arboricity of a given graph (or a bound on it) the question arises as to how fast one can find the corresponding collection of linear forests. We show the following result.
206
M. Cygan, L . Kowalik, and B. Luˇzar
Theorem 2. For every n-vertex planar graph G of maximum degree Δ, one can find a cover of its edges by max{la(G), 5} linear forests in O(n log n) time. Preliminaries. For any graph G, V (G) and E(G) denote the sets of vertices and edges of G, respectively. If G is plane, we also denote the set of its faces by F (G). We call a vertex of degree k, at least k, and at most k, a k-vertex, (≥ k)vertex, and (≤ k)-vertex, respectively. Moreover, a neighbor u of a vertex v is called a k-neighbor, where k = deg(u). In a plane graph, length of a face f , denoted as (f ) is the number of edges incident to f . Analogously to vertices, a face of length k, at least k, and at most k, is called a k-face, (≥ k)-face, and (≤ k)-face, respectively. By a weight of an edge uv we denote the sum of degrees of its endpoints. Throughout the paper it will be convenient for us to treat partitions into linear forests as a kind of edge-colorings. A k-linear coloring of a graph G = (V, E) is a function C : E → {1, . . . , k} such that for i = 1, . . . , k, the set of edges C −1 (i) is a linear forest. We call an edge colored by a, an a-edge. Following the notation in [14], by C0 (v), we denote the set of colors that are not used on edges incident to the vertex v, and C1 (v) is the set of colors which are assigned to exactly one edge incident to v. Finally, C2 (v) = {1, . . . , k} \ (C0 (v) ∪ C1 (v)). We call the color which is in C0 (v) ∪ C1 (v) a free color at v. A path, where all edges have the same color a is called a monochromatic path or an a-path. A (uv, a)-path is an a-path with endpoints u and v. We use also the Iverson’s notation, i.e. [α] is 1 when α is true and 0 otherwise.
2
Proof of Theorem 1
It will be convenient for us to prove the following generalization of Theorem 1: Proposition 1. Any simple planar graph of maximum degree Δ has a linear coloring in max{ Δ 2 , 5} colors. Our plan for proving Proposition 1 is as follows. First we are going to show some structural properties of a graph which is not k-linear colorable and, subject to this condition, is minimal, i.e. has as few edges as possible. In this phase we do not use planarity, and our results apply to general graphs. Next, using the so-called discharging method (a powerful technique developed for proving the four color theorem) we will show that when k = max{ Δ 2 , 5}, there is no planar graph with the obtained structural properties. 2.1
Structure of a Minimal Graph G with Δ(G) ≤ 2k and la(G) > k
In this section we fix a number k and we assume that G is a graph of maximum degree at most 2k which is not k-linear colorable and, among such graphs, G has minimal number of edges. The following Lemma appears in many previous works, e.g. in [16], but we give the proof for completeness.
A Planar Linear Arboricity Conjecture
207
Lemma 1. For every edge uv of G, d(u) + d(v) ≥ 2k + 2. Proof. Suppose for a contradiction that uv is an edge in G, and d(u) + d(v) < 2k + 2. By the minimality of G, there exists a k-linear coloring of G = G − uv. Note that the degree of vertices u and v in G is one less than in G, hence dG (u) + dG (v) < 2k. So there exists at least one color c which is either an element of C0 (u) and free at v, or an element of C0 (v) and free at u. It follows that we can extend the k-linear coloring of G to G, a contradiction.
Lemma 2. G does not contain a 2-vertex v such that the two neighbors u and z are not adjacent. Proof. Since there is no edge uz in G, we can create a simple graph G = (G − v) ∪ uz. Because of the minimality of G there exists a k-linear coloring C of G . Let a = C(uz). We put C(uv) = C(vz) = a obtaining a k-linear coloring of G, a contradiction.
Lemma 3. Every vertex has at most one adjacent 2-vertex. Proof. Assume for a contradiction that a vertex u has at least two neighbors of degree two namely w and z. By Lemma 2, neighbors of every 2-vertex are adjacent. Consider the configuration and the labeling of vertices as in Fig. 1. w v
u
v
u
t
w z z (A) 2-vertices have 2 common neighbors (B) 2-vertices have 1 common neighbor Fig. 1. Cases A and B in the proof of Lemma 3
Case A. The vertices w and z have two common neighbors. Since G is minimal, there exists a k-linear coloring C of G = G − uz. Let a be a free color at u. We may assume that C(vz) = a and there exists a (uv, a)-path, otherwise we can put C(uz) = a and we are done. Consider edges vw and wu. If at least one of them has color a it means that both have color a since there is a (uv, a)-path. In such a case (C(vw) = C(wu) = a) we can take color b = C(uv) = a and recolor C(vw) = C(wu) = b and C(uv) = a. Thus we can assume that C(vw) = b =a and C(wu) = c = a therefore it suffices to recolor C(uw) = a and put C(uz) = c. Case B. Vertices w and z have precisely one common neighbor. Since G is minimal, there exists a k-linear coloring C of G = G − uz. Let a be the only free color at u. We may assume that C(tz) = a and there exists a (tu, a)-path since otherwise we can put C(uz) = a and we are done. Now let us take into consideration the edge uw. Case B.1. C(uw) = a. Since in G the only a-edge incident to the vertex u is the edge uw we have C(wv) = a because there exists a (tu, a)-path in G .
208
M. Cygan, L . Kowalik, and B. Luˇzar
3
2
a)
3
3
b)
Fig. 2. Configurations from Lemma 4 (left) and Lemma 7 (right). Labels denote degrees in graph G.
Let C(uv) = b. We know that b = a since a is free at u. In this case we recolor C(vw) = b, C(uv) = a and C(uz) = b. It is easy to see that we do not introduce any monochromatic cycle. Case B.2. C(uw) = b = a. In this case we only recolor C(uw) = a and put C(uz) = b. Even if C(vw) = a we do not introduce an a-cycle since then a (uv, a)-path can not exist because of the (tu, a)-path.
By using similar methods as in the proof of Lemma 3 we prove the following four lemmas. We omit the proofs here because of space limitations. The proofs can be found in our technical report [7] or in a future journal version. Lemma 4. G does not contain the configuration of Fig. 2 a), i.e. a 4-cycle vzuw with a chord zw such that deg(v) = 3 and deg(u) = 2. Lemma 5. If a vertex v belongs to a triangle with a 2-vertex then every 3-vertex adjacent to v belongs to at most one triangle. Lemma 6. If k ≥ 3 and G contains a vertex v of degree at most 2k − 1 with two 3-neighbors then the neighbors of any 3-neighbor of v are pairwise nonadjacent. Lemma 7. G does not contain the configuration in Fig. 2 b). 2.2
Proof of Proposition 1
ˇ Now we use the following lemma due to Cole, Kowalik and Skrekovski. Lemma 8 (Proposition 1.3 in [6]). Let G be a simple planar graph with minimum degree δ ≥ 2 such that each d-vertex, d ≥ 12, has at most d − 11 neighbors of degree 2. Then G contains an edge of weight at most 13. Using the above lemma and Lemmas 1 and 3 only, we can prove the following special case of Proposition 1, which already improves known bounds on the linear arboricity of planar graphs. Proposition 2. Any simple planar graph of maximum degree Δ has a linear coloring in max{ Δ 2 , 6} colors.
A Planar Linear Arboricity Conjecture
209
Proof. Assume the claim is false and let G be a minimal counterexample (in terms of the number of edges). Let k = max{ Δ , 6}. In particular, Δ ≤ 2k. 2 By Lemma 1, G has no vertices of degree 1 and any 2-vertex has two neighbors of degree 2k. Next, by Lemma 3 every (2k)-vertex has at most one 2-neighbor. Since 2k ≥ 12 the assumptions of Lemma 8 are satisfied, so G contains an edge of weight at most 13 ≤ 2k + 1, a contradiction with Lemma 1.
Now, we proceed to the proof of Proposition 1. By the above proposition, Proposition 1 holds for Δ ≥ 11. Hence, in what follows we assume that Δ ≤ 10. We put k = max{ Δ 2 , 5} = 5 and assume that G is a minimal counterexample (in terms of the number of edges). Then we get a contradiction using the discharging method. The procedure is the following. We assign a number (called charge) to every vertex and face of a plane embedding of G, so that the total sum of charges is negative. Next, we redistribute the charge among vertices and faces in such a way, that using the structural properties of G described in Section 2.1 we are able to show that every vertex and every face has a nonnegative charge at the end, hence the total charge of G is nonnegative — a contradiction as desired. Initial charge. We set the following initial charge to all vertices and faces of G: ch0 (v) = deg(v) − 4 , v ∈ V (G) , ch0 (f ) = (f ) − 4 , f ∈ F (G) . From the Euler’s formula we infer the following total charge of G: (deg(v) − 4) + ((f ) − 4) = −4(|V (G)| − |E(G)| + |F (G)|) = −8. v∈V (G)
f ∈F (G)
Discharging rules. Now, we present discharging rules, by which we redistribute the charge of vertices and faces in G. (R1) (R2) (R3) (R4) (R5)
Every 10-vertex sends 1 to an adjacent 2-vertex. Every (≥ 9)-vertex sends 13 to every adjacent 3-vertex. Every (≥ 8)-vertex sends 12 to every incident 3-face with a (≤ 4)-vertex. Every (≥ 7)-vertex sends 25 to every incident 3-face with a 5-vertex. Every (≥ 6)-vertex sends 13 to every incident 3-face which is incident only to (≥ 6)-vertices. (R6) Every 5-vertex sends 15 to every incident 3-face. (R7) Every (≥ 5)-face f sends 13 to every incident 10-vertex which has a 2neighbor incident to f .
Final charge. Note that the initial charge is negative only for 2- and 3-vertices, and for 3-faces. We show that by applying the discharging rules, all vertices and faces of G have nonnegative final charge.
210
M. Cygan, L . Kowalik, and B. Luˇzar
First, we consider the charge of faces. Note that 4-faces do not send any charge so their charge remains 0. Now we consider a face f of length (f ) ≥ 5. ) By Lemmas 1 and 3, f is incident to at most (f 3 vertices of degree 2. Hence ) f sends at most 13 · 2 · (f 3 units of charge by (R7), which is less than (f ) − 4 for (f ) ≥ 5, hence f retains positive charge. It only remains to show that every 3-face f receives at least 1 from its neighbors, since its initial charge is −1. We consider cases regarding the degree of vertices incident to f . If f is incident to a 2-, 3-, or 4-vertex, it follows by Lemma 1 that the other two vertices incident to f are of degree at least 2k − 2 ≥ 8, hence each of them sends 12 to f by (R3). Next, if f is incident to a 5-vertex v, the other two incident vertices of f are of degree at least 2k − 3 ≥ 7 by Lemma 1. Hence, f receives 15 from v by (R6) and 25 from each of the other two incident vertices by (R4), that is 1 in total. Finally, if f is incident only to ≥ 6-vertices, each of them sends 13 by (R5), hence f receives 1 in total again. It follows that the final charge of 3-faces is 0. Now, we consider the final charge of vertices. For convenience, we introduce a notion of a side. Let v be a vertex and let vx0 , . . . , vxdeg(v)−1 be the edges incident to v, enumerated in the clockwise order around v in the given plane embedding. For any i = 0, . . . , deg(v) − 1, the pair s = (vxi , vxi+1 ) will be called a side of v (where xdeg(v) = x0 ). If xi and xi+1 are adjacent, we say that s is triangular. We also say that s is incident to vxi and vxi+1 . Note that v can have less than deg(v) incident faces (when v is a cutvertex), while it has always deg(v) distinct incident sides. However, for each triangular face incident to v there is a distinct triangular side of f . Since v does not send charge to non-triangular faces, when v sends charge to a triangle we can say that it sends the charge to the corresponding side and the total charge sent to sides is equal to the total charge sent to faces. In what follows, we use the following claim. Claim 1. If a d-vertex v has a negative final charge and v is not adjacent to a 2-vertex then v has at most 11 − d non-triangular sides. Proof (of the claim). Let p be the number of non-triangular sides of v. Note that v sends charge only to incident triangles (at most 12 per triangle) and to adjacent 3-vertices (at most 13 per 3-vertex). For the proof of this claim, we replace (R2) by an equivalent rule: (R2’) For each 3-neighbor w of a (≥ 9)-vertex v, vertex v sends 1/6 to each of the two sides incident to edge vw and each of these sides resend the 1/6 to w. Then, v sends at most 23 to each incident triangular side (the corresponding 3-face has only one 3-vertex, for otherwise there is an edge of weight 6 < 2k + 2, which contradicts Lemma 1) and it sends at most 13 to each incident non-triangular side. It follows that v sends at most 13 · p + 23 · (d − p) = 2d−p in total. Hence, the 3 final charge at v is negative when 2d−p > d − 4, which is equivalent to p < 12 − d 3 and Claim 1 follows since p is a natural number.
A Planar Linear Arboricity Conjecture
211
Now we consider several cases regarding the degree of vertex v. – v is a 2-vertex. The initial charge of v is −2. By Lemma 1, both its neighbors are of degree at least 2k ≥ 10. Hence, by (R1), v receives 1 from each of the two neighbors, and since it does not send any charge, its final charge is 0. – v is a 3-vertex. The initial charge of v is −1. By Lemma 1, all of its neighbors are of degree at least 2k − 1 ≥ 9. By (R2), v receives 13 from each of the three neighbors, and since it does not send any charge, its final charge is 0. – v is a 4-vertex. In this case, v does not send nor receive any charge. Hence, its initial charge, which is 0, is equal to its final charge. – v is a d-vertex, 5 ≤ d ≤ 8. Note that v sends charge only to incident triangles. By rules (R3)-(R6), the charge v sends to each incident triangle is at most 15 , 13 , 2 1 5 , 2 , for d = 5, 6, 7, 8 respectively. One can check that in each of the four cases this is not more than d−4 d , and since there are at most d incident triangles, v sends at most d − 4 charge in total and retains nonnegative charge. – v is a 9-vertex. The initial charge at v is 5. If v has at most one 3-neighbor then v sends at most 92 to faces and 13 to vertices so its final charge is positive. If v has at least two 3-neighbors, then by Lemma 6, each of them is incident to two non-triangular sides of v. Hence v has at least 3 non-triangular sides, which contradicts Claim 1. – v is a 10-vertex. Assume first that v has no 2-neighbors. By Claim 1, v is incident to at most one non-triangular side. If v is incident only to 3-faces, by Lemma 7 v has at most three 3-neighbors, since otherwise a pair of 3neighbors would have two common neighbors. Then, v sends at most 3· 13 = 1 to vertices and at most 10 · 12 = 5 to faces, hence at most 6 in total. If v is incident to one non-triangular side, by Lemma 7 v has at most four 3neighbors. Then, v sends at most 4 · 13 = 43 to vertices and at most 9 · 12 = 92 to faces, that is less than 6 in total. Hence, in both cases the final charge at v is nonnegative. Finally, assume that v has a 2-neighbor. Let w0 , w1 , . . . , w9 denote the neighbors of v in the clockwise order in the given plane embedding of G. Assume w.l.o.g. deg(w1 ) = 2. By Lemma 3, this is the only 2-neighbor of v. By Lemma 2, the neighbors of w1 are adjacent, so assume w.l.o.g. w0 is adjacent to w1 (in the beginning, we can choose the plane embedding of G so that each triangle with one 2-vertex and two 10-vertices is a face). Since G is simple, the face incident to vw1 and vw2 , say f , is of length at least 4. Let n3 denote the number of 3-vertices among vertices w3 , . . . , w9 . By Lemma 5, each of these 3-neighbors is incident to at least one non-triangular side. Since each side is incident to at most two 3-neighbors of v, there are at least n23 non-triangular sides, not counting the side (vw1 , vw2 ). It follows that v sends 1 unit to w1 , 13 to w2 if deg(w2 ) = 3, n33 to vertices w3 , . . . , w9 and at most 12 · (9 − n23 ) to incident faces. Hence, v sends at most 5 12 + 13 [deg(w2 ) = 3] + n33 − 12 n23 . However, when deg(w2 ) = 3, then face f is of length at least 5 by Lemma 4, so v receives additional 13 from f by (R7). Hence, v gets at least 6 + 13 [deg(w2 ) = 3] charge in total. It follows that the final charge at v is at least 12 − n33 + 12 n23 , which is nonnegative since n3 ≤ 7.
212
M. Cygan, L . Kowalik, and B. Luˇzar
It follows that the total charge of G is nonnegative, establishing a contradiction with the existence of a minimal counterexample.
3
Algorithm
In this section we turn our proof into an efficient algorithm for finding a linear max{ Δ 2 , 5}-coloring of an input planar graph. The forbidden subgraphs from Section 2.1 will be called reducible configurations. It should be clear that the proof of Proposition 1 corresponds to the following algorithm: find any of our reducible configurations in linear time, then obtain a smaller graph in constant time by removing/contracting an edge, color it recursively and finally extend the coloring in linear time. Since in each recursive call the number of edges decreases, the number of recursive calls is linear, which gives O(n2 ) overall time complexity. However, with some effort it is possible to improve the running time. Namely, we present an O(n log n)-time algorithm. Our approach is as follows. First we describe an algorithm that finds a partition into max{ Δ 2 , 6} linear forests, which is optimal for Δ ≥ 11. This can be treated as an implementation of Proposition 2. Recall that for proving this proposition we needed only a few reducible configurations: an edge of weight at most 2k + 1, a 2-vertex with its neighbors nonadjacent, and a 2k-vertex with two 2-neighbors. As we will see in Subsection 3.1 these configurations are simple enough to find them very fast (even in constant time) after a linear preprocessing. Once we have this algorithm, we use it whenever Δ ≥ 11. Otherwise Δ ≤ 10, so Δ is bounded which makes finding any bounded-size configuration very easy. Then we use the algorithm sketched in Subsection 3.2. 3.1
An Algorithm for Δ ≥ 11
The coloring algorithm we describe in this section is inspired by the linear-time algorithm for the Δ-edge-coloring of planar graphs presented in [5]. For an input graph G of maximum degree Δ we define k = max{ Δ 2 , 6}. We will show an O(n log n)-time algorithm which finds a k-linear coloring of G. Note that Δ ≤ 2k, so the graph has vertices of degree at most 2k and k ≥ 6 (we will use these facts in our arguments). We use the following three types of reducible edges of weight at most 2k + 1, which will be called nice: – edges of weight at most 13, – edges incident to a 1-vertex, and – edges incident to a 2-vertex and a vertex of degree at most 2k − 1. Our algorithm uses two queues: Qe and Q2 . The queue Qe stores nice edges, while Q2 stores 2-vertices whose two neighbors are, or used to be, of degree 2k. Also, any (2k)-vertex x stores at most one triangle xyz, such that deg(y) = 2 and deg(z) = 2k. The algorithm keeps the following invariants satisfied.
A Planar Linear Arboricity Conjecture
213
Invariant 1. For every nice edge uv, either uv stored in Qe , or one of its endpoints is of degree 2 and is stored in Q2 . Invariant 2. For each 2-vertex x with two (2k)-neighbors v and w, either x is in Q2 or G contains a triangle vxw and this triangle is stored in both v and w. Each vertex stores at most one triangle. It is easy to initialize the queues in linear time to make invariants 1 and 2 satisfied at the beginning (without storing triangles in vertices). Then we use a recursive procedure which can be sketched as follows. By configuration A and B we mean the configurations from the cases A and B of the proof of Lemma 3 (see Fig. 1). Step 1. (Base of the recursion.) If G has no edges, return the empty coloring. Step 2. If Qe contains an edge e, obtain a coloring of G − e recursively and color e by a free color as described in Lemma 1. Return the resulting coloring of G. Step 3. Remove a vertex x from Q2 until deg(x) = 2. Let v, w be the x’s neighbors. Step 4. If deg(v) < 2k (resp. deg(w) < 2k), add xv (resp. xw) to Qe and go to Step 2. Step 5. If v or w stores a triangle vwy, we have a configuration A. Remove an edge e of G as described in Lemma 3, recurse on G − e and extend the coloring of G − e to a coloring of G as described in Lemma 3. Step 6. If vw ∈ E(G), proceed as in Lemma 2: remove the vertex x and add an edge vw, recurse, add vertex x and edges vx, wx, color these edges the same color as vw and remove the edge vw. Step 7. Else (vw ∈ E(G)) (i) If v (resp. w) stores a triangle vyu, we have configuration B. Remove an edge e of G as described in Lemma 3, recurse on G − e and extend the coloring of G − e to a coloring of G as described in Lemma 3. (ii) Otherwise, store the triangle vxw in v and w.
Now we describe how the queues Qe and Q2 are updated during an execution of the algorithm, to keep invariants 1 and 2 satisfied. First notice that it is easy to store degrees of vertices and update them in overall O(n) time. Then, whenever an edge is removed, for each of its endpoints, say z, we check whether z is of degree at most 12. If so, for all its O(1) incident edges we check whether they are nice and if that is the case we add them to Qe (unless Qe already contains this edge). Also, if the degree of z was decreased from 2k to 2k − 1, and z stored a triangle zxy with deg(x) = 2 and deg(y) = 2k, then we add the edge zx to Qe and remove the triangle from both z and y. Also, if after removing an edge a degree of one of its endpoint z drops to 1, we check whether z is on Q2 and if so, we remove z from Q2 . Now it is easy to see that Invariant 1 is satisfied. Finally, when after removing an edge a degree of its endpoint z drops to 2, we check whether both of its neighbors are of degree 2k and if so, we add z to Q2 . This makes Invariant 2 satisfied as well. Notice that the updates described above take only O(1) time after each edge deletion. Clearly, after the graph modification in Step 6, there is no need to update any queue. Now we are going to show the correctness of our algorithm. , 6}. The above algorithm correctly finds a Proposition 3. Let k = max{ Δ 2 k-linear coloring of any planar graph of maximum degree Δ.
214
M. Cygan, L . Kowalik, and B. Luˇzar
Proof. Clearly, it suffices to show that whenever the algorithm finds itself in Step 3 the queue Q2 is not empty. Assume the contrary. Since Qe and Q2 are empty, by Invariant 1 there are no nice edges, so G has no 1-vertices and each 2vertex is adjacent to two (2k)-vertices. Hence only (2k)-vertices have 2-neighbors. Since Q2 is empty, by Invariant 2 each (2k)-vertex has at most one 2-neighbor. Hence the assumptions of Lemma 8 are satisfied and G contains an edge of weight at most 13. But this edge is nice and we get the contradiction with Invariant 1 and the fact that Qe is empty.
Proposition 4. The above algorithm can be implemented in O(n log n) time. Proof. First we show that each recursive call takes only O(log n) amortized time. Checking adjacency in Step 6 can be easily done in O(log n) time e.g. by storing the neighbors of each vertex in a balanced tree. Then adding and removing edges can be done in O(log n) time. It remains to consider recoloring the graph after going back from the recursion. Recall from the proof of Lemma 3 that during the recoloring the algorithm checks colors of a bounded number of edges and also recolors a bounded number of edges. Finding a free color can be done in O(log n) time using any balanced binary search tree containing used colors. When we are looking for a free color we can go down from the root of the tree going into the subtree which does not contain all colors from its range. To achieve it in each node of the balanced tree we store the size of its subtree. The last unclear issue is verifying whether there is a path of given color, say a, between two vertices, say x, y. W.l.o.g. we can assume that both x and y are incident to an edge colored a (otherwise, immediately, the answer in negative), so in fact, given two edges of the same color we want to check whether they are on the same path in the linear forest of color a. Note that during recoloring an edge of color a to b (say), some path in the linear forest of a is split into two paths (possibly one of length 0), and some two paths (possibly empty) of the linear forest of color b are connected to one path. In other words, we need a data structure which maintains a linear forest that can be updated after adding or removing an edge and processes connectivity queries of the form “are the edges e1 and e2 on the same path?”. There are several solutions to this problem generalized to forests with O(log n) time complexity (amortized) both for updates and queries – e.g. the ET-trees of Henzinger and King [11], which takes only linear space with respect to the size of the linear forest. Since in a one recursive call we perform a bounded number of path queries, this takes only O(log n) amortized time.
3.2
An Algorithm for Δ ≤ 10
Now we sketch an algorithm which finds a partition of any planar graph of maximum degree Δ = O(1) into k = max{ Δ 2 , 5} linear forests. Our algorithm uses all the reducible configurations described in Section 2.1. Recall that they are of bounded size. Hence it is easy to check in constant time, whether a given vertex v belongs to a given configuration, since if this is the case, this configuration is a
A Planar Linear Arboricity Conjecture
215
subgraph of the graph induced by all vertices at some bounded distance from v and because Δ = O(1) this subgraph has a bounded size. Our algorithm uses a queue of reducible configurations, initialized in linear time. Then configurations are added to the queue after modifying the graph. Since each modification decreases the size of the graph, and causes the appearance of a bounded number of configurations, the total number of configurations is linear. After finding a configuration (by just removing it from the queue in constant time), shrinking the graph (usually by removing an edge), and going back from the recursive call, extending the coloring of the shrinked graph to the original graph takes O(log n) time, as described in the proof of Proposition 4. It may happen that when we remove a configuration from the queue it is no longer a configuration because we have erased some parts of if in the meantime. In such a situation we simply skip this configuration and take another one from the queue. Corollary 1. Let k = max{ Δ 2 , 5}. The above algorithm finds a k-linear coloring of any planar graph of maximum degree Δ in O(n log n) time.
References 1. Akiyama, J., Exoo, G., Harary, F.: Covering and packing in graphs III: Cyclic and acyclic invariants. Math Slovaca 30, 405–417 (1980) 2. Akiyama, J., Exoo, G., Harary, F.: Covering and packing in graphs IV: Linear arboricity. Networks 11, 69–72 (1981) 3. Alon, N.: The linear arboricity of graphs. Israel Journal of Mathematics 62(3), 311–325 (1988) 4. Alon, N., Teague, V., Wormald, N.C.: Linear arboricity and linear k-arboricity of regular graphs. Graphs and Combinatorics 17(1), 11–16 (2001) 5. Cole, R., Kowalik, L .: New linear-time algorithms for edge-coloring planar graphs. Algorithmica 50(3), 351–368 (2008) ˇ 6. Cole, R., Kowalik, L ., Skrekovski, R.: A generalization of Kotzig’s theorem and its application. SIAM Journal on Discrete Mathematics 21(1), 93–106 (2007) 7. Cygan, M., Kowalik, L ., Luˇzar, B.: A planar linear arboricity conjecture. arXiv.org e-Print archive, arXiv:0912.5528v1 (2009) 8. Enomoto, H., P´eroche, B.: The linear arboricity of some regular graphs. J. Graph Theory 8, 309–324 (1984) 9. Guldan, F.: The linear arboricity of 10-regular graphs. Math Slovaca 36(3), 225–228 (1986) 10. Harary, F.: Covering and packing in graphs I. Ann. N.Y. Acad. Sci 175, 198–205 (1970) 11. Henzinger, M.R., King, V.: Randomized fully dynamic graph algorithms with polylogarithmic time per operation. J. ACM 46(4), 502–516 (1999) 12. Peroche, B.: Complexity of the linear arboricity of a graph. RAIRO Oper. Res. 16, 125–129 (1982), in French 13. Vizing, V.G.: Critical graphs with a given chromatic number. Diskret. Analiz 5, 9–17 (1965) 14. Wu, J.L.: On the linear arboricity of planar graphs. J. Graph Theory 31, 129–134 (1999)
216
M. Cygan, L . Kowalik, and B. Luˇzar
15. Wu, J.L., Wu, Y.W.: The linear arboricity of planar graphs of maximum degree seven is four. J. Graph Theory 58(3), 210–220 (2008) 16. Wu, J.L., Hou, J.F., Liu, G.Z.: The linear arboricity of planar graphs with no short cycles. Theor. Comput. Sci. 381(1-3), 230–233 (2007) 17. Wu, J.L., Hou, J.F., Sun, X.Y.: A note on the linear arboricity of planar graphs without 4-cycles. In: International Symposium on Operations Research and Its Applications. pp. 174–178 (2009)
On the Number of Higher Order Delaunay Triangulations Dieter Mitsche1, , Maria Saumell2, , and Rodrigo I. Silveira2, 1 2
Centre de Recerca Matem` atica, Universitat Aut` onoma de Barcelona
[email protected] Dept. Matem` atica Aplicada II, Universitat Polit`ecnica de Catalunya {maria.saumell,rodrigo.silveira}@upc.edu
Abstract. Higher order Delaunay triangulations are a generalization of the Delaunay triangulation which provides a class of well-shaped triangulations, over which extra criteria can be optimized. A triangulation is order-k Delaunay if the circumcircle of each triangle of the triangulation contains at most k points. In this paper we study lower and upper bounds on the number of higher order Delaunay triangulations, as well as their expected number for randomly distributed points. We show that arbitrarily large point sets can have a single higher order Delaunay triangulation, even for large orders, whereas for first order Delaunay triangulations, the maximum number is 2n−3 . Next we show that uniformly distributed points have an expected number of at least 2ρ1 n(1+o(1)) first order Delaunay triangulations, where ρ1 is an analytically defined constant (ρ1 ≈ 0.525785), and for k > 1, the expected number of order-k Delaunay triangulations (which are not order-i for any i < k) is at least 2ρk n(1+o(1)) , where ρk can be calculated numerically.
1
Introduction
A triangulation is a decomposition into triangles. In this paper we are interested in triangulations of point sets in the Euclidean plane, where the input is a set of points in the plane, denoted P, and a triangulation is defined as a subdivision of the convex hull of P into triangles whose vertices are the points in P. It is a well-known fact that n points in the plane can have many different triangulations. For most application domains, the choice of the triangulation is important, because different triangulations can have different effects. For example, two important fields in which triangulations are frequently used are finite element methods and terrain modeling. In the first case, triangulations are used to subdivide a complex domain by creating a mesh of simple elements (triangles), over which a system of differential equations can be solved more easily.
Partially supported by a Beatriu de Pin´ os grant from the Generalitat de Catalunya and by the project TIN2007-66523 (FORMALISM). Partially supported by projects MTM2009-07242 and Gen. Cat. DGR 2009SGR1040. Supported by the Netherlands Organisation for Scientific Research (NWO).
T. Calamoneri and J. Diaz (Eds.): CIAC 2010, LNCS 6078, pp. 217–228, 2010. c Springer-Verlag Berlin Heidelberg 2010
218
D. Mitsche, M. Saumell, and R.I. Silveira
In the second case, the points in P represent points sampled from a terrain (thus each point has also an elevation), and the triangulation defines a bivariate interpolating surface, providing an elevation model of the terrain. In both cases, the shapes of the triangles can have serious consequences on the result. For mesh generation for finite element methods, the aspect ratio of the triangles is particularly important, since elements of large aspect ratio can lead to poorly-conditioned systems. Similarly, long and skinny triangles are generally not appropriate for surface interpolation because they can lead to interpolation from points that are too far apart. In most applications, the need for well-shaped triangulations is usually addressed by using the Delaunay triangulation. The Delaunay triangulation of a point set P is defined as a triangulation where the vertices are the points in P and the circumcircle of each triangle (that is, the circle defined by the three vertices of each triangle) contains no other point from P. The Delaunay triangulation has many known properties that make it the most widely-used triangulation. In particular, there are several efficient and relatively simple algorithms to compute it, and its triangles are considered well-shaped. This is because it maximizes the minimum angle among all triangle angles, which implies that its angles are—in a sense—as large as possible. Moreover, when the points are in general position (that is, when no four points are cocircular and no three points are collinear) it is uniquely defined. However, this last property can become an important limitation if the Delaunay triangulation is suboptimal with respect to other criteria, independent of the shape of its triangles, as it is often the case in applications. To overcome this limitation, Gudmundsson et al. proposed higher order Delaunay triangulations [9]. They are a natural generalization of the Delaunay triangulation that provides well-shaped triangles, but at the same time, flexibility to optimize some extra criterion. They are defined by allowing up to k points inside the circumcircles of the triangles. For k = 0, each point set in general position has only one higher order Delaunay triangulation, equal to the Delaunay triangulation. As k is increased, more points inside the circumcircles imply a reduction of the shape quality of the triangles, but also an increase in the number of triangulations that are considered. This last aspect makes the optimization of extra criteria possible, providing triangulations that are a compromise between well-shaped triangles and optimality with respect to other criteria. Therefore the importance of higher order Delaunay triangulations lies in multicriteria triangulations. Their major contribution is providing a way to optimize over a—hopefully large—class of well-shaped triangulations. A particularly important subclass of higher order Delaunay triangulations are the first order Delaunay triangulations, that is, when k = 1. It has been observed that already for k = 1, a point set with n points can have an exponential number of different triangulations [17]. This, together with the fact that for k = 1 the shape of the triangles is as close as possible to the shape of the Delaunay triangles (while allowing more than one triangulation to choose from), make first order Delaunay triangulations especially interesting. In fact, first order Delaunay triangulations have been shown to have a special structure that facilitates
On the Number of Higher Order Delaunay Triangulations
219
the optimization of many criteria [9]. For example, it has been shown that many criteria related to measures of single triangles, as well as some other relevant parameters like the number of local minima, can be optimized in O(n log n) time for k = 1. In a recent paper [11], Van Kreveld et al. studied several types of more complex optimization problems, constrained to first order Delaunay triangulations. They showed that many other criteria can be also optimized efficiently for k = 1, making first order Delaunay triangulations even more appealing for practical use. For larger values of k, fewer results are known. The special structure of first order Delaunay triangulations is not present anymore, which complicates exact optimization algorithms. Several heuristics and experimental results have been presented for optimization problems related to terrain modeling, showing that very small values of k (k = 1, . . . , 8) are enough to achieve important improvements for several terrain criteria [4,5,10]. However, despite the importance given to finding algorithms to optimize over higher order Delaunay triangulations, it has never been studied before how many higher order Delaunay triangulations there can be in the first place. In other words, it is not known what the minimum and maximum number of different triangulations are, as functions of k and n, not even for the simpler (but—in practice—most important) case of first order Delaunay triangulations. The problem of determining bounds on the number of higher order Delaunay triangulations is of both theoretical and practical interest. From a theoretical point of view, determining how many triangulations a point set has is one of the most intriguing problems in combinatorial geometry, and has received a lot of attention (e.g. [2,16,15]). Higher order Delaunay triangulations are a natural generalization of the Delaunay triangulation, thus the impact of such generalization on the number of triangulations is worth studying. From a more practical point of view, knowing the number of triangulations for a given k gives an idea of how large the solution space is when optimizing over this class of well-shaped triangulations. Ideally, one expects to have many different triangulations to choose from, in order to find one that is good with respect to other criteria. Up to now, only trivial bounds were known: every point set has at least one order-k Delaunay triangulation, for any k (equal to the Delaunay triangulation), and there are point sets of size n that have 2Θ(n) triangulations, already for k = 1. In this paper we present the first non-trivial bounds on the number of higher order Delaunay triangulations. Given the practical motivation mentioned above, we are mostly interested in results that have practical implications for the use of higher order Delaunay triangulations. Thus low values of k are our main concern. Our ultimate goal—achieved partially in this paper—is to determine to what extent the class of higher order Delaunay triangulations (for small values of k, which has the best triangle-shape properties), also provides a large number of triangulations to choose from. Results. We study lower and upper bounds on the number of higher order Delaunay triangulations, as well as the expected number of order-k Delaunay
220
D. Mitsche, M. Saumell, and R.I. Silveira
triangulations for uniformly distributed points. Let Tk (n) denote the maximum number of order-k Delaunay triangulations that a set with n points can have, and let tk (n) denote the minimum number of order-k Delaunay triangulations that a set with n points can have. First we show that the lower bound tk (n) ≥ 1 is tight. In other words, there are arbitrarily large point sets that have a single higher order Delaunay triangulation, even for large values of k. Next we show that, for first order Delaunay triangulations, T1 (n) = 2n−3 . Since these extreme cases do not describe an average situation when higher order Delaunay triangulations are used, we then study the number of higher order Delaunay triangulations for a uniformly distributed point set. Let Rk denote the number of order-k (and not order-i, for any i < k) Delaunay triangulations of a uniformly distributed point set of size n. We show that E[R1 ] ≥ 2ρ1 n(1+o(1)) , where ρ1 is an analytically defined constant (ρ1 ≈ 0.525785). We also prove that, for constant values of k, E[Rk ] ≥ 2ρk n(1+o(1)) , where ρk can be calculated numerically (asymptotics are with respect to n). The result has interesting practical consequences, since it implies that it is reasonable to expect an exponential number of higher order Delaunay triangulations for any k ≥ 1. Related work. As mentioned earlier, there is no previous work on counting higher order Delaunay triangulations. A related concept, the higher order Delaunay graph, has been studied by Abellanas et al. [1]. The order-k Delaunay graph of a set of points P is a graph with vertex set P and an edge between two points p, q when there is a circle through p and q containing at most k other points from P. Abellanas et al. presented upper and lower bounds on the number of edges of this graph. However, since a triangulation that is a subset of the order-k Delaunay graph does not need to be an order-k Delaunay triangulation, it is difficult to derive good bounds for higher order Delaunay triangulations based on them. There is an ample body of literature on the more general problem of counting all triangulations. Lower and upper bounds on the number of triangulations that n points can have have been improved many times over the years, with the current best ones establishing that there are point sets that have Ω(8.48n ) [2] triangulations, whereas no point set can have more than O(43n ) [16]. In relation to our expected case analysis of the number of higher order Delaunay triangulations, it is worth mentioning that many properties of the Delaunay triangulation—and related proximity graphs—of random points have been studied. The expected behavior of properties of the Delaunay triangulation that have been considered include the average and maximum edge length [13,3], the minimum and maximum angles [3], and its expected weight [6]. Expected properties of other proximity graphs, such as the Gabriel graph and some relatives, are investigated in [8,7,12].
2
Higher Order Delaunay Triangulations
We begin by introducing higher order Delaunay triangulations more formally, and presenting a few properties that will be used throughout the paper. From now on, we assume that point sets are in general position.
On the Number of Higher Order Delaunay Triangulations
221
Fig. 1. Left: A Delaunay triangulation (k = 0). Center: an order-1 triangulation (with useful-1, non-Delaunay, edges in gray). Right: an order-2 triangulation, with order-1 triangles in light gray and order-2 triangles in medium gray.
Definition 1. (from [9]) A triangle uvw in a point set P is order-k Delaunay if its circumcircle C(u, v, w) contains at most k points of P. A triangulation of P is order-k Delaunay if every triangle of the triangulation is order-k. Note that if a triangle or triangulation is order-k, it is also order-k for any k > k. A simple corollary of this is that, for any point set and any k ≥ 0, the Delaunay triangulation is an order-k Delaunay triangulation. Definition 2. (from [9]) An edge uv is an order-k Delaunay edge if there exists a circle through u and v that has at most k points of P inside. An edge uv is a useful order-k Delaunay edge (or simply useful-k edge) if there is an order-k Delaunay triangulation that contains uv. The useful order of an edge can be checked using the following lemma, illustrated in Fig. 2. u s1 s2 v Fig. 2. The useful order of edge uv is determined by the lowest order of triangles uvs1 and uvs2 . In the example, the (lowest) useful order of uv is max{3, 1} = 3.
Lemma 1. (from [9]) Let uv be an order-k Delaunay edge, let s1 be the point → such that the circle C(u, v, s ) contains no points to the left of to the left1 of − vu, 1 − → → Edge uv is useful-k if and vu. Let s2 be defined similarly but to the right of − vu. only if uvs1 and uvs2 are order-k Delaunay triangles. 1
We sometimes treat edges as directed, to be able to refer to the right or left side of → denotes the halfplane defined by the line supporting the edge. The left side of − vu uv, such that a polygonal line defined by v, u and a point interior to that halfplane, makes a counterclockwise turn. In the right side, the turn is clockwise.
222
D. Mitsche, M. Saumell, and R.I. Silveira
The concept of a fixed edge is important in order to study the structure of higher order Delaunay triangulations. Definition 3. Let P be a point set and T its Delaunay triangulation. An edge of T is k-fixed if it is present in every order-k Delaunay triangulation of P. Some simple observations derived from this are that the convex hull edges are always k-fixed, for any k, and that all the Delaunay edges are 0-fixed. First order Delaunay triangulations have a special structure. If we take all edges that are 1-fixed, then the resulting subdivision has only triangles and convex quadrilaterals (and an unbounded face). In the convex quadrilaterals, both diagonals are possible to obtain a first order Delaunay triangulation (see Fig. 1, center). We say that both diagonals are flippable, and similarly we call the quadrilateral flippable. More formally, based on results in [9], we can make the following observation. Observation 1. Let e be a useful order-1 Delaunay edge in an order-1 Delaunay triangulation, such that e is not a Delaunay edge. Then flipping e results in a Delaunay edge. Moreover, the four edges (different from e) that bound the two triangles adjacent to e are 1-fixed edges. An implication of this special structure is that a point set with q flippable quadrilaterals has exactly 2q order-1 Delaunay triangulations. Thus instead of counting triangulations, we can count flippable quadrilaterals or, equivalently, useful-1 edges that are not Delaunay. For k > 1, the structure is not so simple anymore and it seems difficult to provide an exact expression for the number of order-k Delaunay triangulations in terms of the number of useful-k edges. However, we can derive the following lower bound, whose proof can be found in the full version of this paper [14]: Lemma 2. Let P be a point set and let ek , for k > 1, be the number of useful-k edges (which are not useful-i for any i < k) of P. Then P has at least 2ek /Ck − 1 order-k (and not order-i, for any i < k) Delaunay triangulations, where Ck = (4k + 1)(2k + 1)2 + 1.
3
Lower and Upper Bounds
In this section we derive upper and lower bounds on the number of first order Delaunay triangulations. As mentioned in the introduction, due to the practical motivation of this work, we are mostly interested in lower bounds. However, for completeness and because the theoretical question is also interesting, this section also includes a result on upper bounds. The main question that we address in this section is: what is the minimum number of higher order Delaunay triangulations that n points can have? Are there arbitrarily large point sets that have only O(1) higher order Delaunay triangulations? To our surprise, the answer to the second question is affirmative.
On the Number of Higher Order Delaunay Triangulations
223
The lemma below presents a construction that has only one higher order Delaunay triangulation, regardless of the value of k, for any k ≤ n/3 − 1. Note that this implies that for any value of k of practical interest, there are point sets that have no other order-k Delaunay triangulation than the Delaunay triangulation. Lemma 3. Given any n ≥ 6 and any k such that k ≤ n/3 − 1, there are point sets with n points in general position that have only one order-k Delaunay triangulation. Proof. We give a construction with n points that can be shown to have only one order-k Delaunay triangulation, for any value of k ≤ n/3 − 1. The idea is illustrated in Fig. 3. To simplify the explanation, in the following we assume that n is a multiple of 3. Note that for the proof it is enough to take k = n/3 − 1. We start with a triangle s1 s2 s3 . Then we add three groups of points, which we will denote with letters p, q, and r. The points in the first group are denoted p1 . . . pm , where m = n/3. These points are initially placed on a circle Cp that goes through s3 , as shown in the figure; they are sorted from top to bottom. The second group comprises k points q1 . . . qk , placed very close to each other on a circle Cq through s3 , as shown in the figure. In addition, we must also make sure that the points q1 . . . qk are close enough to s3 in order to be contained inside C(s1 , s2 , p1 ). Finally, the points in the third group, r1 . . . rk−1 , are placed very close to each other on a third circle Cr , which goes through s2 . The important properties of these circles are: (i) Cp contains s2 and all the points ri , (ii) Cr and Cq contain all the points of the type pi , and (iii) C(s1 , s2 , p1 ) contains s3 and all points of type qi . Clearly, the point set as constructed is degenerate, but this can be easily solved by applying a slight perturbation to each point, without affecting the properties just mentioned. Moreover, the perturbation can be made such that the Delaunay triangulation of the point set looks like the one in the right of Fig. 3. We argue in the full version [14] that all the edges in the Delaunay triangulation are k-fixed, by considering all the different types of edges that, potentially, could cross a Delaunay edge to make it non-fixed, and showing that any such edge cannot be useful-k.
C(s1 , s2 , p1 )
Cr
Cq
ri s s2
s3
qi s
pi s
s1
s3
ri s s2
qi s
s1
pi s
Cp Fig. 3. Construction of a point set (left) whose only order-k Delaunay triangulation is the Delaunay triangulation (right)
224
D. Mitsche, M. Saumell, and R.I. Silveira
Having determined that some point sets can have as little as one first order Delaunay triangulation, it is reasonable to ask what is the maximum number of first order Delaunay triangulations that a point set can have. In the full version [14] we prove the following tight bound, in part illustrated in Fig. 4.
Fig. 4. Construction with the maximum number of first order Delaunay triangulations. Left and right: point set and flippable quadrilaterals, for points not in general position.
Lemma 4. Every point set P with n points in general position has at most 2n−3 first order Delaunay triangulations, and this bound is tight.
4
Expected Number of Triangulations
Let P be a set of n points uniformly distributed in the unit square. In this section we give lower bounds on the expected number of higher order Delaunay triangulations of P. Note that the events that four points in P are cocircular and that three points in P form a right angle happen with probability zero, and hence we can safely ignore these cases. Throughout this section we will use the notation x ∼ y if x = y(1 + o(1)). We start with first order Delaunay triangulations. We aim to compute the probability that two randomly chosen points u, v in P form a useful-1, non→ Let w be the point to the Delaunay, edge. Assume that the edge is directed − vu. − → → left of vu, such that the circle C(u, v, w) contains no points to the left of − vu, − → and let t be the point to the right of vu, such that the circle C(u, v, t) contains → Let E be the event defined as follows: the edge uv no points to the right of − vu. → and the circle C(u, v, t) is useful-1 (but not Delaunay), t is to the right of − vu − → → and the circle contains no points of P to the right of vu, w is to the left of − vu − → C(u, v, w) contains no points of P to the left of vu. It is well-known that uv belongs to the Delaunay triangulation of P if and only if ∠uwv + ∠utv < π. Thus the event E can be decomposed into the disjoint union E = E1 ∪ E2 ∪ E3 , where E1 denotes the event E with the additional conditions that ∠uwv > π/2, ∠utv > π/2, E2 denotes the event E with the conditions that ∠uwv < π/2, ∠utv > π/2, and E3 denotes the event E with the conditions that ∠uwv > π/2, ∠utv < π/2 (in all cases we must have ∠uwv + ∠utv > π). Consequently, P[E] = P[E1 ] + P[E2 ] + P[E3 ].
On the Number of Higher Order Delaunay Triangulations ·
225 ·
Lemma 5. P[E1 ] ∼ c1 /n3 and P[E2 ] ∼ c2 /n3 , where c1 = 0.23807 and c2 = 0.40675. Proof. Let us first compute P[E1 ]. Let Aw (respectively, At ) be the interior of the set consisting of all points in → Let B (respecC(u, v, w) ∩ C(u, v, t) that are to the left (resp. right) of − vu. w tively, Bt ) denote the interior of the set containing all points in C(u, v, w) (resp. → and do not lie in A (resp. A ) C(u, v, t)) that are to the right (resp. left) of − vu t w (see Fig. 5, left). Since w is the point such that the circle C(u, v, w) contains no → the region A is empty of points in P. In order for the points to the left of − vu, w edge uv to be useful-1, the region Bt also has to be empty of points in P. Analogously, under the hypothesis of E1 , the regions At and Bw are empty of points in P. It is not difficult to see that the reverse implications also hold. Therefore, the event E1 is equivalent to the event that Aw , Bt , At , and Bw do not contain any point in P. Now let us denote by rw the radius of the circle C(u, v, w) and by the length of the edge uv (see Fig. 5, center). A straightforward calculation leads to the following expression for the area of Aw : area (Aw ) =
2 rw
arcsin
2rw
− 2
2 − rw
2 . 4
In order to compute P[E], we will be interested in having certain areas being empty of n points, which happens with probability (1 − area (A))n (for A the area in question). Since the contribution of areas A of size Θ(1) is O(λn ) for some 0 < λ < 1 (which is far less than the asymptotic value of the integrals, as we shall see below), for any constant j we can safely assume in the integrals below the asymptotic equivalence (1 − area (A))n−j ∼ e−area (A)n , without affecting the first order terms of the asymptotic behavior√of the integral. Observe that may take values from 0 to 2 and that the probability density of the event |uv| = is 2π d. Notice also that rw ∈ (/2, +∞) and that the event of having radius rw has probability density −2rw arcsin 2rw + rw 2 drw , 2 − rw
u
w Bt
Aw
w Bw
Aw
At v
u rw
u Bt
w Aw
t
v
4
At t
Bw
v
Fig. 5. Left: the event E1 and the regions Aw , Bw , At and Bt . Middle: in the event E1 , the region Aw is a circular sector minus a triangle. Right: the event E2 and the regions Aw , Bw , At and Bt .
226
D. Mitsche, M. Saumell, and R.I. Silveira
since it corresponds to the negative derivative −f (rw )drw of the function f (r) =
2 − 2 r2 − 4 . r2 arcsin 2r Denoting by rt the radius of the circle C(u, v, t), we obtain analogous expressions for rt . Now we have all the necessary ingredients to develop an expression for P[E1 ] : ⎛ ⎞ √2 ∞ ∞ r w ⎝−2rw arcsin ⎠ P[E1 ] ∼ 2π + 2rw 2 2 0 /2 /2 rw − 4 ⎛ ⎞ rt ⎝−2rt arcsin ⎠ + 2 2rt r2 − t
e
2 2 −n(πrw +πrt2 −rw
arcsin( 2rw
)+ 2
4
2
2 − −r 2 arcsin( )+ rw t 4 2r 2 t
2
rt2 − 4 )
drt drw d. (1)
Since classical methods for asymptotic integration fail for the integral given by (1) (the derivative of the exponent is infinity at the point where √ the exponent √ maximizes), we apply the following change of variables: /2 = a/ n, rt = b/ n, √ rw = c/ n (see full version [14] for details). This yields an integral independent of n. Given that it does not seem possible to evaluate this integral symbolically, we resort to applying numerical methods. For reasons of numerical stability a , (especially in the case of P[E2 ]) we apply another change of variables b = sin(σ/2) a c = sin(θ/2) . Solving this integral numerically (using Mathematica), we obtain ·
that P[E1 ] ∼ c1 /n3 , where c1 = 0.23807 (more details in the full version [14]). Let us now consider E2 . Let Aw , Bw , At and Bt be defined as in the event E1 (see Fig. 5, right). By the same arguments, the event E2 is equivalent to the event that the regions Aw , Bt , At , and Bw are empty of points in P. Analogous observations as in the previous case yield ⎛ ⎞ √2 ∞ ∞ r w ⎝2rw π − 2rw arcsin ⎠ P[E2 ] ∼ 2π + 2rw 2 2 0 /2 rw rw − 4 ⎞ ⎛ rt ⎠ ⎝−2rt arcsin + 2 2rt r2 − e
−n(πrt2 −rt2
arcsin(
2rt
+ 2
)
t
2 rt2 − 4
4
2 +rw arcsin( 2rw )− 2
2
2 − ) rw 4
drt drw d. (2)
Solving this integral numerically (using Mathematica), we obtain that P[E2 ] ∼ · c2 /n3 , where c2 = 0.40675 (see again full version [14] for details).
Denote by U1 the random variable counting the number of useful-1 (and not Delaunay) edges. We have the following corollary:
On the Number of Higher Order Delaunay Triangulations
Corollary 1. E[U1 ] ∼
c1 +2c2 2n
227
·
=: d1 n, where d1 = 0.525785.
Proof. Since E2 and E3 are symmetric, we obviously have that P[E3 ] = P[E2 ]. 2 2 Hence, P[E] ∼ c1 +2c n3 . Since for a fixed edge uv there are (n − 2)(n − 3) ∼ n − → ways to choose the points w and t to the left and to the right of vu, and these events are all disjoint, the edge uv is useful-1 (and not Delaunay) with proba · 2 2 2 bility c1 +2c . Hence, E[U1 ] ∼ n2 c1 +2c ∼ c1 +2c =: d1 n, where d1 = 0.525785.
n n 2n Recall that Rk denotes the number of order-k (and not order-i, for any i < k) Delaunay triangulations of a uniformly distributed point set. We can now state the following theorem: Theorem 1. Given n points distributed uniformly at random in the unit square, · E[R1 ] ≥ 2ρ1 n(1+o(1)) , where ρ1 = 0.525785. Proof. As noted earlier, E[R1 ] = E[2U1 ]. Now, by Jensen’s inequality, E[2U1 ] ≥
2E[U1 ] , and the result follows by Corollary 1. Combining the ideas for the case k = 1 with the result from Lemma 2, we obtain the following generalization for constant values of k: Theorem 2. Given n points distributed uniformly at random in the unit square, for any constant value of k, E[Rk ] ≥ 2ρk n(1+o(1)) , where ρk is a constant that can be calculated numerically. Proof. Denote by Uk the number of useful-k edges (which are not useful-i for any i < k) for any constant k > 1. By similar calculations as in the case k = 1, we obtain E[Uk ] ∼ dk n, where the constant dk can be calculated numerically (see full version [14] for details). By Lemma 2, Rk ≥ 2Uk /Ck − 1, where Ck = (4k + 1)(2k + 1)2 + 1. Therefore E[Rk ] ≥ E[2Uk /Ck ] − 1 and as before, by
Jensen’s inequality, E[2Uk /Ck ] ≥ 2E[Uk ]/Ck .
5
Concluding Remarks
We have given the first non-trivial bounds on the number of higher order Delaunay triangulations. We showed that there are sets of n points that have only one higher order Delaunay triangulation for values of k ≤ n/3 − 1, and that no point set can have more than 2n−3 first order Delaunay triangulations. Moreover, we showed that for any constant value of k (in particular, already for k = 1) the expected number of order-k triangulations of n points distributed uniformly at random is exponential. This supports the use of higher order Delaunay triangulations for small values of k, which had already been shown to be useful in several applications related to terrain modeling [10]. Acknowledgments. We are grateful to Nick Wormald for his help on dealing with the integrals of Section 4. We would also like to thank Christiane Schmidt and Kevin Verbeek for helpful discussions.
228
D. Mitsche, M. Saumell, and R.I. Silveira
References 1. Abellanas, M., Bose, P., Garc´ıa, J., Hurtado, F., Nicol´ as, C.M., Ramos, P.: On structural and graph theoretic properties of higher order Delaunay graphs. Internat. J. Comput. Geom. Appl. 19(6), 595–615 (2009) 2. Aichholzer, O., Hackl, T., Huemer, C., Hurtado, F., Krasser, H., Vogtenhuber, B.: On the number of plane graphs. In: 17th Annual ACM-SIAM Symposium on Discrete Algorithms, pp. 504–513. ACM, New York (2006) 3. Bern, M., Eppstein, D., Yao, F.: The expected extremes in a Delaunay triangulation. Internat. J. Comput. Geom. Appl. 1, 79–91 (1991) 4. Biniaz, A., Dastghaibyfard, G.: Drainage reality in terrains with higher-order Delaunay triangulations. In: van Oosterom, P., Zlatanova, S., Penninga, F., Fendel, E.M. (eds.) Advances in 3D Geoinformation Systems, pp. 199–211. Springer, Heidelberg (2008) 5. Biniaz, A., Dastghaibyfard, G.: Slope fidelity in terrains with higher-order Delaunay triangulations. In: 16th International Conference in Central Europe on Computer Graphics, Visualization and Computer Vision, pp. 17–23 (2008) 6. Chang, R.C., Lee, R.C.T.: On the average length of Delaunay triangulations. BIT 24, 269–273 (1984) 7. Cimikowski, R.J.: Properties of some Euclidian proximity graphs. Pattern Recogn. Lett. 13(6), 417–423 (1992) 8. Devroye, L.: On the expected size of some graphs in computational geometry. Comput. Math. Appl. 15, 53–64 (1988) 9. Gudmundsson, J., Hammar, M., van Kreveld, M.: Higher order Delaunay triangulations. Comput. Geom. 23, 85–98 (2002) 10. de Kok, T., van Kreveld, M., L¨ offler, M.: Generating realistic terrains with higher order Delaunay triangulations. Comput. Geom. 36, 52–65 (2007) 11. van Kreveld, M., L¨ offler, M., Silveira, R.I.: Optimization for first order Delaunay triangulations. Comput. Geom. 43(4), 377–394 (2010) 12. Matula, D.W., Sokal, R.R.: Properties of Gabriel graphs relevant to geographic variation research and clustering of points in the plane. Geogr. Anal. 12(3), 205– 222 (1980) 13. Miles, R.E.: On the homogenous planar Poisson point-process. Math. Biosci. 6, 85–127 (1970) 14. Mitsche, D., Saumell, M., Silveira, R.I.: On the number of higher order Delaunay triangulations (2010), arXiv:1002.4364 15. Santos, F., Seidel, R.: A better upper bound on the number of triangulations of a planar point set. J. Combin. Theory Ser. A 102(1), 186–193 (2003) 16. Sharir, M., Welzl, E.: Random triangulations of planar point sets. In: 22nd Annual Symposium on Computational Geometry, pp. 273–281. ACM, New York (2006) 17. Silveira, R.I.: Optimization of polyhedral terrains. Ph.D. thesis, Utrecht University (2009)
How Simple Robots Benefit from Looking Back Jérémie Chalopin1, , Shantanu Das1 , Yann Disser2 , Matúš Mihalák2 , and Peter Widmayer2 1 LIF, CNRS & Aix-Marseille Université,
[email protected],
[email protected] 2 Institute of Theoretical Computer Science, ETH Zürich {ydisser,mmihalak,widmayer}@inf.ethz.ch
Abstract. We study the sensor and movement capabilities that simple robots need in order to create a map of an unknown polygon of size n, and to meet. We consider robots that can move from vertex to vertex, can backtrack movements, and see distant vertices in counter-clockwise order but have no means of visibly identifying them. We show that such robots can always solve the weak rendezvous problem and reconstruct the visibility graph, given an upper bound on n. Our results are tight: The strong rendezvous problem, in which robots need to gather at a common location, cannot be solved in general, and without a bound on n, not even n can be determined. In terms of mobile agents exploring a graph, our result implies that they can reconstruct any graph that is the visibility graph of a simple polygon. This is in contrast to the known result that the reconstruction of arbitrary graphs is impossible in general, even if n is known.
1
Introduction
We are interested in the study of simple but autonomous robots that are capable of performing tasks like searching, cleaning, guarding or gathering data in unknown territories. One of the most fundamental problems involved in these tasks is to obtain a map of the environment. The complexity of this problem depends on the environment in which a robot operates, and on the robot’s sensor capabilities. For example, it is a substantial difference whether there are identifiable landmarks in the environment, or whether a robot has access to powerful sensors like GPS. In some settings, large numbers of simple robots are deployed in an environment and expected to cooperate and solve given tasks. A fundamental problem that arises in many settings with multiple robots is the rendezvous problem in which robots either need to gather at the same location (strong rendezvous) or at least need to position themselves such that they are visible to each other (weak rendezvous). The task of mapping an unknown environment has previously been studied both in graphs and in geometric environments, where robots move in the plane.
Most of this work was carried out while the first two authors were at ETH Zürich. This author was partially supported by ANR Projects SHAMAN and ECSPER.
T. Calamoneri and J. Diaz (Eds.): CIAC 2010, LNCS 6078, pp. 229–239, 2010. c Springer-Verlag Berlin Heidelberg 2010
230
J. Chalopin et al.
In this paper we focus on the latter case, more precisely on the case of robots operating in polygonal environments. For many tasks a geometrically accurate map of the environment is not needed, but a qualitative description of its shape is sufficient. The visibility graph of a polygon is such a qualitative map: Its nodes are the vertices of the polygon and two nodes are joined by an edge if they are visible to each other, i.e., if the line segment connecting them in the plane lies entirely within the polygon. Visibility graphs and their characterization have been studied extensively [7]. We aim to find minimalistic configurations of sensors and movement capabilities that enable simple robots to reconstruct the visibility graph of a polygon, and, in the case of multiple robots, to solve the rendezvous problem. There have been several studies concerned with the capabilities of minimalistic robots. For instance it has been shown that a single pebble alone already enables a simple robot to reconstruct the visibility graph [9]. The rendezvous problem in the plane has been solved for robots that measure distances. Studies in this setting consider for example robots with limited visibility and memory [1] or robots subject to measurement errors [5]. Other models for simplistic robots have been studied (e.g. [3,6,11]). The variant considered in this paper originates from [9]. Roughly speaking, we allow a robot to order the vertices it sees in counter-clockwise (ccw) order and to drive to any vertex it sees (for more details cf. Section 2). Bilò et al. showed that such a robot cannot reconstruct the visibility graph of a polygon by moving along the boundary only, even if the number of vertices n is known, unless provided with additional capabilities [2]. We extend the model by allowing the robot to look-back after moving, i.e. to know which vertex it came from among those now visible to it. In [2], another sensor was used in addition to the look-back capability and an algorithm for reconstructing the visibility graph was given for a robot equipped with both sensors, when the number n of vertices is known. In this paper we show that the capability to look-back alone is already sufficient, even if only an upper bound on n is known. It was previously shown that if robots have no previous knowledge about the polygon (i.e. not even a bound on n), they cannot reconstruct its size and thus they cannot reconstruct the visibility graph [3]. Furthermore we show that the look-back capability is sufficient for solving the weak rendezvous problem in all polygons, even if only an upper bound on n is known. This is in contrast to the fact that the strong rendezvous problem cannot be solved in general, even when the entire geometry of the polygon is known. The problem of reconstructing the visibility graph of a polygon can be seen as a special case of the problem of reconstructing a general graph. In a graph a robot is allowed to move along edges and sense the degree of the vertex it is currently located at. A usual assumption is that the edges incident to a vertex are distinctly labeled by a port-numbering function. The resulting model is equivalent to the message-passing network model of distributed computation [4]. A characterization of the graphs for which the rendezvous problem is solvable has been given [4,10]. From the results of [10] it is easy to infer that there are graphs which cannot be distinguished by a robot, i.e. it is not always possible
How Simple Robots Benefit from Looking Back
231
to reconstruct a graph. A robot with look-back capability moving in a polygon can imitate an agent that is moving in the corresponding visibility graph, which allows us to borrow concepts that led to the above results. We are able to show that while the graph reconstruction problem and the rendezvous problem are not solvable in general, the reconstruction problem as well as the weak rendezvous problem are solvable for visibility graphs, if a bound on n is known and if the edges on the polygon boundary can be distinguished.
2
Polygons and LB-Robots
Polygons. In this work we consider simple polygons only. Let in the following P be a simple polygon with n vertices. We denote the set of vertices of P by V (P), where we drop the argument P whenever the polygon is evident from the context. The boundary of P together with a (arbitrary) choice of a starting vertex v0 induces an order among the vertices and we write v0 , . . . , vn−1 to denote the vertices along the boundary in counter-clockwise (ccw) order. We define chain(vi , vj ) := (vi , vi+1 , . . . , vj ). Note that all indices of vertices are modulo n. In the following we assume polygons to be in general position, i.e. no three vertices lie on a common line. We say two vertices u, w ∈ V see each other or u sees w, if and only if the line segment uw lies entirely in P – in particular vi sees vi+1 for all i. If vi−1 sees vi+1 , we say vi forms an ear. The visibility graph of a polygon has a node for every vertex of the polygon and an edge for every pair of vertices that see each other. We define the degree of a vertex to be the degree of the corresponding node in the visibility graph. With vis(vi ) = (u1 , . . . , ud ) we denote the sequence of vertices that a vertex vi ∈ V of degree d sees, enumerated in ccw order along the boundary starting at u1 = vi+1 and ending at ud = vi−1 . We write visj (vi ) , 1 ≤ j ≤ d, to denote uj , vis−j (vi ) to denote ud+1−j and vis0 (vi ) to denote vi itself. Let C = (u0 , . . . , um−1 ) be a cycle of length m in the visibility graph of P. We say C is an ordered cycle, if and only if u0 , . . . , um−1 appear on the boundary of P in that order (ccw). As ui sees ui+1 mod m for 0 ≤ i ≤ m − 1, C induces a subpolygon of P. Note that C being an ordered cycle implies that the boundary of the induced subpolygon does not self-intersect. Lemma 1. Let P be a simple polygon of size n ≥ 4. For all 0 ≤ i < n we have that the degree of vi or vi+1 is greater than two. Proof. As any polygon has a triangulation, two vertices that see each other need to share a third vertex they both see. In our instance two vertices vi and vi+1 thus need to share a third vertex w that they both see. For the sake of contradiction assume there is a vertex vi such that vi and vi+1 have degree two. It follows that w must be a neighbor of both vertices on the boundary which is a contradiction to the assumption n ≥ 4.
232
J. Chalopin et al.
Look-Back Robot. We now define a basic robot which we use as a foundation for more sophisticated models later on. A basic robot r in a polygon P is modeled to be a moving point initially situated at some vertex of P. We allow it to move to the neighboring vertices along the boundary of P, and we write vr to denote its current location. We say r sees a vertex u if u ∈ vis(vr ). While r remains at vr , we allow it to sense the degree of vr and to put the vertices it sees into ccw order starting with vr+1 . Note that the robot has no immediate way of globally identifying the vertices it sees, i.e. knowing their global index with respect to vr (i.e. their index counting from vr in ccw order along the boundary). As our intention lies in obtaining a weak model, we do not allow robots to gather sensory information while moving. We do not impose a limitation on the robots’ memory. A natural extension of the basic model lies in allowing a robot r to not only move along the boundary, but to any vertex it sees. In general r does not know the identity (= global index) of any vertex but its neighbors. This means that any local information it gathered while driving along the boundary may be lost once it decides to drive to a distant vertex. In order to get around this problem we further enhance our model by adding the look-back capability: Consider a robot at some vertex vi that drives to a distant visible vertex vj . Without lookback, the robot afterwards has no way of knowing the identity of vi in vis(vj ). Look-back provides the robot with the index k such that vi = visk (vj ). We call such a robot a look-back robot or LB-robot.
3
Results
As soon as there is one vertex v of the environment that a robot can distinguish from all other vertices, it can easily determine the visibility graph: It can define v0 = v and identify the global index of any vertex it sees easily by driving there and then along the boundary until it encounters v , counting the number of steps along the boundary (cf. [9]).This means that if the robot can perceive any nonsymmetrical structure, it can define a unique vertex v and thus reconstruct the visibility graph. In other words, for most polygons reconstructing the visibility graph (or meeting other identical robots) is an easy task. Only highly symmetrical polygons present a challenge. In order to solve the problem in general, we make use of concepts first introduced in the context of distributed networks. In distributed computing, a network is modelled as a graph whose edges are labelled by so-called port numbers (local orientation), such that edges incident to a vertex are assigned distinct labels [10]. As our robot is capable of bringing the vertices it sees into ccw order, and as this order is the same whenever a vertex is visited, the robot has access to a port numbering. Look-back allows the robot to backtrack any number of moves or, in the sense of distributed computing, to send messages back and forth between vertices. In distributed networks it has proven beneficial [10] to define a view of a vertex as the collection of information a node can gather by sending and receiving messages. We will introduce the same concept in our setting of a robot moving along the visibility graph of a polygon and show that it is a powerful tool for analysing the capabilities of the robot.
How Simple Robots Benefit from Looking Back
233
In the following we adapt the definition of the view of a vertex, to suit our robot perspective. Consult Figure 1 (left) along with the definitions. Definition 1. Let v be a vertex of a simple polygon P and d be its degree. The level-1-label l(v) ≡ l(1) (v) of v is given by l(v) := (r1 , . . . , ri , . . . , rd ) where ri is defined such that visri (visi (v)) = v, i.e. ri is the index of v in visi (v)’s list of neighbors. We write lj (v) to denote rj and l−j (v) to denote rd+1−j for 0 < j ≤ d. Similarly li (v) = −k means vis−k (visi (v)) = v. Definition 2. Let v be a vertex of a simple polygon P and d be its degree. Let , . . . , ud ). For k ∈ N, k > 1, the level-k-label l(k) (v) of v is given by vis(v) = (u 1(k−1) (k−1) (k) (k−1) l (v) := l (v) , l (u1 ) , . . . , l (ud ) . Note that the definition of the level-k-label of a vertex v is equivalent to its view up to depth k as originally defined in [10]. Intuitively it contains the information a backtracking agent can gather by exploring the visibility graph up to a distance of k from v. In the following we introduce the notion of a level-k-class of a vertex for the equivalence class containing all vertices with the same level-k-labels. (k)
Definition 3. Let v be a vertex of a simple polygon P. The level-k-class Cv (P) of v is the set of vertices of P that have the same level-k-label as v, including (k) (k) v itself. Formally Cv (P) := u ∈ V l (u) = l(k) (v) . The class Cv (P) of v is defined the same level-j-label for all j: to be the set of vertices that have Cv (P) := u ∈ V ∀j ≥ 1 : l(j) (u) = l(j) (v) . We drop the argument P whenever the polygon is clear from the context. The following lemma summarizes the key properties of classes. In particular it states that a finite exploration depth is sufficient for fully characterizing the class of a vertex. Lemma 2. Let v be a vertex of a simple polygon P of size n. For all k ≥ 1 we have the following properties: (k+1) (k) (k) (n−1) (k) (n−1) 1: Cv ⊆ Cv ; 2: Cv ⊆ Cv ; 3: Cv ⊆ Cv ; 4: Cv = Cv .
Fig. 1. Left: illustration of the definition of the level-1-label of a vertex v. Right: illustration of how classes repeat along the boundary of a highly symmetrical polygon.
234
J. Chalopin et al.
Proof. Properties 1 and 2 follow immediately from the definitions of level-klabels and classes. Property 3 was proven by Norris [8] for general graphs (not only visibility graphs) using the observation that if there is a vertex v such that (k) (k+1) for some k > 1 we have Cv
= Cv , then there is also a vertex u for which (k−1) (k) Cu = Cu . Property 4 follows from Property 3 and the definition of Cv .
In [10] it was first shown that all classes have the same size q even in general graphs. The following lemma adds that in the case of polygons, the sequence of classes to which the vertices along the boundary belong is periodical with period n q (cf. Figure 1 (right)). Lemma 3. Let vi be a vertex of a simple polygon P of size n. For all vertices u ∈ V we have q := |Cvi | = |Cu | and p := nq is an integer equal to the number of different classes of P. For all integers k we have Cvi = Cvi+kp . Proof. For every vj ∈ V we have Cvj = Cvj+1 as every vertex of Cvj has a vertex of Cvj+1 as its ccw neighbor on the boundary and conversely every vertex of Cvj+1 has a vertex of Cvj as its cw neighbor on the boundary. Since this is true for every vertex vj , all classes must have the same size q = |Cvi | and thus p = nq is an integer and there are p classes. As the sequence Cvl , Cvl+1 , . . . , Cvl−1 is the same for all vl ∈ Cvi , the vertices of Cvi need to be equally spaced in it. Using that an equal spacing is given by n/ |Cvi | = p, we get Cvi = Cvi +kp for all integers k. We now show that level-1-labels are enough to find the ears of a polygon. Lemma 4. Let vi be a vertex of a simple polygon P of size n ≥ 3. We have that vi is an ear, if and only if l2 (vi−1 ) = −2 or equivalently l−2 (vi+1 ) = 2. Proof. If vi is an ear, we obviously have vis2 (vi−1 ) = vi+1 and vis−2 (vi+1 ) = vi−1 which implies l2 (vi−1 ) = −2 and l−2 (vi+1 ) = 2. Conversely vis2 (vi−1 ) = vi+1 obviously implies that vi is an ear. As l2 (vi−1 ) = −2 and l−2 (vi+1 ) = 2 are equivalent, it remains to show that l2 (vi−1 ) = −2 implies vis2 (vi−1 ) = vi+1 . For the sake of contradiction assume w := vis2 (vi−1 )
= vi+1 . Consider the subpolygon P induced by the ordered cycle chain(vi−1 , w). In P , vi−1 and w have degree 2. As w
= vi+1 , we have |chain(vi−1 , w)| ≥ 4 which contradicts Lemma 1. Therefore vis2 (vi−1 ) = vi+1 and vi is an ear. Lemma 5. Let vi be a vertex of a simple polygon P. If vi is an ear of P, then (2) every vertex in Cvi is an ear. Proof. By Lemma 4 we know that l2 (vi−1 ) = −2 and l−2 (vi+1 ) = 2. Let vj ∈ (2) Cvi . Because l(2) (vi ) = l(2) (vj ), we have l(vi−1 ) = l(vj−1 ) and l(vi+1 ) = l(vj+1 ) from which it follows that l2 (vj−1 ) = −2 and l−2 (vj+1 ) = 2. This however implies that vj is an ear (again using Lemma 4).
How Simple Robots Benefit from Looking Back
235
The following lemma allows a robot to ’cut off’ ears of the polygon, i.e. the operation that removes a vertex vi yielding the subpolygon induced by the ordered cycle v0 , . . . , vi−1 , vi+1 , . . . , vn−1 in P’s visibility graph. Cutting off a single ear is problematic for a robot as it has no obvious way of deciding which edges of the visibility graph it has to ignore afterwards in order to restrict itself to the remaining polygon. An edge might lead to a vertex of the same class as the one the robot cut off, in which case it has no way of distinguishing whether the vertex is still there or not. Cutting off all vertices of one class however is possible as the robot can then simply ignore edges leading to vertices of the corresponding class altogether. Lemma 6. Let v be a vertex of a simple polygon P of size n with |Cv | < n, i.e. P has more than one class. If v is an ear of P, the subpolygon P of P obtained by cutting off the vertices Cv (P) is well-defined and for all vertices u of P we have Cu (P) ⊆ Cu (P ). (2)
Proof. As v is an ear, Lemma 5 gives us that all vertices in Cv are ears and thus (2) all vertices in Cv ⊆ Cv are (Lemma 2). The subpolygon P is thus well-defined as the inducing set of vertices lies on an ordered cycle. Let u, w be vertices of P such that Cu (P) = Cw (P) and thus for all k ≥ 1 we have l(k) (u) = l(k) (w) in P. The level-k-label of a vertex v in P can be obtained from its level-k-label in P by recursively removing all occurrences of labels that belong to a vertex in Cv (P) (i.e. we remove the level-(k − 1)-labels belonging to vertices in Cv (P) from l(k) (v ) and apply the procedure recursively (n−1) for k − 1 to the other labels in l(k) (v )). As Cv (P) = Cv (P), i.e. a finite depth determines the class of a vertex, the same occurrences are removed for vertices in the same class. Thus in P , l(k) (u) = l(k) (w) holds for all k ≥ 1 and hence Cu (P ) = Cw (P ). The following result is the main insight for reconstructing the visibility graph of a polygon and for solving the weak rendezvous problem. (n−1)
Theorem 1. For any simple polygon P there is a vertex v for which Cv Cv forms a clique in the visibility graph of P.
=
Proof. Using the fact that any simple polygon has an ear, we can select an ear u of our polygon and cut off all vertices in Cu . Lemma 6 gives us that we can do this and we never divide classes in the process. We can repeatedly apply this procedure until we obtain a polygon P where every vertex is in the same class. As P needs to have at least one ear, it follows from Lemma 5 that all vertices of P are ears. This in turn implies that P is convex and thus its visibility graph is a complete graph. As we never divide classes in our procedure, we know that there is a vertex v of P such that every vertex of Cv (P) is still present in P . Hence, Cv (P) forms a clique in P and thus forms a clique in P. Lemma 7. Let P be a simple polygon of n vertices. Given n and some k ≥ 1, an LB-robot located at v can determine l(k) (v).
236
J. Chalopin et al.
Proof. The LB-robot can compute l(1) (v) by moving to every neighbor of v in turn. It can recursively compute l(k) (v) by moving to every neighbor of v in turn and computing its level-(k − 1)-label. In both cases, as the robot can look-back, it is capable of returning to v after visiting a neighbor. Using Lemma 7 and Theorem 1, we show that any number of deterministic LB-robots can position themselves such that they are mutually visible. Theorem 2. Let P be a simple polygon of n vertices. Given n, any number of identical and deterministic LB-robots can weakly meet in P, i.e. they can position themselves such that every robot sees all other robots. Proof. By Lemma 7 a robot can calculate l(n) (v) for every vertex v along the boundary and thus not only find the classes of all vertices but also the classes of all vertices they see. By Theorem 1 at least one class forms a clique. The robot can easily check which classes form a clique (by comparing the level-n-labels) and drive to a vertex of the class Cmin with the lexicographically smallest leveln-label among all these classes. This strategy will choose the same class Cmin for every robot independent of its starting location, thus if all robots execute it they will eventually all be located on vertices of Cmin seeing each other as Cmin forms a clique. In the following we again use the fact that an LB-robot can find a class of vertices that forms a clique, and we show that using this clique as a frame, it can incrementally build up the visibility graph of the polygon. Theorem 3. Let P be a simple polygon of n vertices. Given n, an LB-robot can determine the visibility graph of P. Proof. By Lemma 7 the robot can determine l(n) (v) for all vertices v along the boundary and thus not only find the classes of all vertices but also the classes of all vertices they see. As in the proof of Theorem 2, this means the robot can identify the class Cmin with the lexicographically smallest level-n-label among the classes forming a clique. Let u ∈ Cmin be a vertex of this class. We argue that the edges of u in the visibility graph of P are easily identified. Assume that the i-th edge of u (in ccw order) leads to a vertex w of class C and let xi be the number of edges with index j < i that lead to vertices of class Cmin . If C = Cmin , w is easily identified as the (xi + 1)-th vertex of class Cmin counting along the boundary starting at u. If C
= Cmin , w is the first vertex of class C after the xi -th vertex of class Cmin in ccw order counting from u (by Lemma 3, there is exactly one vertex of class C between the xi -th and the (xi + 1)-th vertex of class Cmin ). In the following we show that the robot can identify the edges to other vertices (u ∈ / Cmin ). Let vi be a vertex of P. With dk (vi ) and d−k (vi ) we denote the set of vertices in chainvi (vi , vi+k ) and chainvi (vi−k , vi ), respectively. Finding the visibility graph is the same as finding d n2 (v) and d− n2 (v) (i.e. the global indices of the vertices in d n2 (v), d− n2 (v)) of every vertex v along the boundary. In the following we assume that () for two vertices u, w, Cu = Cw implies |dk (u)| = |dk (w)| and
How Simple Robots Benefit from Looking Back
237
|d−k (u)| = |d−k (w)| for all k ≥ 1. We will prove () later, but for now observe that it trivially holds for k = 1. We show inductively how to obtain d± n2 for all vertices. The robot knows d±1 for every vertex. It remains to be shown how to obtain dk+1 (vi ) for some vertex vi assuming dk (vi ) is known – this can then be applied to all vertices in order to obtain d±(k+1) . Let x := |dk (vi )| and vis(vi ) = (u1 , . . . , ud ), where d is vi ’s degree. We have dk (vi ) ∪ {vi+k+1 } , if ux+1 = vi+k+1 dk+1 (vi ) = dk (vi ) , otherwise. Let vj := ux+1 be the first vertex (in ccw order) visible to vi and not in dk (vi ). In order to derive dk+1 (vi ), it is now enough for the robot to decide whether vj = vi+k+1 or vj
= vi+k+1 . As the robot knows Cvi+k+1 and can compute Cvj , this is trivial for vi+k+1 ∈ / Cvj . We therefore restrict ourselves to the case vi+k+1 ∈ Cvj . We then have y := |d−k (vi+k+1 )| = |d−k (vj )|, using (). Assuming vj = vi+k+1 immediately leads to lx+1 (vi ) = − (y + 1). We want to show that lx+1 (vi ) = − (y + 1) if and only if vj = vi+k+1 . For the sake of contradiction assume vj
= vi+k+1 and lx+1 (vi ) = − (y + 1). Let a ∈ Cmin be the first vertex in chain(vi , vj ) lying in Cmin and likewise let b ∈ Cmin be the last vertex in chain(vi , vj ) lying in Cmin . Note that a and b are well defined as vi+k+1 ∈ chain(vi , vj ) and there is a vertex of Cmin between vi+k+1 and vj as Cvi+k+1 = Cvj (Lemma 3). Consider the case a
= b (cf. Figure 2 (left)). We define s to be the last vertex in chain(vi+1 , a) visible to vi and t to be the first vertex in chain(b, vj−1 ) visible to vj . Let P be the subpolygon induced by vi , chain(s, a) , chain(b, t) , vj . This subpolygon is well defined since a sees b as Cmin forms a clique. Note that vi does not see any vertices in chain(b, vj−1 ), likewise vj does not see any vertices in chain(vi+1 , a) (recall that vj = ux+1 and lx+1 (vi ) = − (y + 1)). In P , vi and vj are neighbors on the boundary and both have degree 2 which is a contradiction with Lemma 1. We may thus assume a = b (cf. Figure 2 (right)). As there has to be a vertex of class Cmin in chain(vi+k+1 , vj ), there can be none in chain(vi , vi+k+1 ) (and thus none in chain(vj−k−1 , vj ) as vj−k−1 ∈ Cvi ). This however means that k < p − 2 with p = n/ |Cv0 | from Lemma 3, and thus chain(vi , vi+k ) and chain(vj−k , vj ) do not overlap (|chain(vi+k+1 , vj )| ≥ p + 1 as vi+k+1 ∈ Cvj ). Let now s be the last vertex in chain(vi+1 , vi+k ) visible to vi and t be the first vertex in chain(vj−k , vj−1 ) visible to vj . We can then define the subpolygon P induced by vi , chain(s, t) , vj in which again vi and vj are neighbors of both degree 2, which is a contradiction to Lemma 1. We have seen that lx+1 (vi ) = − (y + 1) is necessary and sufficient for vj = vi+k+1 . Both x and y as well as level-1-labels can be derived from l(n) (vi ). This proves that our robot can compute the visibility graph inductively. To complete the proof we still need to show (). Obviously we have () for k = 1. By inspection of the inductive method above for k > 1, we see that whenever we conclude vj = vi+k+1 for some vertex vi , the same conclusion will be made for any other vertex vl ∈ Cvi . In step k of the induction, we only use () for d±k . Hence () is maintained throughout.
238
J. Chalopin et al.
Fig. 2. Illustration of the visibility graph for the cases a = b (left) and a = b (right). The outline of the subpolygon causing a contradiction is highlighted.
The following theorem implies that the results of Theorems 2 and 3 still hold if only an upper bound N ≥ n on the number of vertices is given. Theorem 4. Let P be a simple polygon of n vertices. Given a bound N ≥ n, an LB-robot can determine the number of vertices n. Proof. By Lemma 7, the robot can determine the sequence of level-N -labels l(N ) (vi ) , l(N ) (vi+1 ) , . . . , l(N ) (vi+N −1 ), where vi is its initial location. By Lemma 2, (N −1) we have Cvj = Cvj and thus the robot knows the classes of the vertices vi , vi+1 , . . . , vi+N −1 as well as the classes of the vertices they see. Let q = |Cvi | and p = nq as in Lemma 3. The robot can determine p as the number of different classes it encounters since N ≥ n. Once the robot knows q, it can immediately infer n = p · q. By Theorem 1 there is a class C that forms a clique in the visibility graph. Let Mi := vis(vi ) ∩ Cvi . As N ≥ n, there is a vertex of C among vi , vi+1 , . . . , vi+N −1 and hence q = maxi≤j≤i+N −1 |Mi | + 1. As the robot knows the classes of the vertices vi , vi+1 , . . . , vi+N −1 as well as the classes of the vertices they see, it can infer Mi , Mi+1 , . . . , Mi+N −1 and thus q.
References 1. Ando, H., Oasa, Y., Suzuki, I., Yamashita, M.: Distributed memoryless point convergence algorithm for mobile robots with limited visibility. IEEE Transactions on Robotics and Automation 15(5), 818–828 (1999) 2. Bilò, D., Disser, Y., Mihalák, M., Suri, S., Vicari, E., Widmayer, P.: Reconstructing visibility graphs with simple robots. In: Proceedings of the 16th International Colloquium on Structural Information and Communication Complexity, pp. 87–99 (2009) 3. Brunner, J., Mihalák, M., Suri, S., Vicari, E., Widmayer, P.: Simple robots in polygonal environments: A hierarchy. In: Fekete, S.P. (ed.) ALGOSENSORS 2008. LNCS, vol. 5389, pp. 111–124. Springer, Heidelberg (2008)
How Simple Robots Benefit from Looking Back
239
4. Chalopin, J., Godard, E., Métivier, Y., Ossamy, R.: Mobile agent algorithms versus message passing algorithms. In: Shvartsman, M.M.A.A. (ed.) OPODIS 2006. LNCS, vol. 4305, pp. 187–201. Springer, Heidelberg (2006) 5. Cohen, R., Peleg, D.: Convergence of autonomous mobile robots with inaccurate sensors and movements. SIAM Journal of Computing 38(1), 276–302 (2008) 6. Ganguli, A., Cortés, J., Bullo, F.: Distributed deployment of asynchronous guards in art galleries. In: Proceedings of the 2006 American Control Conference, pp. 1416–1421 (2006) 7. Ghosh, S.K.: Visibility Algorithms in the Plane. Cambridge University Press, Cambridge (2007) 8. Norris, N.: Universal covers of graphs: isomorphism to depth n − 1 implies isomorphism to all depths. Discrete Applied Mathematics 56(1), 61–74 (1995) 9. Suri, S., Vicari, E., Widmayer, P.: Simple robots with minimal sensing: From local visibility to global geometry. International Journal of Robotics Research 27(9), 1055–1067 (2008) 10. Yamashita, M., Kameda, T.: Computing on anonymous networks: Part I – characterizing the solvable cases. IEEE Transactions on Parallel and Distributed Systems 7(1), 69–89 (1996) 11. Yershova, A., Tovar, B., Ghrist, R., LaValle, S.M.: Bitbots: Simple robots solving complex tasks. In: Proceedings of the 20th National Conference on Artificial intelligence, vol. 3, pp. 1336–1341 (2005)
On Strategy Improvement Algorithms for Simple Stochastic Games Rahul Tripathi1 , Elena Valkanova1 , and V.S. Anil Kumar2 1
2
Department of Computer Science and Engineering, University of South Florida, Tampa, FL 33620, USA
[email protected],
[email protected] Virginia Bioinformatics Institute and Dept. of Computer Science, Virginia Tech. Blacksburg, VT 24061, USA
[email protected]
Abstract. The study of simple stochastic games (SSGs) was initiated by Condon for analyzing the computational power of randomized space-bounded alternating Turing machines. The game is played by two players, MAX and MIN, on a directed multigraph, and when the play terminates at a sink s, MAX wins from MIN a payoff p(s) ∈ [0, 1]. Condon showed that the SSG value problem, which given a SSG asks whether the expected payoff won by MAX exceeds 1/2 when both players use their optimal strategies, is in NP ∩ coNP. However, the exact complexity of this problem remains open as it is not known whether the problem is in P or is hard for some natural complexity class. In this paper, we study the computational complexity of a strategy improvement algorithm by Hoffman and Karp for this problem. The Hoffman-Karp algorithm converges to optimal strategies of a given SSG, but no nontrivial bounds were previously known on its running time. We show a bound of O(2n /n) on the convergence time of this algorithm, and a bound of O(20.78n ) on a randomized variant. These are the first non-trivial upper bounds on the convergence time of these strategy improvement algorithms.
1
Introduction
Stochastic games, first studied by Shapley in 1953 [Sha53], are two-player games that arise in a number of applications, including complexity theory, game theory, operations research, automated software verification, and reactive systems. Several variations of stochastic games have been studied, and an interesting restriction of this game model is the class of simple stochastic games (SSGs). Condon [Con92] initiated the study of SSGs for analyzing the computational power of randomized space-bounded alternating Turing machines. The game is played by two players, MAX and MIN, on a game board, which is a directed multigraph G = (V, E). The vertex set V is partitioned into disjoint subsets VMAX , VMIN , VAVE , and VSINK . Each vertex x ∈ VSINK has a payoff p(x) ∈ [0, 1]. The play is determined by a token, which is initially placed at a given start vertex. At each step, the token is moved along an edge of the graph. If the T. Calamoneri and J. Diaz (Eds.): CIAC 2010, LNCS 6078, pp. 240–251, 2010. c Springer-Verlag Berlin Heidelberg 2010
On Strategy Improvement Algorithms for Simple Stochastic Games
241
token is at vertex x ∈ VMAX , MAX chooses an outgoing edge, while if x ∈ VMIN , MIN chooses the outgoing edge. If x ∈ VAVE , the outgoing edge is chosen uniformly at random, and if x ∈ VSINK , then the play stops and MAX wins from MIN the payoff p(x). The goal of MAX is to maximize the payoff won from MIN, while the goal of MIN is to minimize this payoff. Condon studied the computational complexity of the problem SSG-VAL, which is the problem of determining whether the expected payoff won by MAX is greater than 1/2, when both players use their optimal strategies. She showed that SSG-VAL is complete for the class of languages accepted by logspace randomized alternating Turing machines, and is in NP ∩ coNP. Despite considerable interest, the complexity of this problem is not fully resolved as it is unknown whether the problem is in P or is hard for some natural complexity class. The best known algorithms for SSG-VAL are subexponential-time randomized algorithms of Ludwig [Lud95] and Halman [Hal07]. This puts SSG-VAL among a small list of natural combinatorial problems in NP ∩ coNP, which are not yet known to be in P; the sub-exponential upper bound makes this problem rarer still. Apart from the results in [Lud95,Hal07], very few additional upper bound results are known for SSG-VAL. Condon [Con92] showed that restricted versions of SSG-VAL consisting of only two classes of nodes (out of MAX, MIN and AVE) can be solved in polynomial time. This was extended by Gimbert et al. [GH09] who developed a fixed parameter tractable algorithm in terms of |VAVE |, which runs in time O(|VAVE |! · poly(n)) where n is the size (in bits) of the input game. There have been numerous other algorithms for this problem based on the general approach of “strategy improvement,” which involves switching the choices of nodes that are not locally optimal. One well studied strategy improvement algorithm is the Hoffman-Karp algorithm [HK66] (Section 3) in which choices of all locally non-optimal nodes are switched in each iteration until optimal strategies are found. Condon [Con92] showed that the HoffmanKarp algorithm does converge to the optimum, though its convergence time is still not very well understood. The specific details of such strategy improvement algorithms are important, and as discussed by Condon [Con93], variants of Hoffman-Karp and other natural heuristics do not converge to the optimum. The focus of this paper is on understanding the convergence time of the Hoffman-Karp algorithm. Let n denote min{|VMAX |, |VMIN |}. We show that the convergence time of the Hoffman-Karp algorithm is O(2n /n). This is the first non-trivial upper bound on the convergence time of the Hoffman-Karp algorithm. We also consider a randomized variant of this algorithm, and show that the convergence time of the randomized algorithm is O(20.78n ). While these bounds are still exponential, they represent an improved understanding of these strategy improvement algorithms. Our analyses extend those of Mansour and Singh [MS99] for policy iteration algorithms for Markov decision processes.
2
Preliminaries
We now discuss the basic concepts and notations needed for the rest of the paper. We follow the definitions presented in [Som05] for the most part.
242
R. Tripathi, E. Valkanova, and V.S. Anil Kumar
A SSG is a two-player game between players MAX and MIN. The game is played on a game board, which is a directed multigraph G = (V, E). The vertex set V is partitioned into disjoint subsets VMAX , VMIN , VAVE , and VSINK . All vertices of G, except those of VSINK , have exactly two outgoing edges. The vertices belonging to VSINK have no outgoing edge. The vertex set VPOS =df VMAX ∪ VMIN ∪ VAVE represents the set of all game positions and the edge set E denotes a possible move in the game. One vertex from VPOS is called start vertex. We call x ∈ V a MAX-position if x ∈ VMAX , a MIN-position if x ∈ VMIN , an AVE-position if x ∈ VAVE , and a sink if x ∈ VSINK . Each sink x has a rational payoff p(x) ∈ [0, 1]. For every x ∈ VAVE , every edge leaving x is labeled with a probability such that the sum of probabilities over all edges leaving x is one; the probability associated with an edge (x, y) ∈ E, for x ∈ VAVE , is denoted by q(x, y). The outgoing edges from any vertex x ∈ VMAX ∪ VMIN are unlabeled. Before the start of a play, a token is placed on start vertex x. Each step of the play depends on where the token is located. Suppose that the token is currently at x ∈ V . If x ∈ VMAX , then MAX chooses an outgoing edge. If x ∈ VMIN , then MIN chooses an outgoing edge. If x ∈ VAVE , then a random outgoing edge is chosen from a distribution q(x , ·) over the neighbors of x . Finally, if x ∈ VSINK , then the play stops and MAX wins from MIN a payoff p(x ) ∈ [0, 1]. We refer to a SSG by the name of its game board, i.e., the multigraph G. We denote the game G starting at vertex x by G(x). The above definition generalizes the usual definition of SSGs [Con92,Con93,Lud95,Hal07], which considers two types of sink vertices, 0-sink and 1-sink, but no payoffs. However, as discussed by Condon [Con92], these two definitions are equivalent. A strategy of a player specifies the choices made by the player during a play of the game. A strategy is pure if the choices are made in a deterministic manner, and is mixed if the choices are made according to some probability distribution. A pure strategy may depend on time, and, more generally, it may depend on the history of a play. On the other hand, a stationary (or memoryless) strategy depends only on the current state of a play, and is independent of both time and history. Condon [Con92] showed that both players MAX and MIN have optimal strategies (defined in Definition 1), which are pure and stationary. Therefore, in this paper, we consider only pure, stationary strategies of the two players. Formally, a strategy σ of MAX is a function σ : VMAX → V such that for every x ∈ VMAX , (x, σ(x)) ∈ E. Similarly, a strategy τ of MIN is a function τ : VMIN → V such that for every x ∈ VMIN , (x, τ (x)) ∈ E. For every strategy α of a player P ∈ {MAX, MIN}, we say that a play x0 , x1 , x2 , . . . of G(x0 ) confirms to α if, for every i ≥ 0 and every xi ∈ VP , we have xi+1 = α(xi ). For every choice of start vertex x and strategies σ, τ of the players, the expected payoff vσ,τ (x) that MAX wins is defined as vσ,τ (x) =df s∈VSINK qσ,τ (x, s) · p(s), where qσ,τ (x, s) denotes the probability that a play of G(x) confirming to σ and τ stops at a sink vertex s. It is implicit in the above definition that vσ,τ (x) = 0 if no play of G(x) conforming to σ and τ is finite. A stopping SSG is a SSG in which starting at any initial position, every possible play ends at a sink vertex. Stopping SSGs are known to have certain desirable
On Strategy Improvement Algorithms for Simple Stochastic Games
243
properties (e.g., the existence of a unique optimal value vector). Condon [Con92] showed that there is a polynomial-time transformation that, given any SSG G, constructs a new stopping SSG G such that G is as good as G for the purpose of studying the problem SSG-VAL. Since the focus of this paper is to study algorithms for the SSG value problem, we will henceforth assume that a SSG is a stopping SSG. Given any strategy τ of MIN, a best response (i.e., optimal) strategy σ = σ(τ ) of MAX w.r.t. τ , if it exists, is one that, for every game position x ∈ VPOS , assures the maximum payoff for MAX over all choices of MAX-strategies, i.e., vσ,τ (x) = maxσ vσ ,τ (x). Similarly, given any startegy σ of MAX, a best response strategy τ = τ (σ) of MIN w.r.t. σ, if it exists, is one that, for every game position x ∈ VPOS , assures the minimum payoff for MAX over all choices of MIN-strategies, i.e., vσ,τ (x) = minτ vσ,τ (x). Howard [How60] showed that such strategies always exist, and therefore, σ(τ ) and τ (σ) are well defined. Derman’s [Der70] LP formulation can be used for constructing these best response strategies for any stopping SSG in polynomial time. Strategies σ and τ are optimal strategies if each is a best response strategy w.r.t. the other. Condon [Con92] showed that every stopping SSG has optimal strategies. Definition 1 (optimal strategies). Let σ and τ be strategies of MAX and MIN, respectively. Strategies σ and τ are optimal at x ∈ VPOS if, for any strategy σ of MAX and for any strategy τ of MIN, it holds that vσ ,τ (x) ≤ vσ,τ (x) ≤ vσ,τ (x). Strategies σ and τ are optimal if they are optimal at every x ∈ VPOS . The expected payoff vector corresponding to a pair of optimal strategies is called an optimal value vector. Condon [Con92] showed that every stopping SSG has an optimal value vector, which is unique. Definition 2 (optimal value vector). For any optimal strategies σ and τ at x ∈ VPOS , the expected payoff vopt (x) =df vσ,τ (x) is called an optimal value of G(x). If, for every x ∈ VPOS , there exist optimal strategies at x, then a vector vopt : VPOS → [0, 1] of optimal values is called an optimal value vector of G. We call any mapping v : VPOS → [0, 1] a value vector. Sometimes, we extend the domain of such a value vector v to VSINK and define the mapping of any sink vertex s as the payoff p(s) ∈ [0, 1]. We use v to denote this extension of v. The v-switchable positions, defined in Definition 3, will be useful in constructing an improved value vector from v (see Lemma 4). Notice that only a position x ∈ VMAX ∪ VMIN can possibly be a v-switchable position. Definition 3 (switchable positions). Let v : VPOS → [0, 1] be a value vector. For any x ∈ VMAX ∪ VMIN , we say that x is v-switchable if either x ∈ VMAX and v(x) < max{v(y) | (x, y) ∈ E}, or x ∈ VMIN and v(x) > min{v(y) | (x, y) ∈ E}. Given a value vector v, we say that a player strategy is v-greedy if the strategy makes locally optimal choice w.r.t. v at every position of the player. Definition 4 (greedy strategies). Let v : VPOS → [0, 1] be a value vector. A MAX-strategy σ is said to be v-greedy at x ∈ VMAX if v(σ(x)) = max{v(y) |
244
R. Tripathi, E. Valkanova, and V.S. Anil Kumar
(x, y) ∈ E}. Similarly, a MIN-strategy τ is said to be v-greedy at x ∈ VMIN if v(τ (x)) = min{v(y) | (x, y) ∈ E}. For P ∈ {MAX, MIN}, a strategy of P is said to be v-greedy if it is v-greedy at each x ∈ VP . Condon [Con92] introduced an operator FG corresponding to any SSG G. This operator allows to give an alternate characterization of an optimal value vector of G (see Lemmas 1 and 2). Definition 5 ([Con92]). Let σ and τ be strategies of MAX and MIN, respectively. We define an operator FG : (VPOS → [0, 1]) → (VPOS → [0, 1]) as follows: For every v : VPOS → [0, 1], FG (v) = w such that, for every x ∈ VPOS , ⎧ ⎨ max{v(y) | (x, y) ∈ E} if x ∈ VMAX , | (x, y) ∈ E} if x ∈ VMIN , w(x) = min{v(y) ⎩ q(x, y) · v(y) if x ∈ VAVE . (x,y)∈E Lemma 1 shows that, for any stopping SSG, there is a unique solution to the local optimality equations given by the operator FG of Definition 5; this solution is also an optimal value vector of G. (Note that a fixpoint of an operator F is an element of the domain of F such that F (x) = x.) Lemma 1 implies that there always exist optimal strategies and an optimal value vector of a stopping SSG. Lemma 1 ([Sha53,Con92]). Let G be a stopping SSG. Then there is a unique fixpoint v : VPOS → [0, 1] of the operator FG . Moreover, v is an optimal value vector of G, and v -greedy strategies σ and τ are optimal strategies of G. Lemma 2 states that any optimal value vector of a stopping SSG is a fixpoint of the operator FG . The proof of this lemma is similar to the proofs by Howard [How60] and Condon [Con92]. Lemma 2 (see [Con92]). Let G be a stopping SSG and let vopt be an optimal value vector of G. Then vopt is a fixpoint of the operator FG . Lemma 2 implies that there is a unique optimal value vector of a stopping SSG, since FG has a unique fixpoint by Lemma 1. Therefore, any pair of optimal strategies of a stopping SSG yields the same optimal value vector of the SSG. Henceforth, we refer to an optimal value vector of a stopping SSG as the optimal value vector of the game. The proof of the following lemma can be found in [Con92,Som05]. Lemma 3 (see [Con92,Som05]). Let G be a stopping SSG and let vopt be the optimal value vector of G. Then the following statements are equivalent: 1. 2. 3. 4. 5.
strategies σ and τ are optimal, vσ,τ (x) = max min vσ,τ (x) = min max vσ,τ (x) for every x ∈ V , σ τ τ σ vσ,τ = vopt , strategies σ and τ are vσ,τ -greedy for MAX and MIN, respectively, strategies σ and τ are vopt -greedy for MAX and MIN, respectively.
Definition 6 ([Con92]). The value of a SSG and the SSG value problem (SSG-VAL) are defined as follows: 1. The value of a SSG G is maxσ minτ vσ,τ (start vertex). 2. SSG-VAL ≡ Given a SSG G, is the value of G > 1/2?
On Strategy Improvement Algorithms for Simple Stochastic Games
3
245
Results
The strategy improvement method is an iterative procedure for constructing optimal strategies within a finite number of iterations in a decision-making scenario (e.g., game). This technique was developed first in the context of Markov decision processes, which are SSGs that have only MAX-positions and AVE-positions, but no MIN-positions. In Section 3.1, we study a strategy improvement algorithm developed by Hoffman and Karp [HK66] (Algorithm 1) for solving the SSG value problem. The Hoffman-Karp algorithm starts with an initial pair of player strategies. It then iteratively computes new player strategies until a pair of optimal strategies is found. W.l.o.g. assume that |VMAX | ≤ |VMIN | and let n = min{|VMAX |, |VMIN |}. In each iteration, the current strategy σ of MAX is changed to σ by switching the choices of all MAX-positions at which local optimality is not achieved, while the MIN-strategy is always the best response strategy τ (σ ) w.r.t. the new MAX-strategy σ . The algorithm terminates when all MAX-positions (and also MIN-positons) are locally optimal. At this point, the value vector vσ,τ (σ) corresponding to the current MAX-strategy σ and MIN-strategy τ (σ) will satisfy the local optimality equations given by the operator FG (Definition 5), and so it will be a fixpoint of FG .
Algorithm 1. The Hoffman-Karp Algorithm [HK66] Input : A stopping SSG G Output: optimal strategies σ, τ and the optimal value vector vopt 1 2 3 4 5 6 7 8
begin Let σ and τ be arbitrary strategies of MAX and MIN, respectively while (FG (vσ,τ ) = vσ,τ ) do Let σ be obtained from σ by switching the choices of all vσ,τ -switchable MAX-positions Let τ be an optimal strategy of MIN w.r.t. σ Set σ ← σ , τ ← τ Output σ, τ and the optimal value vector vσ,τ end
Each iteration of the while loop of Algorithm 1 requires (a) computing vσ,τ given player strategies σ and τ , and (b) computing an optimal MIN-strategy τ w.r.t. MAX-strategy σ . Both (a) and (b) are known to take polynomial time. It follows that every iteration of the while loop executes in polynomial time. Thus, it only remains to prove the correctness of the algorithm and bound the number of iterations of the while loop. The proof of correctness is based on a property of value vectors, which is formally stated in Lemma 4. Using this property, it can be shown that in every iteration, the new value vector vσ ,τ improves upon the initial vector vσ,τ in
246
R. Tripathi, E. Valkanova, and V.S. Anil Kumar
the following sense: for all positions x, vσ,τ (x) ≤ vσ ,τ (x), and for all MAXswitchable positions, this inequality is strict. Thus, it follows that no MAXstrategy can repeat over all the iterations of the algorithm. Since there can be at most 2n distinct MAX-strategies in a (binary) SSG with n MAX-positions, this algorithm requires at most 2n iterations of the while loop in the worst case. It is important to study the convergence time (i.e., the number of iterations) of strategy improvement algorithms for solving SSGs (e.g., the Hoffman-Karp algorithm and its many variants). These algorithms are not complicated from implementation perspective, and so a nontrivial upper bound on their convergence time might have a practical value. Melekopoglou and Condon [MC94] showed that many variations of the Hoffman-Karp algorithm require Ω(2n ) iterations in the worst case. In these variations, only one MAXswitchable position is switched at every iteration as opposed to all MAXswitchable positions in the Hoffman-Karp algorithm. In a recent breakthrough, Friedmann [Fri09] presented a super-polynomial lower bound for the discrete strategy improvement algorithm of V¨oge and Jurdzi´ nski [VJ00] for solving parity games. In Section 3.1, we prove that the Hoffman-Karp algorithm requires O(2n /n) iterations in the worst case. This is the first non-trivial upper bound on the worst-case convergence time of this algorithm. In Section 3.2, we propose a randomized variant of the Hoffman-Karp algorithm and prove that with probability almost one the randomized strategy improvement algorithm requires O(20.78n ) iterations in the worst case. Our analyses in these sections extend those of Mansour and Singh [MS99] for policy improvement algorithms for Markov decision processes. We now present some definitions and results, which will be used in the remaining part of this paper. Notation 1. For every MAX-strategy σ, Sσ denotes the set of all vσ,τ (σ) switchable positions of G. Definition 7. For every MAX-strategy σ and S ⊆ VMAX , let switch(σ, S) : VMAX → V be a MAX-strategy obtained from σ by switching the choices of the positions of S only. That is, for every x ∈ VMAX such that (x, y), (x, z) ∈ E and y = σ(x), switch(σ, S)(x) = y if x
∈ S, and switch(σ, S)(x) = z if x ∈ S. Definition 8. Let u, v ∈ [0, 1]N , for some N ∈ N+ . We say that – u v if for each x ∈ [N ], it holds that u(x) ≤ v(x). – u ≺ v if u v and there is an x ∈ [N ] such that u(x) < v(x). – u and v are incomparable if there are x, y ∈ [N ] such that u(x) < v(x) and v(y) < u(y). – u
v if either v ≺ u, or u and v are incomparable. – u
≺ v if either v u, or u and v are incomparable. Fact 2. (see [Juk01]) Let H(x) =df −x log2 x−(1−x) log for 0 < x < 1 s2 (1−x) and H(0) = H(1) = 0. Then, ∀s : 0 ≤ s ≤ t/2, we have k=0 kt ≤ 2t·H(s/t) .
On Strategy Improvement Algorithms for Simple Stochastic Games
247
We establish some properties of value vectors, which are crucial in the analyses presented in Sections 3.1 and 3.2. Because of the space limitations, the proofs of Lemmas 4, 5, and 6 are omitted. They will appear in the full version of the paper. Lemma 4. Let σ be a strategy of MAX such that Sσ is nonempty and let S be any nonempty subset of Sσ . Let σ =df switch(σ, S) be a MAX-strategy. Then, it holds that vσ,τ (σ) ≺ vσ ,τ (σ ) . Lemma 5. Let σ and σ be MAX-strategies such that σ is obtained from σ by switching a single position x ∈ VMAX , i.e., σ = switch(σ, {x}). Then, vσ,τ (σ) and vσ ,τ (σ ) are not incomparable, i.e., either vσ,τ (σ) ≺ vσ ,τ (σ ) or vσ ,τ (σ ) vσ,τ (σ) . Moreover, we have vσ,τ (σ) ≺ vσ ,τ (σ ) if and only if x is vσ,τ (σ) -switchable. 3.1
An Improved Analysis of the Hoffman-Karp Algorithm
In this section, we prove that the number of iterations in the worst case required by the Hoffman-Karp strategy improvement algorithm is O(2n /n). This improves upon the previously known, trivial, worst-case upper bound 2n for this algorithm. Lemma 6 shows that the set of all switchable MAX-positions differs from one iteration to another in the Hoffman-Karp strategy improvement algorithm. Lemma 6. Let σi , τ (σi ) and σj , τ (σj ) be player strategies at the start of iterations i and j, respectively, for i < j, of the Hoffman-Karp algorithm. Then, it holds that Sσi Sσj . In the Hoffman-Karp algorithm, the value vectors monotonically increase with the number of iterations by Lemma 4. Thus, Lemma 7 shows that this algorithm rules out, at the end of every iteration, a number of MAX-strategies, which is at least linear in the number of switchable MAX-positions. Lemma 7. Let σ, τ (σ) and σ =df switch(σ, Sσ ), τ =df τ (σ ) be player strategies at the start and at the end, respectively, of an iteration of the Hoffman-Karp algorithm. Then, there are at least |Sσ | − 1 strategies σi , τ (σi ) such that vσ,τ ≺ vσi ,τ (σi ) vσ ,τ . Proof. Let the elements of Sσ be denoted by 1, 2, . . ., |Sσ |. For every S ⊆ Sσ , let σS =df switch(σ, S) be a MAX-strategy. For notational convenience, let τS denote τ (σS ), which is an optimal MIN-strategy w.r.t. σS . Assume w.l.o.g. that vσ{1} ,τ{1} is a minimal value vector among the set of value vectors vσ{i} ,τ{i} for 1 ≤ i ≤ n. In other words, we assume that for every 2 ≤ i ≤ |Sσ |, we have either vσ{1} ,τ{1} vσ{i} ,τ{i} or vσ{i} ,τ{i} is incomparable to vσ{1} ,τ{1} . From Lemma 4, we know that vσ,τ ≺ vσ{1} ,τ{1} . Claim 1. For every 2 ≤ i ≤ |Sσ |, it holds that vσ{1} ,τ{1} vσ{1,i} ,τ{1,i} . For now assume that Claim 1 is true. (We prove this claim at the end of the proof of Lemma 7.) Pick a minimal value vector, say vσ{1,2} ,τ{1,2} , among the set of value vectors vσ{1,i} ,τ{1,i} for 2 ≤ i ≤ n. This gives the sequence vσ,τ ≺ vσ{1} ,τ{1} vσ{1,2} ,τ{1,2} .
248
R. Tripathi, E. Valkanova, and V.S. Anil Kumar
Repeating the arguments of Claim 1 with vσ{1,2} ,τ{1,2} in place of vσ{1} ,τ{1} gives the following statement: for every 3 ≤ i ≤ |Sσ |, it holds that vσ{1,2} ,τ{1,2} vσ{1,2,i} ,τ{1,2,i} . Next, we pick a minimal vector, say vσ{1,2,3} ,τ{1,2,3} , among the set of value vectors vσ{1,2,i} ,τ{1,2,i} for 3 ≤ i ≤ |Sσ |. This gives the sequence vσ,τ ≺ vσ{1} ,τ{1} vσ{1,2} ,τ{1,2} vσ{1,2,3} ,τ{1,2,3} . By proceeding in the above manner, we can obtain a monotonically increasing sequence vσ,τ ≺ vσ{1} ,τ{1} vσ{1,2} ,τ{1,2} vσ{1,2,3} ,τ{1,2,3} · · · vσSσ ,τSσ = vσ ,τ . This completes the proof of the lemma. (Lemma 7) We now give a proof of Claim 1. Proof of Claim 1. Assume to the contrary that, for some 2 ≤ i ≤ |Sσ |, we have vσ{1} ,τ{1}
vσ{1,i} ,τ{1,i} . Then, it must be the case that either vσ{1} ,τ{1} and vσ{1,i} ,τ{1,i} are incomparable or vσ{1,i} ,τ{1,i} ≺ vσ{1} ,τ{1} . Since σ{1,i} = switch(σ{1} , {i}), Lemma 5 implies that vσ{1} ,τ{1} and vσ{1,i} ,τ{1,i} are not incomparable. Therefore, we must have vσ{1,i} ,τ{1,i} ≺ vσ{1} ,τ{1} . We next show that vσ{1,i} ,τ{1,i} ≺ vσ{i} ,τ{i} . Notice that σ{1,i}=switch(σ{i} , {1}). By Lemma 5, we must have either vσ{i} ,τ{i} vσ{1,i} ,τ{1,i} or vσ{1,i} ,τ{1,i} ≺ vσ{i} ,τ{i} . If the former holds, then by transitivity of , we get that vσ{i} ,τ{i} vσ{1,i} ,τ{1,i} ≺ vσ{1} ,τ{1} . However, the relation vσ{i} ,τ{i} ≺ vσ{1} ,τ{1} contradicts the minimality of vσ{1} ,τ{1} . Therefore, we must have vσ{1,i} ,τ{1,i} ≺ vσ{i} ,τ{i} . Thus, we have shown that vσ{1,i} ,τ{1,i} ≺ vσ{1} ,τ{1} and vσ{1,i} ,τ{1,i} ≺ vσ{i} ,τ{i} . We claim that both 1, i ∈ Sσ{1,i} . To see this, note that σ{1} = switch(σ{1,i} , {i}) and vσ{1,i} ,τ{1,i} ≺ vσ{1} ,τ{1} . So, by Lemma 5, we must have i ∈ Sσ{1,i} . In the same way, we must have 1 ∈ Sσ{1,i} . We now know that σ = switch(σ{1,i} , {1, i}), where {1, i} ⊆ Sσ{1,i} . Lemma 4 implies that we must have vσ{1,i} ,τ{1,i} ≺ vσ,τ . However, we also have {1, i} ⊆ Sσ and σ{1,i} = switch(σ, {1, i}). So, Lemma 4 also implies that vσ,τ ≺ vσ{1,i} ,τ{1,i} . This gives a contradiction. (Claim 1) We are now ready to prove the main result of Section 3.1. Theorem 3. The Hoffman-Karp algorithm requires at most O(2n /n) iterations in the worst case, where n = min{|VMAX |, |VMIN |}. Proof. W.l.o.g. ssume that n = |VMAX | ≤ |VMIN |. We partition the analysis of the number of iterations into two cases: (1) iterations in which |Sσ | ≤ n/3 and (2) iterations in which |Sσ | > n/3. By Lemma 6, the set of all switchable MAX-positions cannot repeat throughout the iterations of the Hoffman-Karp algorithm. Therefore, in case (1), n/3 the number of iterations in which |Sσ | ≤ n/3 is bounded by k=0 nk , which is at most 2n·H(1/3) by Fact 2. In case (2), since |Sσ | > n/3 in each such iteration, by Lemma 7 the Hoffman-Karp algorithm rules out at least n/3 strategies σi such that vσ,τ ≺ vσi ,τ (σi ) vσ ,τ . (Note that σ, τ refers to the current strategy pairs and σ , τ refers to the strategy pairs in the next iteration.) Therefore, the number of iterations in which |Sσ | > n/3 is bounded by 2n /(n/3) = 3 · 2n /n.
On Strategy Improvement Algorithms for Simple Stochastic Games
249
It follows that the Hoffman-Karp algorithm requires at most 2n·H(1/3) + 3 · 2 /n ≤ 4 · 2n /n iterations in the worst case. (Theorem 3) n
3.2
A Randomized Variant of the Hoffman-Karp Algorithm
We propose a randomized strategy improvement algorithm (Algorithm 2) for the problem SSG-VAL (Definition 6). This algorithm can be seen as a variation of the Hoffman-Karp algorithm in that, instead of deterministically choosing all switchable MAX-positions, the randomized algorithm chooses a uniformly random subset of the switchable MAX-positions in each iteration. Similar to the results in Section 3.1, our results in this section extend those of Mansour and Singh [MS99] for policy iteration algorithms for Markov decison processes. We mention that Condon [Con93] also presented a randomized variant of the Hoffman-Karp algorithm, which is different from ours. The expected number of iterations of Condon’s algorithm is at most 2n−f (n) + 2o(n) , for any function f (n) = o(n), where n = min{|VMAX |, |VMIN |}.
Algorithm 2. A Randomized Variant of the Hoffman-Karp Algorithm Input : A stopping SSG G Output: Optimal strategies σ, τ and the optimal value vector vopt 1 2 3 4 5 6 7 8 9
begin Let σ and τ be arbitrary strategies of MAX and MIN, respectively while (FG (vσ,τ ) = vσ,τ ) do S ← a uniformly random subset of vσ,τ -switchable MAX-positions Let σ ← switch(σ, S) Let τ be an optimal strategy of MIN w.r.t. σ Set σ ← σ , τ ← τ Output σ, τ and the optimal value vector vσ,τ end
Lemma 8 shows that if a MAX-strategy σ does not yield an improved value vector vσ ,τ (σ ) compared to the value vector vσi+1 ,τi+1 at the start of iteration i + 1, then σ cannot appear after iteration i + 1. Lemma 8. In each iteration i of Algorithm 2, let σi , τ (σi ) be player strategies at the start of this iteration. Let S ⊆ Sσi be a subset of vσi ,τ (σi ) -switchable MAX≺ positions and let σ =df switch(σi , S) be a MAX-strategy. If vσi+1 ,τ (σi+1 )
vσ ,τ (σ ) , then for any i + 2 ≤ j, σ
= σj . Proof. By Lemma 4, for each iteration j, it holds that vσj−1 ,τ (σj−1 ) ≺ vσj ,τj . Assume to the contrary that, for some i + 2 ≤ j, σ = σj . Then, by transitivity, we have vσi+1 ,τ (σi+1 ) vσj−1 ,τj−1 ≺ vσj ,τ (σj ) = vσ ,τ (σ ) . This contradicts the assumption that vσi+1 ,τ (σi+1 )
≺ vσ ,τ (σ ) . (Lemma 8)
250
R. Tripathi, E. Valkanova, and V.S. Anil Kumar
Lemma 9 shows that by switching the choices at a uniformly random subset of switchable MAX-positions, we can rule out (at the end of every iteration) a number of MAX-strategies, which on average is at least exponential in the number of switchable MAX-positions. Lemma 9. In Algorithm 2, let σi , τ (σi ) be player strategies at the start of an iteration in which Sσi is nonempty, and let σi+1 , τ (σi+1 ) be the player strategies at the end of this iteration. Then, the expected number of MAX-strategies σ such that vσi+1 ,τ (σi+1 )
≺ vσ ,τ (σ ) is at least 2|Sσi |−1 . Proof. Consider an iteration in which σi , τ (σi ) are player strategies such that Sσi is nonempty. Let U denote the set of all MAX-strategies obtained from σi by switching some subset of Sσi , i.e., U = {σ | (∃S ⊆ Sσi )[σ = switch(σi , S)]}. Clearly, |U | = 2|Sσi | . For each strategy σ ∈ U , we associate sets Uσ+ and Uσ− that are defined as follows: Uσ+ =df {σ ∈ U | vσ,τ (σ) ≺ vσ ,τ (σ ) } and Uσ− =df {σ ∈ U | vσ ,τ (σ ) ≺ vσ,τ (σ) }. Notice that, for any pair σ, σ ∈ U , we have σ ∈ Uσ+ if and only if σ ∈ |U|2 − Uσ− . From this equivalence, it follows that σ∈U |Uσ+ | = σ∈U |Uσ | ≤ 2 . Thus, for a strategy σi+1 chosen uniformly at random from U in iteration i, the expected number of MAX-strategies σ ∈ U such that vσi+1 ,τ (σi+1 )
≺ vσ ,τ (σ ) is 1 |Sσi |−1 · σ∈U |Uσ+ | ≥ |U| = 2 . (Lemma 9) = |U | − |U| 2 We are now ready to prove the main result of Section 3.2. Ω(n)
Theorem 4. With probability at least 1 − 2−2 , Algorithm 2 requires at most O(20.78n ) iterations in the worst case, where n = min{|VMAX |, |VMIN |}. Proof. Let c ∈ (0, 1/2) that we will fix later in the proof. As in the proof of Theorem 3, the number of iterations cn i in which σi , τ (σi ) are player strategies and |Sσi | ≤ cn is bounded by k=0 nk , which is at most 2n·H(c) by Fact 2. We next bound the number of iterations i in which σi , τ (σi ) are player strategies and |Sσi | > cn. Let σi+1 , τ (σi+1 ) be player strategies at the end of iteration i. By Lemma 9, the expected number of MAX-strategies σ such that vσi+1 ,τ (σi+1 )
≺ vσ ,τ is at least 2|Sσi |−1 . By Lemma 8, none of these strategy pairs σ , τ (σ ) is chosen in any future iteration. Therefore, the expected number of MAX-strategies σ that Algorithm 2 rules out in each such iteration is at least 2|Sσi |−1 ≥ 2cn . It follows from Markov’s inequality that, with probability at least 1/2, Algorithm 2 rules out at least 2cn−1 MAX-strategies in each such iteration. We say that an iteration in which |Sσi | > cn is good if Algorithm 2 rules out at least 2cn−1 MAX-strategies at the end of it. We know from above that the probability that an iteration in which |Sσi | > cn is good is at least 1/2. By Chernoff bounds, for any t > 0, at least 1/4 of the t iterations in which |Sσi | > cn will be good with probability at least 1 − e−t/16 . Thus, the total number of iterations is at most 2n·H(c) + 2n·(1−c)+3 with a high probability. Choosing c ∈ (0, 1/2) such that H(c) = 1 − c gives c ≈ 0.227. For c = 0.227,
On Strategy Improvement Algorithms for Simple Stochastic Games
251
this number of iterations is bounded by O(20.78n ). Also, when the number of iterations (and so t) is at most 20.78n , then the probability of success is Ω(n) ≥ 1 − 2−2 . (Theorem 4) Acknowledgements. V.S. Anil Kumar was supported partially by the following grants: DTRA CNIMS Grant HDTRA1-07-C-0113, NSF Nets Grant CNS0626964, NSF HSD Grant SES-0729441, NSF NETS CNS-0831633, and NSF CNS-0845700.
References [Con92]
Condon, A.: The complexity of stochastic games. Information and Computation 96, 203–224 (1992) [Con93] Condon, A.: On algorithms for simple stochastic games. In: Cai, J. (ed.) Advances in Computational Complexity Theory. DIMACS series in DM&TCS, vol. 13, pp. 51–73. American Mathematical Society, Providence (1993) [Der70] Derman, C.: Finite State Markovian Decision Processes. In: Mathematics in Science and Engineering, vol. 67. Academic Press, New York (1970) [Fri09] Friedmann, O.: An exponential lower bound for the parity game strategy improvement algorithm as we know it. In: Proceedings of the 24th IEEE Symposium on LICS. IEEE Computer Society, Los Alamitos (2009) (to appear) [GH09] Gimbert, H., Horn, F.: Solving simple stochastic games with few random vertices. In: Foundations of Software Science and Comput. Structures (2009) [Hal07] Halman, N.: Simple stochastic games, parity games, mean payoff games and DPGs are all LP-type problems. Algorithmica 49(1), 37–50 (2007) [HK66] Hoffman, A., Karp, R.: On nonterminating stochastic games. Management Science 12, 359–370 (1966) [How60] Howard, R.: Dynamic Programming and Markov Processes. MIT Press, Cambridge (1960) [Juk01] Jukna, S.: Extremal Combinatorics. Springer, Heidelberg (2001) [Lud95] Ludwig, W.: A subexponential randomized algorithm for the simple stochastic game problem. Information and Computation 117(1), 151–155 (1995) [MC94] Melekopoglou, M., Condon, A.: On the complexity of the policy improvement algorithm for Markov decision processes. ORSA Journal of Computing 6(2), 188–192 (1994) [MS99] Mansour, Y., Singh, S.: On the complexity of Policy Iteration. In: Proceedings of the 15th Conference on UAI, July 1999, pp. 401–408 (1999) [Sha53] Shapley, L.: Stochastic games. In: Proceedings of National Academy of Sciences (USA), vol. 39, pp. 1095–1100 (1953) [Som05] Somla, R.: New algorithms for solving simple stochastic games. Electronic Notes in Theoretical Computer Science 119(1), 51–65 (2005) [VJ00] V¨ oge, J., Jurdzi´ nski, M.: A discrete strategy improvement algorithm for solving parity games. In: Emerson, E.A., Sistla, A.P. (eds.) CAV 2000. LNCS, vol. 1855, pp. 202–215. Springer, Heidelberg (2000)
Online Cooperative Cost Sharing Janina Brenner1 and Guido Sch¨ afer2 1
2
Institute of Mathematics, Technical University Berlin, Germany
[email protected] Algorithms, Combinatorics and Optimization, CWI Amsterdam, The Netherlands
[email protected]
Abstract. The problem of sharing the cost of a common infrastructure among a set of strategic and cooperating players has been the subject of intensive research in recent years. However, most of these studies consider cooperative cost sharing games in an offline setting, i.e., the mechanism knows all players and their respective input data in advance. In this paper, we consider cooperative cost sharing games in an online setting: Upon the arrival of a new player, the mechanism has to take instantaneous and irreversible decisions without any knowledge about players that arrive in the future. We propose an online model for general demand cost sharing games and give a complete characterization of both weakly group-strategyproof and group-strategyproof online cost sharing mechanisms for this model. Moreover, we present a simple method to derive incremental online cost sharing mechanisms from online algorithms such that the competitive ratio is preserved. Based on our general results, we develop online cost sharing mechanisms for several binary demand and general demand cost sharing games.
1
Introduction
The pivotal point in mechanism design is to achieve a global objective even though part of the input information is owned by selfish players. In cost sharing, the aim is to share the cost of a common service in a fair manner while the players’ valuations for the service are private information. Based on the declared bids of the players, a cost sharing mechanism determines a service allocation and distributes the incurred cost among the served players. In many cost sharing games, the common service is represented by a combinatorial optimization problem like minimum Steiner tree, machine scheduling, etc., which defines a cost for every possible service allocation. We consider cooperative cost sharing games, i.e., players may form coalitions to coordinate their bidding strategies. During the last decade, there has been substantial research on binary demand cost sharing games, where a service allocation defines simply whether or not a player is served. In this paper, we consider the general demand setting, in which players require not only one but several levels of service, and the mechanism
This work was supported by the DFG Research Center Matheon “Mathematics for key technologies”.
T. Calamoneri and J. Diaz (Eds.): CIAC 2010, LNCS 6078, pp. 252–263, 2010. c Springer-Verlag Berlin Heidelberg 2010
Online Cooperative Cost Sharing
253
determines which service level is granted to each player and at what price. We assume that players are concerned only about the quantity of service levels they obtain, e.g., the number of distinct connections to a source, executions of their job, etc. Moreover, once a player’s request for a certain service level was refused, she will not be granted a higher level. This general demand cost sharing model has recently been investigated quite intensively; see [1,4,11,12]. To the best of our knowledge, all previous works on cooperative cost sharing consider offline settings, where the entire instance is known in advance. Hence, when determining the allocation and payment scheme, the mechanism can take into account all input data associated with every player (bids for different service levels and other relevant player characteristics). However, many natural cost sharing games inherently bear an online characteristic in the sense that players arrive over time and reveal their input data only at their arrival. In such settings, the mechanism needs to take instantaneous and irreversible decisions with respect to the assigned service level and payment of the player without any knowledge about players that arrive in the future. Problems in which the input data is revealed gradually and irreversible decisions have to be taken without knowledge of future requests are the subject of online computation [2]. The standard yardstick to assess the quality of an online algorithm is by means of its competitive ratio, i.e., the worst case ratio of the cost of the solution produced by the online algorithm compared to the cost of an optimal offline algorithm that knows the entire input data in advance. Our Contributions. The main contributions of this paper are as follows: 1. We propose the first online model for general demand cost sharing games: In its most general form, every player arrives several times to request an additional service level. Upon the arrival of a player, the online mechanism immediately determines a price for her new request. We require that at each point of time, the sum of the collected payments approximates the cost of the (optimal offline) solution for the current allocation. 2. We completely characterize weakly group-strategyproof and group-strategyproof (formal definitions in Sec. 2) online mechanisms for general demand cost sharing games: We show that online cost sharing mechanisms are automatically weakly group-strategyproof for binary demand games. In the general demand case, this is true if the marginal costs of the underlying cost function are increasing. Moreover, we prove necessary and sufficient conditions for group-strategyproofness of online cost sharing mechanisms. 3. We present a simple yet effective method to derive online cost sharing mechanisms from competitive online algorithms: Given a ρ-competitive algorithm for the underlying problem, we show that the induced incremental online mechanism is ρ-budget balanced at all times. Using the above characterization, this enables us to derive incentive compatible online mechanisms for several binary demand and general demand cost sharing games for network design and scheduling problems.
254
J. Brenner and G. Sch¨ afer
Related Work. Immorlica et al. [9] partially characterized group-strategyproof cost sharing mechanisms in the offline case. They state that upper-continuous group-strategyproof β-budget balanced binary demand cost sharing mechanisms correspond to cross-monotonic cost sharing schemes. Juarez [10] very recently gave a similar characterization for mechanisms fulfilling the MAX property, meaning that indifferent players are always accepted.1 He also showed that group-strategyproof cost sharing mechanisms correspond to feasible sequential mechanisms if indifferent players are always rejected. A sequential mechanism offers players service one after another according to an order that may change with previous decisions (see [10] for precise definitions). Moulin [12] introduced incremental cost sharing mechanisms in the offline setting. An incremental mechanism is a sequential mechanism in which the payment offered to a player is equal to her incremental cost, i.e. the increase in cost caused by adding her to the set of previously selected players. He claimed that for supermodular cost functions, incremental mechanisms are group-strategyproof and budget balanced. However, this statement is flawed (as indicated in [10]) and holds only under the assumption that players are never indifferent. We extend the characterizations for group-strategyproof mechanisms to the general demand online setting. The mechanisms in our online model always accept indifferent players and thus fulfill Juarez’ MAX property. This allows us to guarantee group-strategyproofness for all incremental mechanisms derived from submodular cost functions. Moreover, we achieve weak group-strategyproofness for the whole class of games with increasing marginal cost functions.
2
Online General Demand Cost Sharing Games
We first review offline general demand cost sharing games as studied in [1,4,11,12]. Let U be a set of players that are interested in a common service. In a general demand cost sharing game, every player has valuations for a finite number of service levels, i.e. the maximum service level requested is bounded by a constant L ∈ N. Let (i, l) denote player i’s request for service level l. Each player i ∈ U has a valuation vector vi ∈ RL + , where vi,l denotes how much more (additive) player i likes service level l compared to service level l − 1. The valuation vectors are private information, i.e. vi is known to i only. Additionally, each player i announces a bid vector bi ∈ RL + . bi,l represents the maximum price player i is willing to pay for service level l (in addition to service level l − 1). An allocation of goods or service to the set of players U is denoted by a vector x ∈ NU 0 , where xi ∈ N0 indicates the level of service that player i obtains; here xi = 0 represents that i does not receive any good or service. Note that as a characteristic of this model, only subsequent service levels can be allocated to a player (i.e. if a player obtains service level l, then she also obtains service levels 1, . . . , l − 1). We denote by ei ∈ NU 0 the ith unit vector. The servicing cost of an allocation x ∈ NU 0 is given by a cost function C : NU → R . We assume that C is non-decreasing in every component and + 0 1
A player is said to be indifferent if her bid is equal to her requested payment.
Online Cooperative Cost Sharing
255
C(0) = 0 for the all-zero allocation 0. In the examples we study, the common service is represented by a combinatorial optimization problem like e.g. Steiner tree, machine scheduling, etc. In these cases, we define C(x) as the cost of an offline optimal solution to the underlying optimization problem. A general demand cost sharing mechanism solicits the bid vectors bi from all players i ∈ U , and computes a service allocation x ∈ NU 0 and a payment φi,l ∈ R for every player i ∈ U and service level l ≤ L. We sometimes write x(b) and φ(b) to refer to the outcome resulting from bid vector b. We assume that the mechanism complies with the following standard assumptions: 1. Individual rationality: A player is charged only for service levels that she receives, and for any service level, her payment is at most her bid, i.e. for all i, l: φi,l = 0 if xi < l and φi,l ≤ bi,l if xi ≥ l. 2. No positive transfer : A player is not paid for receiving service, i.e. φi,l ≥ 0 for all i, l. 3. Consumer sovereignty: A player is guaranteed to receive an additional service level if she bids high enough, i.e. there exists a threshold value b∗i,l for each player i and service level l such that xi ≥ l if bi,l ≥ b∗i,l and xi ≥ l − 1. For notational convenience, we define vi,0 = φi,0 = 0 for all players i ∈ U . ¯ Let C(x) denote the cost of the actually computed solution for allocation x. A cost sharing mechanism is β-budget balanced if the total payment obtained from ¯ all players deviates by at most a factor β ≥ 1 from the total cost, i.e. C(x) ≤ L φ ≤ β · C(x). If β = 1, we simply call the cost sharing mechanism i∈U l=1 i,l budget balanced. We assume that players act strategically and each player’s goal xisi to maximize her own utility. The utility of player i is defined as ui (x, φ) := l=1 (vi,l − φi,l ). Since the outcome (x, φ) computed by the mechanism depends on the bids b of the players (and not on their true valuations), a player may have an incentive to declare a bid vector bi that differs from her true valuation vector vi . We say that a mechanism is strategyproof if bidding truthfully is a dominant strategy for every player. That is, for every player i ∈ U and every two bid vectors b, b with bi = vi and bj = bj for all j = i, we have ui (x, φ) ≥ ui (x , φ ), where (x, φ) and (x , φ ) are the solutions output by the mechanism for bid vectors b and b , respectively. Note that in our model, a player cannot lie about the characteristics or arrival times of her requests. In cooperative mechanism design, it is assumed that players can form coalitions in order to coordinate their bids. A mechanism is group-strategyproof if no coordinated bidding of a coalition S ⊆ U can strictly increase the utility of some player in S without strictly decreasing the utility of another player in S. Formally, for every coalition S ⊆ U and every two bid vectors b, b with bi = vi for / S, if there is some i ∈ S with ui (x , φ ) > ui (x, φ) all i ∈ S and bi = bi for all i ∈ then there is some j ∈ S with ui (x , φ ) < ui (x, φ). A mechanism is weakly groupstrategyproof if no coordinated bidding can strictly increase the utility of every player in a coalition. That is, for every coalition S ⊆ U and every two bid vectors / S, there is some i ∈ S b, b with bi = vi for all i ∈ S and bi = bi for all i ∈ with ui (x , φ ) ≤ ui (x, φ). Intuitively, weak group-strategyproofness suffices if
256
J. Brenner and G. Sch¨ afer
we assume that players adopt a slightly more conservative attitude with respect to their willingness of joining a coalition: Group-strategyproofness is needed if a player will participate in a coalition even if her utility is not affected, while weak group-strategyproofness suffices if she only joins if she is strictly better off. Online Model. Many cost sharing games studied in the literature are derived from combinatorial optimization problems. This motivates us to define online cost sharing games very generally depending on the varying online characteristics inherited from different online optimization problems [2]. The most important characteristic of our model is that an online mechanism must immediately fix the payment for a requested service at the point of time when it is revealed, without any knowledge about future requests. As in the offline setting, we assume that an online mechanism never accepts further requests from players that have previously been rejected. For cost sharing games that are derived from combinatorial optimization problems, the mechanism has to maintain a (possibly suboptimal) feasible solution for the current service allocation. The feasible modifications of this current solution are inherited from the underlying online optimization problem. We use the online list model by Borodin et al. [2] to describe the proceeding of an online mechanism: Service requests (i, l) arrive according to an online order. (For certain problems like online scheduling, jobs may have release dates which are then treated as arrival times of the respective requests.) Upon arrival, the player reveals the characteristics of her new request (i.e. the input information for the underlying combinatorial optimization problem) and her bid bi,l . The mechanism immediately offers her the additional service level at a price p that may depend on previous inputs and decisions only. If her bid bi,l is larger or equal to this price, the request is accepted and added to the current allocation. Otherwise, the request is rejected and all further appearances of player i are removed from the online list (formally, we set p = ∞ for all subsequent requests of player i). A more formal description is given in Algorithm 1. Algorithm 1: Online general demand cost sharing mechanism Input: online cost sharing game Output: allocation vector x = (xi )i∈U , payment vector φ = (φi,l )i∈U,l≤L 1 2 3 4 5 6 7 8
Initialize x0 = 0 forall requests t ∈ T do Read out input data and bid bi,l of newly arrived request t =: (i, l). Determine payment p for new request. if bi,l ≥ p then set xt = xt−1 + ei and φi,l = p else set xt = xt−1 and φi,l = 0; delete all further appearances of player i. end Output allocation vector x and payments φ
Let xt denote the current allocation after processing request t ∈ T = {1, 2, . . .}. ¯ t ) denote the cost of the actually computed solution for xt . We call an Let C(x
Online Cooperative Cost Sharing
257
online cost-sharing mechanism β-budget balanced at all times for some β ≥ 1 if for all requests t ∈ T : t
¯ t) ≤ C(x
xi
φi,l ≤ β · C(xt ).
i∈U l=1
The conditions of individual rationality and no positive transfer as well as the different forms of incentive compatibility transfer in a straightforward way.
3
Incentive Compatibility
The following characterizations hold for all online mechanisms in our framework. Note that the requirements for group-strategyproofness highly depend on the fact that requests are accepted if the announced bid is equal to the offered price. Strategyproofness. To guarantee strategyproofness, we must bound the increase in marginal valuations of individual players. This is essential to prevent players from overbidding for some level to obtain positive utility for higher levels. In previous works on general demand cost sharing [1,11], players’ valuations were assumed to be non-increasing. However, we can slightly relax this condition by introducing a positive factor λ: Definition 1. A valuation vector vi ∈ RL is λ-decreasing if for all 1 < l ≤ L, vi,l ≤ λ · vi,l−1 . Given λ-decreasing valuations for all players, an online mechanism is guaranteed to be strategyproof if and only if its cost shares grow faster than the valuations. Definition 2. A cost sharing mechanism has λ-increasing prices if for every bid vector b and player i ∈ U , the price for any service level 1 < l ≤ xi (b) is at least λ times the price for the previous service level, i.e. φi,l (b) ≥ λ · φi,l−1 (b). The above conditions can be further generalized by letting λ vary for every player (and/or level) or by adding constant terms to the right hand sides. However, the following fact emphasizes that a similar set of conditions are necessary to achieve strategyproofness. We omit the proof due to space restrictions. total price
xi X
φi,l
l=1
total valuation
xi X
vi,l
l=1
service level xi
Fig. 1. Illustration of λ-decreasing valuations and λ-increasing prices for λ = 1
258
J. Brenner and G. Sch¨ afer
Fact 1. A general demand online mechanism is not strategyproof if cost shares do not increase by more than valuations per service level. Weak Group-Strategyproofness. We prove now that under the above conditions, an online mechanism is in fact weakly group-strategyproof. Theorem 1. If valuations are λ-decreasing, a general demand online cost sharing mechanism with λ-increasing prices is weakly group-strategyproof. Proof. Fix a coalition S ⊆ U and a bid vector b with bi = vi for all i ∈ S. Assume for contradiction that all members of the coalition can strictly increase / S). Let (i, l) their utilities by changing their bids to b (while bi = bi for all i ∈ be the first request for which the mechanism makes different decisions in the runs on b and b . By the online character of the mechanism, the price offered for request (i, l) only depends on previous decisions and is thus equal in both runs. Let p denote this offer price. There are two possible cases: 1. vi,l < p ≤ bi,l . Then, φi,l (b ) = p, and λ-decreasing valuations and λincreasing prices yield . . . ≤ λ−2 vi,l+2 ≤ λ−1 vi,l+1 ≤ vi,l < φi,l (b ) ≤ λ−1 φi,l+1 (b ) ≤ λ−2 φi,l+2 (b ) ≤ . . .. Hence, player i has negative utility for service levels l and higher in the run on b , whereas when bidding truthfully, the utility for each level is non-negative. 2. bi,l < p ≤ vi,l . Then, player i obtains only l − 1 levels of service in the run on b , but she may get additional utility by accepting level l in the run on b. Hence, player i gets less or equal utility in the run on b , a contradiction.
For binary demand cost sharing games, both Definitions 1 and 2 are always fulfilled since there is only one service level. Hence, quite remarkably, binary demand online cost sharing mechanisms are inherently weakly group-strategyproof. Group-Strategyproofness. To ensure the stronger notion of group-strategyproofness, we must prevent that dropping out, i.e. underbidding in case of indifference, can help subsequent players. Towards this end, we introduce the following generalization of the well-known notion of cross-monotonicity for binary demand cost sharing games [12]. Consider a fixed instance of an online cost sharing game and let φi,l (b) denote the price that player i is offered for service level l when b is the bid vector input to the mechanism. Throughout this section, we assume λ-decreasing valuations and λ-increasing prices. Definition 3. An online mechanism is cross-monotonic if for every player i ∈ U and service level l, the offered price does not decrease when a subset of requests are accepted in previous iterations, i.e. φi,l (b ) ≥ φi,l (b) for all bid vectors b, b such that xt−1 (b ) ≤ xt−1 (b), where (i, l) is request t.
Online Cooperative Cost Sharing
259
This condition is sufficient for group-strategyproofness. The proof contains two main ideas: First, dropping out can never help others since it only increases cost shares of subsequent bidders. Second, the first member of a coalition who overbids for an additional level of service can only decrease her utility by doing this, since prices increase more than valuations in terms of service levels. Theorem 2. If valuations are λ-decreasing, an online cost sharing mechanism with λ-increasing prices is group-strategyproof if it is cross-monotonic. Proof. Fix a coalition S ⊆ U and a bid vector b with bi = vi for all i ∈ S. Assume that every member of the coalition increases or maintains her utility when the coalition changes their bids to b (while bi = bi for all i ∈ / S). We first prove that xt (b ) ≤ xt (b) for all t ∈ T . Assume for contradiction that there is a request which is accepted in the run on b but not in the run on b. Let (i, l) be the earliest such request, say request t. That is, xτ (b ) ≤ xτ (b) for all τ < t. By cross-monotonicity, we have φi,l (b ) ≥ φi,l (b). Since players outside the coalition submit the same bids in both runs, player i must be a member of the coalition to gain service in the run on b . But then, φi,l (b ) ≥ φi,l (b) > bi,l = vi,l and hence by λ-decreasing valuations and λ-increasing prices, player i has negative utility for service levels l and higher in the run on b . Since xτ (b ) ≤ xτ (b) for all τ < t, by cross-monotonicity φi,k (b ) ≥ φi,k (b) for all k < l as well, and therefore ui (b ) < ui (b), contradicting the first assumption. We can conclude that xt (b ) ≤ xt (b) for all t ∈ T . Hence, φi,l (b ) ≥ φi,l (b) for all i, l by cross-monotonicity. This means that
ui (b ) =
xi (b )
l=1
(vi,l − φi,l (b )) ≤
xi (b)
(vi,l − φi,l (b)) = ui (b)
l=1
for all i and l, hence we obtain group-strategyproofness.
We prove next that the conditions in Theorem 2 are not only sufficient but also necessary, even in the binary demand case. Theorem 3. A binary demand online mechanism is not group-strategyproof if it is not cross-monotonic. Proof. Consider an online mechanism that is not cross-monotonic; let L = 1. That is, there are bid vectors b, b with xt−1 (b ) ≤ xt−1 (b) and φi (b ) < φi (b) for some player i. For simplicity, assume that i is the last player in the online instance. Since the mechanism is online, φi (b ) does not depend on bi , so we can assume that bi = φi (b). We will define valuations such that there is a coalition S which has an incentive to misreport their valuations. Define S := {j ∈ U | bj = bj }∪{i}. Assume that all j ∈ U \S bid bj = bj . Now, define vj := φj (b) for all j ∈ S. Observe that if all players in S bid truthfully, the outcome of the mechanism is the same as for bid vector b. Now, if the coalition changes their bids to b , some players j ∈ S \ {i} lose service but all retain their previous utility of zero. Meanwhile, player i increases her utility from zero to φi (b) − φi (b ) > 0. Hence, the mechanism is not group-strategyproof.
260
4
J. Brenner and G. Sch¨ afer
Incremental Online Mechanisms
We now describe a generic method to turn competitive online algorithms into online cost sharing mechanisms. Given a ρ-competitive algorithm alg for a combinatorial optimization problem, we define an incremental online mechanism for the corresponding cost sharing game, which is ρ-budget balanced at all times. The mechanism is weakly group-strategyproof if the algorithm’s marginal costs are increasing, which is gratuitous in the binary demand case. Let alg be a ρ-competitive algorithm for an online combinatorial optimization problem P. Consider an instance I of P. The incremental online mechanism induced by alg works as follows: Requests arrive according to I. Each time a new request arrives, we simulate alg on the online instance induced by the requests that have previously been accepted and the new item. The price p for the additional service level is set to be the incremental cost caused by the update in the competitive algorithm. We call an online algorithm alg crossmonotonic if the induced incremental online mechanism is cross-monotonic. It is straightforward to see that the budget balance factor of an incremental online mechanism is inherited from the competitive ratio of the input algorithm: In every iteration, the sum of the collected payments equals the cost inferred by the algorithm. Lemma 1. The incremental online mechanism is ρ-budget balanced at all times. 4.1
Binary Demand Examples
To demonstrate the applicability of our framework, we apply it to competitive online algorithms for a number of combinatorial optimization problems. In this section, we give examples for binary demand cost sharing games, i.e. the maximum service level is L = 1 and every player has only one request. Online Scheduling. Consider the parallel machine scheduling problem with the objective of minimizing the makespan. Any list scheduling algorithm has an approximation factor of at most 2 for this problem. Hence, the online algorithm that adds each arriving job to the machine with currently least load is 2-competitive. Unfortunately, it is not cross-monotonic as deleting jobs can cause higher or lower completion times for subsequent jobs. Thus, our framework yields a 2-budget balanced weakly group-strategyproof online mechanism. Corollary 1. There is a 2-budget balanced weakly group-strategyproof incremental online mechanism for the minimum makespan scheduling problem on parallel machines P | |Cmax . Online Steiner Tree and Forest. Given an undirected graph G with edge costs, connection requests arrive online. In the Steiner forest problem, each request consists of a pair of terminals si , ti ; in the Steiner tree problem, all requests have one vertex in common, i.e. si = sj for all i, j ∈ U . The goal is to select a minimum cost set of edges such that each terminal pair is connected by a path. Let n denote the number of players (i.e., terminal pairs).
Online Cooperative Cost Sharing
261
The online greedy Steiner tree algorithm picks the shortest path to the current tree each time a new terminal pair arrives. It has a competitive ratio of log n, while the competitive ratio of any online algorithm is known to be at least 1/2 log n [8]. Hence, our framework gives a weakly group-strategyproof Θ(log n)budget balanced online cost sharing mechanism for the Steiner tree problem, which is asymptotically best possible. The greedy algorithm for the online Steiner forest problem achieves an approximation ratio of O(log2 n). Corollary 2. There is an O(log2 n)-budget balanced weakly group-strategyproof incremental online mechanism for the Steiner forest game. This mechanism is (log n)-budget balanced for the Steiner tree game. Unfortunately, the greedy algorithm is not cross-monotonic, as the removal of some players may cause other players to switch their paths, which in turn can have arbitrary effects on the costs incurred by subsequent players. This issue can be overcome if paths are unambiguous; e.g. if G = (V, E) is a forest, the above mechanisms are group-strategyproof. Pushing this insight further, we obtain an O(log |V |)-budget balanced group-strategyproof mechanism for the Steiner forest game if the underlying graph is known in advance: We use the oblivious online Steiner forest algorithm by Gupta et al. [6], which essentially works as follows: Given the underlying graph, the algorithm precomputes a collection of paths. When a new terminal pair arrives, it simply connects it by one of the predefined paths. The authors show that one can identify a collection of paths such that the resulting algorithm is O(log |V |)-competitive. Since the used paths are defined in advance, a player can only benefit from the presence of other players, who might pay for parts of her designated path. Hence, we obtain cross-monotonicity without losing much in terms of the budget balance guarantee. Corollary 3. There is an O(log2 |V |)-budget balanced group-strategyproof incremental online mechanism for the Steiner forest game, where V is the vertex set of the underlying graph. We believe that such “universal” algorithms that determine generic solutions without knowing the upcoming instance will also yield group-strategyproof online mechanisms for several other interesting problems like e.g. the traveling salesman problem. 4.2
General Demand Examples
We now exploit the whole range of our framework by deriving incremental mechanisms for general demand cost sharing games. In the first example, players arrive only once with the complete list of their requests. In the second example, the arrival sequence is mixed, i.e. players take turns announcing additional requests. Online Preemptive Scheduling. A common problem in preemptive scheduling is the parallel machine setting in which each job has a release date. The cost of a solution is given by the sum of all completion times. The single machine case is solved optimally by the shortest remaining processing time (srpt) algorithm [13]. srpt is a 2-approximation for the parallel machine case [5].
262
J. Brenner and G. Sch¨ afer
In the corresponding cost sharing game, we treat the release date of a job as its arrival time. Upon arrival, each player may request multiple executions of her job. In scheduling terms, each player owns a set of jobs which all have the same release date and processing time. E.g. imagine a student who asks a copy shop to print and bind several copies of his thesis, or a joinery is asked to produce a few of the same individual piece of furniture. In such scenarios, it is very natural to assume that the marginal valuation for each additional copy is decreasing, i.e. vi,l ≥ vi,l+1 for all i, l. srpt schedules all of a player’s jobs subsequently. Hence, each of them delays the same number of jobs, and later copies have larger completion times. Therefore, the mechanism induced by srpt has increasing marginal prices. Corollary 4. There is a 2-budget balanced weakly group-strategyproof general demand incremental online mechanism for the preemptive scheduling problem with release dates P |ri , pmtn| Ci . This mechanism is budget balanced in the single machine case. Online Multicommodity Routing. In an online multicommodity routing problem, we are given a directed graph with monotonically increasing cost functions on each arc. Commodities arrive online and request routing of l units from some vertex to another. We assume that the routing is splittable in integer units. The greedy algorithm which routes each unit of flow separately in an optimal √ way is (3 + 2 2)-competitive for this problem [7]. Marginal costs are increasing since the cost functions on each arc grow with increasing traffic. This is true even when players arrive in a mixed order and request to route additional units between their source-destination pair. However, this is a congestion-type game (the more players in the game, the higher the costs per request), and so we cannot expect group-strategyproofness. √ Corollary 5. There is a (3 + 2 2)-budget balanced weakly group-strategyproof incremental online mechanism for the online multicommodity routing problem in which each player arrives multiple times.
5
Conclusion
We characterized strategyproofness, weak group-strategyproofness and groupstrategyproofness of mechanisms in a new framework for online general demand cost sharing games. Quite notably, weak group-strategyproofness comes for free for binary demand problems. Online mechanisms are group-strategyproof if and only if dropping out cannot help subsequent players. Consequently, we cannot expect incremental cost sharing mechanisms for problems with congestion effects like e.g. scheduling games to be group-strategyproof, while this seems easier for network design problems. In the offline setting, finding a good order to consider players is the key to derive cost sharing mechanisms with attractive budget balance factors (see [3]). In the online case, this order is determined by an adversary and thus not under
Online Cooperative Cost Sharing
263
the control of the mechanism designer, which strongly constrains the possibilities of designing valuable cost sharing mechanisms. However, our results prove that there is no gap between the best possible competitive ratio of an online algorithm and the best possible budget balance factor of a weakly group-strategyproof online cost sharing mechanism. We consider this work as a very natural and general starting point to exploit cooperative cost sharing in an online context. It would be interesting to see more applications to our framework, with or without usage of the direct derivation of incremental mechanisms from competitive algorithms. Our model restricts feasible allocations to a continuous sequence of accepts for each player, starting with their first request. This feature of the model is crucial for truthfulness as it prevents players from underbidding to reject some service request and then obtain it later for a cheaper price. One interesting line of research would be to allow for more general mechanisms which might accept further requests of players even after a request has been rejected.
References 1. Bleischwitz, Y., Schoppmann, F.: Group-strategyproof cost sharing for metric fault tolerant facility location. In: Monien, B., Schroeder, U.-P. (eds.) SAGT 2008. LNCS, vol. 4997, pp. 350–361. Springer, Heidelberg (2008) 2. Borodin, A., El-Yaniv, R.: Online computation and competitive analysis. Cambridge University Press, New York (1998) 3. Brenner, J., Sch¨ afer, G.: Singleton acyclic mechanisms and their applications to scheduling problems. In: Monien, B., Schroeder, U.-P. (eds.) SAGT 2008. LNCS, vol. 4997, pp. 315–326. Springer, Heidelberg (2008) 4. Devanur, N., Mihail, M., Vazirani, V.: Strategyproof cost-sharing mechanisms for set cover and facility location games. Decision Support. Syst. 39(1), 11–22 (2005) 5. Du, J., Leung, J.Y.T., Young, G.H.: Minimizing mean flow time with release time constraint. Theoretical Computer Sci. 75(3), 347–355 (1990) 6. Gupta, A., Hajiaghayi, M., R¨ acke, H.: Oblivious network design. In: Proc. of the 17th ACM-SIAM Sympos. on Discrete Algorithms, pp. 970–979 (2006) 7. Harks, T., Heinz, S., Pfetsch, M.: Competitive online multicommodity routing. Theory of Computing Systems (2008) 8. Imase, M., Waxman, B.: Dynamic Steiner tree problems. SIAM J. Disc. Math. 4(3), 369–384 (1991) 9. Immorlica, N., Mahdian, M., Mirrokni, V.S.: Limitations of cross-monotonic costsharing schemes. ACM Trans. Algorithms 4(2), 1–25 (2008) 10. Juarez, R.: Group strategyproof cost sharing (2008) (unpublished) 11. Mehta, A., Roughgarden, T., Sundararajan, M.: Beyond Moulin mechanisms. In: Proc. of the ACM Conference on Electronic Commerce (2007) 12. Moulin, H.: Incremental cost sharing: Characterization by coalition strategyproofness. Soc. Choice Welfare 16, 279–320 (1999) 13. Schrage, L.: A proof of the optimality of the shortest remaining processing time discipline. Operations Res. 16, 687–690 (1968)
On the Power of Nodes of Degree Four in the Local Max-Cut Problem Burkhard Monien and Tobias Tscheuschner Faculty of Computer Science, Electrical Engineering, and Mathematics, University of Paderborn, Fürstenallee 11, 33102 Paderborn, Germany {bm,chessy}@upb.de
Abstract. We study the complexity of local search in the max-cut problem with FLIP neighborhood, in which exactly one node changes the partition. We introduce a technique of constructing instances which enforce certain sequences of improving steps. Using our technique we can show that already graphs with maximum degree four satify the following two properties. 1. There are instances with initial solutions for which every local search takes exponential time to converge to a local optimum. 2. The problem of computing a local optimum reachable from a given solution by a sequence of improving steps is PSPACE-complete. Schäffer and Yannakakis (JOC ’91) showed via a so called “tight” PLSreduction that the properties (1) and (2) hold for graphs with unbounded degree. Our improvement to the degree four is the best possible improvement since Poljak (JOC ’95) showed for cubic graphs that every sequence of improving steps has polynomial length, whereby his result is easily generalizable to arbitrary graphs with maximum degree three. In his paper Poljak also asked whether (1) holds for graphs with maximum degree four, which is settled by our result. Many tight PLS-reductions in the literature are based on the max-cut problem. Via some of them our constructions carry over to other problems and show that the properties (1) and (2) already hold for very restricted sets of feasible inputs of these problems. Since our paper provides the two results that typically come along with tight PLS-reductions it does naturally put the focus on the question whether it is even PLS-complete to compute a local optimum on graphs with maximum degree four – a question that was recently asked by Ackermann et al. We think that our insights might be helpful for tackling this question. Keywords: Max-cut, local search, degree four, complexity, PLS.
1
Introduction
In computer science the complexity of problems is mostly measured by worst case running times. Focussing on optimization problems the most common question
This work was partially supported by the DFG Schwerpunktprogramm 1307 “Algorithm Engineering.”
T. Calamoneri and J. Diaz (Eds.): CIAC 2010, LNCS 6078, pp. 264–275, 2010. c Springer-Verlag Berlin Heidelberg 2010
On the Power of Nodes of Degree Four in the Local Max-Cut Problem
265
in the complexity class NP is to find a solution such that there is no better solution at all, namely one asks for a global optimum. In this paper we consider optimization problems in the context of local search. Hereby, a set of neighbor solutions is associated to each feasible solution and one asks for a local optimum, i.e. a solution which has no neighbor solution with a better value of the objective function. In particular we consider the complexity of the class of local search algorithms for the max-cut problem. For an undirected graph G = (V, E) with weighted edges w : E → N a cut is a partition of V into two sets. The max-cut problem asks for a cut maximizing the sum of the weights of the edges connecting the two sets. Finding a maximum cut is known to be NP-complete [9]. The problem is one of the most basic combinatorial optimization problems and has a wide range of applications (for an overview one might see [19]). Local search is one of the most successful practical approaches to deal with hard optimization problems. The most frequently used method for finding a local optimum is to start with a feasible solution and iteratively move to a better neighbor solution until a local optimum is found. Johnson et al. [13] introduced the complexity class PLS (polynomial local search) capturing the most common local search problems. Schäffer and Yannakakis [22] considered local search for the max-cut problem in which the neighborhood of a solution contains all solutions in which exactly one node is in a different partition (the FLIP-neighborhood). For this problem they showed PLS-completeness via a tight PLS-reduction. The tightness of their reduction implies that the following two properties come along: 1. There are instances with initial solutions for which independent of the rule of selecting a better neighbor solution every sequence of improving steps to a local optimum has exponential length. 2. The problem of computing a local optimum reachable from a given solution by a sequence of improving steps state is PSPACE-complete. Concurrently to [22], Haken [11] explicitly constructed instances for (1) (a description can be found in [8]). On the positive side Poljak [18] showed that the number of improving steps before reaching a local optimum is polynomial for cubic graphs. Loebl [16] earlier provided a polynomial time algorithm not using local search to compute local optima for the same problem. For the degree four Haken and Luby [11] constructed instances in a slightly different problem for which the steepest descent rule takes exponential time. Closely related to graphs with bounded degree is the result of Krentel [14]. He showed PLS-completeness for a constraint satisfiability problem with bounded occurrences of variables — whereby he allows for the variables to take three different values. A return of the focus on the class PLS in the recent past was initiated by Fabrikant et al. [7] who showed PLS-completeness for the computation of Nash equilibria in some variants of congestion games. Ackermann et al. [2] provide a simpler proof for asymmetric (network) congestion games via a tight PLS-reduction from max-cut. For an overview of theoretical results of
266
B. Monien and T. Tscheuschner
local search and PLS in particular, we refer to Michiels et al. [17]. Inspired by the results of [11] and [14] Poljak asks in [18] whether it is possible to construct graphs with maximum degree four and initial 2-partitions which are exponentially many improving steps away from any local optimum. In our paper we give a positive answer. The existence of exponentially long sequences of improving steps raised interest in several fields of theoretical computer science. For example Englert et al. [6] show that there are instances of the metric TSP-problem and initial solutions for which the number of improving 2-opt exchanges can be exponentially long. For the well known k-means algorithm Vattani [23] showed that it can take an exponential number of steps even for the problem of clustering points in the plane. For the computation of Nash Equilibria in square bimatrix games using the famous Lemke-Howsen algorithm Savani and von Stengel [21] show that it takes an exponential number of steps even in the best case. On the other hand Ackermann et al. [2] provide a sufficient condition in congestion games such that the number of improving steps is polynomial in any initial solution. Our results. At first, we introduce three different types of nodes of degree four. Then we show in Section 3 (Theorem 2) for graphs that contain only nodes of these two types that there exist instances and initial 2-partitions for which local search can take exponential time to converge to a local optimum, and that (Theorem 3) the problem of computing a local optimum is P-hard. In Section 4 we consider graphs that contain all three types of nodes. At first, we introduce our technique of constructing instances that enforce certain sequences of improving flips. Then, using our technique, we show that (Theorem 5) there are graphs and initial 2-partitions for which every local search takes exponential time to converge to a local optimum, and that (Theorem 6) the problem of computing a local optimum reachable from an initial 2-partition by a sequence of improving flips is PSPACE-complete. In the proof for Theorem 5 we use the construction of the proof for Theorem 2 and enforce exponentially long sequences by adding auxiliary nodes and edges according to our technique. The proof for Theorem 6 uses the construction of the P-hardness result to simulate the behavior of a linear bounded automaton and the construction of Theorem 5 to fuel the simulation process as long as necessary. By means of known tight PLS-reductions our constructions can be transferred to other problems. The reductions maintain the bounded degree of the max-cut instances in some sense. Therefore, we can provide instances and initial solutions for very restricted sets of feasible inputs for the problems which are exponentially many steps away from any local optimum and that the problem of computing a local optimum reachable from a given state is PSPACE-complete. Namely, these two properties follow for the Max-2SAT problem [22] in which each variable occurs at most eight times, the problem of partitioning [22] a graph into two equally sized sets of nodes by minimizing or maximizing the weight of the cut for graphs with maximum degree five, and the problem of computing a Nash Equilibrium in congestion games [2] in which each strategy contains at most four strategies.
On the Power of Nodes of Degree Four in the Local Max-Cut Problem
2
267
Notations and Basic Properties
A graph G = (V, E) together with a partition P of V into two sets V1 and V2 is denoted by GP . We let cGP : V → {0, 1} with cGP (u) = 1 if and only if u ∈ V1 in GP . We refer to cGP (u) as the color (white, black) of u in GP . We = cGP (v). For a vector v of say that an edge {u, v} is in the cut if cGP (u) nodes we let cP (v) be the corresponding vector of colors. For a node u we say that u flips if it changes the partition. A flip is improving if it increases the sum of the weights of the edges that are in the cut. A node u is happy in GP if a flip of u is not improving, and unhappy otherwise. We call a partition P a local optimum if all nodes in GP are happy. For a sequence of flips of nodes s = (u1 , ..., uq ) we let P1 , ..., Pq be the partitions obtained from a partitioned graph GP0 by subsequently flipping the nodes in s and for 1 ≤ j ≤ k ≤ q we let + k s− j := (u1 , ..., uj ), sj := (uj+1 , ..., uq ), and sj := (uj+1 , ..., uk ). Definition 1. For a node u and edges au , bu , cu , du incident to u with w(au ) ≥ w(bu ) ≥ w(cu ) ≥ w(du ) we distinguish the following types for u: – type I: if w(au ) > w(bu ) + w(cu ) + w(du ) – type II: if w(au )+w(du ) > w(bu )+w(cu ) and w(au ) < w(bu )+w(cu )+w(du ) – type III: if w(au ) + w(du ) < w(bu ) + w(cu ) These three types do not cover all possible nodes in graphs of maximum degree four (due to the fact that the inequalities are strict) but if u has one of these types, then we can fully characterize its happiness: Observation 1. For a graph G = (V, E) with maximum degree four, a partition P , a node u, and edges au , bu , cu , du incident to u with w(au ) ≥ w(bu ) ≥ w(cu ) ≥ w(du ) the following three conditions hold: – If u is of type I, then u is happy in GP if and only if au is in the cut. – If u is of type II, then u is happy in GP if and only if au and at least one other edge is in the cut or bu , cu , and du are in the cut. – If u is of type III, then u is happy in GP if and only if at least two of the edges au , bu , cu are in the cut. Throughout this paper we will introduce several graphs and partitions containing nodes of these three types. For the purpose of succinctness we will introduce the graphs and partitions by means of drawings. In Figure 2 we depict how we distinguish the different types of nodes in our drawings. A node u of type I has a little arrow pointing out the heaviest edge incident to u (see Figure 1(a)). If u is of type II, then this is recognizable by an incident edge which is half-dashed (see Figure 1(b)). The edge that is half-dashed is the heaviest edge incident to u and the dashed half of the edge is closer to u than to the respective neighbor of u. If u is of type III, then the lightest edge incident to u is half-dotted (see Figure 1(c)), whereby the half-dotted side of the edge is closer to u. Due to Observation 1 the happiness of a node u of type I (resp. II,III)
268
B. Monien and T. Tscheuschner bu
au
u
(a) u is of type I
(b) u is of type II
du
cu
(c) u is of type III
Fig. 1. Illustration of the three types of nodes
is known if the colors of u and neighbors and the heaviest (heaviest, lightest) edge incident to u is known. The initial partitions of the nodes are illustrated with white or black fillings (the filling of a node is gray if its partition is not determined). If a node has a degree lower than four, then we assume the weights of the missing edges to be zero. Definition 2. For a graph G = (V, E) of maximum degree four and two adjacent nodes u, v ∈ V we say that u has no influence on v if v is of type I and {u, v} is not the heaviest edge incident to v or if v is of type III and {u, v} is the lightest edge incident to v. Otherwise we say that u has influence on v. + (u) := {v|v ∈ V, u has influence on v}, for Furthermore, for u ∈ V we let IG + + U ⊆ V we define IG (U ) := {v|v ∈ V \ U, ∃u ∈ U such that v ∈ IG (u)}, and − + IG (U ) := {v|v ∈ V \ U, ∃u ∈ U such that u ∈ IG (v)}. If the considered graph is clear from the context, then we omit the subscript. Note that the happiness of a node u in a partitioned graph GP is independent from the color of a neighbor which has no influence on u.
3
Graphs with Nodes of Type I and III
Theorem 2. For every n ∈ N there is a graph Gn containing O(n) nodes of type I and III together with an initial partition P such that there is a sequence of improving flips in GnP in which one node flips 2n+1 times. Proof. We give a construction of Gn as a concatenation of subgraphs Gi , 0 ≤ i ≤ n as depicted in Figure 2. The initial partition P is indicated by the colors of the nodes. The nodes vi , 1 ≤ i ≤ n are of type III and all the other nodes are of type I. For the purpose of a succinct illustration of the weights of the edges we let fn,i (k) := k + 5(n − i) for all k ∈ N. In the following we prove by induction that for any n ∈ N there is a sequence of improving flips in GnP in which vn flips 2n+1 times. For the induction basis, observe that in G0P the sequence of improving flips (v0 , u2 , v0 ) allows v0 to flip 21 times. Assume that the induction hypothesis holds for Gn−1 and let s be a P n sequence of improving flips in Gn−1 for which v flips 2 times. Then we can n−1 P extend s by inserting the following sequences of flips of nodes in Gn directly after the k-th flip of vn−1 for all 1 ≤ k ≤ 2n .
On the Power of Nodes of Degree Four in the Local Max-Cut Problem
G0 u1
G1
u2 fn,0(2)
u1,1
v0 fn,0(1)
fn,0(0)= fn,1(5) fn,1(3)
u1,2
Gn
G2 v1
fn,1(1)
u1,3 fn,1(2)
fn,1(1)
u2,1
fn,1(0)=fn,2(5) fn,1(1)
fn,2(3)
u2,2
269
v2
fn,2(1)
fn,2(1)
u2,3
un,1 fn,n-1(0)= fn,n(5)
fn,2(1)
fn,2(2)
fn,n(3)
un,2
vn
fn,n(1)
fn,n(1)
un,3
fn,n(1)
fn,n(2)
Fig. 2. A family of graphs allowing exponentially many flips
k odd: k even:
insert (un,1 , vn , un,2 ) insert (un,1 , vn , un,3 , un,2 , vn , un,3 , vn )
The subsequent execution of the two flip sequences result in the same partition as the nodes have before the two flip sequences are executed. This guarantees that the sequence for the odd case can be inserted after an execution of the sequence for the even case. Within the two inserted subsequences vn flips four
times. Thus, vn flips 2n+1 times in the extended flip sequence. Note that the only nodes of degree 4 in the graphs Gn are the nodes vi . These nodes are of type III and have an incident edge which has no influence on their happiness. If none of these nodes had such an edge, then we would have a graph with a degree of at most 3, in which only quadratically many flips were possible. Thus, it is the existence of edges of this kind that allows exponentially long flip sequences, although the edges do not affect the happiness of nodes of type III. The following result is mainly built on a property of a node u of type III in local optimum. Assume that one of the neighbors with influence on u is black in a local optimum. Then, u is black if and only if the other two neighbors with influence on u are white. This property can be used to simulate a NOR-gate of a boolean circuit since the output of a NOR-gate is 1 if and only if both inputs are 0. Theorem 3. (a) Finding a local optimum of max-cut on graphs containing only nodes of type I and III is P -hard with respect to logspace-reduction. (b) Let Cf be a boolean circuit with N gates which computes a function f : {0, 1}n → {0, 1}m. Then, using O(logN ) space, one can compute a graph Gf = (Vf , Ef ) containing only nodes of type I and III among which there are nodes s1 , ..., sn , t1 , ..., tm ∈ Vf of degree one such that f (cP (s)) = cP (t) in every local optimum P of Gf .
4
Graphs with Nodes of Type I, II, and III
In this section we begin with the description of the building blocks of our technique of adding nodes and edges in existing graphs with initial partitions which allows to enforce certain sequences of improving flips. The first definition below describes the key relation between two nodes that we exploit with our technique.
270
B. Monien and T. Tscheuschner
Definition 3. For a graph G = (V, E), a partition P , two nodes u, v ∈ V , and a sequence s of improving flips in GP we say that u follows v in s if v flips prior to the first flip of u in s, and between any two subsequent flips of v in s there is exactly one flip of u. We say that u follows v if u follows v in s for all sequences s of improving flips in GP . The following Lemma states that adding a subgraph to an existing graph, such that the added subgraph does not have influence on the original graph, does not affect the sequences of improving flips in the original graph. Lemma 1. Let G = (V, E) and G = (V , E ) be graphs with partitions P0 and P respectively and let E ⊆ V × V . The graph G+ = (V + , E + ) is defined by + V + = V ∪V and E + = E ∪E ∪E , whereby we assume that IG + (V ) = ∅. We let + Q0 be a partition of V induced by P0 and P . Furthermore, we let s = (w1 , ..., wq ) be a sequence of improving flips in G+ Q0 . Then, the sequence s , obtained from s by deleting every flip of a node in V is a sequence of improving flips in GP0 . In the following we consider a graph G = (V, E) and a partition P0 , nodes u1 , u2 , y1 , y2 ∈ V with e = {u1 , u2 } ∈ E, w(e) = a, u1 ∈ / I + (u2 ), and y1 , y2 are = cP0 (u2 ), let — without loss of type I and degree ≤ 3. We assume that cP0 (u1 ) of generality — cP0 (u1 ) = 0, and assume that u2 follows u1 in G. This is the framework in which our technique is applied. In the following, we describe how and for what purpose the e is replaced in our technique. The graphs Si = (Vi , Ei ) are as introduced in Figures 3(b)-3(g). We let h(G, e, Si , Yi ) with Yi = {} if 1 ≤ i ≤ 2, Yi = {y1 , y2 } if 3 ≤ i ≤ 4, and Yi = {y1 } if 5 ≤ i ≤ 6 be the graph obtained from G in the following way. We replace u1 , u2 , and e (see Figure 3(a)) by Si , whereby all edges incident to u1 and u2 in G — except e — are also incident to u1 and u2 respectively in Gi := h(G, e, Si , Yi ). We choose small enough such that the types of u2 , y1 and
(a)
(b)
(c)
(d)
(e)
(f)
(g)
Fig. 3. Edge {u1 , u2 } (Figure 3(a)) is replaced by some subgraph Si (Figures 3(b)-3(g))
On the Power of Nodes of Degree Four in the Local Max-Cut Problem
271
y2 are the same in Gi as in G — note that the type of u1 is the same in both graphs anyway since w({u1 , ui,1 }) = a = w(e). We let Eib be the set of edges of Ei not incident to a node yj for 1 ≤ j ≤ 2. We denote by er (Si ) an edge of Ei and call it the reference edge of Si , in particular we let er (S1 ) = {u1,3 , u1,5 } and er (Si ) = {u1 , ui,1 } for 2 ≤ i ≤ 6. We let e1 (S1 ) = {u1,4 , u1,5 } and call it the lower reference edge of S1 . For i ∈ {3, 5} we say that ui,2 is the decider of y1 in Gi . For i ∈ {4, 6} we call ui,3 the decider of y1 in Gi . For 3 ≤ i ≤ 6 we call u1 the prenode and u2 the postnode of y1 in Gi . The definitions for y2 in Gi for 3 ≤ i ≤ 4 are analogous to those for y1 . Considering the types of the nodes in the subgraphs Si one can easily verify the following observation. Observation 4. For each of the graphs Gi and each partition P of V i every node ui,j for 1 ≤ i ≤ 6, 2 ≤ j ≤ 5 is happy if all edges of Eib incident to ui,j are in the cut in GiP . Lemma 2 specifies the sequences of improving flips that are possible in the graphs Gi . Roughly speaking, the flips walk along the path(s) from u1 to u2 , whereby they do not necessarily reach u2 . Lemma 2. Let si be a sequence of improving flips in Gi for an arbitrary 1 ≤ i ≤ 6 ending up in a local optimum. Then, the sequence si obtained from si by deleting every flip of a node that is not in Vi is an element of the set Wi which is introduced as a regular expression in Table 1. Table 1. All possible flip sequences in Si i Wi 1 (u1 u1,1 u1,2 (u1,3 u1,4 |u1,4 u1,3 )u1,5 u2 )∗ (u1 u1,1 u1,2 (u1,3 u1,4 |u1,4 u1,3 )u1,5 (u2 )? )? 2 (u1 u2,1 u2,2 u2 )∗ (u1 u2,1 u2,2 (u2 )? )? 3 and 5 (u1 ui,1 ui,2 (ui,2 ui,2 )∗ u2 )∗ (u1 ui,1 (ui,2 (ui,2 ui,2 )∗ (u2 )? )? )? 4 and 6 (u1 ui,1 ui,2 ui,3 (ui,3 ui,3 )∗ ui,4 u2 )∗ (u1 ui,1 ui,2 (ui,3 (ui,3 ui,3 )∗ (ui,4 (u2 )? )? )? )?
Corollary 1. In G1 node u1,5 follows both, node u1,3 and u1,4 . In Gi each of the nodes ui,1 and u2 follows u1 for all 1 ≤ i ≤ 6. Note that the “following”-relations in Corollary 1 provide a basis for a recursive substitution of the reference edges by other graphs Si . The following Lemmas consider properties of the graph Gi for an arbitrary i with 1 ≤ i ≤ 6 with initial partition P0 and a sequence s = (w1 , ..., wq ) of improving flips in Gi that ends up in a local optimum. Lemma 3. The sequence s obtained from s by deleting every flip of a node in Vi \ {u1 , u2 } is a sequence of improving flips in G. Proof. Due to Lemma 1 node u2 follows u1 in s . No node in Vi \ {u1 , u2 } has influence on some node in V \ {u2 }. Since u1 and u2 have the same type in Gi as in G every flip in s is improving if the corresponding flip in s is improving.
272
B. Monien and T. Tscheuschner
Definition 4. Consider Gi for any 3 ≤ i ≤ 6 and let wq be the prenode of y1 in Gi . We say that y1 is sticked to wq in GiPq if in every sequence s+ q node y1 is happy if both its postnode in Gi did not yet flip in s+ and y has the same 1 q color as wq for i ∈ {3, 5} and the opposite color for i ∈ {4, 6} respectively. The definition for y2 in Gi for 3 ≤ i ≤ 4 is analogous to that of y1 . Lemma 4. Consider Gi for any 3 ≤ i ≤ 6 and let 1 ≤ j ≤ q such that u1 = wq . Assume that y1 — and for 3 ≤ i ≤ 4 also y2 — is sticked to u1 in GiPq . Then, there is exactly one flip of the decider of y1 in s+ j prior to the first flip of the postnode of y1 if and only if for some j ≤ k ≤ q the predicate Ri as introduced in Table 2 is true in partition Pk . Table 2. Predicates that decide which sequence of flips occurs in Si after a flip of u1
i Ri 3 c(y1 ) = c(u1 ) OR c(y2 ) = c(u1 ) 4 c(y1 ) = c(u1 ) OR c(y2 ) = c(u1 ) 5 c(y1 ) = c(u1 ) 6 c(y1 ) = c(u1 )
Lemma 4 characterizes the conditions under which the flips walk from u1 to u2 in Gi . It shows which subgraph Si for 3 ≤ i ≤ 6 can be used to hinder the flips from walking from u1 to u2 as long as a given predicate, namely Ri , is false. Recall that corollary 1 shows that for any path p = (w1 , ..., wm ) in any subgraph Si with w1 = u1 and wm = u2 there is a reference edge {wj , wj+1 } in Si such that wj+1 follows wj in Gi . Thus, every subgraph Si provides the basis to substitute its reference edge(s) by further subgraphs. This allows to query more sophisticated conditions. Theorem 5. For every n ∈ N there is a graph H n containing O(n) nodes of maximum degree four together with an initial partition P0 such that every sequence of improving flips in HPn0 ending up in a local optimum contains a node that flips 2n+1 times. Proof Sketch. The graph H n is built up by a concatenation of subgraphs Hi for 0 ≤ i ≤ n. There are two types of subgraphs, namely H0 (see Figure 4) and Hi for 1 ≤ i ≤ n (see Figure 5). To outline the weights of the edges succinctly, we let fn,i (k) := k + 34(n − i) for all k ∈ N. Node vi is the only node of type III in Hi which has a degree of four. All nodes of degree three are of type III and all nodes which have a degree lower than three are of type I. There are two nodes of type II in Hi , namely hi,6 and hi,15 . The gray edges in Figure 4 and 5 are to distinguish different cases. In H0 there is an edge {v0,1 , v0,2 } if n = 0 and if n > 0, then there are two edges {v0,1 , h1,1 } and {v0,2 , u1,1 } concatenating H0 and H1 . In the subgraph Hi there is an edge
On the Power of Nodes of Degree Four in the Local Max-Cut Problem
273
Fig. 4. The subgraph H0 of H n
hi,17
Hi
3
hi,18 hi,1 fn,i(39)
hi,2
fn,i(38)
hi,3 fn,i(37)
hi,4 fn,i(37)
2
hi,5 fn,i(36)
hi,6 fn,i(35)
II
hi,7
fn,i(33)
hi,8 fn,i(32)
ui,1
hi,9 fn,i(32)
1
1
III h 1
hi,12
vi
fn,i(7)
fn,i(18)
h
i,15
i,2
i
5 4
hi,10
2
II
i=n fn,i(5) 5
fn,i(7) v
fn,i(9)
1 fn,i(18)
v i,1
fn,i(6)
i,16
1
fn,i(18)
ui,2
fn,i(7)
fn,i(31)
hi,11
5
fn,i(8)
3
fn,i(11)
1
hi,13fn,i(15) h fn,i(13)
fn,i(15)
i,14
ui,3
1
Fig. 5. The subgraph Hi of H n for 0 < i ≤ n
{vi,1 , vi,2 } if i = n and if n > 0, then there are two edges {vi,1 , hi+1,1 } and {vi,2 , ui+1,1 } concatenating Hi and Hi+1 . The initial partition P0 is indicated by the colors of the nodes. We use thin edges to indicate edges with a certain purpose. Each of them is incident to at least one node of type I. The idea behind these edges is to transport the information about the current color of a certain node of type I to other nodes in the graph and form a condition under which a flip is possible there. The claim follows by showing by induction on n that in HPn0 1. vn,1 flips 2n+1 times in every sequence of improving flips ending up in a local optimum and 2. vn,2 follows vn,1 . Proving these two statements is rather technical and therefore omitted.
Theorem 6. The problem of computing a local optimum for a partitioned graph GP0 with maximum degree four which is reachable from GP0 by a sequence of improving flips is PSPACE-complete. Proof Sketch. Clearly, the problem is computable in polynomial space. We reduce from the PSPACE-complete problem of deciding whether a linear bounded automaton M halts for a given input [9]. A configuration of M for inputs of
274
B. Monien and T. Tscheuschner
length n is the state of M , the position of the head, and a string of length n. Then, the number of configurations of M is bounded by cn for some constant c. We let m be the integer such that 2m−1 ≤ cn < 2m and let c0 be the initial configuration of M . Let f : {0, 1}q → {0, 1}q be the function which computes for any given configuration of M encoded as a bitvector the bitwise complement of the configuration of M after one step, whereby we assume that the output of f is the bitwise complement of the input if the configuration represented by the input is a halting configuration. Clearly, f is polynomial time computable. Due to Theorem 3(b) it is possible to compute in logarithmic space and therefore in polynomial time a graph Gf with nodes of degree at most four with input nodes si and output nodes ti such that in any local optimum P we have cP (t) = f (cP (s)). We overtake Gf for this construction aswell and add an edge ei = {si , ti } for each i with a weight that is small enough such that the types of both si and ti are maintained and their corresponding heaviest edges are also still the same. We also include the graph H m+1 from the proof of Theorem 5 and scale its weights by a very great number M . Let G0 be the resulting graph. Now we add the subgraph S2 to G0 several times whereby we use a superscript to distinguish the subgraphs, i.e. the subgraph S2 added in step i is S2i and contains the nodes ui2,1 , ui2,2 . In particular, we let G1 = h(G0 , {u1 , u2 }, S21 , {}) and Gj = j j h(Gj−1 , {u1 , uj−1 2,1 }, S2 , {}) for 2 ≤ j ≤ q and add an edge {u2,1 , sj } with the same weight as the weight of the heaviest edge incident to sj in G0 to Gq . This edge does not alter the type of uj2,1 and its heaviest edge is remained if M is great enough. Note that the nodes sj are happy if they have the opposite color as tj if tj has the same color as uj2,1 . Finally, we add subgraphs according to Lemma 2 and 4 that hinder vm+1,2 from flipping to white as long as any si is white for which ti is white and further subgraphs that hinder vm+1,2 from flipping to black as long as any si is black for which ti is black or any nodes in Gf is unhappy. The initial colors of the input nodes si are chosen such that they correspond to the {0, 1} assignment representing c0 and the colors of the remaining nodes in G such that they are happy. Then, each step of M is simulated by the colors of the input nodes of Gf . Thus, in the local optimum that is finally reached, the colors of the input nodes equal the bitwise complement of the colors of the output nodes if and only if M halts if started with c0 .
References 1. Anshelevich, E., Dasgupta, A., Kleinberg, J., Tardos, E., Wexler, T., Roughgarden, T.: The price of stability for network design with fair cost allocation. In: FOCS, pp. 295–304 (2004) 2. Ackermann, H., Röglin, H., Vöcking, B.: On the Impact of Combinatorial Structure on Congestion Games. JACM Art. 25, 55(6) (2008) 3. Awerbuch, B., Azar, Y., Epstein, A., Mirokkni, V.S., Skopalik, A.: Fast Convergence to Nearly Optimal Solutions in Potential Games. In: Conference on Electronic Commerce (EC), pp. 264–273 (2008)
On the Power of Nodes of Degree Four in the Local Max-Cut Problem
275
4. Dunkel, J., Schulz, A.S.: On the Complexity of Pure-Strategy Nash Equilibria in Congestion and Local-Effect Games. In: Spirakis, P.G., Mavronicolas, M., Kontogiannis, S.C. (eds.) WINE 2006. LNCS, vol. 4286, pp. 62–73. Springer, Heidelberg (2006) 5. Christodoulou, G., Mirrokni, V.S., Sidiropoulos, A.: Convergence and approximation in potential games. In: Durand, B., Thomas, W. (eds.) STACS 2006. LNCS, vol. 3884, pp. 349–360. Springer, Heidelberg (2006) 6. Englert, M., Röglin, H., Vöcking, B.: Worst Case and Probabilistic Analysis of the 2-Opt Algorithm for the TSP. In: SODA, pp. 1295–1304 (2006) 7. Fabrikant, A., Papadimitriou, C., Talwar, K.: The complexity of pure Nash Equilibria. In: STOC, pp. 604–612 (2004) 8. Floreen, P., Orponen, P.: Complexity Issues in Discrete Hopfield Networks. NeuroCOLT Technical Report Series, NC-TR-94-009 (October 1994) 9. Garey, M., Johnson, D.: Computers and Intractability, A Guide to the Theory of NP-Completeness. Freeman, New York (1979) 10. Goemans, M., Mirokkni, V., Vetta, A.: Sink Equilibria and Convergence. In: FOCS, pp. 142–154 (2005) 11. Haken, A.: Connectionist Networks that need exponential time to stabilize. Unpublished manuscript, Dept. of Computer Science, University of Toronto (1989) 12. Haken, A., Luby, M.: Steepest Descent Can Take Exponential Time for Symmetric Connection Networks. Complex Systems 2, 191–196 (1988) 13. Johnson, D., Papadimitriou, C., Yannakakis, M.: How easy is local search? JCSS 37(1), 79–100 (1988) 14. Krentel, M.: Structure in locally optimal solutions. In: FOCS, pp. 216–221 (1989) 15. Ladner, R.: The circuit value problem is log space complete for P. SIGACT News 7(1), 18–20 (1975) 16. Loebl, M.: Efficient maximal cubic graph cuts. In: Leach Albert, J., Monien, B., Rodríguez-Artalejo, M. (eds.) ICALP 1991. LNCS, vol. 510, pp. 351–362. Springer, Heidelberg (1991) 17. Michiels, W., Aarts, E., Korst, J.: Theoretical aspects of local search. Springer, New York (2007) 18. Poljak, S.: Integer linear programs and local search for max-cut. SIAM Journal on Computing 21(3), 450–465 (1995) 19. Poljak, S., Tuza, Z.: Maximum cuts and largest bipartite subgraphs. In: Combinatorial Optimization, pp. 181–244. American Mathematical Society, Providence (1995) 20. Rosenthal, R.: A Class of Games Possessing Pure-Strategy Nash Equilibria. International Journal of Game Theory 2, 65–67 (1973) 21. Savani, R., von Stengel, B.: Hard-To-Solve Bimatrix Games. Econometrica 74, 397–429 (2006) 22. Schäffer, A., Yannakakis, M.: Simple local search problems that are hard to solve. SIAM Journal on Computing 20(1), 56–87 (1991) 23. Vattani, A.: k-means Requires Exponentially Many Iterations Even in the Plane. In: Proceedings of the 25th annual symposium on Computational geometry, pp. 324–332 (2009)
Packing Bipartite Graphs with Covers of Complete Bipartite Graphs J´er´emie Chalopin1, and Dani¨el Paulusma2, 1
Laboratoire d’Informatique Fondamentale de Marseille, CNRS & Aix-Marseille Universit´e, 39 rue Joliot-Curie, 13453 Marseille, France
[email protected] 2 Department of Computer Science, Durham University, Science Laboratories, South Road, Durham DH1 3LE, England
[email protected]
Abstract. For a set S of graphs, a perfect S-packing (S-factor) of a graph G is a set of mutually vertex-disjoint subgraphs of G that each are isomorphic to a member of S and that together contain all vertices of G. If G allows a covering (locally bijective homomorphism) to a graph H, then G is an H-cover. For some fixed H let S(H) consist of all Hcovers. Let Kk, be the complete bipartite graph with partition classes of size k and , respectively. For all fixed k, ≥ 1, we determine the computational complexity of the problem that tests if a given bipartite graph has a perfect S(Kk, )-packing. Our technique is partially based on exploring a close relationship to pseudo-coverings. A pseudo-covering from a graph G to a graph H is a homomorphism from G to H that becomes a covering to H when restricted to a spanning subgraph of G. We settle the computational complexity of the problem that asks if a graph allows a pseudo-covering to Kk, for all fixed k, ≥ 1.
1
Introduction
Throughout the paper we consider undirected graphs with no loops and no multiple edges. Let G = (V, E) be a graph and let S be some fixed set of mutually vertex-disjoint graphs. A set of (not necessarily vertex-induced) mutually vertex-disjoint subgraphs of G, each isomorphic to a member of S, is called an S-packing. Packings naturally generalize matchings (the case in which S only contains edges). They arise in many applications, both practical ones such as exam scheduling [12], and theoretical ones such as the study of degree constraint graphs (cf. the survey [11]). If S consists of a single subgraph S, we write Spacking instead of S-packing. The problem of finding an S-packing of a graph G that packs the maximum number of vertices of G is NP-hard for all fixed connected S on at least three vertices, as shown by Hell and Kirkpatrick [13].
Partially supported by ANR Project SHAMAN and ANR Project ECSPER. Supported by EPSRC (Grant EP/G043434/1) and LMS (Scheme 7 Grant).
T. Calamoneri and J. Diaz (Eds.): CIAC 2010, LNCS 6078, pp. 276–287, 2010. c Springer-Verlag Berlin Heidelberg 2010
Packing Bipartite Graphs with Covers of Complete Bipartite Graphs
277
A packing of a graph is perfect if every vertex of the graph belongs to one of the subgraphs of the packing. Perfect packings are also called factors and from now on we call a perfect S-packing an S-factor. We call the corresponding decision problem the S-Factor problem. For a survey on graph factors we refer to [18]. Our Focus. We study a relaxation of Kk, -factors, where Kk, denotes the biclique (complete connected bipartite graph) with partition classes of size k and , respectively. In order to explain this relaxation we must introduce some new terminology. A homomorphism from a graph G to a graph H is a vertex mapping f : VG → VH satisfying the property that f (u)f (v) belongs to EH whenever the edge uv belongs to EG . If for every u ∈ VG the restriction of f to the neighborhood of u, i.e. the mapping fu : NG (u) → NH (f (u)), is bijective then we say that f is a locally bijective homomorphism or a covering [2,16]. The graph G is then B → H. Locally bijective homomorphisms have called an H-cover and we write G − applications in distributed computing [1] and in constructing highly transitive regular graphs [3]. For a specified graph H, we let S(H) consist of all H-covers. This paper studies S(Kk, )-factors of bipartite graphs.
(a)
(b)
(d)
(c)
(e)
Fig. 1. Examples: (a) a K2,3 . (b) a bipartite K2,3 -cover. (c) a bipartite K2,3 -pseudocover that is no K2,3 -cover and that has no K2,3 -factor. (d) a bipartite graph with a K2,3 -factor that is not a K2,3 -pseudo-cover. (e) a bipartite graph with an S(K2,3 )-factor but with no K2,3 -factor and that has no K2,3 -pseudo-cover.
Our Motivation. Since a K1,1 -factor is a perfect matching, K1,1 -Factor is polynomially solvable. The Kk, -Factor problem is known to be NP-complete for all other k, ≥ 1, due to the earlier mentioned result of [13]. These results have some consequences for our relaxation. In order to explain this, we make the following observation, which holds because only a tree has a unique cover (namely the tree itself).
278
J. Chalopin and D. Paulusma
Observation 1. S(Kk, ) = {Kk, } if and only if min{k, } = 1. Hence, the above results immediately imply that S(K1, )-Factor is only polynomially solvable if = 1; it is NP-complete otherwise. What about our relaxation for k, ≥ 2? Note that, for these values of k, , the size of the set S(Kk, ) is unbounded. The only result known so far is for k = = 2; Hell, Kirkpatrick, Kratochv´ıl and Kˇr´ıˇz [14] showed that S(K2,2 )-Factor is NP-complete for general graphs, as part of their computational complexity classification of restricted 2-factors. For bipartite graphs, the following is known. Firstly, Monnot and Toulouse [17] researched path factors in bipartite graphs and showed that the K2,1 -Factor problem stays NP-complete when restricted to the class of bipartite graphs. Secondly, we observed that as a matter of fact the proof of the NP-completeness result for S(K2,2 )-Factor in [14] is even a proof for bipartite graphs. Our interest in bipartite graphs stems from a close relationship of S(Kk, )factors of bipartite graphs and so-called Kk, -pseudo-covers, which originate from topological graph theory and have applications in the area of distributed computing [4,5]. A homomorphism f from a graph G to a graph H is a pseudo-covering from G to H if there exists a spanning subgraph G of G such that f is a covering P → H. from G to H. In that case G is called an H-pseudo-cover and we write G − The computational complexity classification of the H-Pseudo-Cover problem P that tests if G − → H for input G is still open, and our paper can also be seen as a first investigation into this question. We explain the exact relationship between factors and pseudo-coverings in detail, later on. Our Results and Paper Organization. Section 2 contains additional terminology, notations and some basic observations. In Section 3 we pinpoint the relationship between factors and pseudo-coverings. In Section 4 we completely classify the computational complexity of the S(Kk, )-Factor problem for bipartite graphs. Recall that S(K1,1 )-Factor is polynomially solvable on general graphs. We first prove that S(K1, )-Factor is NP-complete on bipartite graphs for all fixed ≥ 2. By applying our result in Section 3, we then show that NPcompleteness of every remaining case can be shown by proving NP-completeness of the corresponding Kk, -Pseudo-Cover problem. We classify the complexity of Kk, -Pseudo-Cover in Section 5. We show that it is indeed NP-complete on bipartite graphs for all fixed pairs k, ≥ 2 by adapting the hardness construction of [14] for restricted 2-factors. In contrast to S(Kk, )-Factor, we show that Kk, -Pseudo-Cover is polynomially solvable for all k, ≥ 1 with min{k, } = 1. In Section 6 we further discuss the relationships between pseudo-coverings and locally constrained homomorphisms, such as the earlier mentioned coverings. We shall see that as a matter of fact the NP-completeness result for Kk, -PseudoCover for fixed k, ≥ 3 also follows from a result of Kratochv´ıl, Proskurowski and Telle [15] who prove that Kk, -Cover is NP-complete for k, ≥ 3. This B → Kk, for a given graph G. However, the same auproblem tests whether G − thors [15] show that Kk, -Cover is polynomially solvable when k = 2 or = 2. Hence, for those cases we need to rely on our proof in Section 5.
Packing Bipartite Graphs with Covers of Complete Bipartite Graphs
2
279
Preliminaries
From now on let X = {x1 , . . . , xk } and Y = {y1 , . . . , y } denote the partition classes of Kk, , where we assume k ≤ . If k = 1 then we say that x1 is the center of K1, . We denote the degree of a vertex u in a graph G by degG (u). Recall that a homomorphism f from a graph G to a graph H is a pseudocovering from G to H if there exists a spanning subgraph G of G such that f is a covering from G to H. We would like to stress that this is not the same as saying that f is a vertex mapping from VG to VH such that f restricted to some spanning subgraph G of G becomes a covering. The reason is that in the latter setting it may well happen that f is not a homomorphism from G to H. For instance, f might map two adjacent vertices of G to the same vertex of H. However, there is an alternative definition which turns out to be very useful for us. In order to present it we need the following notations. We let f −1 (x) denote the set {u ∈ VG | f (u) = x}. For a subset S ⊆ VG , G[S] denotes the induced subgraph of G by S, i.e., the graph with vertex set S and edges uv whenever uv ∈ EG . For xy ∈ EH with x = y, we write G[x, y] = G[f −1 (x) ∪ f −1 (y)]. Because f is a homomorphism, G[x, y] is a bipartite graph with partition classes f −1 (x) and f −1 (y). Proposition 1 ([4]). A homomorphism f from a graph G to a graph H is a pseudo-covering if and only if G[x, y] contains a perfect matching for all x, y ∈ VH . Consequently, |f −1 (x)| = |f −1 (y)| for all x, y ∈ VH . Let f be a pseudo-covering from a graph G to a graph H. We then sometimes call the vertices of H colors of vertices of G. Due to Proposition 1, G[x, y] must contain a perfect matching Mxy . Let uv ∈ Mxy for xy ∈ EH . Then we say that v is a matched neighbor of u, and we call the set of matched neighbors of u the matched neighborhood of u.
3
How Factors Relate to Pseudo-covers
Theorem 1. Let G be a graph on n vertices. Then G is a Kk, -pseudo-cover if and only if G has an S(Kk, )-factor and G is bipartite with partition classes A kn n and B such that |A| = k+ and |B| = k+ . Proof. First suppose G = (V, E) is a Kk, -pseudo-cover. Let f be a pseudocovering from G to Kk, . Then f is a homomorphism from G to Kk, , which is a bipartite graph. Consequently, G must be bipartite as well. Let A and B denote the partition classes of G. Then we may without loss of generality assume that kn f (A) = X and f (B) = Y . Due to Proposition 1 we then find that |A| = k+ n and |B| = k+ . By the same proposition we find that each G[xi , yj ] contains a perfect matching Mij . We define the spanning subgraph G = (V, ij Mij ) of G and observe that every component in G is a Kk, -cover. Hence G has an S(Kk, )-factor.
280
J. Chalopin and D. Paulusma
Now suppose G has an S(Kk, )-factor. Also suppose G is bipartite with parkn n tition classes A and B such that |A| = k+ and |B| = k+ . Since {F1 , . . . , Fp } is an S(Kk, )-factor, there exists a covering fi from Fi to Kk, for i = 1, . . . , p. Let f be the mapping defined on V such that f (u) = fi (u) for all u ∈ V , where fi is the (unique) covering that maps u to some vertex in Kk, . Let AX be the set of vertices of A that are mapped to a vertex in X and let AY be the set of vertices of A that are mapped to a vertex in Y . We define subsets BX and BY of B in the same way. This leads to the following equalities: |AX | + |AY | = |BX | + |BY | = |AY | = |BY | =
kn k+ n k+ k |BX | k |AX |.
Suppose = k. Then this set of equalities has a unique solution, namely, |AX | = kn n k+ = |A|, |AY | = |BX | = 0, and |BY | = k+ = |B|. Hence, we find that f maps all vertices of A to vertices of X and all vertices of B to Y . This means that f is a homomorphism from G to Kk, that becomes a covering when restricted to the spanning subgraph obtained by taken the disjoint union of the subgraphs {F1 , . . . , Fp }. In other words, f is a pseudo-covering from G to Kk, , as desired. Suppose = k. Then solving this set of equalities yields solutions of the form |AX | = |BY | = α and |AY | = |BX | = 12 n − α with arbitrary α. However, in this case we have that |VFi ∩ A| = |VFi ∩ B| for i = 1, . . . , p. Then we can without loss of generality assume that each fi maps VFi ∩ A to X and VFi ∩ B to Y ; so, |AX | = |A| = |BY | = |B| and |AY | = |BX | = 0. This completes the proof of Theorem 1.
4
Classifying the S(Kk,)-Factor Problem
Here is the main theorem of this section. Theorem 2. The S(Kk, )-Factor problem is solvable in polynomial time for k = = 1. Otherwise it is NP-complete, even for the class of bipartite graphs. We prove Theorem 2 as follows. First we consider the case when min{k, } = 1 Due to Observation 1 the S(K1,1 )-Factor problem is equivalent to the problem of finding a perfect matching, which can be solved in polynomial time. We continue with the case when k = 1 and ≥ 2. Recall that for general graphs NP-completeness of this case immediately follows from Observation 1 and the earlier mentioned result of Hell and Kirkpatrick [13]. However, we consider bipartite graphs. For this purpose, a result by Monnot and Toulouse [17] is of importance for us. Here, Pk denotes a path on k vertices. Theorem 3 ([17]). For any fixed k ≥ 3, the Pk -Factor problem is NP-complete for the class of bipartite graphs.
Packing Bipartite Graphs with Covers of Complete Bipartite Graphs
281
We use Theorem 3 to show the result below, the proof of which is omitted. Proposition 2. For any fixed ≥ 2, S(K1, )-Factor and K1, -Factor are NP-complete, even for the class of bipartite graphs. The following statement allows us to consider the Kk, -Pseudo-Cover problem in order to finish the proof of Theorem 2. We omit its proof. Proposition 3. Fix arbitrary integers k, ≥ 2. If the Kk, -Pseudo-Cover problem is NP-complete, then so is the S(Kk, )-Factor problem for the class of bipartite graphs.
5
Classifying the Kk,-Pseudo-Cover Problem
Here is the main theorem of this section. Theorem 4. The Kk, -Pseudo-Cover problem can be solved in polynomial time for any fixed k, with min{k, } = 1. Otherwise it is NP-complete. In order to prove Theorem 4 we first analyse the polynomial cases. Proposition 4. The Kk, -Pseudo-Cover problem can be solved in polynomial time for any fixed k, with min{k, } = 1. Proof. For k = = 1, the problem is equivalent to finding a perfect matching in a graph. Let k = 1 and ≥ 2. Let G be an input graph of K1, -Pseudo-Cover. By Theorem 1, we may without loss of generality assume that G is bipartite with n n partition classes A and B such that |A| = 1+ and |B| = 1+ . Because ≥ 2, we can distinguish between A and B. Then we replace each vertex a ∈ A by copies a1 , . . . , a , and we make each ai adjacent to all neighbors of a. This leads to a bipartite graph G , the partition classes of which have the same size. Then
G has a K1, -Pseudo-Cover if and only if G has a perfect matching. We now prove that Kk, -Pseudo-Cover is NP-complete for all k, ≥ 2. Our proof is inspired by the proof of Hell, Kirkpatrick, Kratochv´ıl, and Kˆr´ıˆz in [14]. They consider the problem of testing if a graph has an SL -factor for any set SL of cycles, the length of which belongs to some specified set L. This is useful for our purposes because of the following. If L = {4, 8, 12, . . . , } then an SL -factor of a bipartite graph G with partition classes A and B of size n2 is an S(K2,2 )-factor of G that is also a K2,2 -pseudo-cover of G by Theorem 1. However, for k = ≥ 3, this is not longer true, and when k = the problem is not even “symmetric” anymore. Below we show how to deal with these issues. We refer to Section 6 for an alternative proof for the case k, ≥ 3. However, our construction for k, ≥ 2 does not become simpler when we restrict ourselves to k, ≥ 2 with k = 2 or = 2. Therefore, we decided to present our NP-completeness result for all k, with k, ≥ 2. Recall that we denote the partition classes of Kk, by X = {x1 , . . . , xk } and Y = {y1 , . . . , y } with k ≤ . We first state a number of useful lemmas (proofs are
282
J. Chalopin and D. Paulusma a
b1
b−1
c1
ck−1
d
e Fig. 2. The graph G1 (k, )
omitted). Hereby, we use the alternative definition in terms of perfect matchings, as provided by Proposition 1, when we argue on pseudo-coverings. Let G1 (k, ) be the graph in Figure 2. It contains a vertex a with − 1 neighbors b1 , . . . , b−1 and a vertex d with k − 1 neighbors c1 , . . . , ck−1 . For any i ∈ [1, − 1], j ∈ [1, k − 1], it contains an edge bi cj . Finally, it contains a vertex e which is only adjacent to d. Lemma 2. Let G1 (k, ) be an induced subgraph of a bipartite graph G such that only a and e have neighbors outside G1 (k, ). Let f be a pseudo-covering from G to Kk, . Then f (a) = f (e). Moreover, a has only one matched neighbor outside G1 (k, ) and this matched neighbor has color f (d), where d is the only matched neighbor of e inside G1 (k, ). Lemma 3. Let G be a bipartite graph that contains G1 (k, ) as an induced subgraph such that only a and e have neighbors outside G1 (k, ) and such that a and e have no common neighbor. Let G be the graph obtained from G by removing all vertices of G1 (k, ) and by adding a new vertex u adjacent to all neighbors of a and e outside G1 (k, ). Let f be a pseudo-covering from G to Kk, such that u has exactly one neighbor v of a in its matched neighborhood. Then G is a Kk, -pseudo-cover. Let G2 (k, ) be the graph in Figure 3. It contains k vertices u1 , . . . , uk . It also contains (k − 1)k vertices vh,i for h = 1, . . . , k − 1, i = 1, . . . , k, and (k − 1)( − 1) vertices wi,j for i = 1, . . . , k−1, j = 1, . . . , −1. For h = 1, . . . , k−1, i = 1, . . . , k, j = 1, . . . , − 1, G2 (k, ) contains an edge ui vh,i and an edge vh,i wh,j . Lemma 4. Let G be a bipartite graph that has G2 (k, ) as an induced subgraph such that only u-vertices have neighbors outside G2 (k, ). Let f be a pseudocovering from G to Kk, . Then each ui has exactly one matched neighbor ti outside G2 (k, ). Moreover, |f ({u1 , . . . , uk })| = 1 and |f ({t1 , . . . , tk })| = k.
Packing Bipartite Graphs with Covers of Complete Bipartite Graphs
u1
283
u2
v1,1
v1,2
w1,1 w1,2
v1,k
w1,−1
uk
v2,1
v2,2
v2,k
vk−1,2 vk−1,1
w2,1 w2,2
w2,−1
vk−1,k
wk−1,1 wk−1,2 wk−1,−1
Fig. 3. The graph G2 (k, )
Lemma 5. Let G be a bipartite graph that has G2 (k, ) as an induced subgraph such that only u-vertices have neighbors outside G2 (k, ) and such that no two u-vertices have a common neighbor. Let G be the graph obtained from G by removing all vertices of G2 (k, ) and by adding a new vertex s that is adjacent to the neighbors of all u-vertices outside G2 (k, ). Let f be a pseudo-covering from G to Kk, such that s has exactly one neighbor ti of every ui in its matched neighborhood. Then G is a Kk, -pseudo-cover. Let G3 (k, ) be the graph defined in Figure 4. It contains k copies of G1 (k, ), where we denote the a-vertex and e-vertex of the ith copy by ai and ei , respectively. It also contains a copy of G2 (k, ) with edges ei ui and ai ui+1 for
p
a1
a2
ak
e1
e2
ek
r2
r1
u1
u2
G1 (k, )
r−2
uk
G2 (k, )
q
Fig. 4. The graph G3 (k, )
284
J. Chalopin and D. Paulusma
i = 1, . . . , k (where uk+1 = u1 ). The construction is completed by adding a vertex p adjacent to all a-vertices and by adding vertices q, r1 , . . . , r−2 that are adjacent to all e-vertices. Here we assume that there is no r-vertex in case = 2. Lemma 6. Let G be a bipartite graph that has G3 (k, ) as an induced subgraph, such that only p and q have neighbors outside G3 (k, ). Let f be a pseudo-covering from G to Kk, . Then either every ai is a matched neighbor of p and no ei is a matched neighbor of q, or else every ei is a matched neighbor of q and no ai is a matched neighbor of p. Lemma 7. Let G be a graph that has G3 (k, ) as an induced subgraph such that only p and q have neighbors outside G3 (k, ) and such that p and q do not have a common neighbor. Let G be the graph obtained from G by removing all vertices of G3 (k, ) and by adding a new vertex r∗ that is adjacent to all neighbors of p and q outside G3 (k, ). Let f be a pseudo-covering from G to Kk, such that either all vertices in the matched neighborhood of r∗ in G are neighbors of p in G, or else are all neighbors of q in G. Then G is a Kk, -pseudo-cover. Let G4 (k, ) be the graph in Figure 5. It is constructed as follows. We take k copies of G3 (, k). We denote the p-vertex and the q-vertex of the ith copy by p1,i and q1,i , respectively. We take copies of G3 (k, ). We denote the p-vertex and the q-vertex of the j th copy by p and q , respectively. We add an edge 2,j
2,j
between any p1,i and p2,j . Lemma 8. Let G be a bipartite graph that has G4 (k, ) as an induced subgraph such that only the q-vertices have neighbors outside G4 (k, ). Let f be a pseudocovering from G to Kk, . Then either every p1,i p2,j is in a perfect matching and all matched neighbors of every q-vertex are in G4 (k, ), or else no edge p1,i p2,j is in a perfect matching and all matched neighbors of every q-vertex are outside G4 (k, ). We are now ready to present our NP-completeness reduction. This finishes the proof of Theorem 4.
q1,1
q1,2
G3 (, k)
G3 (, k)
p2,1 G3 (k, )
q2,1
p2,2 G3 (k, )
q2,2
p1,1
p1,2 G3 (k, )
q1,k
G3 (, k)
p1,k p2, G3 (k, )
Fig. 5. The graph G4 (k, )
q2,
Packing Bipartite Graphs with Covers of Complete Bipartite Graphs
285
Proposition 5. The Kk, -Pseudo-Cover problem is NP-complete for any fixed k, with k, ≥ 2. Proof. We reduce from the problem k + -Dimensional Matching, which is NP-complete as k + ≥ 3 (see [10]). In this problem, we are given k + mutually disjoint sets Q1,1 , . . . , Q1,k , Q2,1 , . . . , Q2, , all of equal size m, and a set H of k hyperedges h ∈ Πi=1 Q1,i × Πj=1 Q2,j . The question is whether H contains a k + -dimensional matching, i.e., a subset M ⊆ H of size |M | = m such that for , . . . , q1,k , q2,1 , . . . , q2, ) in any distinct pairs (q1,1 , . . . , q1,k , q2,1 , . . . , q2, ) and (q1,1 M we have q1,i = q1,i for i = 1, . . . , k and q1,j = q1,j for j = 1, . . . , . Given such an instance, we construct a bipartite graph G with partition classes V1 and V2 . First we put all elements in Q1,1 ∪ . . . ∪ Q1,k in V1 , and all elements in Q2,1 ∪ . . . ∪ Q2, in V2 . Then we introduce an extra copy of G4 (k, ) for each hyperedge h = (q1,1 , . . . , q1,k , q2,1 , . . . , q2, ) by adding the missing vertices and edges of this copy to G. We observe that indeed G is bipartite. We also observe that G has polynomial size. We claim that ((Q1,1 , . . . , Q1,k , Q2,1 , . . . , Q2, ), H) admits a k + -dimensional matching M if and only if G is a Kk, -pseudo-cover. Suppose ((Q1,1 , . . . , Q1,k , Q2,1 , . . . , Q2, ), H) admits a k + -dimensional matching M . We define a homomorphism f from G to Kk, as follows. For 1 ≤ i ≤ k, we define f (q) = xi if q ∈ Q1,i , and for 1 ≤ j ≤ we define f (q) = yj if q ∈ Q2,j . For each hyperedge h = (q1,1 , . . . , q1,k , q2,1 , . . . , q2, ), we let f (p1,i ) = xi for i = 1, . . . , k and f (p2,j ) = yj for j = 1, . . . , . For all h ∈ M , we let every q-vertex of h has all its matched neighbors in the copy of G4 (k, ) that corresponds to h. Since M is a k + -dimensional matching, the matched neighbors of every q-vertex are now defined. We then apply Lemma 7 and find that G is a Kk, -pseudo-cover. Conversely, suppose that f is a pseudo-covering from G to Kk, . By Lemma 8, every q-vertex has all its matched neighbors in exactly one copy of G4 (k, ) that corresponds to a hyperedge h such that the matched neighbor of every q-vertex in h is as a matter of fact in that copy G4 (k, ). We now define M to be the set of all such hyperedges. Then M is a k + -dimensional matching: any q-vertex appears in exactly one hyperedge of M .
6
Further Research on Pseudo-coverings
Pseudo-coverings are closely related to the so-called locally constrained homomorphisms, which are homomorphisms with some extra restrictions on the neighborhood of each vertex. In Section 1 we already defined a covering which is also called a locally bijective homomorphism. There are two other types of such homomorphisms. First, a homomorphism from a graph G to a graph H is called locally injective or a partial covering if for every u ∈ VG the restriction of f to the neighborhood of u, i.e. the mapping fu : NG (u) → NH (f (u)), is injective. Second, a homomorphism from a graph G to a graph H is called locally surjective or a role assignment if the mapping fu : NG (u) → NH (f (u)) is surjective for every u ∈ VG . See [7] for a survey.
286
J. Chalopin and D. Paulusma
The following observation is insightful. Recall that G[x, y] denotes the induced bipartite subgraph of a graph G with partition classes f −1 (x) and f −1 (y) for some homomorphism f from G to a graph H. Observation 9 ([9]). Let f be a homomorphism from a graph G to a graph H. For every edge xy of H, • f is locally bijective if and only if G[x, y] is 1-regular (i.e., a perfect matching) for all xy ∈ EH ; • f is locally injective if and only if G[x, y] has maximum degree at most one (i.e., a matching) for all xy ∈ EH ; • f is locally surjective if and only if G[x, y] has minimum degree at least one for all xy ∈ EH . By definition, every covering is a pseudo-covering. We observe that this is in line with Proposition 1 and Observation 9. Furthermore, by these results, we find that every pseudo-covering is a locally surjective homomorphism. This leads to the following result, the proof of which is omitted. Proposition 6. For any fixed graph H, if H-Cover is NP-complete, then so is H-Pseudo-Cover. Due to Proposition 6, the NP-completeness of Kk, -Pseudo-Cover for k, ≥ 3 also follows from the NP-completeness of Kk, -Cover for these values of k, . The latter is shown by Kratochv´ıl, Proskurowski and Telle [15]. However, these authors show in the same paper [15] that Kk, -Cover is solvable in polynomial time for the cases k, with min{k, } ≤ 2. Hence for these cases we have to rely on our proof in Section 5. Another consequence of Proposition 6 is that H-Pseudo-Cover is NP-complete for all k-regular graphs H for any k ≥ 3 due to a hardness result for the corresponding H-Cover [6]. However, a complete complexity classification of H-Pseudo-Cover is still open, just as dichotomy results for H-Partial Cover and H-Cover are not known, whereas for the locally surjective case a complete complexity classification is known [8]. Hence, for future research we will try to classify the computational complexity of the H-Pseudo-Cover problem. So far we have obtained some partial results but a complete classification seems already problematic for trees (we found many polynomially solvable and NP-complete cases).
References 1. Angluin, D.: Local and global properties in networks of processors. In: 12th ACM Symposium on Theory of Computing, pp. 82–93. ACM, New York (1980) 2. Abello, J., Fellows, M.R., Stillwell, J.C.: On the complexity and combinatorics of covering finite complexes. Austral. J. Comb. 4, 103–112 (1991) 3. Biggs, N.: Constructing 5-arc transitive cubic graphs. J. London Math. Soc. II 26, 193–200 (1982)
Packing Bipartite Graphs with Covers of Complete Bipartite Graphs
287
4. Chalopin, J.: Election and Local Computations on Closed Unlabelled Edges. In: Vojt´ aˇs, P., Bielikov´ a, M., Charron-Bost, B., S´ ykora, O. (eds.) SOFSEM 2005. LNCS, vol. 3381, pp. 81–90. Springer, Heidelberg (2005) 5. Chalopin, J., Paulusma, D.: Graph labelings derived from models in distributed computing. In: Fomin, F.V. (ed.) WG 2006. LNCS, vol. 4271, pp. 301–312. Springer, Heidelberg (2006) 6. Fiala, J.: Locally Injective Homomorphisms. Doctoral Thesis, Charles University (2000) 7. Fiala, J., Kratochv´ıl, J.: Locally constrained graph homomorphisms - structure, complexity, and applications. Comput. Sci. Rev. 2, 97–111 (2008) 8. Fiala, J., Paulusma, D.: A complete complexity classification of the role assignment problem. Theoret. Comput. Sci. 349, 67–81 (2005) 9. Fiala, J., Paulusma, D., Telle, J.A.: Locally constrained graph homomorphism and equitable partitions. European J. Combin. 29, 850–880 (2008) 10. Garey, M.R., Johnson, D.R.: Computers and Intractability. Freeman, New York (1979) 11. Hell, P.: Graph Packings. Elec. Notes Discrete Math. 5, 170–173 (2000) 12. Hell, P., Kirkpatrick, D.G.: Scheduling, matching, and coloring. In: Alg. Methods in Graph Theory. Coll. Math. Soc. J. B´ olyai 25, 273–279 (1981) 13. Hell, P., Kirkpatrick, D.G.: On the complexity of general graph factor problems. SIAM J. Comput. 12, 601–609 (1983) 14. Hell, P., Kirkpatrick, D.G., Kratochv´ıl, J., Kˇr´ıˇz, I.: On restricted two-factors. SIAM J. Discrete Math. 1, 472–484 (1988) 15. Kratochv´ıl, J., Proskurowski, A., Telle, J.A.: Complexity of graph covering problem. Nordic. J. Comput. 5, 173–195 (1998) 16. Kratochv´ıl, J., Proskurowski, A., Telle, J.A.: Covering regular graphs. J. Combin. Theory Ser. B 71, 1–16 (1997) 17. Monnot, J., Toulouse, S.: The path partition problem and related problems in bipartite graphs. Oper. Res. Lett. 35, 677–684 (2007) 18. Plummer, M.D.: Graph factors and factorization: 1985-2003: A survey. Discrete Math. 307, 791–821 (2007)
Irredundant Set Faster Than O(2n ) Marek Cygan1 , Marcin Pilipczuk1 , and Jakub Onufry Wojtaszczyk2 1
Dept. of Mathematics, Computer Science and Mechanics, University of Warsaw, Poland 2 Institute of Mathematics, Polish Academy of Sciences {cygan,malcin,onufry}@mimuw.edu.pl
Abstract. In this paper we provide algorithms faster than O(2n ) for two variants of the I RREDUNDANT S ET problem. More precisely, we give: – a branch-and-reduce algorithm solving L ARGEST I RREDUNDANT S ET in O(1.9657n ) time and polynomial space; the time complexity can be reduced using memoization to O(1.8475n ) at the cost of using exponential space, – and a simple iterative-DFS algorithm for S MALLEST I NCLUSION -M AXIMAL I RREDUNDANT S ET that solves it in O(1.999956n ) time and polynomial space. Inside the second algorithm time complexity analysis we use a structural approach which allows us to break the O(2n ) barrier. We find this structural approach more interesting than the algorithm itself. Despite the fact that the discussed problems are quite similar to the D OMINATING S ET problem solving them faster than the obvious O(2n ) solution seemed harder; that is why they were posted as an open problems at the Dagstuhl seminar in 2008.
1 Introduction The field of exact exponential-time algorithms for NP-hard problems has attracted a lot of attention in recent years (see Woeginger’s survey [16]). Many difficult problems can be solved much faster than by the obvious brute-force algorithm; examples include I NDEPENDENT S ET [11], D OMINATING S ET [11,15] , C HROMATIC N UMBER [2] and BANDWIDTH [8,10]. A few powerful techniques have been developed, including Measure & Conquer [11] and inclusion/exclusion principle applications [2,3,13]. However, there is still a bunch of problems for which no faster solution than the obvious one is known. These include S UBGRAPH I SOMORPHISM and C HROMATIC I NDEX which are mentioned as open problems in [1,12]. In order to define irredundance problems let us introduce some basic notions. Let G = (V, E) be an undirected graph. Given F ⊂ E we write V (F ) to denote the set of all endpoints of the edges in F . Given W ⊂ V by G[W ] we denote the subgraph induced by W . We say a vertex v ∈ V dominates u ∈ V if u = v or uv ∈ E, i.e. a vertex dominates itself and all its neighbours. By N [v] = {v} ∪ {u : uv ∈ E} we denote the set of vertices dominated by v. We extend this notation to any subset
This work was partially supported by the Polish Ministry of Science grants N206 491038 and N206 491238.
T. Calamoneri and J. Diaz (Eds.): CIAC 2010, LNCS 6078, pp. 288–298, 2010. c Springer-Verlag Berlin Heidelberg 2010
Irredundant Set Faster Than O(2n )
289
W ⊂ V by putting N [W ] = v∈W N [v], we say that a set W dominates a vertex u if u ∈ N [W ]. The set N [W ] is called the closed neighbourhood of W . The D OMINATING S ET problem asks for the smallest set that dominates the whole V . We say a set S ⊂ V is irredundant if for any v ∈ S there exists a vertex u ∈ V such that v dominates u and S \ {v} does not dominate u. We call any such vertex u a private vertex for v. An irredundant set is called inclusion–maximal if it is not a proper subset of any other irredundant set. Note that an inclusion–maximal irredundant set does not necessarily have to dominate the whole vertex set of G as in Figure 1.
v2
v6
v7
v3
v4
v5
v1 Fig. 1. The smallest inclusion-maximal irredundant set X = {v3 , v4 }. Note that X is not a dominating set.
The irredundance numbers ir(G) and IR(G) are defined as the smallest and largest possible cardinality of an inclusion–maximal irredundant set. The problems S MALL EST I NCLUSION -M AXIMAL I RREDUNDANT S ET and L ARGEST I RREDUNDANT S ET ask for ir(G) and IR(G) respectively. Finding an algorithm faster than O(2n ) for D OMINATING S ET was an open problem until 2004. Currently the fastest algorithm is by van Rooij et al. and runs in O(1.5048n) time [15]. However, many other graph-dominating problems still lack faster solutions. The problems of solving S MALLEST I NCLUSION -M AXIMAL I RREDUNDANT S ET and L ARGEST I RREDUNDANT S ET faster than obvious O(2n ) algorithms were posted by van Rooij in 2008 [12]. In this paper we present algorithms providing answers to those problems. Downey et al. [9] have shown that the problem of finding an irredundant set of size k is W [1]-hard when parameterized by k and FPT with parameter n − k. However, Raman and Saurabh proved that this problem becomes FPT in graphs without small cycles [14]. It is worth noticing that irredundant sets attract some attention from the graph-theoretical point of view [7], i.e. the relation between ir(G), IR(G) and other graph parameters. Our results. In Section 2 we consider a simple iterative depth-first search algorithm that solves S MALLEST I NCLUSION -M AXIMAL I RREDUNDANT S ET and prove that it breaks slightly the O(2n ) barrier: we show that it works in O(1.999956n) time and polynomial space. This algorithm is based on a structural approach to the problem. We discuss possible applications of this approach in Section 4. In Section 3 we provide a branch-and-reduce algorithm that solves L ARGEST I R REDUNDANT S ET in O(1.9657n ) time and polynomial space. When we are allowed to use memoization (and thus exponential space) this algorithm runs in O(1.8475n ) time.
290
M. Cygan, M. Pilipczuk, and J.O. Wojtaszczyk
Recently it came to our attention that Brankovic et al. [6] were independently working on the irredundance problems and found algorithms computing L ARGEST I R REDUNDANT S ET and S MALLEST I NCLUSION -M AXIMAL I RREDUNDANT S ET in O(1.96n ) and O(1.99914n ) time respectively. However, their approach is significantly different than ours. They consider a problem of finding an inclusion–maximal irredundant set of size n−k, parameterized by k, from the point of view of parameterized complexity, and develop an algorithm working in ck nO(1) time for some constant c < 4. The algorithm is a branching one, with quite complex analysis involving Measure & Conquer techniques. It recursively constructs two sets: one, which becomes the irredundant set, and another, which becomes the set of private neighbours of vertices in the irredundant set. In the intermediate states of the algorithm, they may choose a vertex to the first set without choosing its private neighbour at this moment, as well as choose a vertex to the second set without indicating its owner immediately. This approach makes algorithm of Brankovic et al. significantly different than our branching algorithm described in Section 3. The second difference is that we may use memoization to improve the running time at the cost of exponential space complexity, whereas it seems hard to apply the same trick to the algorithm of Brankovic et al.
2
S MALLEST I NCLUSION -M AXIMAL I RREDUNDANT S ET
In this section we focus on solving S MALLEST I NCLUSION -M AXIMAL I RREDUNDANT S ET. We show a simple iterative-DFS algorithm that requires polynomial space and prove that it works in O(1.999956n) time. W.l.o.g. we may assume that G contains no isolated vertices, since they need to be included in any inclusion-maximal irredundant set. Let Fk be the family of irredundant sets in G of size not greater than k. Note that checking if a set is an (inclusion-maximal) irredundant set can be done in polynomial time. Moreover, the family of irredundant sets is closed under taking subsets. Therefore Fk can be enumerated in O∗ (|Fk |) time and polynomial space by a simple depth-first search algorithm1. The simple iterative-DFS algorithm enumerates Fk for k = 0, 1, 2, . . . , n until it finds an inclusion-maximal irredundant set. Now we prove that it works in O(1.999956n) time. First, as a warm-up, let us show a O∗ ((2 − εΔ )n ) time bound for graphs with maximum degree bounded by Δ, where εΔ depends on Δ. Construct a set A ⊂ V greedily: repeatedly add any vertex v ∈ V to A and remove from V all vertices distant by at most 2 from v. At each step, at most 1 + Δ + Δ(Δ − 1) = 1 + Δ2 vertices are removed, therefore |A| ≥ n/(1 + Δ2 ). The set A is an independent set; moreover, closed neighbourhoods {N [v] : v ∈ A} are disjoint. If S in an irredundant set, then S ∩ N [v] = N [v] and, therefore, for each v ∈ A we have at most 2|N [v]| − 1 possibilities to choose S ∩ N [v] instead of 2|N [v]| . As these neighbourhoods are disjoint, this leads to the following bound: Δ+1 n 2|N [v]| − 1 2 − 1 1+Δ2 n n ≤2 = (2 − εΔ )n , |Fn | ≤ 2 2Δ+1 2|N [v]| v∈A
and the time bound for the algorithm follows. 1
By O∗ we denote the standard big O notation where we suppress polynomially bounded terms.
Irredundant Set Faster Than O(2n )
N [D]
A1
291
A2
D
Fig. 2. Notation in the proof of Lemma 1
Now we show how to bypass the maximum degree assumption. Note that if an irredundant set is a dominating set, it is inclusion–maximal. Moreover an inclusion– minimal dominating set is an inclusion–maximal irredundant set. Assume that G admits a dominating set of size not greater than 149n/300. Then the algorithm n stops )= before or at the step k = 149n/300 and up to this point consumes O∗ ( 149n/300 n O(1.999956 ) time. Therefore we may consider only the case where every dominating set in G is of size greater than 149n/300. The following structural lemma is crucial for the analysis. Lemma 1. Let G = (V, E) be a graph with n vertices that contains no dominating set of cardinality smaller than 149n/300. Then there exists a set A ⊂ V satisfying: 1. A is an independent set and the neighbourhoods {N [v] : v ∈ A} are disjoint, 2. every vertex in A has degree at most 6, 3. |A| ≥ 41n/9800. Proof. We construct a dominating set D greedily. Start with D = ∅. In a single step, take any vertex v that adds at least 3 new vertices to N [D], i.e. |N [D∪{v}]\N [D]| ≥ 3, and add v to D. This algorithm stops at some point and let A1 = V \ N [D], i.e. the vertices not dominated by D. For every vertex v we have |N [v] ∩ A1 | ≤ 2, since D cannot be extended any more. In particular, every vertex in G[A1 ] has degree at most 1, so G[A1 ] is a graph of isolated vertices and isolated edges. Let A2 be any inclusion– maximal independent set in G[A1 ], i.e. A2 contains all isolated vertices of G[A1 ] and one endpoint of every isolated edge. The set A2 is an independent set in G, too. Let us now note that D ∪ A2 is a dominating set in G, since A2 dominates A1 . Therefore |D| + |A2 | ≥ 149n/300. Note that, by the construction procedure of D, we have |D| ≤ 13 |N [D]| = 13 |V \ A1 |, so: 149/300 ≤
1 |A1 | |A2 | 1 2 |A2 | |D| + |A2 | ≤ − + ≤ + · . |V | 3 3|V | |V | 3 3 |V |
Therefore |A2 | ≥ 49n/200.
292
M. Cygan, M. Pilipczuk, and J.O. Wojtaszczyk
Now recall that every vertex in V has at most two vertices from A1 in its closed neighbourhood. Therefore, every vertex in V has at most two neighbours in A2 . Let n7 be the number of vertices in A2 with degree at least 7. By counting edge endpoints we obtain that 7n7 ≤ 2(n − |A2 |) ≤ 151n/100 and n7 ≤ 151n/700. Let A3 ⊂ A2 be the set of vertices of degree at most 6. Then |A3 | ≥ 41n/1400. Now construct A ⊂ A3 greedily. In a single step, add any v ∈ A3 to A and remove from A3 the vertex v and all vertices that share a neighbour with v (recall that A3 is an independent set). Since the vertices in A3 have degree at most 6 and every vertex in V is a neighbour of at most two vertices in A3 , then at one step we remove at most 7 vertices from A3 . Therefore |A| ≥ 41n/9800.
The bound for our iterative-DFS algorithm is now straightforward. Note that for every non–isolated vertex v at least one point from N [v] does not belong to an irredundant set. By Lemma 1 we obtain 41n/9800 disjoint sets {N [v] : v ∈ A}, such that all these sets are of size at most 7 and no N [v] can be contained in an irredundant set. Therefore the total number of irredundant sets is bounded by: 2n ·
41n 27 − 1 9800
27
= O(1.99994n).
Both the algorithm and its time complexity are far from astonishing. However we find the structural approach interesting since it allowed us to bypass the maximum degree assumption. We discuss this issue in Section 4.
3
L ARGEST I RREDUNDANT S ET
In this section we show a branching algorithm to find the largest (in the cardinality sense) irredundant set. Notice that the largest irredundant set is necessarily inclusion– maximal. 3.1 Bipartite Induced Matching Reduction Let us construct a bipartite graph H = (W, F ), with W = V ∪ V (where V is a disjoint copy of V ) and edges {u, v } ∈ F iff {u, v} ∈ E or u = v. We call a set of edges M ⊂ F in this graph an induced matching if: – no two edges in M share an endpoint – the set W (M ) is an independent set in the graph (W, F \ M ), i.e. no edge connects endpoints of different edges from M . In other words, the graph induced by the set of endpoints of M is the matching M . Now we show a correspondence between largest irredundant sets in G and largest induced matching in H: Lemma 2. If M is an induced matching in H, then S := W (M ) ∩ V is an irredundant set in G. Conversely, if S is an irredundant set in G, then there exists an induced matching M ⊂ F such that S = W (M ) ∩ V . In both cases, the induced matching M and the irredundant set S are of the same cardinality.
Irredundant Set Faster Than O(2n )
293
Proof. Let T be an induced matching in H. If {u, v } ∈ M , then v is not a neighbour of any w ∈ W (M ) ∩ V other than u, thus v is a private vertex dominated by u in G. Conversely, if we have an irredundant set S in G then letting u(v) to be any private vertex dominated by v for v ∈ S we obtain an induced matching M := {{v, u (v)} : v ∈ S} in H.
Thus, to find the largest irredundant set in G it suffices to look for the largest induced matching in H. v1
v2
v3
v1
v2
v3
v4
v1
v2
v3
v4
v4
Fig. 3. From the irredundant set {v1 , v3 } to the induced matching {v1 v1 , v3 v4 }
A remark to make here is that the correspondence between induced matchings of H and irredundant sets of G does not preserve inclusion–maximality — e.g. in the graph in Figure 3 there are four inclusion–maximal irredundant sets ({v1 , v3 }, {v1 , v4 }, {v2 , v3 } and {v2 , v4 }), while in the corresponding bipartite graph the edge v2 v3 forms a singleton inclusion–maximal induced matching. This does no harm in the search for IR(G) (as the cardinality of the set is preserved), but prevents us from using this approach to determine ir(G). 3.2 Branch and Reduce Analysis Let α = 1.40202. We provide an algorithm for finding the largest induced matching in a bipartite graph H on n vertices with complexity O(αn ). As we reduced the problem of finding the largest irredundant set in a graph with n vertices to the problem of finding the largest induced matching in a bipartite graph with 2n vertices, our algorithm allows us to find the largest irredundant set in a graph on n vertices in O(α2n ) = O(1.9657n) time. The algorithm is a typical branch-and-reduce algorithm. We provide a set of reduction rules; in a single step the algorithm finds the first applicable rule and applies it. By T (n) we denote the bound on the number of steps that the algorithm requires for a graph with n vertices. For each rule, we provide a recursion inequality for T (n). Since the function T (n) = C · αn satisfies all inequalities for any C > 0, and every step takes polynomial time, the algorithm halts within the claimed time bound. We do simple reductions without any memoization, so the algorithm uses polynomial space. As a result of every reduction rule we work on an induced subgraph of the original graph — thus if we can spare more space, we can have a standard trade–off between space and computation time. We may, for instance, store answers for all considered induced subgraphs of our bipartite graph having up to 0.09188n vertices. As a result we compute the largest induced matching for each induced subgraph having up to 0.09188n vertices at most once. When we are to compute the answer for an already considered induced subgraph we look the answer up in a dictionary. From the
294
M. Cygan, M. Pilipczuk, and J.O. Wojtaszczyk
n Stirling approximation of the factorial we have O∗ ( cn ) = O∗ ((1/(cc (1 − c)1−c ))n ) n ∗ n thus O ( 0.09188n ) = O(1.3592 ). Such memoization reduces the time complexity to O(max(1.3592n, α(1−0.09188)n )) = O(1.3592n ) for finding the induced matching, and thus to O(1.35922n ) =O(1.8475n) for finding the largest irredundant set. Let H = (W, F ) be a bipartite graph on n vertices. We use the word choose (an edge) to mean “consider as a part of the induced matching being built in the considered subcase” and the word drop (a vertex) to mean “consider that this vertex is not the endpoint of any edge in the induced matching being built in the considered subset, so we can consider the graph without this vertex in this subcase”. 1. There is an isolated vertex v ∈ W . Obviously it cannot be an endpoint of an edge, so we drop it and solve the problem for (W \ {v}, F ). The recursion inequality for T (n) is T (n) ≥ T (n − 1), which holds trivially. 2. There is a vertex v of degree 1 in H, and its only neighbour is also of degree 1. These two vertices form an edge which is a part of any largest induced matching. Thus we choose it and solve the problem for the remaining graph on n − 2 vertices, obtaining the trivial inequality T (n) ≥ T (n − 2). 3. There is a vertex v of degree 1 in H. Let u be its sole neighbour, deg u ≥ 2. Consider any induced matching M which contains some edge ux for x = v. Then (M \ {ux}) ∪ {uv} is also an induced matching of the same cardinality. Thus we can branch out into two cases — either we drop u (and consequently drop v, as it becomes isolated), or we choose uv and drop all the neighbours of v (at least one of them). Here we obtain the inequality T (n) ≥ T (n − 2) + T (n − 3). 4. There is a vertex v of degree k := deg v ≥ 8. We branch out, and either drop this vertex and a obtain graph with n − 1 vertices, or choose one of the edges incident with v. If we choose an edge, we remove all the neighbours of v (k of them) and all the neighbours of the other endpoint (at least 2 of them — we already excluded vertices of degrees 0 and 1, and they do not coincide with the neighbours of v due to bipartiteness) from the graph. Thus we obtain the inequality T (n) ≥ T (n − 1) + k · T (n − k − 2) for
k ≥ 8.
Now we check if T (n) = Cαn satisfies this inequality for all k ≥ 8. However, note that α > k+1 k for k ≥ 8, so we only need to check the case k = 8, which holds by straightforward calculations. 5. There are two adjacent vertices u and v of degree 2 each. Let u1 be the other = v1 due to bipartiteness). neighbour of u and v1 be the other neighbour of v (u1 We claim that there exists a largest induced matching which contains one of the edges uu1 , uv or vv1 . Indeed, consider any induced matching M . Then: – if neither u1 nor v1 is an endpoint of an edge in M , we may add uv to M , preserving independence and increasing cardinality; – if, say, u1 is the endpoint of some edge u1 x, but none of the three aforementioned edges belong to M , we may remove u1 x from M and add u1 u instead, thus preserving cardinality and keeping independence.
Irredundant Set Faster Than O(2n )
295
Thus we consider three cases (each case consisting of choosing one of the three edges). In each case we remove the neighbours of two adjacent vertices, each of degree at least two, thus we remove at least 4 vertices in each case. We get the inequality T (n) ≥ 3T (n − 4). 6. There is a vertex v of degree 2. Let u and w be its two neighbours. Let du and dw be degrees of u and w respectively and let k be the number of common neighbours of u and w, excluding v. We have 3 ≤ du , dw < 8 and 0 ≤ k < du , dw . We branch into four cases. In the first, the edge uv is chosen, we drop the neighbours of u and v and obtain graph on n − du − 2 vertices. In the second, we choose the edge vw, and similarly obtain n − dw − 2 vertices. In the third, we drop the vertices u, v and w and solve the problem for the graph on n − 3 vertices. In the fourth we drop v and choose one of the edges incident with w and one of the edges incident with u. The case we have not considered is when there is an induced matching M , where exactly one of the points w, u, say w, is incident with an edge wx from M . In this case, however, we may remove wx from M , adding wv instead, preserving both cardinality and independence. Thus this case need not be considered. Now let us analyze the fourth branching option. If we choose edges uu and ww to the induced matching, neither u nor w is a common neighbour of u and w. Therefore we can choose u and w in (du − k − 1)(dw − k − 1) ways. Let us check how many vertices are removed in each choice. From one side of the bipartite graph we remove at least v and the du − 1 + dw − 1 − k vertices adjacent to either u or w. From the other we remove u, w and at least one neighbour of u (w and u may both have degree 2 and common neighbours, thus we cannot assume removing additionally a neighbour of w ). Thus we remove at least du + dw + 2 − k vertices in total and obtain the inequality T (n) ≥ T (n − du − 2) + T (n − dw − 2) + T (n − 3) + (du − k − 1)(dw − k − 1)T (n − du − dw − 2 + k). A direct check of all the possible values of du , dw and k proves the inequality for T (n) = Cαn . The case du = dw = 3, k = 0 is the only tight recurrence in the whole algorithm. 7. There are two adjacent vertices u and v, both of degree 3. This case is the most complicated and is considered separately in Section 3.3. 8. What remains is a case where there is a vertex v of degree 3 ≤ i < 8 and all its neighbours have degree at least 4. We branch, either dropping v or choosing one of the incident edges. If we choose edge vv , we remove at least i + 4 vertices, thus obtaining the inequality T (n) ≥ T (n − 1) + iT (n − i − 4). By a direct check the inequality holds for T (n) = Cαn for all valid values of i. 3.3 Two Adjacent Vertices of Degree 3 Recall the single case we have left to consider is when we have two adjacent vertices of degree 3 and all other vertices have degrees between 3 and 7. Let the two adjacent vertices be u and v, let u1 and u2 be the two other vertices adjacent to u and let v1 and v2 be the two other vertices adjacent to v. Again, we want to take advantage of the fact that searching for the largest induced matching we do not have to consider some of the combinations.
296
M. Cygan, M. Pilipczuk, and J.O. Wojtaszczyk (du − k − 1)
u
k
(dw − k − 1)
w
v Fig. 4. Notation in Case 6
Lemma 3. There exists a largest induced matching M in H for which either 1. one of the edges uv, uu1 , uu2 , vv1 , vv2 appears in M , or 2. both u1 and u2 are endpoints of edges in M , or 3. both v1 and v2 are endpoints of edges in M and u1 and u2 are not endpoints of edges in M . Proof. Take any largest induced matching M . If M satisfies the conditions above, there is nothing to prove. If exactly one of u1 , u2 is an endpoint of an edge in M (say u1 is an endpoint of u1 u1 ), we may remove u1 u1 from M and add uu1 instead. We do not lose independence (as neither v nor u2 was an endpoint of an edge), thus we received a new induced matching of the same cardinality and satisfying our conditions. We proceed similarly if u1 and u2 are not endpoints of any edge in M and only one of v1 , v2 is an endpoint of an edge in M . If none of u1 , u2 , v1 , v2 are endpoints of edges in M we may add uv to M , thus
contradicting the assumption M was a largest induced matching. Thus we branch using the options from Lemma 3. There are five branches in which we choose one of the five named edges. Each edge connects two vertices of degree at least three, so in each case we obtain graph with at most n − 6 vertices. Let i1 and i2 be the degrees of u1 and u2 respectively, and let j1 and j2 be the degrees of v1 and v2 in G[V \ {u1 , u2 }]. Note that the previous reduction rules ruled out the (i1 − ku − 1)
ku
(i2 − ku − 1) (j1 − kv − 1)
u1
kv
(j2 − kv − 1)
u2 u
v1
v2 v
Fig. 5. Notation in Case 7, i.e., in Section 3.3
Irredundant Set Faster Than O(2n )
297
vertices of degree at most 2 or at least 8, thus 3 ≤ i1 , i2 ≤ 7 and 1 ≤ j1 , j2 ≤ 7. Assume that u1 and u2 share ku neighbours, excluding u, and v1 and v2 share kv neighbours, excluding v, u1 and u2 . The next branch is when u1 and u2 are taken. As we take none of the named edges, we drop the vertex u and then take one of the remaining edges leaving u1 and one edge leaving u2 . We have i1 − 1 − ku ways to choose an edge leaving u1 and i2 − 1 − ku ways to choose one leaving u2 . Let us now count the number of vertices removed in such a branch. We remove u1 , u2 , u, (i1 − ku − 1) + (i2 − ku − 1) + ku neighbours of u1 and u2 , excluding u, and at least 2 neighbours of the other endpoints of the chosen edges. In total, we remove i1 + i2 − ku + 3 vertices. Note that we do not count v to be removed, as it might be one of these 2 neighbours of the other endpoints (one of the edges taken might be, e.g., u1 v1 ). The final branch is when we drop u1 , u2 , u and v and choose one edge leaving v1 and one edge leaving v2 . We have (j1 −1−kv )(j2 −1−kv ) ways to choose these edges. From one side of the bipartite graph, we remove u1 , u2 , v and (j1 −1−kv )+(j2 −1−kv )+kv neighbours of v1 and v2 , excluding v, u1 and u2 . From the other side, we remove u and at least 2 neighbours of the other endpoints of the chosen edges. In total, we remove j1 + j2 − kv + 6 vertices. Therefore, in this branching rule, we obtain the following inequality for T (n): T (n) ≥ 5T (n − 6) + (i1 − ku − 1)(i2 − ku − 1)T (n − i1 − i2 + ku − 3) + (j1 − kv − 1)(j2 − kv − 1)T (n − j1 − j2 + kv − 6). A direct check for all possible values of i1 , i2 , j1 , j2 , ku and kv (i.e., 3 ≤ i1 , i2 ≤ 7, 1 ≤ j1 , j2 ≤ 7, 0 ≤ ku ≤ min(i1 , i2 ) − 1, 0 ≤ kv ≤ min(j1 , j2 ) − 1) finishes the proof that T (n) = O(αn ).
4 Conclusions There is a large number of problems for which the fastest current known algorithm requires O∗ (2n ) time, including C HROMATIC N UMBER and TSP. This paper shows that the problems considered by us are somewhat easier and admit solutions faster than O∗ (2n ). However we would like to note that our techniques in Section 2 seem a bit similar to those that lead to O∗ ((2 − ε)n )-time algorithms for D OMATIC N UMBER [5] and TSP [4] in graphs of bounded degree. We think it is interesting and somewhat surprising that such techniques can be used in graphs without any degree assumption and hope that those techniques can lead to other O∗ ((2 − ε)n )-time algorithms.
References 1. Amini, O., Fomin, F.V., Saurabh, S.: Counting subgraphs via homomorphisms. In: Albers, S., Marchetti-Spaccamela, A., Matias, Y., Nikoletseas, S., Thomas, W. (eds.) ICALP 2009. LNCS, vol. 5555, pp. 71–82. Springer, Heidelberg (2009) 2. Bj¨orklund, A., Husfeldt, T.: Inclusion–exclusion algorithms for counting set partitions. In: Proc. FOCS 2006, pp. 575–582 (2006) 3. Andreas, B., Thore, H., Petteri, K., Mikko, K.: Fourier meets m¨obius: fast subset convolution. In: Proc. STOC 2007, San Diego, California, USA, pp. 67–74 (2007)
298
M. Cygan, M. Pilipczuk, and J.O. Wojtaszczyk
4. Bj¨orklund, A., Husfeldt, T., Kaski, P., Koivisto, M.: The travelling salesman problem in bounded degree graphs. In: Aceto, L., Damg˚ard, I., Goldberg, L.A., Halld´orsson, M.M., Ing´olfsd´ottir, A., Walukiewicz, I. (eds.) ICALP 2008, Part I. LNCS, vol. 5125, pp. 198–209. Springer, Heidelberg (2008) 5. Bj¨orklund, A., Husfeldt, T., Kaski, P., Koivisto, M.: Trimmed moebius inversion and graphs of bounded degree. In: STACS 2008, pp. 85–96 (2008) 6. Brankovic, L., Fernau, H., Kneis, J., Kratsch, D., Langer, A., Liedloff, M., Raible, D., Rossmanith, P.: Breaking the 2n -barrier for irredundance: A parameterized route to solving exact puzzles. CoRR abs/0909.4224 (2009) 7. Chartrand, G., Lesniak, L.: Graphs and Digraphs. CRC Press, Boca Raton (2004) 8. Cygan, M., Pilipczuk, M.: Faster exact bandwidth. In: Broersma, H., Erlebach, T., Friedetzky, T., Paulusma, D. (eds.) WG 2008. LNCS, vol. 5344, pp. 101–109. Springer, Heidelberg (2008) 9. Downey, R.G., Fellows, M.R., Raman, V.: The complexity of irredundant sets parameterized by size. Discrete Applied Mathematics 100(3), 155–167 (2000) 10. Feige, U.: Coping with the NP-hardness of the graph bandwidth problem. In: Halld´orsson, M.M. (ed.) SWAT 2000. LNCS, vol. 1851, pp. 10–19. Springer, Heidelberg (2000) 11. Fomin, F.V., Grandoni, F., Kratsch, D.: A measure & conquer approach for the analysis of exact algorithms. J. ACM 56(5), 1–32 (2009) 12. Fomin, F.V., Iwama, K., Kratsch, D.: Moderately exponential time algorithms, Dagstuhl seminar (2008) 13. Nederlof, J.: Fast polynomial-space algorithms using m¨obius inversion: Improving on steiner tree and related problems. In: Albers, S., Marchetti-Spaccamela, A., Matias, Y., Nikoletseas, S., Thomas, W. (eds.) ICALP 2009. LNCS, vol. 5556, pp. 713–725. Springer, Heidelberg (2009) 14. Raman, V., Saurabh, S.: Short cycles make W[1]-hard problems hard: FPT algorithms for W[1]-hard problems in graphs with no short cycles. Algorithmica 52(2), 203–225 (2008) 15. van Rooij, J.M.M., Nederlof, J., van Dijk, T.C.: Inclusion/exclusion meets measure and conquer: Exact algorithms for counting dominating sets. In: Fiat, A., Sanders, P. (eds.) ESA 2009. LNCS, vol. 5757, pp. 554–565. Springer, Heidelberg (2009) 16. Woeginger, G.J.: Exact algorithms for NP-hard problems: A survey. In: J¨unger, M., Reinelt, G., Rinaldi, G. (eds.) Combinatorial Optimization - Eureka, You Shrink! LNCS, vol. 2570, pp. 185–208. Springer, Heidelberg (2003)
The Complexity of Computing Minimal Unidirectional Covering Sets Dorothea Baumeister1 , Felix Brandt2 , Felix Fischer3 , Jan Hoffmann2 , and J¨ org Rothe1 1
Institut f¨ ur Informatik, Universit¨ at D¨ usseldorf, 40225 D¨ usseldorf, Germany Institut f¨ ur Informatik, Universit¨ at M¨ unchen, 80538 M¨ unchen, Germany Harvard School of Engineering and Applied Sciences, Cambridge, MA 02138, USA 2
3
Abstract. Given a binary dominance relation on a set of alternatives, a common thread in the social sciences is to identify subsets of alternatives that satisfy certain notions of stability. Examples can be found in areas as diverse as voting theory, game theory, and argumentation theory. Brandt and Fischer [1] proved that it is NP-hard to decide whether an alternative is contained in some inclusion-minimal unidirectional (i.e., either upward or downward) covering set. For both problems, we raise this lower bound to the Θ2p level of the polynomial hierarchy and provide a Σ2p upper bound. Relatedly, we show that a variety of other natural problems regarding minimal or minimum-size unidirectional covering sets are hard or complete for either of NP, coNP, and Θ2p . An important consequence of our results is that neither minimal upward nor minimal downward covering sets (even when guaranteed to exist) can be computed in polynomial time unless P = NP. This sharply contrasts with Brandt and Fischer’s result that minimal bidirectional covering sets are polynomial-time computable.
1
Introduction
A common thread in the social sciences is to identify sets of alternatives that satisfy certain notions of stability according to some binary dominance relation. Applications range from cooperative to noncooperative game theory, from social choice theory to argumentation theory, and from multi-criteria decision analysis to sports tournaments (see, e.g., [2,1] and the references therein). In social choice settings, the most common dominance relation is the pairwise majority relation, where an alternative x is said to dominate another alternative y if the number of individuals preferring x to y exceeds the number of individuals preferring y to x. McGarvey [3] proved that every asymmetric dominance relation can be realized via a particular preference profile, even if the individual preferences are linear. For example, Condorcet’s well-known paradox says that the majority relation may contain cycles and thus does not always have maximal elements, even if all of the underlying individual preferences do. This means that the concept of maximality is rendered useless in many cases, which is why various so-called solution concepts have been proposed. Solution concepts can be used in place of T. Calamoneri and J. Diaz (Eds.): CIAC 2010, LNCS 6078, pp. 299–310, 2010. c Springer-Verlag Berlin Heidelberg 2010
300
D. Baumeister et al.
maximality for nontransitive relations (see, e.g., [2]). In particular, concepts based on so-called covering relations—transitive subrelations of the dominance relation at hand—have turned out to be very attractive [4,5,6]. Computational social choice, an emerging new field at the interface of social choice theory, economics, and computer science, focuses on the computational properties of social-choice-related concepts and problems [7]. In this paper, we study the computational complexity of problems related to the notions of upward and downward covering sets in dominance graphs. An alternative x is said to upward cover another alternative y if x dominates y and every alternative dominating x also dominates y. The intuition is that x “strongly” dominates y in the sense that there is no alternative that dominates x but not y. Similarly, an alternative x is said to downward cover another alternative y if x dominates y and every alternative dominated by y is also dominated by x. The intuition here is that x “strongly” dominates y in the sense that there is no alternative dominated by y but not by x. A minimal upward or minimal downward covering set is defined as an inclusion-minimal set of alternatives that satisfies certain notions of internal and external stability with respect to the upward or downward covering relation [6,1]. Recent work in computational social choice has addressed the computational complexity of most solution concepts proposed in the context of binary dominance (see, e.g., [8,9,10,11,1,12]). Brandt and Fischer [1] have shown NP-hardness of deciding whether an alternative is contained in some minimal upward (or downward) covering set. For both problems, we raise their NP-hardness lower bounds to the Θ2p level of the polynomial hierarchy, and we provide an upper bound of Σ2p . We also analyze the complexity of a variety of other problems related to minimal and minimum-size upward and downward covering sets that have not been studied before. In particular, we provide hardness and completeness results for the complexity classes NP, coNP, and Θ2p . Remarkably, these new results imply that neither minimal upward covering sets nor minimal downward covering sets (even when guaranteed to exist) can be found in polynomial time unless P = NP. This sharply contrasts with Brandt and Fischer’s result that minimal bidirectional covering sets are polynomial-time computable [1]. Note that, notwithstanding the hardness of computing minimal upward covering sets, the decision version of this search problem is trivially in P: Every dominance graph always contains a minimal upward covering set. Our Θ2p -hardness results apply Wagner’s method [13]. To the best of our knowledge, our constructions for the first time apply his method to problems defined in terms of minimality rather than minimum size of a solution.
2
Definitions and Notation
We now define the necessary concepts from social choice and complexity theory. Let A be a finite set of alternatives, let B ⊆ A, and let ⊆ A×A be a dominance relation on A, i.e., is asymmetric and irreflexive (in general, need not
The Complexity of Computing Minimal Unidirectional Covering Sets
301
be transitive or complete).1 A dominance relation on a set A of alternatives can be conveniently represented as a dominance graph, denoted by (A, ), whose vertices are the alternatives from A, and for each x, y ∈ A there is a directed edge from x to y if and only if x y. For any two alternatives x and y in B, define the following covering relations (see, e.g., [4,5,14]): x upward covers y in B, denoted by x CuB y, if x y and for all z ∈ B, z x implies z y, and x downward covers y in B, denoted by x CdB y, if x y and for all z ∈ B, y z implies x z. When clear from the context, we omit mentioning “in B” explicitly. Definition 1. Let A be a set of alternatives, let B ⊆ A be any subset, and let be a dominance relation on A. The upward uncovered set of B is defined as UCu (B) = {x ∈ B | y CuB x for no y ∈ B}, whereas the downward uncovered set of B is defined as UCd (B) = {x ∈ B | y CdB x for no y ∈ B}. In the dominance graph (A, ) in Figure 1, b upward covers c in A, and a downward covers b in A (i.e., b CuA c and a CdA b), so U Cu (A) = {a, b, d} is the upward uncovered set and U Cd (A) = {a, c, d} is the downward uncovered set of A. For both the upward and the downward covering relation (henceforth unidirectional covering relations), transitivity of the relation implies nonemptiness of the corresponding uncovered set for each nonempty set of alternatives. The intuition underlying covering sets is that there should be no reason to restrict the selection by excluding some alternative from it (internal stability) and there should be an argument against each proposal to include an outside alternative into the selection (external stability). Definition 2. Let A be a set of alternatives and be a dominance relation on A. A subset B ⊆ A is an upward covering set of A if UCu (B) = B (internal stability) and for all x ∈ A − B, x ∈ UCu (B ∪ {x}) (external stability). Downward covering sets are defined analogously using UCd . An upward (or downward) covering set M is said to be (inclusion-)minimal if no M ⊂ M is an upward (or downward) covering set for A. Every upward uncovered set contains one or more minimal upward covering sets, whereas minimal downward covering sets do not always exist [1]. Dutta [6] proposed minimal covering sets in the context of tournaments, i.e., complete dominance relations, where both notions of covering coincide. Minimal unidirectional covering sets are one of several possible generalizations to incomplete dominance relations (see [1]). Occasionally, it might be helpful to specify the dominance relation explicitly to avoid ambiguity. In such cases we refer to the dominance graph and write, e.g., “M is an upward covering set for (A, ).” The unique minimal upward covering set for the dominance graph shown in Figure 1 is {b, d}, and the unique minimal downward covering set is {a, c, d}. One computational problem of central interest in this paper is Minimal Upward Covering Set Member (MCu -Member, for short): Given a set of alternatives A, a dominance relation on A, and a distinguished element d ∈ A, 1
For alternatives x and y, x y (alternatively, (x, y) ∈ ) is interpreted as x being strictly preferred to y (we say “x dominates y”), e.g., due to a strict majority of voters preferring x to y.
302
D. Baumeister et al. a
b
d
c
Fig. 1. Upward and downward covering relations in dominance graph (A, )
is d contained in some minimal upward covering set for A? Another important problem is the search problem MCu -Find: Given a set of alternatives A and a dominance relation on A, find a minimal upward covering set for A. The problems MCd -Member and MCd -Find are defined analogously for minimal downward covering sets. We assume that the reader is familiar with the basic notions of complexity theory, such as polynomial-time many-one reducibility and the related notions of hardness and completeness, and also with standard complexity classes such as P, NP, coNP, and the polynomial hierarchy (see, e.g., [15]). In particular, coNP is the class of sets whose complements are in NP. Σ2p = NPNP , the second level of the polynomial hierarchy, consists of all sets that can be solved by an NP oracle machine that has access (in the sense of a Turing reduction) to an NP oracle set such as SAT. SAT denotes the satisfiability problem of propositional logic, which is one of the standard NP-complete problems (see, e.g., Garey and Johnson [16]) and is defined as follows: Given a boolean formula in conjunctive normal form, does there exist a truth assignment to its variables that satisfies the formula? Papadimitriou and Zachos [17] introduced the class of problems solvable in polynomial time via asking O(log n) sequential Turing queries to NP. This class is also known as the Θ2p level of the polynomial hierarchy, and has been shown to coincide with the class of problems that can be decided by a P machine that accesses its NP oracle in a parallel manner. Equivalently, Θ2p is the closure of NP under polynomial-time truth-table reductions. It follows immediately from the definitions that P ⊆ NP ∩ coNP ⊆ NP ∪ coNP ⊆ Θ2p ⊆ Σ2p . The class Θ2p captures the complexity of various optimization problems [13]. In the field of computational social choice, the winner problems for Dodgson, Young, and Kemeny elections have been shown to be Θ2p -complete (see [18] and the references cited therein).
3
Results and Discussion
Results. Brandt and Fischer [1] proved that it is NP-hard to decide whether a given alternative is contained in some minimal unidirectional covering set. Using the notation of this paper, their results state that the problems MCu -Member and MCd -Member are NP-hard. The question of whether these problems are NP-complete or of higher complexity was left open. Our contribution is (i) to raise Brandt and Fischer’s NP-hardness lower bounds for MCu -Member and MCd -Member to Θ2p -hardness and to provide (simple) Σ2p upper bounds for these problems, and (ii) to extend the techniques we developed to also apply
The Complexity of Computing Minimal Unidirectional Covering Sets
303
to various other covering set problems that will be defined in Section 6 and in particular to the search problems. Due to space constraints we focus here on our results for MCu -Member and MCu -Find but we mention that we obtained many more results on upward and downward covering set problems (see Theorem 9 and Table 1 in Section 6) the proofs of which are provided in the full version of this paper [19]. Discussion. We consider the problem of finding a minimal unidirectional covering set (MCu -Find and MCd -Find) to be particularly important and natural. Regarding upward covering sets, we stress that our result that, assuming P = NP, MCu -Find is hard to compute (Theorem 8) does not follow directly from the NP-hardness of MCu -Member in an obvious way.2 Our reduction that raises the lower bound of MCu -Member from NP-hardness to Θ2p -hardness, however, allows us to prove that MCu -Find is not polynomial-time solvable unless P = NP. Regarding downward covering sets, the hardness of MCd -Find (assuming P = NP) is an immediate consequence of Brandt and Fischer’s result that it is NP-complete to decide whether there exists a minimal downward covering set [1, Thm. 9]. We provide an alternative proof based on our reduction showing that MCd -Member is Θ2p -hard [19, Thm. 5.13]. In contrast to Brandt and Fischer’s proof, our proof shows the hardness of MCd -Find even when the existence of a (minimal) downward covering set is guaranteed. As mentioned above, the problem MCu -Member was already known to be NP-hard [1] and is here shown to be even Θ2p -hard. One may naturally wonder whether raising its (or any problem’s) lower bound from NP-hardness to Θ2p hardness gives us any more insight into the problem’s inherent computational complexity. After all, P = NP if and only if P = Θ2p . However, this question is a bit more subtle than that and has been discussed carefully by Hemaspaandra et al. [20]. They make the case that the answer to this question crucially depends on what one considers to be the most natural computational model. In particular, they argue that raising NP-hardness to Θ2p -hardness potentially (i.e., unless longstanding open problems regarding the separation of the corresponding complexity classes could be solved) is an improvement in terms of randomized polynomial time and in terms of unambiguous polynomial time [20].
4
Upward Covering Constructions and Their Properties
In this section, we provide the constructions and their key properties to be used in Sections 5 and 6 to prove lower bounds for problems such as MCu -Member. 2
The decision version of MCu -Find is: Given a dominance graph, does it contain a minimal upward covering set? However, this question has always an affirmative answer, so this problem is trivially in P. Note also that MCu -Find is no harder (with respect to “polynomial-time disjunctive truth-table” reductions) than the search version of MCu -Member. The converse, however, is not at all obvious. Brandt and Fischer’s results only imply the hardness of finding an alternative that is contained in all minimal upward covering sets [1].
304
D. Baumeister et al.
Construction 1. Given a boolean formula in conjunctive normal form, ϕ(w1 , w2 , . . . , wk ) = f1 ∧ f2 ∧ · · · ∧ f , over the set W = {w1 , w2 , . . . , wk } of variables, we construct a set of alternatives A = {ui , ui , ui , ui | wi ∈ W } ∪ {ej , ej | fj is a clause in ϕ} ∪ {a1 , a2 , a3 }, and a dominance relation on A that is defined by: (i) for each i, 1 ≤ i ≤ k, there is a cycle ui ui ui ui ui ; (ii) if variable wi occurs in clause fj as a positive literal, then ui ej , ui ej , ej ui , and ej ui ; (iii) if variable wi occurs in clause fj as a negative literal, then ui ej , ui ej , ej ui , and ej ui ; (iv) if variable wi does not occur in clause fj , then ej ui and ej ui ; (v) for each j, 1 ≤ j ≤ , we have a1 ej and a1 ej ; and (vi) there is a cycle a1 a2 a3 a1 . Figures 2(a)–2(c) show some parts of the dominance graph that results from the given formula ϕ. As a more complete example, Figure 2(d) shows the entire dominance graph that corresponds to the concrete formula (¬w1 ∨ w2 ) ∧ (w1 ∨ ¬w3 ), which can be satisfied by setting, for example, each of w1 , w2 , and w3 to true. A minimal upward covering set for A corresponding to this assignment is ej
ej
ej
ej
ej
ej
ui
ui
ui
ui
ui
ui
ui
ui
ui
ui
ui
ui
(a) wi occurs in fj as a positive literal
(b) wi occurs in fj as a negative literal a2
(c) wi does not occur in fj
a3 a1 e1
e1
u1
u1
u2
u2
u3
u3
u1
u1
u2
u2
u3
u3
e2
e2
(d) Example for the formula (¬w1 ∨ w2 ) ∧ (w1 ∨ ¬w3 ) Fig. 2. Dominance graph from Construction 1
The Complexity of Computing Minimal Unidirectional Covering Sets
305
M = {u1 , u1 , u2 , u2 , u3 , u3 , a1 , a2 , a3 }. Note that neither e1 nor e2 occurs in M , and none of them occurs in any other minimal upward covering set for A either. For alternative e1 in the example shown in Figure 2(d) this can be seen as follows. If there were a minimal upward covering set M for A containing e1 (and thus also e1 , since they both are dominated by the same alternatives) then neither u1 nor u2 (which dominate e1 ) must upward cover e1 in M , so all alternatives corresponding to the variables w1 and w2 (i.e., {ui , ui , ui , ui | i ∈ {1, 2}}) would also have to be contained in M . Due to e1 u3 and e1 u3 , all alternatives corresponding to w3 (i.e., {u3 , u3 , u3 , u3 }) are in M as well. Consequently, e2 and e2 are no longer upward covered and must also be in M . The alternatives a1 , a2 , and a3 are contained in every minimal upward covering set for A. But then M is not minimal because the upward covering set M , which corresponds to the satisfying assignment stated above, is a strict subset of M . Hence, e1 cannot be contained in any minimal upward covering set for A. We now list some properties of the dominance graph created by Construction 1 in general. The first property, stated in Claim 2(1), has already been seen in the example above. All proofs omitted due to space constraints are given in the full version of this paper [19]. Claim 2. Let (A, ) be the dominance graph created from ϕ by Construction 1. 1. Fix any j, 1 ≤ j ≤ . For each minimal upward covering set M for A, if the alternative ej is in M then all alternatives are in M (i.e., A = M ). 2. ϕ is satisfiable if and only if there is no minimal upward covering set for A that contains any of the ej , 1 ≤ j ≤ . Construction 1 and Claim 2(2) already prove MCu -Member coNP-hard, via a reduction from the complement of SAT. Building on this reduction and that of Brandt and Fischer [1] to show MCu -Member NP-hard, we raise the lower bound to Θ2p -hardness. Wagner provided a sufficient condition for proving Θ2p hardness that was useful also in other contexts (e.g., [21]): Lemma 3 (Wagner [13]). Let S be some NP-complete problem and let T be any set. If there is a polynomial-time computable function f such that, for all m ≥ 1 and all strings x1 , x2 , . . . , x2m satisfying that if xj ∈ S then xj−1 ∈ S (1 < j ≤ 2m), {i | xi ∈ S} is odd if and only if f (x1 , x2 , . . . , x2m ) ∈ T , then T is Θ2p -hard. One subtlety in our construction is due to the fact that we consider not only minimum-size but also (inclusion-)minimal covering sets. To the best of our knowledge, our constructions for the first time apply Wagner’s technique [13] to problems defined in terms of minimality/maximality rather than minimum/maximum size of a solution: In Construction 4 below, we define a dominance graph based on Construction 1 and the construction from Brandt and Fischer [1] (which is also presented in the proof sketch of Thm. 4.1 [19]) such that Lemma 3 can be applied to prove Θ2p -hardness of MCu -Member (see Theorem 6).
306
D. Baumeister et al.
Construction 4. We apply Wagner’s Lemma with the NP-complete problem S = SAT and construct a dominance graph. Fix an arbitrary m ≥ 1 and let ϕ1 , ϕ2 , . . . , ϕ2m be 2m boolean formulas in conjunctive normal form such that if ϕj is satisfiable then so is ϕj−1 , for each j, 1 < j ≤ 2m. Without loss of generality, we assume that for each j, 1 ≤ j ≤ 2m, the first variable of ϕj does not occur in all clauses of ϕj . It is easy to see that if ϕj does not have this property, it can be transformed into a formula that does have it, without affecting the satisfiability of the formula. We will now define a polynomial-time computable function f , which maps the given 2m boolean formulas to a dominance graph (A, ) with useful 2m properties for upward covering sets. Define A = j=1 Aj and the domi 2m m nance relation on A by ∪ j=1 j ∪ i=1 (u1,2i , d2i−1 ), (u1,2i , d2i−1 ) m ( i=2 {(d2i−1 , z) | z ∈ A2i−2 }), where we use the following notation: 1. For each i, 1 ≤ i ≤ m, let (A2i−1 , 2i−1 ) be the dominance graph that results from the formula ϕ2i−1 according to Brandt and Fischer’s construction [1]. We use the same names for the alternatives in A2i−1 as in the proof sketch of [19, Thm. 4.1] that presents their construction, except that we attach the subscript 2i − 1. For example, alternative d from the proof sketch of [19, Thm. 4.1] now becomes d2i−1 , x1 becomes x1,2i−1 , y1 becomes y1,2i−1 , etc. 2. For each i, 1 ≤ i ≤ m, let (A2i , 2i ) be the dominance graph that results from the formula ϕ2i according to Construction 1. We use the same names for the alternatives in A2i as in that construction, except that we attach the subscript 2i. For example, alternative a1 from Construction 1 now becomes a1,2i , e1 becomes e1,2i , u1 becomes u1,2i , and so on. 3. For each i, 1 ≤ i ≤ m, connect the dominance graphs (A2i−1 , 2i−1 ) and (A2i , 2i ) as follows. Let u1,2i , u1,2i , u1,2i , u1,2i ∈ A2i be the four alternatives in the cycle corresponding to the first variable of ϕ2i . Then both u1,2i and u1,2i dominate d2i−1 . The resulting dominance graph is denoted by (Bi , B i ). B 4. Connect the m dominance graphs (Bi , i ), 1 ≤ i ≤ m, as follows: For each i, 2 ≤ i ≤ m, d2i−1 dominates all alternatives in A2i−2 .
d1
u1,2
d3
u1,4
u1,2
A1
A2
...
d2m-1
u1,4
A3
A4
u1,2m u1,2m
A2m−1
A2m
Fig. 3. Dominance graph from Construction 4. Most alternatives, and all edges between pairs of alternatives, in Aj for 1 ≤ j ≤ 2m have been omitted. All edges between = j are shown. An edge incident to a set alternatives in Ai and alternatives in Aj for i of alternatives represents an edge incident to each alternative in the set.
The Complexity of Computing Minimal Unidirectional Covering Sets
307
Figure 3 sketches the dominance graph (A, ) created by Construction 4. Clearly, (A, ) is computable in polynomial time. Before we use this construction to prove MCu -Member Θ2p -hard, we again list the key properties of this construction. Note that the first item of Claim 5 considers, for any fixed i with 1 ≤ i ≤ m, the dominance graph (Bi , B i ) resulting from the formulas ϕ2i−1 and ϕ2i in Step 3 of Construction 4. Doing so will simplify our arguments for the whole dominance graph (A, ) in the second and third item of Claim 5. Claim 5. Consider Construction 4. 1. For each i, 1 ≤ i ≤ m, alternative d2i−1 is contained in some minimal upward covering set for (Bi , B i ) if and only if ϕ2i−1 is satisfiable and ϕ2i is not. 2. For each i, 1 ≤ i ≤ m, let Mi be the minimal upward covering set for (Bi , B i ) according to the cases in the proof of the first item. Then each of the sets Mi must be contained in every minimal upward covering set for (A, ). 3. It holds that {i | ϕi ∈ SAT} is odd if and only if d1 is contained in some minimal upward covering set M for A.
5
Complexity of MCu -Member and MCu -Find
We now apply the constructions from Section 4 to show that MCu -Member is Θ2p -hard and that MCu -Find cannot be solved in polynomial time unless P = NP. Theorem 6. MCu -Member is hard for Θ2p and in Σ2p . Our main goal is to determine the complexity of finding minimal unidirectional covering sets. As mentioned in the discussion in Section 3, the hardness of MCu -Find does not follow directly from the NP-hardness of MCu -Member, and neither from its Θ2p -hardness (Theorem 6). However, Construction 1 has another important property, stated in Claim 7, that can be applied to show coNP-hardness of the problem MCu -Unique: Given a set A of alternatives and a dominance relation on A, does there exist a unique minimal upward covering set for A? And this property can be used to establish the hardness of the search problem MCu -Find. Claim 7. Consider Construction 1. The boolean formula ϕ is not satisfiable if and only if there is a unique minimal upward covering set for A. Theorem 8. If P = NP then minimal upward covering sets cannot be found in polynomial time, i.e., MCu -Find is not polynomial-time solvable unless P = NP. Proof. Consider the problem of deciding whether there exists a nontrivial minimal upward covering set, i.e., one that does not contain all alternatives. By Construction 1 and Claim 7, there exists a trivial minimal upward covering set for A (i.e., one containing all alternatives in A) if and only if this set is the
308
D. Baumeister et al.
only minimal upward covering set for A. Thus, the coNP-hardness proof for MCu -Unique that is based on Claim 7 immediately implies that the problem of deciding whether there is a nontrivial minimal upward covering set for A is NP-hard. However, since the latter problem can easily be reduced to the search problem (because the search problem, when used as a function oracle, will yield the set of all alternatives if and only if this set is the only minimal upward covering set for A), it follows that the search problem cannot be solved in polynomial time unless P = NP.
6
Generalizations
In addition to the (inclusion-)minimal unidirectional covering sets considered by Brandt and Fischer [1], we also consider minimum-size covering sets, i.e., unidirectional covering sets of smallest cardinality. For some of the computational problems we study, different complexities can be shown for the minimal and minimum-size versions of the problem (see Theorem 9 and Table 1). Specifically, we consider six types of computational problems, for both upward and downward covering sets, and for each both their “minimal” (prefixed by MCu or MCd ) and “minimum-size” versions (prefixed by MSCu or MSCd ). In addition to MCu -Member and MCu -Find (which were defined in Section 2) and to MCu -Unique (which was defined in Section 5) we now define three more problem types: 1. MCu -Size: Given a set A of alternatives, a dominance relation on A, and a positive integer k, does there exist some minimal upward covering set for A containing at most k alternatives? 2. MCu -Member-All: Given a set A of alternatives, a dominance relation on A, and a distinguished element d ∈ A, is d contained in all minimal upward covering sets for A? 3. MCu -Test: Given a set A of alternatives, a dominance relation on A, and a subset M ⊆ A, is M a minimal upward covering set for A? Theorem 9. The complexity of the covering set problems defined in this paper is as shown in Table 1. Table 1. Overview of complexity results for various covering set problems. As indicated, previously known results are due to Brandt and Fischer [1]; all other results are new to this paper. Problem Type Size Member Member-All Unique Test Find
MCu
MSCu
MCd
MSCd
NP-complete Θ2p -hard, in Σ2p coNP-complete [1] coNP-hard, in Σ2p coNP-complete not in polynomial time unless P = NP
NP-complete Θ2p -complete Θ2p -complete coNP-hard, in Θ2p coNP-complete not in polynomial time unless P = NP
NP-complete Θ2p -hard, in Σ2p coNP-complete [1] coNP-hard, in Σ2p coNP-complete not in polynomial time unless P = NP (follows from [1])
NP-complete coNP-hard, in Θ2p coNP-hard, in Θ2p coNP-hard, in Θ2p coNP-complete not in polynomial time unless P = NP
The Complexity of Computing Minimal Unidirectional Covering Sets
309
Acknowledgements. This work was supported in part by DFG grants BR2312/3-2, BR-2312/6-1, RO-1202/11-1, RO-1202/12-1, the ESF EUROCORES program LogICCC, and the Humboldt Foundation’s TransCoop program.
References 1. Brandt, F., Fischer, F.: Computing the minimal covering set. Mathematical Social Sciences 56(2), 254–268 (2008) 2. Laslier, J.: Tournament Solutions and Majority Voting. Springer, Heidelberg (1997) 3. McGarvey, D.: A theorem on the construction of voting paradoxes. Econometrica 21(4), 608–610 (1953) 4. Fishburn, P.: Condorcet social choice functions. SIAM Journal on Applied Mathematics 33(3), 469–489 (1977) 5. Miller, N.: A new solution set for tournaments and majority voting: Further graphtheoretical approaches to the theory of voting. American Journal of Political Science 24(1), 68–96 (1980) 6. Dutta, B.: Covering sets and a new Condorcet choice correspondence. Journal of Economic Theory 44, 63–80 (1988) 7. Chevaleyre, Y., Endriss, U., Lang, J., Maudet, N.: A short introduction to computational social choice. In: van Leeuwen, J., Italiano, G.F., van der Hoek, W., Meinel, C., Sack, H., Pl´ aˇsil, F. (eds.) SOFSEM 2007. LNCS, vol. 4362, pp. 51–69. Springer, Heidelberg (2007) 8. Woeginger, G.: Banks winners in tournaments are difficult to recognize. Social Choice and Welfare 20, 523–528 (2003) 9. Alon, N.: Ranking tournaments. SIAM Journal on Discrete Mathematics 20(1), 137–142 (2006) 10. Conitzer, V.: Computing Slater rankings using similarities among candidates. In: Proceedings of the 21st National Conference on Artificial Intelligence, pp. 613–619. AAAI Press, Menlo Park (2006) 11. Brandt, F., Fischer, F., Harrenstein, P.: The computational complexity of choice sets. Mathematical Logic Quarterly 55(4), 444–459 (2009) 12. Brandt, F., Fischer, F., Harrenstein, P., Mair, M.: A computational analysis of the tournament equilibrium set. Social Choice and Welfare (Forthcoming) 13. Wagner, K.: More complicated questions about maxima and minima, and some closures of NP. Theoretical Computer Science 51, 53–80 (1987) 14. Bordes, G.: On the possibility of reasonable consistent majoritarian choice: Some positive results. Journal of Economic Theory 31, 122–132 (1983) 15. Papadimitriou, C.: Computational Complexity. Addison-Wesley, Reading (1994) 16. Garey, M., Johnson, D.: Computers and Intractability: A Guide to the Theory of NP-Completeness. W. H. Freeman and Company, New York (1979) 17. Papadimitriou, C., Zachos, S.: Two remarks on the power of counting. In: Cremers, A.B., Kriegel, H.-P. (eds.) GI-TCS 1983. LNCS, vol. 145, pp. 269–276. Springer, Heidelberg (1982) 18. Faliszewski, P., Hemaspaandra, E., Hemaspaandra, L., Rothe, J.: A richer understanding of the complexity of election systems. In: Ravi, S., Shukla, S. (eds.) Fundamental Problems in Computing: Essays in Honor of Professor Daniel J. Rosenkrantz, pp. 375–406. Springer, Heidelberg (2009)
310
D. Baumeister et al.
19. Baumeister, D., Brandt, F., Fischer, F., Hoffmann, J., Rothe, J.: The complexity of computing minimal unidirectional covering sets. Technical Report arXiv:0901.3692v3 [cs.CC], ACM Computing Research Repository, CoRR (2009) 20. Hemaspaandra, E., Hemaspaandra, L., Rothe, J.: Raising NP lower bounds to parallel NP lower bounds. SIGACT News 28(2), 2–13 (1997) 21. Hemaspaandra, E., Hemaspaandra, L., Rothe, J.: Exact analysis of Dodgson elections: Lewis Carroll’s 1876 voting system is complete for parallel access to NP. Journal of the ACM 44(6), 806–825 (1997)
A Parameterized Route to Exact Puzzles: Breaking the 2n -Barrier for Irredundance (Extended Abstract) Daniel Binkele-Raible1 , Ljiljana Brankovic2, , Henning Fernau1 , Joachim Kneis3, , Dieter Kratsch4 , Alexander Langer3, , Mathieu Liedloff 5 , and Peter Rossmanith3, 1
2
Universit¨ at Trier, FB 4—Abteilung Informatik, D-54286 Trier, Germany {fernau,raible}@uni-trier.de The University of Newcastle, University Drive, NSW 2308 Callaghan, Australia
[email protected] 3 Department of Computer Science, RWTH Aachen University, Germany {kneis,langer,rossmani}@cs.rwth-aachen.de 4 Laboratoire d’Informatique Th´eorique et Appliqu´ee, Universit´e Paul Verlaine - Metz, 57045 Metz Cedex 01, France
[email protected] 5 Laboratoire d’Informatique Fondamentale d’Orl´eans, Universit´e d’Orl´eans, 45067 Orl´eans Cedex 2, France
[email protected]
Abstract. The lower and the upper irredundance numbers of a graph G, denoted ir(G) and IR(G) respectively, are conceptually linked to domination and independence numbers and have numerous relations to other graph parameters. It is a long-standing open question whether determining these numbers for a graph G on n vertices admits exact algorithms running in time less than the trivial Ω(2n ) enumeration barrier. We solve this open problem by devising parameterized algorithms for the duals of the natural parameterizations of the problems with running times faster than O∗ (4k ). For example, we present an algorithm running in time O∗ (3.069k ) for determining whether IR(G) is at least n − k. Although the corresponding problem has been shown to be in FPT by kernelization techniques, this paper offers the first parameterized algorithms with an exponential dependency on the parameter in the running time. Furthermore, these seem to be the first examples of a parameterized approach leading to a solution to a problem in exponential time algorithmics where the natural interpretation as exact exponential-time algorithms fails.
1
Introduction
A set I ⊆ V is called an irredundant set of a graph G = (V, E) if each v ∈ I is either isolated in G[I], the subgraph induced by I, or there is at least one
Supported by the RGC CEF grant G0189479 of The University of Newcastle. Supported by the DFG under grant RO 927/7.
T. Calamoneri and J. Diaz (Eds.): CIAC 2010, LNCS 6078, pp. 311–322, 2010. c Springer-Verlag Berlin Heidelberg 2010
312
D. Binkele-Raible et al.
vertex u ∈ V \ I with N (u) ∩ I = {v}, called a private neighbor of v. An irredundant set I is maximal if no proper superset of I is an irredundant set. The lower irredundance number ir(G) equals the minimum cardinality taken over all maximal irredundant sets of G; similarly, the upper irredundance number IR(G) equals the maximum cardinality taken over all such sets. In graph theory, the irredundance numbers have been extensively studied due to their relation to numerous other graph parameters. An estimated 100 research papers [1] have been published on the properties of irredundant sets in graphs, e.g., [2,3,4,5,6,7,8]. For example, a set is minimal dominating if and only if it is irredundant and dominating [9]. Since each independent set is also an irredundant set, the well-known domination chain ir(G) ≤ γ(G) ≤ α(G) ≤ IR(G) is a simple observation. Here, as usual, γ(G) denotes the size of a minimum dominating set, and α(G) denotes the size of a maximum independent set in G. It is also known that γ(G)/2 < ir(G) ≤ γ(G) ≤ 2 · ir(G) − 1, see [10]. There are also some applications of irredundant sets in combinatorial optimization, e.g., locating senders in broadcast and packet radio networks [11]. Determining the irredundance numbers is NP-hard even for bipartite graphs [5]. The fastest currently known exact algorithm is the simple O∗ (2n ) brute-force approach enumerating all subsets.1 So it is tempting to study these problems from a parameterized complexity viewpoint (for an introduction, see, e.g., [12]). It has been known for a while (see, e.g., [13]) that it is possible to break the so-called 2n -barrier for (some) vertex-selection problems by designing parameterized algorithms that run in time O∗ (ck ) for some c < 4 by a “win-win” approach: either the parameter is “small” (k < n/2 + for an appropriate > 0) and we use the n parameterized algorithm, or we enumerate all n/2− < 2n subsets. Unfortunately, the problem of finding an irredundant set of size k is W [1]complete when parameterized in k as shown by Downey et al. [14]. However, they also proved that the parameterized dual, where the parameter is k := 2 n − k, admits a problem kernel of size 3k and is therefore in FPT (but the running time has a superexponential dependency on the parameter). Therefore in this paper we study the parameterized problems (following the notation of [14]) Co-Maximum Irredundant Set (Co-MaxIR) and Co-Minimum Maximal Irredundant Set (Co-MinMaxIR), which given a graph G = (V, E) and a positive integer parameter k are to decide whether, respectively, IR(G) ≥ n − k and ir(G) ≤ n − k. We also consider the variant exact Co-Minimum Maximal Irredundant Set (exact Co-MinMaxIR), which given a graph G = (V, E) and positive integer parameter k, asks to decide whether ir(G) = n − k. Our contribution. First, we present linear problem kernels with 2k −1 vertices for the Co-MinMaxIR problem and 3k vertices for Co-MaxIR, which already shows that both problems can be solved with a running time of O∗ (ck ), c ≤ 8. In particular, this improves the kernel with 3k 2 vertices and the corresponding 2 running time of O∗ (8k ) of [14]. Secondly, we present a simple algorithm with a running time of O∗ (3.841k ) which solves both Co-MaxIR and exact Co-MinMaxIR simultaneously. The price we pay for this generality is that the 1
The O∗ -notation hides polynomial factors, e.g., f (n, k) · poly(n, k)) = O∗ (f (n, k)).
A Parameterized Route to Exact Puzzles
313
running time is only slightly better than O∗ (4k ), since we cannot exploit any special properties of Co-MaxIR that do not hold for exact Co-MinMaxIR and vice versa. Thirdly, we present a modification of the above algorithm, which trades the generality for improved running time and solves Co-MaxIR in time O∗ (3.069k ). Although all the algorithms are surprisingly simple, a major effort is required to prove their running time using a non-standard measure and a Measure & Conquer (M&C) approach. While nowadays M&C is a standard technique for the analysis of moderately exponential time algorithms (see, e.g., [15]), it is still seldom used in parameterized algorithmics. Finally, as a direct consequence, we obtain algorithms that compute the irredundance numbers in time O∗ (1.99914n) and even O∗ (1.9601n) in case of Co-MaxIR. These are the first exact exponential time algorithms breaking the trivial 2n enumeration barrier for computing the irredundance numbers on arbitrary graphs with n vertices, a well-known open question (see, e.g., [16]). Recently, this has independently been achieved by a group consisting of M. Cygan, M. Pilipczuk and J. O. Wojtaszczyk [17]. Due to space limits, some proofs are omitted in this extended abstract.
2
Preliminaries and Linear Kernels
The following alternative definition of irredundance is more descriptive and eases understanding the results in this paper: The vertices in an irredundant set can be thought of as kings, where each such king ought to have his very own private garden that no other king can see (where “seeing” means adjacency). Each king has exactly one cultivated garden, and all additional private gardens degenerate to wilderness. It is also possible that the garden is already built into the king’s own castle. One can easily verify that this alternate definition is equivalent to the formal one given above. Definition 1. Let G = (V, E) be a graph and I ⊆ V an irredundant set. We call the vertices in I kings. Private neighbors are called gardens, and all remaining vertices are wilderness. If a king has more than one private neighbor, we fix one of these vertices as a unique garden and the other vertices as wilderness. If a vertex v ∈ I has no neighbors in I, we (w.l.o.g.) say v has an internal garden, otherwise the garden is external. We denote the corresponding sets as K, G, W (K and G are not necessarily disjoint). Kings with external gardens are denoted by Ke and kings with internal garden by Ki . Similarly, the set of external gardens is Ge := G \ K. In what follows these sets are also referred to as labels. Our first theorem makes use of the inequality ir(G) ≤ γ(G) ≤ n/2 in graphs without isolated vertices for Co-MinMaxIR, and of crown reductions [18,19] for Co-MaxIR. This already shows that Co-MinMaxIR and Co-MaxIR allow fixed-parameter tractable algorithms with a running time exponential in k, a new contribution. In contrast, computing IR(G) is W[1]-complete [14]. Theorem 1. The Co-MinMaxIR problem admits a kernel with at most 2k − 1 vertices. Co-MaxIR admits a kernel with at most 3k vertices.
314
3
D. Binkele-Raible et al.
A Simple Algorithm for Computing the Irredundance Numbers
Our algorithm for the irredundance numbers recursively branches on the vertices of the graph and assigns each vertex one of the four possible labels Ki , Ke , Ge , W, until a labeling that forms a solution has been found (if one exists). If I is an irredundant set of size at least n − k, then is is easy to see that |Ke | = |K \ G| ≤ k and |G \K|+|W| ≤ k, which indicates a first termination condition. Furthermore, one can easily observe that for any irredundant set I ⊆ V the following simple properties hold for all v ∈ V : (1) if |N (v) ∩ K| ≥ 2 then v ∈ K ∪ W; (2) if |N (v) ∩ G| ≥ 2 then v ∈ G ∪ W; (3) if |N (v) ∩ K| ≥ 2 and |N (v) ∩ G| ≥ 2 then v ∈ W. Additionally, for all v ∈ Ki , we have N (v) ⊆ W. This gives us a couple of conditions the labeling has to satisfy in order to yield an irredundant set: each external garden is connected to exactly one external king and vice versa. Once the algorithm constructs a labeling that cannot yield an irredundant set anymore the current branch can be terminated. Definition 2. Let G = (V, E) be a graph and let Ki , Ke , Ge , W ⊆ V be a labeling of V . Let V = V \ (Ki ∪ Ke ∪ Ge ∪ W). We call (Ki , Ke , Ge , W) valid if the following conditions hold, and invalid otherwise. 1. Ki , Ke , Ge , W are pairwise disjoint, 4. for all v ∈ Ke , |N (v) ∩ Ge | ≤ 1, 5. for all v ∈ Ge , N (v) ∩ (Ke ∪ V ) = ∅, 2. for all v ∈ Ki , N (v) ⊆ W, 3. for all v ∈ Ke , N (v) ∩ (Ge ∪ V ) = ∅, 6. for all v ∈ Ge , |N (v) ∩ Ke | ≤ 1. As a direct consequence, we can define a set of vertices that can no longer become external gardens or kings without invalidating the current labeling: NotG := { v ∈ V | the labeling (Ki , Ke , Ge ∪ {v}, W) is invalid } NotK := { v ∈ V | the labeling (Ki , Ke ∪ {v}, Ge , W) is invalid } It is easy to see that NotG and NotK can be computed in polynomial time, and since vertices in NotG ∩ NotK can only be wilderness, we can also assume that NotG ∩ NotK = ∅ once the following reduction rules have been applied. Let G = (V, E) be a graph and let Ki , Ke , Ge , W ⊆ V be a valid labeling of V . Let V = V \ (Ki ∪ Ke ∪ Ge ∪ W). We define the following reduction rules, to be applied in this order, one at a time: R1 If there is some v ∈ W, remove all edges incident to v. R2 If there is some v ∈ V with deg(v) = 0, then set Ki = Ki ∪ {v}. R3 If there is v ∈ Ke with N (v) ∩ Ge = ∅ and N (v) ∩ V = {w}, then set Ge := Ge ∪ {w}. If there is v ∈ Ge with N (v) ∩ Ke = ∅ and N (v) ∩ V = {w}, then set Ke := Ke ∪ {w}. R4 For every v ∈ NotG ∩ NotK set W := W ∪ {v}. A graph and a labeling of its vertices as above is called reduced if no further reduction rules can be applied. Since the algorithm uses exhaustive branching, we easily obtain:
A Parameterized Route to Exact Puzzles
315
Algorithm 1. A fast yet simple algorithm for Co-MaxIR Algorithm CO-IR(G, k, Ke , Ki , Ge , W): Input: Graph G = (V, E), k ∈ N, labels Ke , Ki , Ge , W ⊆ V 01: 02: 03: 04: 05: 06: 07: 08: 09: 10:
Compute the sets NotG, NotK. Apply the reduction rules exhaustively, updating NotG and NotK. if the current labeling is invalid then return NO. if ϕ(k, Ke , Ge , W) < 0 then return NO. if |Ke | + |W| = k or |Ge | + |W| = k or all vertices are labeled then return whether V \ (W ∪ Ge ) is a solution. if NotG = ∅ (or analogously, NotK = ∅) then choose v ∈ NotG; return CO-IR(G, k, Ke ∪ {v}, Ki , Ge , W) or CO-IR(G, k, Ke , Ki , Ge , W ∪ {v}) Choose (in this preferred order) unlabeled v ∈ V of degree one, of maximum = ∅ or any unlabeled v with maximum degree. degree with N (v) ∩ (Ge ∪ Ke ) 11: return CO-IR(G, k, Ke , Ki , Ge , W ∪ {v}) or CO-IR(G, k, Ke , Ki ∪ {v}, Ge , W ∪ N (v)) or ∃u ∈ N (v) \ (Ke ∪ Ki ∪ W) : CO-IR(G, k, Ke ∪ {v}, Ki , Ge ∪ {u}, W) or ∃u ∈ N (v) \ (Ge ∪ Ki ∪ W) : CO-IR(G, k, Ke ∪ {u}, Ki , Ge ∪ {v}, W)
Lemma 1. Algorithm 1 correctly solves Co-MaxIR (when initially called with empty labels). Algorithm 1 can be also used, with slight modifications, to answer the question if a graph G has a minimum inclusion-maximal co-irredundant set of size exactly k (Exact Co-MinMaxIR). Namely, if the potential dropped to zero, then either the current labeling corresponds to a valid co-irredundant set of size k that is inclusion-maximal or not; this has to be tested in addition. Let T (k, Ke , Ge , W) be the number of recursive calls that reach Line 5 where none of the (possibly zero) following recursive calls (in Lines 9 and 11) reach this line. Since all recursive calls only require polynomial time, the running time of Algorithm 1 is bounded by O∗ (T (k, Ke , Ge , W)). Let our measure be: ϕ(k, Ke , Ge , W) = k − |W| − 0.5|Ke | − 0.5|Ge | Lemma 2. T (k, Ke , Ge , W) ≤ αϕ(k,Ke ,Ge ,W) with α ≤ 3.841. Theorem 2. Co-MaxIR and Exact Co-MinMaxIR can be solved in time O∗ (3.841k ). Consequently, the irredundance numbers of a graph G with n vertices can be computed in time O∗ (1.99914n).
4
Measure and Conquer Tailored to the Problems
In this section, we tailor the general Algorithm 2 to the needs of the Co-MaxIR problem. To this end, we use a more precise annotation of vertices: In the course of the algorithm, they will be either unlabeled U, kings with internal gardens
316
D. Binkele-Raible et al.
Ki , kings with external gardens Ke , (external) gardens Ge , wilderness W, not being kings NotK, or not being gardens NotG. We furthermore partition the set of vertices V into active vertices Va = U ∪ NotG ∪ NotK ∪ { v ∈ Ke | N (v) ∩ Ge = ∅ } ∪ { v ∈ Ge | N (v) ∩ Ke = ∅ } that have to be reconsidered, and inactive vertices Vi = V \ Va . Now, a labeling is called complete if Va = ∅. This means that the inactive vertices are either from W, Ki or paired-up external kings and gardens. Define Ke a = Ke ∩ Va and Ke i = Ke ∩ Vi (and analogously Ge a , Ge i ). We use a new measure ϕ(k, Ki , Ke , Ge , NotG, NotK, W, Va ) = k − |W| − |Gei | − ω (|Ke a | + |Ge a |) − ωn (|NotG| + |NotK|), where NotG and NotK are taken into account. We will later determine the weights ω and ωn to optimize the analysis, where 0 ≤ ωn ≤ 0.5 ≤ ω ≤ 1 and ωn + ω ≤ 1. We will describe in words how the measure changes in each case. Let us first present the reduction rules that we employ in Table 1. They shall be applied in the given order, one at a time. Note that the reduction rules are sound and do not increase the measure. Lemma 3. In a reduced instance, a vertex v ∈ NotK ∪ NotG has at most one neighbor u ∈ Ge ∪ Ke ; more precisely, if such u exists, then u ∈ Ge if and only if v ∈ NotG and deg(v) ≥ 2 (Thus, v must have a neighbor z that is not in Ge ∪ Ke ). Proof. Consider, w.l.o.g., v ∈ NotG. Assume that u ∈ N (v) ∩ (Ge ∪ Ke ) exists. Note that the alternative u ∈ Ke is resolved by Reduction Rule 7. Hence, u ∈ Ge . If v had no other neighbor but u, then Reduction Rule 12 would have triggered. So, deg(v) ≥ 2. Let z ∈ N (v) \ {u}. If the claim were false, then z ∈ Ge ∪ Ke . The case z ∈ Ke is ruled out by Reduction Rule 7. The case z ∈ Ge is dealt with
by Reduction Rule 13. Hence, z ∈ / Ge ∪ Ke . Now consider Algorithm 2. Lemma 4. In each labeled graph which is input of a recursive call of CO-IR there are no two neighbors u, v such that u ∈ Ke a and v ∈ Ge a . Lemma 5. Whenever our algorithm encounters a reduced instance, a vertex v ∈ Ge obeys N (v) ⊆ U ∪NotG. Symmetrically, if v ∈ Ke , then N (v) ⊆ U ∪NotK. Although we are looking for a maximal irredundant set, we can likewise look for L L a complete labeling L = (Ki L , Ge L i , Ke i , W ) that partitions the whole vertex L L L L set V = Ki Ge i Ke i W into internal kings, external kings and gardens, L as well as wilderness. Having determined L, IL = Ke L should be an i Ki irredundant set, and conversely, to a given irredundant set I, one can compute in polynomial time a corresponding complete labeling. However, during the course of the algorithm, we deal with (incomplete) labelings L = (Ki , Ge , Ke , NotG, NotK, W, Va ), a tuple of subsets of V that also serve as input to our algorithm, preserving the invariant that V = Ki Ge Ke NotG NotK W U. A complete labeling corresponds to a labeling with NotG = NotK = U = Va = ∅.
A Parameterized Route to Exact Puzzles
317
Table 1. Extensive list of reduction rules 1. If V contains a vertex x ∈ Ki and a neighbor u ∈ Ge ∪ Ke ∪ Ki , then return NO. 2. If V contains a vertex x with two neighbors u, v where x ∈ Ke and u, v ∈ Ge , then return NO. Exchanging the roles of kings and gardens, we obtain a symmetric rule. 3. If V contains an isolated vertex v ∈ (Ge ∪ Ke ), then return NO. 4. If V contains an isolated vertex v ∈ (NotK ∪ NotG), then put v into W, decreasing the measure by 1 − ωn . 5. If V contains an isolated vertex u ∈ U, then put u into Ki and set Va = Va \ {u}. 6. Delete an edge between two external kings or two external gardens. 7. Delete an edge between a Ke - and a NotG-vertex. Exchanging the roles of kings and gardens, we obtain a symmetric rule. 8. Remove any edges incident to vertices in W. 9. a) Delete an edge between two NotK-vertices. b) Delete an edge between two NotG-vertices. 10. If u ∈ U such that N (u) = {v} for some v ∈ U, then put u into Ki and set Va = Va \ {u}. 11. If u ∈ Ki , then put its neighbors N (u) into W and set Va = Va \ N (u); this decreases the measure by |N (u)|. 12. If V contains two neighbors u, v such that u ∈ Gea and v ∈ U ∪ NotG with either deg(u) = 1 or deg(v) = 1, then put v into Ke , and render both, u and v inactive; this decreases the measure by 1 − ω if v ∈ U and otherwise by 1 − ω − ωn . Exchanging the roles of kings and gardens, we obtain a symmetric rule. 13. If V contains a vertex v with two neighboring gardens such that v ∈ U, then set v ∈ NotK; if v ∈ NotG, then set v ∈ W. This decreases the measure by ωn or by (1 − ωn ), respectively. Exchanging the roles of kings and gardens, we obtain a symmetric rule. 14. Assume that V contains two inactive neighbors u, v where u ∈ Ke and v ∈ Ge , then put all x ∈ (N (u) ∩ U) into NotG, all x ∈ (N (u) ∩ NotK) into W, all x ∈ (N (v) ∩ U) into NotK and all x ∈ (N (v)∩NotG) into W. The measure decrease for each vertex x is ωn if x ∈ ((N (u)∪N (v))∩U) and 1−ωn if x ∈ (N (u)∩NotK)∪(N (v)∩NotK).
Since (NotK ∪ NotG) ⊆ Va , we have obtained a complete labeling once we leave our algorithm in Line 4, returning YES. We say that a labeling L = (Ki , Ge , Ke , NotG , NotK , W , Va ) extends the labeling L = (Ki , Ge , Ke , NotG, NotK, W, Va ) if Ki ⊆ Ki , Ge ⊆ Ge , Ke ⊆ Ke , NotG ⊆ W ∪ Ke ∪ NotG , NotK ⊆ W ∪ Ge ∪ NotK , W ⊆ W , Va ⊆ Va . We also write L ≺G L if L extends L. Notice that reduction rules and recursive calls only extend labelings (further). Notice that ≺G is a partial order on the set of labelings of a graph G = (V, E). The maximal elements in this order are precisely the complete labelings. Hence, the labeling LI corresponding to a maximal irredundant set I is maximal, with ϕ(k, LI ) ≤ 0 iff |I| ≥ |V | − k. Conversely, given a graph G = (V, E), the labeling LG = (∅, ∅, ∅, ∅, ∅, ∅, V ) is the smallest element of ≺G ; this is also the initial labeling that we start off with when first calling Algorithm 2. If L, L are labelings corresponding to the parameter lists of nodes n, n in the search tree such that n is ancestor of n in the search tree, then L ≺G L . The basic strategy of Algorithm 2 is to exhaustively consider all complete labelings (only neglecting
318
D. Binkele-Raible et al.
Algorithm 2. A faster algorithm for Co-MaxIR Algorithm CO-IR(G, k, Ki , Ke , Ge , NotG, NotK, W, Va ): Input: Graph G = (V, E), k ∈ N, labels Ki , Ke , Ge , NotG, NotK, W, Va ⊆ V 01: 02: 03: 04: 05: 06: 07: 08: 09: 10: 11: 12: 13: 14: 15: 16:
Consecutively apply the procedure CO-IR to components containing Va -vertices. Apply all the reduction rules exhaustively. if ϕ(k, Ki , Ke , Ge , W, NotG, NotK, Va ) < 0 then return NO. if Va = ∅ then return YES. if maxdegree(G[Va ]) ≤ 2 then solve by dynamic programming [20]. if NotG = ∅ (and analogously, NotK = ∅) then choose v ∈ NotG; if ∃z ∈ N (v) ∩ Ge then I := {v, z} else I := ∅. return CO-IR(G, k, Ki , Ke ∪ {v}, Ge , NotG \ {v}, NotK, W, Va \ I) or CO-IR(G, k, Ki , Ke , Ge , NotG \ {v}, NotK, W ∪ {v}, Va \ {v}); if there is an unlabeled v ∈ V with exactly two neighbors u, w in G[Va ], where u ∈ Gea and w ∈ Kea then return CO-IR(G, k, Ki , Ke ∪ {v}, Ge , NotG, NotK, W, Va \ {v, u}) or CO-IR(G, k, Ki , Ke , Ge ∪ {v}, NotG, NotK, W, Va \ {v, w}); = ∅ then if Kea ∪ Gea Choose some v ∈ Kea ∪ Gea of maximum degree. if v ∈ Kea (and analogously, v ∈ Gea ) then return whether ∃u ∈ N (v) : CO-IR(G, k, Ki , Ke , Ge ∪ {u}, NotG, NotK, W, Va \ {u, v}) Choose v ∈ U of maximum degree, preferring v with some u ∈ N (v) of degree two. return CO-IR(G, k, Ki , Ke , Ge , NotG, NotK, W ∪ {v}, Va \ {v}) or CO-IR(G, k, Ki ∪ {v}, Ke , Ge , NotG, NotK, W, Va \ {v}) or ∃u ∈ N (v) such that CO-IR(G, k, Ki , Ke ∪ {v}, Ge ∪ {u}, NotG, NotK, W, Va \ {u, v}) or ∃u ∈ N (v) such that CO-IR(G, k, Ki , Ke ∪ {u}, Ge ∪ {v}, NotG, NotK, W, Va \ {u, v})
cases that cannot be optimal). This way, also all important maximal irredundant sets are considered. Lemma 6. If ϕ(k, Ki , Ke , Ge , W, NotG, NotK, Va ) < 0, then for weights 0 ≤ ωn ≤ 0.5 ≤ ω ≤ 1 with ωn + ω ≤ 1, for any complete labeling L = (Ki L , Ge L i , L L Ke L i , W ) extending Λ := (Ki , Ke , Ge , NotG, NotK, W, Va ) we have ϕ(k, Ki , L L L Ge i , Ke i , ∅, ∅, W , ∅) < 0. Proof. We give a table for every possible label transition from Λ to its extension L. Note that Algorithm CO-IR only computes such solutions. All entries except two cause a non-increase of ϕ. The entries number 1 and 3 expose an increase in ϕ. By the problem definition, there exists a bijection f : Ke L → Ge L . So for a vertex v in Ke L i ∩Ke a we must have f (v) ∈ U ∪NotK. By Lemma 4 f (v) ∈ Gea . Taking now into account the label transition of f (v) which must be of the form U → Ge L i
1 2 3 4 5 6 7 8 9 10
Kea → Ke L i Gea → Ge L i NotG → Ke L i NotG → W L NotK → Ge L i NotK → W L U → WL U → Ki L U → Ke L i U → Ge L i
−ωl 1 − ωl −ωn 1 − ωn 1 − ωn 1 − ωn 1 0 0 1
A Parameterized Route to Exact Puzzles
319
or NotK → Ge L i , we see that a total decrease with respect to v and f (v) of at least 1 − ωn − ωl ≥ 0 can be claimed. If v ∈ NotG ∩ Ke L i then by arguing analogously we get a total decrease of at least 1 − ωn − ωl ≥ 0.
Lemma 7. Assume that there is an unlabeled vertex v, which has exactly two neighbors vG ∈ Ge and vK ∈ Ke . In the corresponding branching process, we may then omit the case v ∈ W. Proof. We are looking for an inclusion-maximal irredundant set. Hence, only the positions of the kings matter, not the positions of the gardens. So, in particular we cannot insist on the garden of vK being placed on some neighbor u of vK different from v. In this sense, any solution that uses v as wilderness can be transformed into a no worse solution with v ∈ Ge : Simply pair up v and vK , turning the hitherto garden of vK into wilderness. So, no optimum solution is lost by omitting the case v ∈ W in the branching.
Lemma 8. Algorithm 2 correctly solves Co-MaxIR. Proof. The algorithm correctly answers NO in line 3 by Lemma 6. If Va = ∅ in line 4 we can deduce k ≥ |W| + |Ge i |. Thus, we can correctly answer YES. The recursive calls in lines 8, 14 and 16 are all exhaustive branchings and therefore no optimum solution is neglected. In the call in line 10 we do not consider the possibility of setting v ∈ W which is justified by Lemma 7.
Theorem 3. Co-MaxIR can be solved in time O∗ (3.069k ), and consequently in time O∗ (1.9601n). Proof. The correctness of the algorithm has been reasoned above already (in particular, Lemma 6 concerning the correctness of the abort condition). For the running time, we now provide a partial analysis leading to recurrences that estimate an upper bound on the search tree size Tϕ (μ, h), where μ denotes the measure and h the height of the search tree. The claimed running time would then formally follow by an induction over h. 1. Assume that the algorithm branches on some vertex v ∈ NotG, the case v ∈ NotK being completely analogous. By reduction rules, N (v) ⊆ U ∪ Ge a ∪ NotK. a) If N (v) ⊆ U ∪ NotK, we derive the following branch in the worst case: Tϕ (μ, h) ≤ Tϕ (μ − (1 − ωn ), h − 1) + Tϕ (μ − (ω − ωn ), h − 1). This follows from a simple branching analysis considering the cases that v becomes wilderness or that v becomes a king. See also Table 2 where the entries (1a)#1 and (1a)#2 correspond to the reduction of the first and second branch. = ∅ and let u ∈ N (v) ∩ Ge a . Lemma 3 ensures b) Assume now that N (v) ∩ Ge a that there can be at most one element in N (v) ∩ Ge and that d(v) ≥ 2. Due to Reduction Rule 12, deg(u) ≥ 2. First assume that deg(u) = 2, i.e., N (u) = {v, x}. Then, we arrive at the following recursion: Tϕ (μ, h) ≤ Tϕ (μ − (2 − ω − ωn ), h − 1) + Tϕ (μ − (1 − ω + ωn ), h−1), see entries (1bi)#1 and (1bi)#2 of Table 2. This is seen as follows. By setting v ∈ W, due to Reduction Rule 8, u will be of degree one and hence will
320
D. Binkele-Raible et al.
Table 2. Overview over the potential gained in different branchings; symmetric branches due to exchanging roles of kings and gardens are not displayed. Neither are possibly better branches listed. Weight Case (1a)#1 (1a)#2 (1bi)#1 (1bi)#2 (1bii)#1 (1bii)#2 (2a)#1 (2a)#2 (2b)#1 (2b)#2 (2c)#1 (2c)#2 (3)#j (4a)#1 (4a)#2 (4a)#j (4a)#j (4b)#1 (4b)#2 (4b)#j (4b)#j
1 W v v v
N (w) N (v) v N (v)
ω ω ωn ωn Kea Gea NotG NotK −v v −v u −u −v u −u −v, +z x −v u −u −v, +z {x1 , x2 } vG −vG N (vG ) \ Ge v −vK N (vK ) \ Ke {vG , x} −vK −vG N (vG ) \ {v} −x∈N (vK )\{v} {v, vG } −vK −vG −x∈N (vG )\{v} N (vK )\{v} {vG , x} −vK −vG N (vG ) \ {v} −x∈N (vK )\{v} v −vK N (vK ) \ Ke v −v N (u) \ {v} N (v) \ {u} 1 Gei
u v
N (v) \ {u} N (u) \ {v}
N (u) \ {v} N (v) \ {u}
u v
N (v) \ {u} N (u) \ {v}
N (u) \ {v} N (v) \ {u}
potent. diff. ≥ 1 − ωn ω − ωn 2 − ωn − ω 1 + ωn − ω 1 − ωn 1 + 2ωn − ω 1 − ω + 2ωn 1 − ω + 2ωn 2 − 2ω + ωn 2 − 2ω + ωn 2 − 2ω + ωn 1 − ω + ωn 1 − ω + deg(v)ωn 2 deg(v) 1 + deg(v)ωn 1 + deg(v)ωn 1 deg(v) 1+(deg(v)+1)ωn 1+(deg(v)+1)ωn
be paired with its neighbor x due to Reduction Rule 12. If x ∈ U, the measure decreases by 2 − ωl − ωn . If x ∈ NotG, it decreases by 2 − ωl − 2ωn . But then by Lemma 3 there is y ∈ N (x) \ {u} such that y ∈ NotK ∪ U. Then by Reduction Rule 12 y is moved to W ∪ NotG giving some additional amount of at least ωn . Note that y = v as v ∈ NotG. If we set v ∈ Ke , then u and v will be paired by Reduction Rule 14. Thereafter, the other neighbor x of u will become a member of NotG or of W, depending on its previous status. Moreover, there must be a further neighbor z ∈ U ∪ NotK of v (by Lemma 3 and the fact that u is the unique Ge a neighbor) that will become member of NotG or W. This yields the claimed measure change if z = x. If z = x, then z is in U and the vertex will be put into W. Thus, the recursively considered instance has complexity Tϕ (μ−(2−ω −ωn ), h−1) ≤ Tϕ (μ−(1−ω +ωn ), h−1). Secondly, assume that deg(u) ≥ 3 (keeping the previous scenario otherwise). This yields the following worst-case branch: Tϕ (μ, h) ≤ Tϕ (μ − (1 − ωn), h − 1) + Tϕ (μ − (1 − ω + 2ωn ), h − 1), see entries (1bii)#1 and (1bii)#2 of Table 2. This is seen by a similar (even simpler) analysis. Note that all z ∈ N (v) ∩ N (u) ⊆ U get labeled W in the second branch.
A Parameterized Route to Exact Puzzles
321
We will henceforth not present the recurrences for the search tree size in this explicit form, but rather point to Table 2 that contains the same information. There, cases are differentiated by writing Bj for the jth branch. = ∅. 2. Assume that all active vertices are in U ∪ Ge ∪ Ke , with Ge a ∪ Ke a Then, the algorithm would pair up some v ∈ Ge a ∪ Ke a . Assume that there is an unlabeled vertex v that has exactly two neighbors vG ∈ Ge and vK ∈ Ke . Observe that we may skip the possibility that v ∈ W due to Lemma 7. Due to space constraints, we omit further details. For the resulting branching vectors, please see Table 2. 3. Assume that all active vertices are in U ∪ Ge ∪ Ke , with Ge a ∪ Ke a = ∅. Then, the algorithm tries to pair up some v ∈ Gea ∪ Kea of maximum degree. There are deg(v) branches for the cases labeled (3)#j. Since the two possibilities arising from v ∈ Ge a ∪ Ke a are completely symmetric, we focus on v ∈ Ge a . First note that by Lemma 5 and the fact that NotG ∪ NotK = ∅ we have N (v) ⊆ U. Exactly one neighbor u of v ∈ Ge a will be paired with v in each step, i.e., we set u ∈ Ke . Pairing the king on u with the garden from v will inactivate both u and v. Then, reduction rules will label all other neighbors of v with NotK (they can no longer be kings), and symmetrically all other neighbors of u with = ∅, since otherwise a previous branching NotG. Note that N (u) \ (Ke ∪ {v}) case or Reduction Rules 13 or 12 would have triggered. Thus, there must be some q ∈ N (u) ∩ U. From q, we obtain at least a measure decrease of ωn , even if q ∈ N (v). This results in a set of recursions depending on the degree of v as given in Table 2. 4. Finally, assume Va = U. Since an instance consisting of paths and cycles can be easily seen to be optimally solvable in polynomial time, we can assume that we can always find a vertex v of degree at least three to branch at. There are two cases to be considered: (a) either v has a neighbor w of degree two or (b) this is not the case. Details of the analysis are contained in Table 2. Finally, to show the claimed parameterized running time, we set ω = 0.7455 and ωn = 0.2455 in the recurrences. If the measure drops below zero, then we argue that we can safely answer NO, see Lemma 6. The exponential running time is a straightforward consequence using the aforementioned “win-win” approach.
5
Conclusions
We presented a parameterized route to the solution of yet unsolved questions in exact algorithms. More specifically, we obtained algorithms for computing the irredundance numbers running in time less than O∗ (2n ) by devising appropriate parameterized algorithms (where the parameterization is via a bound k on the co-irredundant set) running in time less than O∗ (4k ). It would be interesting to see this approach used for other problems, as well. Some of the vertex partitioning parameters discussed in [21] seem to be appropriate. We believe that the M&C approach could also be useful to find better algorithms for computing the lower irredundance number.
322
D. Binkele-Raible et al.
References 1. Favaron, O., Haynes, T.W., Hedetniemi, S.T., Henning, M.A., Knisley, D.J.: Total irredundance in graphs. Discrete Mathematics 256(1-2), 115–127 (2002) 2. Allan, R.B., Laskar, R.: On domination and independent domination numbers of a graph. Discrete Mathematics 23(2), 73–76 (1978) 3. Favaron, O.: Two relations between the parameters of independence and irredundance. Discrete Mathematics 70(1), 17–20 (1988) 4. Fellows, M.R., Fricke, G., Hedetniemi, S.T., Jacobs, D.P.: The private neighbor cube. SIAM J. Discrete Math. 7(1), 41–47 (1994) 5. Hedetniemi, S.T., Laskar, R., Pfaff, J.: Irredundance in graphs: a survey. Congr. Numer. 48, 183–193 (1985) 6. Bollob´ as, B., Cockayne, E.J.: Graph-theoretic parameters concerning domination, independence, and irredundance. J. Graph Theory 3, 241–250 (1979) 7. Cockayne, E.J., Grobler, P.J.P., Hedetniemi, S.T., McRae, A.A.: What makes an irredundant set maximal? J. Combin. Math. Combin. Comput. 25, 213–224 (1997) 8. Chang, M.S., Nagavamsi, P., Rangan, C.P.: Weighted irredundance of interval graphs. Information Processing Letters 66, 65–70 (1998) 9. Cockayne, E.J., Hedetniemi, S.T., Miller, D.J.: Properties of hereditary hypergraphs and middle graphs. Canad. Math. Bull. 21(4), 461–468 (1978) 10. Haynes, T.W., Hedetniemi, S.T., Slater, P.J.: Fundamentals of Domination in Graphs. In: Monographs and Textbooks in Pure and Applied Mathematics, vol. 208. Marcel Dekker, New York (1998) 11. Colbourn, C.J., Proskurowski, A.: Concurrent transmissions in broadcast networks. In: Paredaens, J. (ed.) ICALP 1984. LNCS, vol. 172, pp. 128–136. Springer, Heidelberg (1984) 12. Downey, R.G., Fellows, M.R.: Parameterized Complexity. Springer, Heidelberg (1999) 13. Raman, V., Saurabh, S.: Parameterized algorithms for feedback set problems and their duals in tournaments. Theoretical Computer Science 351(3), 446–458 (2006) 14. Downey, R.G., Fellows, M.R., Raman, V.: The complexity of irredundant sets parameterized by size. Discrete Applied Mathematics 100, 155–167 (2000) 15. Fomin, F.V., Grandoni, F., Kratsch, D.: A measure & conquer approach for the analysis of exact algorithms. Journal of the ACM 56(5) (2009) 16. Fomin, F.V., Iwama, K., Kratsch, D., Kaski, P., Koivisto, M., Kowalik, L., Okamoto, Y., van Rooij, J., Williams, R.: 08431 Open problems – Moderately exponential time algorithms. In: Moderately Exponential Time Algorithms. Dagstuhl Seminar Proceedings, vol. 08431 (2008) 17. Cygan, M., Pilipczuk, M., Wojtaszczyk, J.O.: Irredundant set faster than O(2n ). In: These proceedings 18. Chor, B., Fellows, M., Juedes, D.: Linear kernels in linear time, or how to save k colors in O(n2 ) steps. In: Hromkoviˇc, J., Nagl, M., Westfechtel, B. (eds.) WG 2004. LNCS, vol. 3353, pp. 257–269. Springer, Heidelberg (2004) 19. Fellows, M.R.: Blow-ups, win/win’s, and crown rules: Some new directions in FPT. In: Bodlaender, H.L. (ed.) WG 2003. LNCS, vol. 2880, pp. 1–12. Springer, Heidelberg (2003) 20. Telle, J.A.: Complexity of domination-type problems in graphs. Nordic. J. of Comp. 1, 157–171 (1994) 21. Telle, J.A.: Vertex Partitioning Problems: Characterization, Complexity and Algorithms on Partial k-Trees. PhD thesis, Department of Computer Science, University of Oregon, USA (1994)
Finding the Maximum Suffix with Fewer Comparisons Gianni Franceschini1 and Torben Hagerup2 1 2
Dipartimento di Informatica, Universit` a “La Sapienza” di Roma, Italy
[email protected] Institut f¨ ur Informatik, Universit¨ at Augsburg, 86135 Augsburg, Germany
[email protected]
Abstract. It is shown how to compute the lexicographically maximum suffix of a string of n ≥ 2 characters over a totally ordered alphabet using at most (4/3)n − 5/3 three-way character comparisons. The best previous bound, which has stood unchallenged for more than 25 years, is (3/2)n − O(1) comparisons. We also prove an interesting property of an algorithm for computing the maximum suffix both with respect to a total order < and with respect to its inverse order >. Keywords: String algorithms, maximum suffix, character comparisons.
1
Introduction
Let Σ be an alphabet equipped with a total order <. As is standard, the total order is extended to all of Σ ∗ using the lexicographic convention: For all u, v ∈ Σ ∗ , u < v if and only if u is a proper prefix of v or u and v can be written in the form u = xay and v = xbz with x, y, z ∈ Σ ∗ , a, b ∈ Σ and a < b. We consider the problem of determining the (lexicographically) maximum suffix of a given nonempty string a1 · · · an over Σ. More precisely, we want to compute the (unique) r ∈ {1, . . . , n} such that for all s ∈ {1, . . . , n} with r = s, ar · · · an > as · · · an . As in earlier work, our measure of the complexity of an algorithm for this and related problems is the number of three-way comparisons carried out between characters of the input string. For 1 ≤ i, j ≤ n, a threeway comparison between ai and aj , written compare(i,j,a) in our program code, yields one of three outcomes, say ‘<’ if ai < aj , ‘=’ if ai = aj and ‘>’ if ai > aj . Comparisons that are not between input characters are neither counted nor mentioned. In 1983 Duval published a celebrated algorithm for the related problem of socalled Lyndon factorization [1]. Duval bounds the number of (three-way) comparisons carried out by his algorithm on an n-character input string by (3/2)n and shows that, essentially as a by-product and without the need for any additional comparisons, the algorithm also computes the maximum suffix of the input string. An algorithm of Shiloach [2] for the related problem of so-called canonization of circular strings can compute the maximum suffix of a (linear) T. Calamoneri and J. Diaz (Eds.): CIAC 2010, LNCS 6078, pp. 323–334, 2010. c Springer-Verlag Berlin Heidelberg 2010
324
G. Franceschini and T. Hagerup
string of length n, also within (3/2)n + O(1) comparisons. Despite the fundamental nature of the problem of finding the maximum suffix of a given string, no better algorithm (in terms of the worst-case number of comparisons) was known previously. We present a new algorithm that solves the problem with at most (4/3)n − 5/3 comparisons for n ≥ 2. Although it is not obvious from the control flow of the algorithm, we demonstrate that it runs in linear time. We also show that if Duval’s algorithm is applied to an n-character string with n ≥ 2 both for a total order < and for its inverse order >, the worst-case total number of comparisons that it uses is (5/2)n − 3. This bound is remarkable in that it is precisely the sum of the worst-case number and the best-case number of comparisons for Duval’s algorithm.
2
Duval’s Algorithm
Since our work builds upon that of Duval [1], we begin by recalling his algorithm and its formal underpinnings. Define the period of a string u as the smallest nonnegative integer m such that u is a prefix of vu for some m-character string v (other authors use the term “period” with a related, but different meaning). It is helpful for the following to observe that u is a prefix of vu if and only if it is a prefix of v k for some sufficiently large integer k. Specialized to the problem of computing the maximum suffix of an n-character string a1 , . . . , an , to a first approximation Duval’s algorithm is an incremental algorithm that increases a variable s from 2 to n + 1 in steps of 1 and maintains during the process the beginning index r of the maximum suffix u of a1 · · · as−1 as well as the periods of all nonempty prefixes of u. The latter are stored in an array M such that for i = 1, . . . , |u|, M [i] is the period of the prefix of u of length i. Initially, for s = 2, it suffices to set r = M [1] = 1, and the final value of r, for s = n + 1, is the desired result. All that remains is to explain how to update r and M following an increase in s. First note the following elementary fact. Observation 1. For all integers t and m with 1 ≤ m ≤ t, t − t mod m ≥ m. Lemma 2. Let a1 · · · an be a string over Σ and assume that r and s are integers with 1 ≤ r ≤ s − 1 < n such that u = ar · · · as−1 is the maximum suffix of a1 · · · as−1 . Let m be the period of u. (a) If as ≤ as−m , then ar · · · as is the maximum suffix of a1 · · · as , and its period is m if as = as−m and s + 1 − r otherwise. (b) Let d = (s − r) mod m and r = s − d. Then v = ar · · · as−1 is not only a suffix, but also a prefix of u, and it is its own maximum suffix. Moreover, if as > as−m , then the maximum suffix of ar · · · an is also the maximum suffix of a1 · · · an . Proof. (a) For 1 ≤ r < r, ar · · · ar −r+s−1 < ar · · · as−1 , and for r < r ≤ s, ar · · · as−1 ≤ ar · · · ar−r +s−1 . If the latter relation holds with equality, u is a prefix of ar · · · ar −1 u, which shows that we cannot have r −r < m; if r −m ≥ r,
Finding the Maximum Suffix with Fewer Comparisons
325
on the other hand, then ar · · · as−1 = ar −m · · · as−1−m and, if as ≤ as−m , ar · · · as ≤ ar −m · · · as−m . In all cases, if as ≤ as−m , we find that ar · · · as cannot be the maximum suffix of a1 · · · as for any r = r. It is clear that the period m of uas is no smaller than m, and m = m if as = as−m . Assume that m ≤ m ≤ s−r and let d = (s−r) mod m . By definition of m , ar · · · ar+d = as−d · · · as , and by definition of m, the prefix of length d of the latter string equals as−d−m · · · as−1−m —note that by Observation 1, s − d − m ≥ r + m − m ≥ r. Thus if as < as−m , ar · · · ar+d < as−d−m · · · as−m , contradicting the fact that ar · · · as is its own maximum suffix. If follows that m = s + 1 − r. (b) It is easy to see that v is a prefix of u. If some suffix of v were larger than v, it would therefore also be larger than u, a contradiction, so v is its own maximum suffix. If as > as−m , then for every r with 1 ≤ r < r , ar · · · ar +d ≤ ar · · · ar+d = vas−m < vas = ar · · · as , so the maximum suffix of ar · · · an is also the maximum suffix of a1 · · · an . Lemma 2 motivates Duval’s algorithm, which is formulated in C below. int max_suffix_duval(string a,int r0,int n) { // Inputs integers r0 and n with 0<=r0<=n and a string a[r0..n]. // Returns the integer r with r0<=r<=n such that a[r..n] is the // maximum suffix of a[r0..n]. compare(i,j,a) must compare a[i] // and a[j] and return ’<’, ’=’ or ’>’ accordingly. int r=r0,s=r+1,m=1,d; int* M=malloc(sizeof(int)*(n+2)); // allocate an integer array M[0..n+1] M[1]=1; while (s<=n) switch (compare(s,s-m,a)) { case ’<’: m=(++s)-r; M[m]=m; break; case ’=’: M[(++s)-r]=m; break; case ’>’: d=(s-r)%m; if (d>0) { r=s-d; m=M[d]; } else { r=s++; m=1; } } free(M); return r; } Call an execution of the while loop a phase. The algorithm uses simple variables r and s and an array M as explained above. For the sake of added convenience of use, the indexing of the input string a is allowed to begin at an arbitrary nonnegative integer r0 rather than at 1. In addition, the algorithm has a temporary variable d and employs m as an abbreviation for the period of the current string ar · · · as−1 , which period, between phases, is also stored in M [s−r].
326
G. Franceschini and T. Hagerup
After initialization, the algorithm repeatedly carries out phases, each of which increases s by 1 or leaves s unchanged, until s reaches the value n + 1, at which point r is returned as the result. A phase begins by comparing as and as−m . If as ≤ as−m , the period of ar · · · as is computed according to Lemma 2(a) and stored in m and in M [s + 1 − r], and s is incremented. If as > as−m , the algorithm computes r according to Lemma 2(b) and, in effect, substitutes the suffix ar · · · an for the input considered so far. Lemma 2(b) states that this is legal in the sense that the two have the same maximum suffix and that v = ar · · · as−1 is its own maximum suffix. Since v is a prefix of ar · · · as−1 , the periods of all nonempty prefixes of v are available in M ; in particular, if d = |v| ≥ 1, v’s own period is M [d]. If d = 0, s is incremented; following this, the string ar · · · as−1 is of length 1 and therefore trivially its own maximum suffix. If d > 0, s is left unchanged, but, by Observation 1, the phase increases r by at least m. Since m ≥ d + 1 ≥ 2, the increase in r is at least 2, and use of the potential function Φ = s + r/2 together with consideration of (worst-case) inputs of the form zazbzczdze · · · shows the maximum number of phases and therefore of comparisons on input strings of n ≥ 2 characters to be (3/2)n − 2.
3
The Fuzzy Algorithm
An inspection of the analysis of Duval’s algorithm shows that, from the point of view of reducing the number of comparisons below (3/2)n − O(1), the problem stems from phases in which the call of compare yields the result ‘>’ and d comes out to have the value 1. Such a phase leaves s unchanged and may increase r by only 2, which is insufficient for a better bound. Note that of the characters that take part in comparisons before or in such a phase, only two, namely as−1 and as , remain of relevance. Their mutual relationship with respect to < is unknown, and Duval’s algorithm proceeds to compare them. Our new algorithm, called the fuzzy algorithm, omits this comparison and proceeds in spite of the resulting uncertainty. It can be viewed as simulating three executions of Duval’s algorithm in parallel, one for each possible outcome of the comparison that was omitted. Fortunately, in many cases the same comparison can advance the state of all three simulated executions. When this is no longer the case, it turns out that one of the two characters whose comparison was omitted lost another comparison whose outcome renders irrelevant the comparison that was omitted. Perhaps surprisingly, this approach reduces the number of comparisons needed in the worst case. We can establish this only with a delicate and rather intricate analysis that must continually guard against the uncertainty. The algorithm itself, however, has the short description shown below. Recall that the value of a conditional expression (boolean expression )?expression 1:expression 2 is expression 1 if boolean expression evaluates to true, and expression 2 otherwise. Conjunctions are evaluated in a lazy fashion from left to right, i.e., the evaluation stops after evaluating an operand to false. Finally, an assignment is an expression that evaluates to the value assigned.
Finding the Maximum Suffix with Fewer Comparisons
327
int max_suffix_fuzzy(string a,int r0,int n) { // Inputs integers r0 and n with 0<=r0<=n and a string a[r0..n]. // Returns the integer r with r0<=r<=n such that a[r..n] is the // maximum suffix of a[r0..n]. compare(i,j,a) must compare a[i] // and a[j] and return ’<’, ’=’ or ’>’ accordingly. int r=r0,s=r+2,m=2,f=1,d,i; int* M=malloc(sizeof(int)*(n+3)); // allocate an integer array M[0..n+2] M[2]=2; while (s<=n) switch (compare(s,s-m,a)) { (1) case ’<’: m=(++s)-r; M[m]=m; break; (2) case ’=’: M[(++s)-r]=m; break; case ’>’: d=(s-r)%m; if (d>=f) { r=s-d; (3) if (d>1) m=M[d]; (4) else { s=r+(m=M[2]=2); f=1; } } else { (5) r=s-(--m); f=0; for (i=3;i<=m;i++) M[i]=(M[i+1]
0&&r as−m and d ≥ 2, the two algorithms execute precisely the same assignments; because different invariants hold for the two algorithms, however, the analogy is not quite as close as it would appear at first glance. Consider the final possibility, as > as−m and d ≤ 1. If d = 1, the fuzzy algorithm increases r to the value s − 1, as does Duval’s algorithm. However, in contrast with Duval’s algorithm, which leaves s unchanged, the fuzzy algorithm increases s by 1; a new character is included in the current string even though the two first characters of that string have not been compared. This is the case discussed at the beginning of the section as motivating the fuzzy algorithm. In addition, a 0-1 variable f is set to 1. Informally, f is a state variable that indicates whether the “fuzziness” is on (f = 1) or off (f = 0). If f = 0, ar · · · as−1 is its own maximum suffix, as in Duval’s algorithm, whereas if f = 1 the maximum suffix of ar · · · as−1 may in fact begin one position later.
328
G. Franceschini and T. Hagerup
If d = f = 0 (still assuming as > as−m ), the fuzzy algorithm does the same as for d = 1, except that r is increased to the value s instead of to s − 1 before s is increased to r + 2. The case d = 0 and f = 1, finally, has no correspondence in Duval’s algorithm and cannot easily be motivated at this point. The fuzzy algorithm decreases m by 1 and, with the updated value of m, increases r to s − m and, if m ≥ 3, replaces M [i] by min{M [i + 1], i} for i = 3, . . . , m. It also turns off the fuzziness by setting f = 0. A final difference to Duval’s algorithm, which always returns the value r, is that the fuzzy algorithm may return r + 1 instead; this happens if f = 1, r < n and ar < ar+1 . 3.1
Correctness Proof
Consider a call max suffix fuzzy(a, r0, n) and again call an execution of the while loop a phase. Each phase executes (fully) exactly one of the numbered lines; if it executes the line numbered (j), for j ∈ {1, . . . , 5}, we call it a (j)-phase. For integers r and s with r0 ≤ r ≤ s ≤ n, denote by MS (r, s) the integer i with r ≤ i ≤ s such that ai · · · as is the maximum suffix of ar · · · as . For k ∈ {1, 2}, define the k-period of a string as the maximum of k and the usual period of the string. We use the following invariants: (I1) 0 ≤ r0 ≤ r ≤ r + f < r + m ≤ s ≤ n and f ≤ 1. (I2) MS (r0, n) = MS (r, n) (informally, r has not increased too far). (I3) r ≤ MS (r, s − 1) ≤ r + f , where s = min{s, n + 1} (informally, ar or ar+f introduces the current maximum suffix). (I4) If ar ≥ ar+1 , then, for i = 2, . . . , s − r, M [i] is the (f + 1)-period of ar · · · ar+i−1 . If ar < ar+1 and s − r ≥ 2, then M [2] = 2 and, for i = 3, . . . , s − r, with p equal to the period of ar+1 · · · ar+i−1 (of length i − 1), we have 2 ≤ p ≤ M [i] ≤ p + 1 and, if p < i − 1, M [i] = p. (I5) If s − r ≥ 2, then m = M [s − r]. (I6) For i = 3, . . . , s − r, M [i − 1] ≤ M [i]. (I7) For i = 2, . . . , s − r, if M [i] ≥ 2, then M [M [i]] = M [i]. It is straightforward to see that the invariants (I1)–(I7) hold at the beginning of the first phase, if there is one. Assuming that they hold at the beginning of a particular phase, called the current phase, we will show that they hold at the end of the phase, except that s may increase beyond n. There is one additional exception, which will be explained later. We will use the names of variables, subscripted by 1 or 2, to denote the values of the corresponding variables at the beginning or at the end, respectively, of the current phase. For variables that never change, the subscripts are omitted. When stating that a fact holds by a certain invariant, what we mean is that it holds because the invariant holds at the beginning of the current phase.
Finding the Maximum Suffix with Fewer Comparisons
329
Invariants (I1) and (I5)–(I7) and (4)-phases. Consider invariant (I1). The relation 0 ≤ r0 is a condition imposed on the input. The relation r0 ≤ r1 implies r0 ≤ r2 because r never decreases. To see the latter, note the following facts, which will be important again in the analysis of the number of comparisons: – Every (3)-phase and every (4)-phase increases r by at least m1 ≥ d2 + 1 ≥ 1 (since s1 − r1 ≥ m1 ≥ 1 by (I1) and d2 = (s1 − r1 ) mod m1 , so that, by Observation 1, r2 − r1 = s1 − r1 − d2 ≥ m1 ). – Every (5)-phase increases r by at least 1 (since r1 ≤ s1 − m1 < s1 − m2 = r2 by (I1)). The relations r ≤ r + f and f ≤ 1 obviously always hold, since the value of f is always 0 or 1. The relation r2 + f2 < r2 + m2 or, what is the same, m2 ≥ f2 + 1 holds for the following reasons: If the current phase is a (1)-phase, m2 = s1 + 1 − r1 ≥ 2 ≥ f2 + 1 by (I1). A (2)-phase changes neither m nor f . In a (3)-phase we must have 2 ≤ d2 ≤ s1 − r1 and therefore, by (I4) and (I5), m2 ≥ f2 + 1. A (4)-phase obviously has m2 = 2 ≥ f2 + 1, and a (5)-phase begins with f = 1 and therefore decreases both m and f by 1. If the current phase is a (1)-phase, a (4)-phase or a (5)-phase, it explicitly establishes the relation r2 +m2 = s2 . In a (2)-phase we have r2 +m2 = r1 +m1 ≤ s1 < s2 by (I1). Since (I4) implies that M1 [i] ≤ i for i = 2, . . . , s1 − r1 , in a (3)-phase we have m2 = M1 [d2 ] ≤ d2 = s2 − r2 . In each case, r2 + m2 ≤ s2 . The relation s2 ≤ n may be violated, but then the current phase is the last one. We have therefore shown that (I1) holds at the beginning of every phase. In the following, we will take this for granted without mentioning it on every occasion; in particular, the relation r + m ≤ s will be used frequently. A (4)-phase establishes invariants (I3)–(I7) without relying on the validity of any of the invariants except (I1) at the beginning of the phase. In the case of a (4)-phase, we will therefore verify only (I2) in what follows. Consider next (I5) and note that the relation m2 = M2 [s2 − r2 ] is established explicitly by every phase that is not a (5)-phase. Thus (I5) must be reconsidered only in the context of a (5)-phase. (1)-phases and (2)-phases preserve (I6). To see this, observe that such a phase increases s − r by 1 and that there is nothing to show unless s2 − r2 ≥ 3, in which case, by (I5), M [s2 − r2 ] is set equal to m2 ≥ m1 = M [s1 − r1 ]. (I6) is clearly preserved by a (3)-phase. As for a (5)-phase, first note that, by (I4) and since f1 = 1, M1 [2] = M2 [2] = 2 and M1 [i] ≥ 2 for i = 2, . . . , s1 − r1 . A (5)phase, which replaces M [i] by min{M1 [i + 1], i} for i = 3, . . . , s2 − r2 , can now be seen to preserve (I6) because the minimum of the two nondecreasing functions → i on {3, . . . , m2 } is again nondecreasing on {3, . . . , m2 }. i
→ M1 [i + 1] and i
As concerns (I7), recall that (I4) implies that M1 [i] ≤ i for i = 2, . . . , s1 − r1 . (I7) is easily seen to be preserved by a (1)-phase. In a (2)-phase, either m1 = 1 and there is nothing to show or, by (I5), 2 ≤ m1 = M1 [s1 − r1 ] < s2 − r2 and therefore M2 [M2 [s2 − r2 ]] = M2 [M1 [s1 − r1 ]] = M1 [M1 [s1 − r1 ]] = M1 [s1 − r1 ] = M2 [s2 − r2 ]. (I7) is clearly preserved by a (3)-phase. In the case of a (5)phase, we argue as follows: First, as noted above, M2 [2] = 2 and therefore
330
G. Franceschini and T. Hagerup
M2 [M2 [2]] = M2 [2]. Now let i ∈ {3, . . . , s2 − r2 } and assume that M2 [i] ≥ 3. If M2 [i] = i, obviously M2 [M2 [i]] = M2 [i], so we can assume that M2 [i] = M1 [i+1]. Now, by (I6) and (I7), M2 [M2 [i]] = M2 [M1 [i + 1]] = min{M1 [M1 [i + 1] + 1], M1 [i + 1]} ≥ min{M1 [M1 [i + 1]], M1 [i + 1]} = M1 [i + 1] = M2 [i]. MS (r1 , s1 − 1) = r1 . Let us now show that each kind of phase preserves the remaining invariants (I2)–(I4). Assume first that MS (r1 , s1 − 1) = r1 and let p be the period of u = ar1 · · · as1 −1 . If s1 = r1 + 1, then p = m1 = 1. If s1 > r1 + 1, then ar1 ≥ ar1 +1 and, by (I4) and (I5), m1 = max{p, f1 + 1} is a multiple of p. In both cases, as1 −m1 = as1 −p , so that Lemma 2 is directly applicable. If as1 ≤ as1 −m1 , the current phase is a (1)-phase or a (2)-phase, and MS (r1 , s1 ) = MS (r1 , s2 − 1) = r1 , so that (I3) holds at the end of the current phase. If as1 < as1 −m1 , the period of uas1 is s1 + 1 − r1 = s2 − r2 = m2 ≥ 2, and if as1 = as1 −m1 , the period of uas1 is p and m2 = m1 = max{p, f1 + 1}. In both cases M2 [s2 − r2 ] = m2 is the (f1 + 1)-period of ar2 · · · as2 −1 , so that (I4) holds at the end of the current phase—since r1 = r2 and (I4) holds before the phase, it suffices to verify its claim for i = s2 − r2 . (I2) also holds at that time, since (1)-phases and (2)-phases leave r unchanged. If as1 > as1 −m1 , assume first that the current phase is a (3)-phase or a (4)phase. Then, by Lemma 2(b) and (I2), v = ar2 · · · as1 −1 is a prefix of u and its own maximum suffix, and MS (r0, n) = MS (r1 , n) = MS (r2 , n), i.e., (I2) holds after the current phase. Assume now that the current phase is a (3)-phase. Then v = ar2 · · · as2 −1 and MS (r2 , s2 − 1) = r2 , so that (I3) holds after the current phase. Moreover, since v is a prefix of u and f1 = f2 , (I4) can be seen to hold after the current phase. If the current phase is a (5)-phase, d2 = 0 and s1 − r1 ≥ m1 ≥ f1 + 1 = 2 and therefore as1 > ar1 ≥ ar1 +1 . In fact, by (I3), as1 > ai for all i with r1 ≤ i < s1 ; in particular, by (I2), MS (r0, n) = MS (s1 , n). Moreover, s2 = s1 = r2 + m2 and f2 = 0. One or both of the invariants (I3) and (I4) may be violated at the end of the current phase—this is the exception alluded to earlier—but we will show that there is a next phase, called a special phase, and that this special phase reestablishes all invariants. The first claim holds simply because the current phase does not increase s, and the second claim can easily be seen to follow from the fact that the special phase is a (4)phase whose value computed for d is 0. In particular, note that the special phase sets r equal to the value of s valid at the end of the phase preceding it, after which (I2) holds by what was observed above. MS (r1 , s1 − 1) = r1 + 1. Assume now that MS (r1 , s1 − 1) = r1 + 1—by (I3), this is the only remaining possibility. Then f1 = 1, s1 − r1 ≥ m1 ≥ 2 and ar1 < ar1 +1 . Let p be the period of u = ar1 +1 · · · as1 −1 . By (I4) and (I5), either m1 = p or m1 = p + 1 = s1 − r1 . In the first case, Lemma 2 is directly applicable with r = r1 + 1. In the second case, there is a “mismatch” between
Finding the Maximum Suffix with Fewer Comparisons
331
the lemma, which considers the comparison of as1 with ar1 +1 , and the procedure max suffix fuzzy, which compares as1 with ar1 instead. Because ar1 < ar1 +1 , however, we can conclude in any case that if the current phase is a (1)-phase or a (2)-phase, then as1 ≤ as1 −p . In this case, therefore, Lemma 2(a) shows that MS (r1 + 1, s1 ) = MS (r1 + 1, s2 − 1) = r1 + 1 and, because ar1 < ar1 +1 , that MS (r2 , s2 − 1) = MS (r1 , s2 − 1) = r1 + 1 = r2 + 1, so that (I3) holds at the end of the current phase. As noted earlier, (I2) also holds because r1 = r2 . Let p be the period of uas1 . If the current phase is a (1)-phase, Lemma 2(a) shows that p = s1 + 1 − (r1 + 1) = s2 − r2 − 1 ≥ 2. Since m2 = s2 − r2 and therefore m2 = p + 1, (I4) can be seen to hold after the current phase—again it suffices to verify its claim for i = s2 −r2 . If the current phase is a (2)-phase, either m1 = m2 = p = p ≥ 2, again by Lemma 2(a), or m1 = m2 = p + 1 = s1 − r1 and p = s1 − r1 ≥ 2 as above and therefore m2 = p . In either case, (I4) again holds after the current phase. If the current phase is a (3)-phase or a (4)-phase, f1 = 1 shows that we cannot have d2 = 0 or m1 = s1 − r1 , so it must be the case that m1 = p. Then, by (I2) and Lemma 2(b), applied with r = r1 + 1, v = ar2 +1 · · · as1 −1 is a prefix of u and its own maximum suffix, and MS (r0, n) = MS (r2 + 1, n), so that (I2) holds after the current phase. Assume that the current phase is a (3)-phase. Then v = ar2 +1 · · · as2 −1 , and since ar2 < ar2 +1 , MS (r2 , s2 − 1) = MS (r2 + 1, s2 − 1) = r2 + 1, so that (I3) holds after the current phase. One easily verifies that (I4) also holds after the current phase, the central fact again being that v is a prefix of u. Assume finally that the current phase is a (5)-phase. In particular, d2 = 0. If m1 = p + 1 = s1 − r1 , it is clear that r2 = r1 + 1. This relation, together with ar1 < ar1 +1 and with (I2) and (I3), shows that (I2) and (I3) hold after the current phase. If instead m1 = p, Lemma 2(b) is directly applicable with r = r1 + 1. It shows that v = ar2 · · · as1 −1 is a prefix of u and its own maximum suffix, so that (I3) holds after the current phase. Moreover, since ar1 < ar1 +1 and by (I2), MS (r0, n) = MS (r1 , n) = MS (r1 + 1, n) = MS (r2 , n), i.e., (I2) holds after the current phase. Still assuming the current phase to be a (5)-phase, if s2 = r2 + 1, (I4) and (I5) hold vacuously after the current phase. If not, ar2 ≥ ar2 +1 since (I3) holds after the current phase, and the last part of the current phase computes M2 [i] as min{M1 [i + 1], i}, for i = 3, . . . , s2 − r2 ≤ s1 − r1 − 1. By (I4), for all such i the minimum of M1 [i+1] and i is the period of ar1 +1 · · · ar1 +(i+1)−1 = ar2 · · · ar2 +i−1 . Moreover, (I4), used with i = 3, shows that the period of ar2 ar2 +1 is 2. Thus (I4) holds after the current phase. The same is true of (I5) since, by (I5) and (I7), m1 = M1 [s1 − r1 ] = M1 [M1 [s1 − r1 ]] = M1 [m1 ] and therefore M2 [s2 − r2 ] = min{M1 [s2 − r2 + 1], s2 − r2 } = min{M1 [m1 ], m2 } = min{m1 , m2 } = m2 . Just before the execution of the return statement, (I2) and (I3) show the correct return value to be either r or r + 1, with r + 1 being possible only if f = 1 and r < n. It is easy to see that the algorithm chooses correctly between the two possibilities, if necessary by means of a direct comparison between ar and ar+1 .
332
3.2
G. Franceschini and T. Hagerup
Analysis of the Number of Comparisons
Theorem 3. The fuzzy algorithm computes the maximum suffix of an arbitrary string of n ≥ 2 characters over a totally ordered alphabet using at most (4/3)n− 5/3 three-way character comparisons. Proof. Consider a call max suffix fuzzy(a, r0, n) with r0 = 1, so that the length of the input string is n. Using variable subscripts as in the correctness proof, we analyze the number of comparisons carried out by the call using the potential function 2 r Φ = s + + (1 − f ). 3 3 Upon entry to the while loop, Φ has the value 10/3. A (1)-phase or (2)-phase increases s by 1 and leaves r and f unchanged. A (3)-phase increases r by at least m1 ≥ d2 +1 ≥ 3 and leaves s and f unchanged. A (4)-phase increases s by 2−d2 ≥ 1, r by at least m1 ≥ d2 + 1 and f by at most 1. A (5)-phase increases r by at least 1, leaves s unchanged and changes f from 1 to 0. Thus every phase increases Φ by at least 1, and every (4)-phase with d2 = 0 increases Φ by at least 5/3. Denote the total increase in Φ over the course of the execution by ΔΦ. The while loop is left with s ≤ n + 2 and r ≤ n. If the final value of s is n + 2 or the final value of r is n (these events always occur in conjunction), the final phase was a (4)-phase with d2 = 0 and f2 = 1, so that the total number of comparisons is bounded by n 10 2 4 2 ΔΦ − ≤ n + 2 + − − = n − 2. 3 3 3 3 3 Assume that the final value of r is at most n − 1. If the final value of f is 1, the total number of phases is at most ΔΦ ≤ n + 1 +
4 8 n − 1 10 − = n− , 3 3 3 3
and the total number of comparisons is bounded by (4/3)n − 5/3. If the final value of f is 0, ΔΦ may be larger by 2/3, but no comparison is carried out after the final phase, and a bound of (4/3)n − 2 results. The bound of Theorem 3 is tight for the fuzzy algorithm, as can be seen by considering (worst-case) input strings formed as the concatenation of the prefix of length n − 2 of the string bzaczadzaezaf za · · · with the two-character string zz. Consideration of the potential function Φ = r + (1 − f )m can show the running time of the fuzzy algorithm to be linear, provided that a comparison takes constant time: Using the observations concerning the effect of phases on r made in the correctness proof, it is not difficult to see that no phase decreases Φ . Moreover, a (5)-phase increases Φ by at least m2 and executes in O(m2 ) time. Every other phase takes constant time. Still with r0 = 1, the initial value of Φ is 1, and by (I1), its value remains bounded by s and is therefore always O(n). The claim follows.
Finding the Maximum Suffix with Fewer Comparisons
4
333
Finding the Maximum Suffix for both < and >
In this section we consider the following problem: Given a string u over an alphabet Σ equipped with a total order <, compute both the maximum suffix of u with respect to < and the maximum suffix of u with respect to the inverse order > (a > b iff b < a for all a, b ∈ Σ). Of course, the problem can be solved with two independent calls of the fuzzy algorithm, one for each linear order. By what we proved in the previous section, if u has n ≥ 2 characters, this needs a total of at most (8/3)n − 10/3 comparisons. Here we will show that two independent calls of Duval’s algorithm, one for each linear order, use a total of at most (5/2)n−3 comparisons. Since Duval’s algorithm uses n−1 comparisons on n-character strings whose characters form a monotonic sequence, while clearly no algorithm can use fewer than n − 1 comparisons, (5/2)n − 3 is precisely the sum of the worst-case number and the best-case number of comparisons for Duval’s algorithm; in particular, the bound is tight. This result shows that, in a certain sense, bad instances for Duval’s algorithm with respect to a total order are necessarily good instances for the inverse order, a property of the algorithm that is not a priori obvious. Consider a call max suffix duval (a, 1, n) with n ≥ 2 and the call max suffix duval > (a, 1, n) of the same algorithm and on the same input, but with the function compare changed to realize the inverse order > instead of <. In every phase of one of the two calls that increases r without increasing s, color the new value of r; use the color blue or the color red, respectively, if the linear order used is < or >, respectively. If an integer j is blue, then there is an integer k with 1 ≤ k ≤ n − j (namely the value of d at the end of the phase in which j is colored blue) such that for every integer i with 1 ≤ i < j, ai · · · ai+k < aj · · · aj+k . Moreover, there is an integer i with 1 ≤ i < j (namely the value of r at the beginning of the same phase) such that ai = aj . Analogous assertions hold if j is red. This can be seen to imply that no number is both blue and red. Lemma 4. No two consecutive integers are colored. Proof. Since a phase that does not increase s always increases r by at least 2, no two consecutive integers can have the same color. Suppose without loss of generality that j is blue. By what was noted above, there are integers i and k with 1 ≤ i < j and 1 ≤ k ≤ n − j such that ai = aj and ai · · · ai+k < aj · · · aj+k . But then ai+1 · · · ai+k < aj+1 · · · aj+k , which shows that j + 1 cannot be red. Theorem 5. On an input string of n ≥ 2 characters, two executions of Duval’s algorithm, one for each of the linear orders < and >, together use at most (5/2)n − 3 three-way character comparisons. Proof. Since a phase that does not increase s always increases r by at least 2 and to at most s − 1 ≤ n − 1, the integers 1, 2 and n are not colored. This fact and Lemma 4 show that the total number of colored integers is at most (n − 2)/2. The total number of comparisons carried out is that number plus twice n − 1.
334
5
G. Franceschini and T. Hagerup
Concluding Remarks
With the results presented here, for the first time the best algorithm known for the computation of maximum suffixes uses fewer comparisons than the best algorithms known for Lyndon factorization and canonization of circular strings. We suspect that the two latter problems are indeed more difficult. Demonstrating this by means of an appropriate lower bound is an obvious open problem. It would be interesting to find out whether, analogously to Theorem 5, a bound of (7/3)n + O(1) holds for a (<, >) version of the fuzzy algorithm. We also consider it an intriguing question whether the correctness of the fuzzy algorithm can be established in a significantly simpler manner.
References 1. Duval, J.P.: Factorizing words over an ordered alphabet. J. Algorithms 4, 363–381 (1983) 2. Shiloach, Y.: Fast canonization of circular strings. J. Algorithms 2, 107–121 (1981)
An Algorithmic Framework for Motif Discovery Problems in Weighted Sequences Hui Zhang1 , Qing Guo2 , and Costas S. Iliopoulos3 1
College of Computer Science and Technology, Zhejiang University of Technology, Hangzhou, Zhejiang 310023, China [email protected] 2 Department of Computer Science and Engineering, Zhejiang University, Hangzhou, Zhejiang 310027, China [email protected] 3 Department of Computer Science, King’s College London Strand, London WC2R 2LS, England [email protected]
Abstract. A weighted sequence is a string in which a set of characters may appear at each position with respective probabilities of occurrence. A common task is to locate a given motif in a weighted sequence in exact, approximate or bounded gap form, with presence probability not less than a given threshold. The motif could be a normal non-weighted string or even a string with don’t care symbols. We give an algorithmic framework that is capable of tackling above motif discovery problems. Utilizing the notion of maximal factors, the framework provides an approach for reducing each problem to equivalent problem in non-weighted strings without any time degradation.
1
Introduction
A weighted biological sequence, called for short a weighted sequence, can be viewed as a compressed version of multiple alignment, in the sense that at each position, a set of characters appear with respective probability, instead of a fixed single character occurring in a normal string. Weighted sequences are apt at summarizing poorly defined short sequences, e.g. transcription factor binding sites, intron/exon junctions, as well as the profiles of protein families and complete chromosome sequences [9]. With this model, one can attempt to locate the biological important motifs, to estimate the binding energy of the proteins, even to infer the evolutionary homology. It thus exhibits theoretical and practical significance to design powerful algorithms on weighted sequences. A simple but common task, called motif discovery, is to seek whether or not, and where a motif occurs in a weighted sequence. The motifs could be a protein that belongs to a specific protein family, transcription factor binding sites in genomes, or any gene segments that we are interested in. This paper mainly investigates one type of motif discovery problems in weighted sequences. Assuming that a motif (pattern) to be sought is given, we then attempt T. Calamoneri and J. Diaz (Eds.): CIAC 2010, LNCS 6078, pp. 335–346, 2010. c Springer-Verlag Berlin Heidelberg 2010
336
H. Zhang, Q. Guo, and C.S. Iliopoulos
to find in a weighted sequence (text) all the occurrences of the motif in the form as needed, e.g. exact form, approximate form, or the form with bounded gap. Here we assume the motif to be a non-weighted string as normal, but may extend it to other type such as a pattern with don’t cares. Due to uncertainties of weighted sequences, it turns out that handling weighted sequences is algorithmically challenging even for simple tasks such as exact pattern matching and even harder for more ambitious problems. The problem of exact pattern matching problem in weighted sequences has been solved using various methods. A weighted suffix tree (WST) was introduced and constructed [11,12] to suit the needs of searching in weighted sequences. Another solution relied on the match count problem [9], and presented an O(nlogm)-time algorithm for the same problem [6]. Approximate string matching is to find the text positions that match a pattern with up to t errors. Many techniques have been introduced to solve this problem, including the dynamic programming algorithms[18], Algorithms based on automata[15], Bit-parallelism technique[4], etc. However, there have been no solutions to the approximate pattern matching problem in weighted sequences, which attracts our interests. As an extension to the pattern matching problem, gapped pattern matching allows for gaps between the occurrences of the subpatterns in the text. Gapped pattern matching has wide applications in information retrieval, data mining and computational biology. It is particularly useful for finding motifs in a biological sequence, where motifs are represented as gapped patterns from the alphabet of 20 amino acids. For non-weighted sequences, several algorithms for different types of gap constraints have been presented[9,10]. The problem of weighted version has a solution that runs in O(mn) time[5], which will be greatly improved in this paper. Another extension of pattern matching problems occurs when the pattern allows for ”don’t care” symbols, which has practical applications in DNA sequence analysis. A don’t care symbol matches with any character in the given alphabet, denoted by ∗. For instance, the string A∗CT matches another string AG∗T. The problem of pattern matching with don’t cares has been studied with different methods. Relying on the convolution procedure, Fischer and Paterson[8] developed an O(nlogm) algorithm for finding the occurrences of a pattern of length m in a text of length n over a bounded alphabet. This algorithm was general√ ized using a divide-and-conquer technique, to obtain an O(n nm) solution[1]. However, the problem of weighted version has not been tackled yet. As scientists pay more attention to the pieces with high probabilities in DNA sequences, we fix a constant threshold, denoted by 1/k in the context, for the presence probability of the pattern. The paper is organized as follows. Section 2 we give the necessary preliminaries used. Then we introduce the notion of maximal factors of weighted sequences and present the algorithms for finding all the maximal factors in Section 3. Section 4 provides a general algorithmic framework for solving weighted matching problems. Using this general framework, we answer in Section 5 varieties of weighted matching problems. Finally, we draw conclusions in Section 6.
An Algorithmic Framework for Motif Discovery Problems
2
337
Preliminaries
Definition 1. Let an alphabet be Σ = {σ1 , σ2 , . . . , σl }. A weighted sequence X over Σ, denoted by X[1, n] = X[1]X[2] . . . X[n], is a sequence of n sets X[i] for 1 ≤ i ≤ n, such that: ⎧ ⎫ l ⎨ ⎬ X[i] = (σj , πi (σj ))| 1 ≤ j ≤ l, πi (σj ) ≥ 0, and πi (σj ) = 1 ⎩ ⎭ j=1
That is, each X[i] is a set of couples (σj , πi (σj )), where πi (σj ) is the non-negative weight of σj at position i, representing the probability of having character σj at position i of X. Let X be a weighted sequence of length n, σ be a character in Σ. We say that σ occurs at position i of X if and only if πi (σ) > 0, written as σ ∈ X[i]. i is called an occurrence of character σ in X. A nonempty string f [1, m] (m ∈ [1, n]) occurs at position i of X if and only if position i + j − 1 is an occurrence of the character f [j] in X, for all 1 ≤ j ≤ m. Then, f is said to be a factor of X, and i is an occurrence of f in X. The probability of the presence of f at position i of X is called the weight of f at i, written as πi (f ), which can be obtained by using different weight measures. We exploit the one in common use, called the cumulative weight, defined as the product of the weight of the character at every position of f : m πi (f ) = πi+j−1 (f [j]) j=1
Definition 2. Let f [1, h] be a factor of a weighted sequence X that occurs at position i, k is real and k ≥ 1. We say that f is a real factor
of X if and only if the weight (probability) of f at i, πi (f ), is at least k1 . Exactly, hj=1 πi+j−1 (f [j]) ≥ k1 . For instance, consider the following weighted sequence and set 1/k = 0.3: ⎧ ⎫ ⎧ ⎫ ⎪ (A, 0.25) ⎪ ⎪ ⎪ ⎨ (A, 0.5) ⎬ ⎨ ⎬ (C, 0.8) (A, 0.7) (C, 0.25) X = (C, 0.4) G (T, 0.2) (C, 0.3) ⎪ (G, 0.25) ⎪ ⎩ ⎭ ⎪ ⎪ (G, 0.1) ⎩ ⎭ (T, 0.25)
(1)
Then GCA is a real factor of X that occurs at position 2 since π2 (GCA)=1 × 0.8 × 0.7 = 0.56 > 0.3. AGT is not a real factor of X at position 1 since π1 (AGT)= 0.1 < 0.3. Then the weighted matching problem discussed in this paper can be formally stated as follows: Problem 1. Let the text be a weighted sequence X[1, n], the pattern be a nonweighted string y [1, m], k be a real number such that k ≥ 1. Weighted matching problem is to find all positions of X at which there exists a match (exact or approximate) of y that has the probability of appearance larger than or equal to the threshold 1/k.
338
H. Zhang, Q. Guo, and C.S. Iliopoulos
We preprocess the weighted sequence in the following way. Given any k ≥ 1, we classify all the positions i, 1 ≤ i ≤ n, of a weighted sequence X into the following four categories: – solid positions: Only one character occurs at position i that its presence probability exactly equals to 1. – leading positions: Only one of the possible characters at position i has probability of appearance at least 1/k threshold, and below 1. – branching positions: More than one character appears at position i with probability at least 1/k. – void positions: Every character that possibly occurs at position i has probability of appearance less than 1/k. For example, assume 1/k = 0.3, the sequence (1) has only one solid position, 2, and one leading position, 3. There are two branching positions, 1 and 4, at which at least two characters are eligible to compose a real factor of X. Position 5 is a void position at which none of the four characters has probability greater than 0.3. The above criteria for labelling positions indicates the following facts: Fact 1. If k < 2, there are no branching positions in a weighted sequence. The evidence for this fact is straightforward. If k < 2, then the cut-off probability 1 > 0.5. There are no such positions in a weighted sequence at which more than k one character has probability higher than 0.5. Fact 2. If k ≥ 2, none of the possible characters occurs at a branching position with probability greater than 1 − k1 . The proof for this fact is clear by contradiction. Assume that there exists a character σj ∈ Σ at a branching position i such that πi (σj ) > 1 − k1 , then for 1 any other σj ∈ Σ except this one, πi (σj ) < k since πi (σj ) = 1. This case deems position i to be a leading position rather than a branching position. Definition 3. For each position i, 1 ≤ i ≤ n, of a weighted sequence X[1, n] = X[1]X[2] . . . X[n], we convert the character X[i] into T (X[i]) such that: ⎧ X[i] if i is a solid position ⎪ ⎪ ⎨ (σj , 1) if i is a leading position and πi (σj ) ≥ k1 T (X[i]) = {(σj , πi (σj ))} if i is a branching position and πi (σj ) ≥ k1 ⎪ ⎪ ⎩ if i is a void position Then, a weighted sequence T (X[1])T (X[2]) . . . T (X[n]) is said to be a No-leading Transform of X, denoted by T (X). It is obvious that T (X) is a simple transformation of X where all leading positions are treated as solid positions, only eligible characters remain at branching positions and all void positions are expressed by an empty character, . Now that the positions of a given weighted sequence X are sorted in light of the value of k, there exists only one such T (X) for a certain k, either in the case of k < 2, or of k ≥ 2.
An Algorithmic Framework for Motif Discovery Problems
3
339
The Maximal Factors
In this section, we introduce a new concept, the maximal factors of weighted sequences which can be defined as below. Definition 4. Given a weighted sequence X[1, n] over Σ and a real number k ≥ 1, a maximal factor of X is a factor f [1, h] that occurs at position i of X, such that: (1) πi (f ) ≥ 1/k; (2) if i > 1, then πi−1 (σj ) × πi (f ) < 1/k for all σj ∈ Σ; (3) if i + h − 1 < n, then πi (f ) × πi+h (σj ) < 1/k for all σj ∈ Σ. Simply speaking, a maximal factor is the longest possible real factor of X. Consider the above example (1). GCA, is a maximal factor of X that occurs at position 2, since π2 (GCA)> 0.3, but extending one character to either direction simply generates factors with probability below the threshold. We first ignore the pattern y for the moment, and preprocess T (X), a weighted sequence without leading positions, to find all the maximal factors. Given a weighted sequence X of length n, the algorithm for computing all the maximal factors of T (X) trivially consists of two steps: first convert X into T (X), then find all the maximal factors of T (X). We handle two cases due to possible value of k, in the following subsections separately. 3.1
Algorithm for k < 2
By Fact 1, the positions of X are composed of solid positions, leading positions and void positions. Without branching positions, T (X) is actually a normal nonweighted string of length n over Σ ∪ {}. In order to turn X into T (X), all we need to do is to check every position of X if there occurs the only one eligible character. Then searching all the maximal factors of T (X) is explicit. Any substring of T (X) that starts at position 1 or ends to n then extends to , or contains no ’s and bounded by ’s on both sides, is a qualified maximal factor. Evidently, The searching process runs in O(n) time. Converting X into T (X) also costs linear time. Thus all the maximal factors of T (X) can be found in O(n) time, and the total length of these factors is linear to n. 3.2
Algorithm for k ≥ 2
Definition 5. Given a weighted sequence X and k, a position i of X is called a start point, if i is not a void position and either of the following conditions holds: (i) i = 1; (ii) i > 1 and i − 1 is not a solid position.
340
H. Zhang, Q. Guo, and C.S. Iliopoulos
Algorithm 1. Find the maximal factors of T (X) When k ≥ 2 Input: T (X), k ≥ 2 Output: All the maximal factors f of T (X) Algorithm Find-Maxfactors-Largek(T (X), k) 1. Set start pos ← 1. 2. Find all the maximal factors of T (X) starting at position start pos: for every position i ∈ [1, n], (a) if i is a solid position: extend each current factor f by adding the character T (X)[i]. Then check i + 1. (b) if i is a void position: each current f stops. (c) if i is a branching position: save each current f . Then for every σ ∈ T (X)[i], compute the cumulative probability π = πstart pos (f ) × π(σ): i. if π ≥ k1 : extend each current f by adding the character σ. Then check next i. ii. if π < k1 : each current f stops. (d) if i is a start point: add i to a list next start. 3. While next start not empty, set start pos ← extract an element from next start, then return step 2.
Definition 6. Given a weighted sequence X and k, a non-void position i of X is called an end point, if i obeys either of the following rules: (i) i = n; (ii) i < n and i + 1 is not a solid position. Fact 3. A maximal factor of T (X) occurs at a start point and stops at an end point. This fact is easily established. First of all, a maximal factor cannot starts at or ends to a void position. Assume that a maximal factor f of T (X) occurs at a non-void position i. If i − 1 (i > 1) is solid, then f could be extended one character to the left for a longer factor without any loss of probability, violating the maximality of f ; an alternative possibility is i = 1. The end point of f can be similarly reasoned. The fact suggests a direct algorithm for finding all the maximal factors of T (X) when k ≥ 2, shown as Algorithm 1. It is easily observed that the size of the output accounts for the running time of the algorithm. Precisely, the time consumption is linear to the total length of all the maximal factors. In the next subsection we will exhibit some properties of the maximal factors of T (X) in this case, and prove the total length of all the maximal factors to be O(nk 2 logk). 3.3
Analysis for the Maximal Factors when k ≥ 2
Recall that for a given k ≥ 2, the positions of T (X) are composed of solid positions, void positions and branching positions. As an eligible character occurs at a branching position with probability at least 1/k, we claim:
An Algorithmic Framework for Motif Discovery Problems
341
Proposition 1. For a given k, there are at most k eligible characters that occur at a branching position of T (X). Definition 7. Let f [1, h] be a maximal factor of a weighted sequence T (X) that occurs at position j, for a given k. We say that f passes by position i of T (X) if i ∈ [j, j + h − 1]. Proposition 2. For a given k, a maximal factor of T (X) passes by at most O(klogk) branching positions. Proof. Assume that the number of branching positions passed by a maximal factor f is lb . Recall Fact 2, each eligible character occurs at a branching position with probability at most 1 − k1 . As there is no leading and void positions within f , we follow that: π(f ) = (1 − k1 )lb ≥
1 k
→ lb ≤
log(1/k) log(1−1/k) .
Using the fact that log(k) − log(k − 1) = O( k1 ) [2], we get: lb ≤
log 1/k log(1−1/k)
=
log(k) log(k)−log(k−1)
=
log(k) 1 O( k )
= O(klogk).
Proposition 3. For a given k, there are at most k maximal factors that occur at each start point of T (X). Proof. As we mentioned earlier, solid positions neither contribute a decreasing cumulative probability to a factor, nor split a factor. The number of maximal factors at each start point simply depends on the branching positions to be examined. Therefore, W.L.O.G, we discard solid positions and treat all positions as branching positions. Let P = { k11 , k12 , . . . , k1r } denote the set of weights of all factors of T (X), such that k11 > k12 > · · · > k1r . Our target is to prove by induction that: for every position i of T (X) and every k1j , the maximal factors starting at i with probability at least k1j , denoted by fkj (i), amounts to at most kj . Base case j = 1: The largest weight k11 of any factor implies a factor of length exactly one. By Proposition 1 there are at most k1 eligible characters at position i. These k1 characters are exactly the fk1 (i)’s to be sought. Inductive step j > 1: Suppose that we have proved the cases for weights 1 1 1 1 , k1 k2 , . . . , kj−1 to be true, now we consider weight kj . Let σ1 , . . . , σl be the eligible lcharacters at position i, with respective probability π1 , . . . , πl . Notice that t=1 πt ≤ 1. Denote N U Mkj (i) to be the number of fkj (i)’s, and denote N U Mkj (i, σt ) to be the number of fkj (i)’s such that every fkj (i)[1] = σt . The expression N U Mkj (i, σt ) = N U Mkj ·πt (i + 1) stands, since each fkj (i) that contains σt can be represented as σt fkj ·πt (i + 1), so that π(fkj (i)) ≥ πt × kj1·πt = k1j . l By induction hypothesis, we infer that N U Mkj (i) = t=1 N U Mkj (i, σt ) = l l l l t=1 N U Mkj ·πt (i + 1) ≤ t=1 kj · πt ≤ t=1 kj · πt = kj · t=1 πt = kj . For any weight k1 ∈ / P (2 ≤ k ), the following possible cases need to be discussed:
342
H. Zhang, Q. Guo, and C.S. Iliopoulos
Fig. 1. A maximal factor passing by i occurs at at most lb + 1 start points
< k1r : Any factor occurs at i with probability more than k1 . Therefore there are at most kr < k maximal factors starting at each position in this case. (2) k1 > k11 : No eligible factor occurs at i, i.e. N U Mk (i) = 0. 1 for some 1 ≤ j < r: no factor occurs at i with probability (3) k1j > k1 > kj+1 1 between k and k1j . Therefore, N U Mk (i) = N U Mkj (i) ≤ kj < k . (1)
1 k
Proposition 4. Consider a certain k and a position i (1 ≤ i ≤ n) of T (X), there are at most O(k 2 logk) maximal factors that can pass i. Proof. By Proposition 2, there are at most lb branching positions within a maximal factor, where lb = O(klogk). Consider a position i of T (X), denote i0 , . . . , ilb to be branching positions located before i, as shown in Fig 1. W.L.O.G, we assume there are no void positions between i0 and i. Definition 5 indicates that only the first of consecutive solid positions could be a start point. Thus only the positions i0 + 1, i1 + 1, . . . , ilb + 1 are the start points of a maximal factor that passes position i, since a maximal factor can pass at most lb branching positions. As stated by Proposition 3, there are at most k maximal factors at a start point. Hence, the total number of maximal factors passing position i is at most (lb + 1) · k = O(klogk) · k = O(k 2 log(k)). Lemma 1. Given a real k, the total length of all the maximal factors of T (X) is at most O(nk 2 logk). Proof. A maximal factor of length l says that it passes l positions of T (X). Therefore, The total length of all the maximal factors of T (X) is exactly the sum of the number of maximal factors passing every position of T (X). By Proposition 4, this value at most equals to O(nk 2 logk). Recall that converting X to T (X) takes linear time, and the running time of computing all the maximal factors of T (X) is proportional to the size of the output, as demonstrated by Algorithm 1. Thus we conclude: Corollary 1. Given a real k ≥ 2 and a weighted sequence X, all the maximal factors of T (X) can be found in linear time.
4
Weighted Matching Framework
Consider a weighted sequence X[1, n] and a normal pattern y[1, m]. Assuming y is a real factor (with presence probability at least 1/k) that occurs at position i of X. The following two possibilities require to be elaborated.
An Algorithmic Framework for Motif Discovery Problems
343
Case 1. i is a start point: Let the presence probability of y in X be π0 ≥ k1 . It is easily discovered that there exists at least a maximal factor f of T (X) starting at i such that y is a prefix of f . The reason is as below: the presence of y at position i of T (X) is a real factor with probability at least π0 , resulted from the fact that transforming X into T (X) increases the probability of each factor that passes a leading position. Therefore, the length of y cannot exceed |f |, otherwise the presence of y will not be real. Case 2. i is not a start point: Consider a maximal factor f [1, h] of T (X) that occurs at position j such that j is the closest start point to the left of i. In other words, j is the largest start point of T (X) such that j < i. This premise reveals that j, j + 1, . . . , i − 1 should be all solid positions, otherwise if there exists a branching position i ∈ [j, i − 1] then i + 1 would be a start point, in contradiction to the assumption that j is the rightmost start point before i. Since every solid position has probability exactly 1, we can reinterpret the presence probability of f [1, h] at position j of T (X) by discarding those solid positions between j and i − 1, i.e. π(f [1, h]) = π(f [i − j + 1, h]) ≥ k1 . Notice that f [i − j + 1, h] occurs at position i of T (X). If the pattern y occurs at position i as a real factor of T (X), then by the same reason as Case 1, |y| ≤ |f [i − j + 1, h]|, i.e. i − j + m ≤ h, thus y is a prefix of f [i − j + 1, h]. Summarizing the above two cases, we realize that if the presence probability of y in X beats the cut-off probability, it must lie within a maximal factor f of T (X), as a substring of f . Formally: Lemma 2. Let X[1, n] be a weighted sequence, y [1, m] be a normal pattern and k (k ≥ 1) be a real number. Then y occurs at position i of X with probability at least k1 only if there is a maximal factor f [1, h] of T (X) starting at position j ≤ i, such that i − j + m ≤ h and y[l] = f [i − j + l] for all l ∈ {1, . . . , m}. It is clear that a pattern y matches a substring of a maximal factor of T (X) with probability at least k1 , but not necessarily true that y also occurs at the same position of X as a real factor of X. If a qualified match of y in T (X) contains leading positions that are replaced by solid positions in T (X), its actual probability in X might decrease below k1 by incorporating the actual probability of the character at each leading position. The combination of this observation and Lemma 2 yields a general technique for solving weighted matching problems stated as Problem 1. The algorithmic framework consists of the following steps: 1. For a given X and k, create T (X) and find all the maximal factors of T (X). 2. Run known algorithms for corresponding non-weighted matching problem on each maximal factor. 3. For each output (occurrence of y in X) of Step 2, check if the presence of this “match” is a real factor of X.
344
H. Zhang, Q. Guo, and C.S. Iliopoulos
Step 1 has been solved in linear time. Step 2 costs the same time with known non-weighted matching algorithms, since the total length of all these maximal factors sums to O(n) when k is a constant. What is left to be done is Step 3. Definition 8. The Range Multiplication Query is defined as follows: Let π = (π1 , . . . , πn ) be a list of positive real numbers, preprocess π so that given any interval [i, j] (1 ≤ i ≤ j ≤ n) return the value of πi × πi+1 × · · · × πj . To answer the Range Multiplication Query, we first build a Cumulative Weight array CW [0, n], such that CW [t] = π1 ×π2 ×· · ·×πt for t ∈ [1, n] and CW [0] = 1. The array CW can be easily created in O(n) time. Given an interval [i, j], we can answer the query by returning the value CW [j]/CW [i − 1], which exactly equals to πi × πi+1 × · · ·× πj . This computation requires O(1) time once the array CW has been constructed. Lemma 3. The Range Multiplication Query takes O(n) time for preprocessing, and for any given interval, the Query can be answered in O(1) time. This lemma allows us to perform the Range Multiplication Query preprocessing on all the maximal factors of T (X), where at each leading position, the actual probability instead of 1 should be retrieved. Then we can find the actual presence probability of every match in X. As the total length of all the maximal factors is O(n), Step 3 can be done in O(n) time. Finally, we conclude: Theorem 1. The weighted matching problem can be solved with the same time complexity as the non-weighted version of these problems.
5
Weighted Matching Problems
In this section, we briefly explain how this general framework for weighted matching work for several typical weighted matching problems. (1) Weighted Exact Pattern Matching Weighted exact pattern matching problem is to find all the occurrences of the pattern y[1, m] with probability at least k1 in a weighted sequence X[1, n]. Using the general algorithmic framework we presented in Section 4, we can solve this problem in linear time by taking any well known linear exact matching algorithm for normal strings, e.g. Boyer-Moore (BM) algorithm [3], Knuth-Morris-Pratt (KMP) algorithm [13], Karp-Rabin (KR) algorithm [14]. The readers can refer to [7,17] for details about more exact matching algorithms. (2) Weighted Approximate Pattern Matching Problem 2. Let the text be a weighted sequence X[1, n], the pattern be a nonweighted string y [1, m], t be the maximal error allowed, k be a real number such that k ≥ 1, and d be a distance function. Weighted approximate pattern matching problem is to find all the text positions j at which there exists i such that d(y, X[i, j] ≤ t and the probability of appearance is larger than or equal to the threshold 1/k.
An Algorithmic Framework for Motif Discovery Problems
345
The distance (.x, y) between two strings x and y indicates the minimum cost to transform x into y. The cost arises from a sequence of operations, which is the sum of the cost of the individual operations. The most frequent operations that are used for string transformation mainly consist of insertion, deletion and substitution. Distance functions commonly include Hamming distance, edit distance and weighed edit distance. This paper is mainly concerned with the simple edit distance, that is, allows insertions, deletions and substitutions. In this model, we count the number of edit operations, the cost of each equal to 1. Applying any well known algorithm for non-weighted sequence, e.g. Landau’s diagonal transition algorithms[16], into our general framework, the approximate weighted pattern matching problem can be solved in O(tn) time and O(n) space, without a degradation of running time. (3) Weighted Gapped Pattern Matching Problem 3. Let the text be a weighted sequence X[1, n], the pattern be a nonweighted string y [1, m], k be a constant such that k ≥ 1, and r be a distance bound. Weighted gapped pattern matching problem is to find all the text positions j ∈ [1, n] such that there exist positions j2 , j2 , . . . , jm : – y[i] ∈ y[ji ], for all 1 ≤ i ≤ m; –
ji − ji−1 ≤ r + 1, for all 2 ≤ i ≤ m m – j=1 πji (y[i]) ≤ 1/k Similarly, our general framework can utilize the algorithm for non-weighted gapped matching [10] to answer the weighted gapped matching problem also in O(n + m) time, without any time degradation. (4) Weighted Matching with Don’t Cares Problem 4. Let the text be a weighted sequence X[1, n], the pattern be a nonweighted string y [1, m] with don’t care symbols, k be a constant such that k ≥ 1. Weighted matching with don’t cares problem is to find all the text positions j ∈ [1, n] where y matches X[j, j + m − 1] and the probability of appearance of X[j, j + m − 1] is larger than or equal to the threshold 1/k. Clearly, we can use our general framework for weighted matching to solve this problem. Applying the convolution algorithm[8] for non-weighted matching, we can obtain a solution to the weighted version, with the same time complexity O(nlogm).
6
Conclusions
In this paper we presented a general algorithmic framework for solving varieties of weighted matching problems, including weighted exact pattern matching, weighted approximate pattern matching, weighted gapped pattern matching and weighted matching with don’t cares. However, The investigation for weighted matching problems is far from being completed. We are tempting to apply our algorithmic framework into more complex problems in the future research.
346
H. Zhang, Q. Guo, and C.S. Iliopoulos
References 1. Abrahamson, K.: Generalized string matching. SIAM Journal of Computing 16, 1039–1051 (1987) 2. Amir, A., Chencinski, E., Iliopoulos, C.S., Zhang, H.: A General Algorithmic Framework for Weighted Matching with a Given Fixed Probability. In: The 2nd Haifa Annual International Stringologyogy, Research Workshop of the Israeli Science Foundation, Israel (2005) 3. Boyer, R.S., Moore, J.S.: A fast string searching algorithm. Communications of ACM 20(10), 762–772 (1977) 4. Baeza-Yates, R., Navarro, G.: Faster approximate string matching. Algorithmica 23(2), 127–158 (1999) 5. Christodoulakis, M.: PHD Thesis Regularities on Fixed and Weighted Sequences. King’s College University of London (2005) 6. Christodoulakis, M., Iliopoulos, C.S., Mouchard, L., Tsichlas, K.: Pattern Matching on Weighted Sequences. In: Proc. of the Algorithms and Computational Methods for Biochemical and Evolutionary Networks (CompBioNets), pp. 17–30 (2004) 7. Charras, C., Lecroq, T.: Handbook of Exact string Matching Algorithms. King’s College London Publications, London (2004) 8. Fischer, M., Paterson, M.: String Matching and Other Products. In: Complexity of Computation SIAM-AMS Proceedings, pp. 113–125 (1974) 9. Gusfield, D.: Algorithms on Strings, Trees and Sequences: Computer Science and Computational Biology. Cambridge University Press, Cambridge (1997) 10. Iliopoulos, C.S., McHugh, J., Peterlongo, P., Pisanti, N., Rytter, W., Sagot, M.: A First Approach to Finding Common Motifs with Gaps. Int. J. of Foundations of Computer Science (2004) 11. Iliopoulos, C.S., Makris, C., Panagis, Y., Perdikuri, K.: Efficient Algorithms for Handling Molecular Weighted Sequences. In: Proc. of the 3rd IFIP-Theoretical Computer Science, pp. 273–285 (2004) 12. Iliopoulos, C.S., Makris, C., Panagis, Y., Perdikuri, K., Theodoridis, E., Tsakalidis, A.: Efficient Algorithms for Handling Molecular Weighted Sequences. IFIP Theoretical Computer Science 147, 265–278 (2004) 13. Knuth, D.E., Morris, J.H., Pratt, V.R.: Fast Pattern Matching in Strings. SIAM Journal Computing 6(1), 323–350 (1977) 14. Karp, R.M., Rabin, M.O.: Efficient randomized pattern–matching algorithms. IBM Journal on Research Development 31(2), 249–260 (1987) 15. Kurtz, S.: Approximate string searching under weighted edit distance. In: Proc. of the 3rd South American Workshop on String Processing (WSP 1996), pp. 156–170 (1996) 16. Landau, G.M., Viskin, U.: Fast Parallel and Serial Approximate String Matching. Journal of Algorithms 10(2), 157–169 (1989) 17. Smyth, W.F.: Computing Patterns in Strings. Pearson/Addison-Wesley, Harlow (2003) 18. Ukkonen, E., Wood, D.G.M.: Approximate string matching with suffix automata. Algorithmica 10, 353–364 (1993)
Capacitated Confluent Flows: Complexity and Algorithms Daniel Dressler1 and Martin Strehler2 1
TU Berlin, Inst. f. Mathematik, MA 5-2, Str. des 17. Juni 136, 10623 Berlin, Germany [email protected] 2 BTU Cottbus, Mathematisches Institut, Postfach 10 13 44, 03013 Cottbus, Germany [email protected]
Abstract. A flow on a directed network is said to be confluent if the flow uses at most one outgoing arc at each node. Confluent flows arise naturally from destination-based routing. We study the Maximum Confluent Flow Problem (MaxConf) with a single commodity but multiple sources and sinks. Unlike previous results, we consider heterogeneous arc capacities. The supplies and demands of the sources and sinks can also be bounded. We give a pseudo-polynomial time algorithm and an FPTAS for graphs with constant treewidth. Somewhat surprisingly, MaxConf is NP-hard even on trees, so these algorithms are, in a sense, best possible. We also show that it is NP-complete to approximate MaxConf better than 3/2 on general graphs. Keywords: approximation algorithm, confluent flow, network flow, routing, treewidth.
1
Introduction
Flows have been a major planning tool ever since Ford and Fulkerson [1] studied them. The basic Maximum (Splittable) Flow Problem is computationally easy and well understood [2]. However, many applications call for flows with restricted structures and optimizing these often leads to NP-hard problems. One well-known example are unsplittable flows [3]. Here, the flow from each source must travel along a single path to the sink, while normally a flow could split into many paths. A confluent flow takes this one step further: At every vertex, all flow traveling through the vertex must leave along one arc. This leads to a forest of flowcarrying arcs pointing towards the sinks. In particular, every confluent flow is unsplittable, but the reverse does not hold in general. Confluent flows can occur in many contexts, with the prime example being destination-based routing: Whenever a node decides where to route a packet based solely on the destination of the packet, all packets to the same destination converge in a tree-like pattern. This is a common property of many routing schemes in telecommunications. While this simplifies the packet forwarding, T. Calamoneri and J. Diaz (Eds.): CIAC 2010, LNCS 6078, pp. 347–358, 2010. c Springer-Verlag Berlin Heidelberg 2010
348
D. Dressler and M. Strehler
managing the protocols that determine the best next hop in a changing network is the hard part [4]. Destination-based routing is also used in railway logistics [5] and even emergency exit signs can be interpreted that way. Furthermore, certain virtual private network design problems always admit a flow-carrying tree as the optimum solution [6]. In this article, we consider the Maximum Confluent Flow Problem (denoted MaxConf), where the goal is to send the maximum amount of flow from the sources to the sinks in a confluent way. The notable difference to previous works is that the flow has to obey heterogeneous arc capacities. Consequently, not all supplies may be routable. Furthermore, the sources and sinks may have upper bounds on their supplies or demands. 1.1
Related Work
Even though confluent flows appear in many applications, there is little mathematical literature discussing the basic underlying problems. Chen et al. [7,8] introduce confluent flows and study the objective of minimizing the maximum node congestion (i.e., the maximum flow into a node, which always occurs at a sink). They derive a powerful inapproximability result and also derive an almost matching approximation algorithm. Furthermore, the authors consider a maximum flow variant, where each vertex must sent exactly 0 or its supply, and give a 13.29-approximation. All of this is effectively for uniform capacities and the authors list heterogeneous capacities among their open problems. Similarly to the node congestion problems, network design problems usually adjust the capacities of the edges to route all demands and minimize the costs of the edges. Thus, while there are many algorithmic results for these, their objective is quite different from the MaxConf. As we use dynamic programming in our approach, let us refer to Bodlaender’s compact introduction to dynamic programming on graphs with bounded treewidth [9]. 1.2
Our Results
We present a pseudo-polynomial time algorithm for MaxConf for graphs with bounded treewidth. We also derive an FPTAS in that case, i.e., a (1 − ε)approximation algorithm with a running time polynomial in the input and 1/ε. We match this with a complexity result, implying that the problem is weakly NP-hard on graphs with bounded treewidth. We show that MaxConf on general graphs cannot be approximated within a factor of 3/2 − ε unless P = N P. 1.3
Overview of the Paper
Section 2 fixes the notation. Section 3 summarizes the basic properties and complexity results. Section 4 formally defines tree decompositions, which allows us to explain the main idea behind the algorithm in Section 5. Then the core algorithm is developed in Section 6, with Section 7 showing the main results. Note that the more technical proofs are omitted due to space constraints.
Capacitated Confluent Flows: Complexity and Algorithms
2
349
Preliminaries
Let G = (V, A) denote a directed graph without multiple arcs or loops. We use A(G) to denote the arc set of a graph. For V ⊆ V , let G[V ] denote the subgraph of G induced by V and let A[V ] := A(G[V ]). For v ∈ V let δ + (v) := {(u, w) ∈ A : u = v} and δ − (v) := {(w, u) ∈ A : u = v} be the outgoing and incoming arcs of v, respectively. Let F (V ) be the family of sets F ⊆ A[V ] such that |F ∩ δ + (v)| ≤ 1 for all v ∈ V . Definition 1 (Instance). An instance of a flow problem consists of a directed graph G = (V, A), a capacity function u : A → N0 , a set of sinks T ⊆ V with sink capacities c : T → N0 ∪{∞}, and upper bounds on the supplies d : V → N0 ∪{∞}. The vertices S := {v ∈ V : d(v) > 0} are called sources and we assume S∩T = ∅. Definition 2 (Flow). Given an instance, a flow is a function x : A → R with 0 ≤ x(a) ≤ u(a) for all a ∈ A. A flow is integral if it has only integral values. The inflow and outflow of a flow x at a given node v are inflowx (v) := a∈δ− (v) x(a) and outflowx (v) := a∈δ+ (v) x(a). Let balx (v) := outflowx (v)−inflowx (v) be the balance of a node. A flow x is an S-T -flow if it satisfies the flow conservation constraint 0 ≤ bal(v) ≤ d(v) for all v ∈ V \ T and −balx (t) ≤ c(t) for all t ∈ T . The value of an S-T -flow is val(x) := − t∈T bal(t) (as we assume d(t) = 0 ∀t ∈ T ). Definition 3 (Confluent flow). Given an instance and a flow x, let Fx := {(v, w) ∈ A : x(v, w) > 0} be the set of flow-carrying arcs. A flow x is called nearly confluent if Fx ∈ F(V ) and Fx ∩ δ + (t) = ∅ for all t ∈ T . A nearly confluent flow x is called confluent if Fx contains no directed cycle. Now we can formally define MaxConf. Problem 1 (MaxConf ). Input: An instance G, u, d, S, T and c. Output: The maximum flow value over all confluent S-T -flows.
3
Understanding the Problem
First consider a nearly confluent flow x and the set of used arcs Fx . This set may contain directed cycles. However, there is no undirected cycle in Fx that is not a directed cycle as well, because it would contain a vertex with two outgoing arcs, which is not allowed in Fx . The flow caught in a directed cycle can never contribute to the flow value because sinks have no outgoing arcs and cannot lie on such a cycle. So the maximum value of a nearly confluent S-T -flow also solves the MaxConf problem. If x is indeed a confluent flow, then it cannot contain directed cycles, either. the sinks. In any case, the flow Thus, Fx is always a forest pointing towards value of a (nearly) confluent flow simplifies to t∈T inflowx (t), because no flow may leave the sink.
350
D. Dressler and M. Strehler
It is a helpful observation that for integral input data, there is always an integral maximum confluent S-T -flow x. If x is not integral, one can consider the basic maximum (splittable) S-T -flow on Fx instead, which can be chosen integral. It is confluent and has equal value. The same applies to nearly confluent flows. We further assume that G is a simple directed graph with no loops or parallel arcs. This does not impose any real restriction on the graph: Loops can never contribute to a solution and all but the one parallel arc with the highest capacity are redundant. Finally, one can also model undirected graphs by using two antiparallel arcs, because the resulting 2-cycles do not affect the solution, either. Let us now fix the decision version of MaxConf to discuss its hardness: “Given an instance G, u, d, S, T and c, is there a confluent S-T -flow with value at least f ?”. Chen et al. [8] study a variant of this problem where the objective is to minimize the node congestion, i.e. the maximum flow arriving at one of the sinks. One can use MaxConf to model the decision version of their problem using sink capacities, but their inapproximability within a factor of 12 lg |T | − ε does not carry over. The crucial problem is that in the congestion case all demands are satisfied proportionally. As long as this proportion is 1, i.e., all flow must arrive at the sinks, the MaxConf problem behaves the same. For lower values, MaxConf does not enforce any proportion at all. Furthermore, their demand maximization variant, an “all-or-nothing flow”, cannot be approximated within a factor of 2 − ε. But for MaxConf the supplies at the sources may be satisfied partially and thus this result does not carry over, either. However, we still obtain the following complexity results. The latter two also carry over to undirected graphs. Theorem 1. 1. Approximating MaxConf on general graphs within a factor of 3/2 − ε is NP-hard. 2. MaxConf is NP-hard if G is a directed tree and all source and sink capacities are infinite. 3. MaxConf with a single sink is NP-hard on planar graphs with treewidth 2 (cf. Section 4 for the definition of treewidth). Proof. 1. One can model the k-Disjoint Paths Problem as a confluent flow: Given a directed graph G with k terminal pairs (s1 , t1 ), . . . , (sk , tk ), are there k node-disjoint paths that connect the corresponding terminals? Even for k = 2, this problem is strongly NP-complete [10]. It can be modelled as a MaxConf on the same graph with arc capacities u ≡ 2, Each source si , i ∈ {1, 2}, has supply d(si ) := i and each sink ti has capacity c(ti ) := i. The maximum flow value is 3 if and only if the two disjoint paths exist, because whenever two paths meet, one sink cannot be used at all. Otherwise, the optimum value is at most 2. 2. We reduce the weakly N P -complete Partition problem [11] to the decision version of MaxConf. An instance to Partition consists of n natural numbers d1 , . . . , dn with D := ni=1 d i and the question is, whether there is a subset P ⊆ {1, . . . , n} such that i∈P di = D/2. The input graph for MaxConf is described in Figure 1, with infinite supplies at all si and 0
Capacitated Confluent Flows: Complexity and Algorithms
351
otherwise. The sinks T = {t1 , . . . , tn , t∗ } also have infinite capacities. The arc capacities are given in the figure.
s1
2d1 2d2 t∗
D
v
2dn
s2
d1 d2
t1 t2
·
·
·
·
sn
dn
tn
Fig. 1. The graph to model the Partition instance
We claim that the solution to MaxConf is at least f := 32 D if and only if the Partition instance is a yes-instance. We can identify P ⊆ {1, . . . , n} with the sources sending to t∗ in an optimum solution. Let z := i∈P di . Then the value of the flow is min{2z, D} + (D − z), which attains its unique maximum 32 D at z = D/2. Thus, the optimum value is 32 D if and only if a partition exists. 3. Note that in the last proof we can identify all of T with t∗ . This yields a planar graph that has treewidth 2 with only one sink.
4
Tree Decompositions
This discouraging result leads to an examination of special graph classes. Our dynamic program uses the special structure of graphs with bounded treewidth to solve MaxConf. Using the underlying tree structure of a graph one can solve the MaxConf problem in a bottom-up strategy from the “leaves” to the “root”. For defining treewidth, we follow Bodlaender [9]. In our case, the treewidth of a directed graph only depends on the underlying undirected graph with edge set E := {{v, w} : (v, w) ∈ A}, so the following definitions deal with undirected graphs. Johnson et al. [12] also give a generalization of treewidth to directed graphs, but it leads to the same results in the case that all reverse arcs are assumed to be in G as well. Definition 4 (Tree decomposition). Let G = (V, E) be an undirected graph. A tree decomposition of G is a tree (I, T ) on some new node set I with edges T , and a family of sets Bi ⊆ V for i ∈ I. The following three properties must hold: 1. i∈I Bi = V ; 2. for every edge {u, v} ∈ E, there is an i ∈ I with {u, v} ⊆ Bi ; 3. for all i, j, k ∈ I, if j lies on the unique path between i and k in (I, T ), then Bi ∩ Bk ⊆ Bj .
352
D. Dressler and M. Strehler
Each Bi is called a bag. The width of a tree decomposition is maxi∈I |Bi | − 1. The treewidth of G is the minimum k such that G has a tree decomposition of width k. The following additional requirements reduce the number of cases that have to be considered by the algorithm. Similar conditions are often used. Definition 5 (Nice tree decomposition). Let (I, T ) with {Bi : i ∈ I} be a tree decomposition of G = (V, E) and denote a vertex t ∈ V . Then this tree decomposition is called nice if (I, T ) is a binary tree for some root r, satisfying the following additional properties: 4. If a node i ∈ I has two children j, k ∈ I, then Bi = Bj = Bk . In this case, i is called a Join node. 5. If a node i ∈ I has one child j, then one of the following must hold: (a) |Bi | = |Bj | − 1 and Bi ⊆ Bj . Then i is called a Forget node. (b) |Bi | = |Bj | + 1 and Bj ⊆ Bi . Then i is called an Introduce node. 6. |Bi | = 1 holds for all leaves i of (I, T ). Such an i is called a Leaf node. 7. Br = {t} holds. Determining the treewidth of a graph is NP-hard. However, if the treewidth is bounded by a constant k, many related problems can be solved in polynomial or even linear time. In particular, one can check in linear time whether a graph has treewidth at most k. One can also construct a tree decomposition with width k in linear time, if it exists. However, in all cases the hidden factors are large and grow quickly with k. See [9] for an overview of fast algorithms. Lemma 1. Let G = (V, E) be a graph of treewidth k and t ∈ V an arbitrary node. Then G has a nice tree decomposition (I, T ) of the same width with root r such that Br = {t} and it can be constructed in linear time, assuming that k is constant. Furthermore, the number of nodes in I is polynomially bounded in the size of G. Proof. We assume a tree decomposition of polynomial size is given and make it “nice”. Showing that the result remains a tree decomposition of G mostly revolves around condition 3 from above. An equivalent condition requires that the nodes containing a given vertex v in their bags must form a connected component of (I, T ). This condition can be easily checked because we will only modify the tree locally. First, we choose an arbitrary node r with t ∈ Br and orient the tree towards r . If |Br | > 1, we introduce a new node r above r that becomes the real root with Br = {t}. If |Br | = 1, no such additional step is needed. Next we want to obtain a binary tree. We we replace any node i ∈ I with p > 2 children by a binary tree (I , T ) with p leaves and all nodes i ∈ I are associated with the vertex set Bi . The p children of i are then connected to the p children of the new binary tree (I , T ). Note that the replacement binary tree can be chosen such that |I | ≤ 2p − 1. Thus, all such replacements can only double the size of the entire tree.
Capacitated Confluent Flows: Complexity and Algorithms
353
It is easy to see that leaves with empty bags may be deleted. Now consider a leaf i with |Bi | > 1. We simply add a new child node to it with a bag containing only one vertex out of Bi . Notice that a single edge {i, k} in the tree (I, T ) can be subdivided easily as long as the new node j between i and k has a bag satisfying Bi ∩ Bk ⊆ Bj ⊆ Bi ∪ Bk . So if i is a father of k that does not satisfy the bag size restrictions of a nice tree decomposition, this allows us to first introduce a node j with Bj = Bi ∩ Bk inbetween, and then “forget” all vertices in Bi \ Bj one by one in further subdivisions of the edge {i, j}. Proceeding from j downwards, we can then “introduce” all vertices in Bk \ Bj in subdivisions of {j, k}. For a Join node i it might actually be necessary to introduce one more subdivision to first obtain a child with the exact same bag Bi . The number of steps needed for each sequence of subdivisions is clearly bounded in |V |, giving a tree decomposition still with a polynomial number of nodes. Since we never use a bag larger than max{|Bi |, |Bk |}, the treewidth does not increase. It only remains to contract edges where both ends have outdegree one and identical associated bags.
5
The Dynamic Programming Table
We now explain the overall structure of our dynamic program for solving the MaxConf problem. First, one preprocesses the instance of MaxConf to obtain one with finite supplies d and a single uncapacitated sink t. Then one determines a nice tree decomposition with t in the root bag. Such a tree decomposition has the useful property that each bag Bi of a node i separates the sink from the subgraph of G induced by all bags Bj of nodes j in the subtree of i (the so-called bagend ). One can then compute suitable representations of all possible flows on each bagend, starting at the Leafs and working towards the root. Having done so, it just remains to read off the maximum flow value at the root node. Definition 6 (Bagend). Given a nice tree decomposition (I, T ) and i ∈ I, the bagend Gi is the subgraph of G induced by the union of Bi and all Bj for j in the subtree rooted at i. The bags and bagends of a nice tree decomposition change towards the sink in an orderly fashion, so this really suggests a dynamic programming approach. However, one has to carefully choose representatives for the flows on each bagend Gi , while keeping enough information to develop the values for the next bag from these. The main trick to make such a representation work is the following: The moment a vertex is first considered, one fixes the amount of flow that this vertex sends out. This is what we will call the estimated outflow d+ (v). Of course, in a dynamic program we can try all possible integer values for each vertex (up to a reasonable bound U ) and later on delete those combinations that turn out to be infeasible. Flow conservation requires that a vertex cannot send more flow than it receives (including its own supply), but when a vertex is first examined, it is not clear how much flow will eventually enter this vertex. Thus, flow conservation cannot
354
D. Dressler and M. Strehler
be established immediately. Instead, we track how much more flow must reach a vertex in its balance deficit, which we denote by d− (v). The supply d(v) does not come into play until the very last moment when a vertex leaves the currently considered bag. The main advantage of fixing the estimated outflow is that we can locally manipulate the set of flow-carrying arcs. For example, if a vertex v uses no outgoing arc so far and we want to send the flow along (v, w), we can simply do so without triggering a chain reaction of increasing flow along the path that these flow units take. Indeed, such a path could lead into “uncharted territory” of the graph, which would make tracking the changes even harder. Instead, we simply update the balance deficit d− (w) of the receiving vertex. We also need to keep track of some structural information for each Bi , the most obvious being the set of used arcs F ⊆ A[Bi ], which coupled with d+ imply the actual flow on A[Bi ]. On a very abstract level, one could misleadingly think of the following idea: a tree-like flow on a tree-like graph structure pointing towards the sink should only flow in the same direction as the underlying tree decomposition. However, this turns out to be wrong, and the optimum flow may send flow back and forth between Bi , the rest of the bagend Gi \ Bi and the part with the sink G \ Gi . The implication is that we have to remember whether a vertex has an outgoing arc at all, because this might not be clear from F , if a flow-carrying outgoing arc points to an already “forgotten” vertex (an already processed vertex in G \ Bi ). For this, each vertex v ∈ Bi is assigned one of two states: z(v) ∈ {free, nonfree}. The state nonfree denotes a vertex that already has an outgoing arc and satisfies the balance condition as if it had supply equal to its balance deficit d− (v). Vertices in the other state free resemble sinks, which is why they must have no outgoing arcs yet. These free vertices act as temporary storage. The estimated outflow d+ (v) for a free vertex v means how much flow it could possibly send. All of this culminates in the following table for each bag Bi : Definition 7 (Table). Let G = (V, A) be a graph with arc capacities u : A → N0 , supplies d : V → N0 and an uncapacitated sink t. Assume that δ + (t) = ∅ and that U ∈ N0 is an upper bound on MaxConf for this instance. Let (I, T ) and (Bi )i∈I be a nice tree decomposition of G. For i ∈ I, let T ABLE(i) be defined as the set containing exactly the elements (F, z, d− , d+ ) with F ∈ F(Bi ), z ∈ {free, nonfree}Bi , d− ∈ {0, 1, . . . , U }Bi , d+ ∈ {0, 1, . . . , U }Bi for which there is an integral nearly confluent flow x in Gi with the following properties: 1. 2. 3. 4. 5.
a ∈ F ⇐⇒ x(a) > 0 ∀a ∈ A[Bi ] ∀v ∈ Bi d+ (v) = inflowx (v) + d− (v) outflowx (v) = 0 ⇐⇒ z(v) = free ∀v ∈ Bi d+ (v) = outflowx (v) ∀v ∈ Bi : z(v) = nonfree 0 ≤ bal(v) ≤ d(v) ∀v ∈ Gi \ Bi .
For brevity, we use SET (i) := F (Bi ) × {free, nonfree}Bi × {0, 1, . . . , U }Bi × {0, 1, . . . , U }Bi to denote the domain of T ABLE(i).
Capacitated Confluent Flows: Complexity and Algorithms
355
Please note that given a nearly confluent flow x on the bagend Gi and some (F, z, d− , d+ ), it is easy to check whether they match. However, x does not necessarily determine a unique entry in T ABLE(i). For a free vertex v, the flow only determines the difference d+ (v)−d− (v) = inflowx (v) by condition 2, not the absolute values. For a nonfree vertex, condition 4 eliminates any ambiguity.
6
Computing the Tables
For computing the entries of the T ABLE(i) out of the tables of the children of i, algorithms that address the four classes of nodes Leaf, Introduce, Join, and Forget are needed. One has to ensure, that the flow values are calculated correctly, and to proof, that all entries can be derived in this way. Due to space limitations we omit the very technical lemmata and lengthy proofs here. They can be found in the full version of this paper. Exemplarily, we present the easiest case of calculating T ABLE(i) of a Leaf node, which only contains one vertex and cannot contain any arcs at all. Lemma 2. Let i ∈ I be a Leaf node. Then T ABLE(i) = {(∅, (free), (f ), (f )) : 0 ≤ f ≤ U }. Proof. If i is a Leaf in T , then Bi = {v} by definition. Since Gi is just a single vertex, A(Gi ) is empty. We show the equality by showing both inclusions. “⊇”: Let 0 ≤ f ≤ U . To show that (∅, (free), (f ), (f )) is in T ABLE(i) we have to give some nearly confluent flow x and then check the conditions for T ABLE(i) given in Definition 7. Since A(Gi ) = ∅, this flow x is a function on an empty set and thus there is no choice to be made. It is also trivially a nearly confluent flow. Note that ∅ is the set of flow-carrying arcs of A(Gi ), as required by condition 1. Also, d+ (v) = f = d− (v) and inflowx (v) = 0, so condition 2 is satisfied. Since outflowx (v) = 0, we set z(v) = free in concordance with condition 3. Finally, there are no nonfree vertices in this bag and no vertices in the empty set Gi \ Bi , either, so conditions 4 and 5 are trivially satisfied. “⊆”: Now let (F, z, d− , d+ ) ∈ T ABLE(i) and let x be a corresponding nearly confluent flow on Gi . (Again, x is defined on the empty set A(Gi ).) Since F ⊆ A(Gi ) = ∅, we know F = ∅. Also, inflowx (v) = 0 which, combined with condition 2, implies d+ (v) = d− (v) =: f ∈ {0, 1, . . . , U }. Finally, condition 3 implies z(v) = free. Thus, every entry must have the form (∅, (free), (f ), (f )) as claimed and this concludes the proof.
The remaining types of nodes require a much more complex handling. We just sketch the basic ideas here. Introduce nodes are algorithmically handled in two steps. First, the new vertex v is added to the bag as a free vertex without any flow entering or leaving it. Afterwards we can designate some of the arcs incident to v to carry flow to or from v, say along (w, w ). This must change the state of w to nonfree and affects the balance of the receiving vertex w . Of course, one needs to ensure that the arc capacity is not exceeded and that the receiving vertex actually requires that much additional incoming flow, i.e. d+ (w) ≤ min{u(w, w ), d− (w )} must hold.
356
D. Dressler and M. Strehler
For a Join node i with children j and k, we “sum” selected entries of T ABLE(j) and T ABLE(k) in such a way, that one of the children carries no flow at all on the bag Bi = Bj = Bk . Note, that the bagends Gj and Gk are disjoint elsewhere. Thus, we do not have to worry about exceeding capacities there, or changing the already fixed value d+ . It remains to describe the process for Forget nodes. In this case, the vertex v that leaves the bag suddenly needs to satisfy any remaining imbalance d− (v) with its own supply d(v), if it uses an outgoing arc at all. Otherwise, it should not try to send any flow. Armed with algorithms for the four node classes, one can then formulate a dynamic program that computes all tables, represented as arrays containing 2 |SET (i)| ∈ O(2(k+1) 2k+1 U 2(k+1) ) = O(U 2k+2 ) bits. Thus, we obtain the following theorem: Theorem 2. There is an algorithm that given a nice tree decomposition (I, T ) computes all tables correctly and runs in time polynomial in |I| and U , assuming that the width k of (I, T ) is constant.
7
Main Results
We can now apply Theorem 2 to solve the MaxConf problem as follows. Theorem 3. MaxConf on graphs with treewidth bounded by some constant k can be solved in pseudo-polynomial time. Proof. Consider an instance G = (V, A), u, d, S, T and c. It is assumed that the treewidth of G is at most k. W.l.o.g. we can assume that no vertex has larger supply than it could send to a sink by itself. This can be assured in polynomial time by solving the Bottleneck Shortest Path problem, e.g., with a modified Dijkstra’s algorithm (cf. [13]). In particular, these values are finite. First we preprocess the instance to obtain a graph G with a single supersink ∗ ∗ t : Remove all arcs leaving the sinks. Then add a supersink t and connect each ∗ old sink t to it by an arc (t, t ) with capacity min{c(t), (v,t)∈A u(v, t)}. The supersink has infinite sink capacity and no supply, while the old sinks T now become normal vertices, i.e. T = {t∗ }. Notice that this preprocessing does not change the solution of MaxConf. Also, the treewidth of this new instance is at most k + 1 because a tree decomposition of G can be turned into a tree decomposition of G by adding t∗ to every bag. Next we compute a nice tree decomposition of G with width at most k + 1 and with polynomially many nodes, as described in Lemma 1. Finally, we run the dynamic program from Theorem 2 on the modified instance with U := ∗ v∈V d(v) to compute T ABLE(r) for Br = {t }. Note that the overall running time is pseudo-polynomial in the size of G. We claim that the solution is the maximum value f ∈ {0, 1, . . . , U } such that (∅, (free), (0), (f )) ∈ T ABLE(r). This value can be extracted from the table easily. To see that it is indeed the solution, first recall that the maximum
Capacitated Confluent Flows: Complexity and Algorithms
357
value of a nearly confluent S-T -flow is the same as the maximum value of a confluent S-T -flow. Note that Gr = G and that every nearly confluent S-T flow x induces an entry in T ABLE(r) of the form (∅, (free), (0), (balx (t∗ ))). On the other hand, all table entries of this kind correspond to a nearly confluent flow x which satisfies the flow conservation constraint in every vertex except t∗ . Since d− (t∗ ) = 0, we have d+ (t∗ ) = inflowx (t∗ ) and outflowx (t∗ ) = 0 because z(t∗ ) = free, so the value of the flow must be equal to d+ (t∗ ).
Even better, this yields an FPTAS for MaxConf. Theorem 4. MaxConf on graphs with |V | nodes and treewidth bounded by some constant k can be approximated to a factor of (1 − ε) for any ε > 0 in time polynomial in |V | and 1/ε. Proof. Again the input is G = (V, A), u, d, T and c and we assume that the supplies d are all individually routable. We first have to bound the value f ∗ ∗ of an optimal solution. With dmax := maxv∈V d(v), we obtain dmax ≤ f ≤ v∈V d(v) ≤ |V |dmax =: U . We will use a simple rounding scheme to obtain the approximation. Let ε := ε/|V |2 and round down all numerical values to multiples of ε U . Call these new values u ˜, d˜ and c˜. For example, u ˜(a) := u(a) ε U ε U . If we further scale the instance
by (ε U )−1 , we obtain integral values between 0 and 1/ε. We run the algorithm to solve this scaled down integral instance. Theorem 3 shows thatthe running ˜ ˜ := (ε U )−1 time is polynomial in the size of the graph and U v∈V d(v) ∈ 3 O(|V |/ε ) = O(|V | /ε). Thus, this is a polynomial time algorithm overall. Let f denote the optimum value of the rounded instance scaled back to the original range by a factor of ε U . (The optimum value scales with the parameters.) We need to show f ≥ (1 − ε)f ∗ to conclude this proof. Consider a confluent S-T -flow x with value f ∗ for the original instance. Standard flow theory tells us that we can decompose it into at most |Fx | ≤ |V | paths P ∈ P carrying flow from the sources to the sinks. (Cycles cannot occur in Fx .) We denote the flow on each path with x(P ), and P ∈P x(P ) = f ∗ must hold. Rounding the flow on each path to x ˜(P ) :=
x(P ) ε U
ε U yields a path decompo-
sition of a new flow x˜ where all flow values are multiples of ε U . Rounding down individual paths results in a larger loss due to rounding than for d, u or c, so x ˜ obeys all rounded capacities. Thus, x ˜ is a confluent S-T -flow that is feasible ) ˜(P ) ≥ ε U P ∈P ( x(P in the rounded instance and has value P ∈P x ε U − 1) = ∗ f − |V |ε U . Since f is the optimum value of a feasible flow in the rounded instance, it follows that f ≥ val(˜ x) ≥ f ∗ − |V |ε U . ∗ Recalling the bounds on f , we obtain f ≥ f ∗ − |V |ε U = f ∗ − |V |2 ε dmax = ∗ f − εdmax ≥ f ∗ − εf ∗ = (1 − ε)f ∗ as claimed.
As usual, backtracking in the dynamic program provides the actual flow as well for both algorithms. Note that it is also possible to modify the exact dynamic program in order to handle, e.g., lower capacities on arcs or all-or-nothing flows. However, since the accuracy of the rounded instance is limited, these conditions only carry over in an O(ε)-precise way to the approximation algorithm.
358
D. Dressler and M. Strehler
References 1. Ford, L.R., Fulkerson, D.R.: Maximal flow through a network. Canadian Journal of Mathematics 8, 399–404 (1956) 2. Ahuja, R.K., Magnanti, T.L., Orlin, J.B.: Network Flows: Theory, Algorithms, and Applications. Prentice-Hall, Englewood Cliffs (1993) 3. Kleinberg, J.M.: Single-source unsplittable flow. In: 37th Annual Symposium on Foundations of Computer Science, pp. 68–77 (1996) 4. Bley, A.: Routing and Capacity Optimization for IP Networks. PhD thesis, TU Berlin (2007) 5. F¨ ugenschuh, A., Homfeld, H., Schuelldorf, H.: Routing cars in rail freight service. Dagstuhl Seminar Proceedings, vol. 09261, Dagstuhl, Germany (2009) 6. Goyal, N., Olver, N., Shepherd, F.B.: The VPN conjecture is true. In: STOC 2008: Proceedings of the 40th annual ACM symposium on Theory of computing, pp. 443–450. ACM, New York (2008) 7. Chen, J., Rajaraman, R., Sundaram, R.: Meet and merge: approximation algorithms for confluent flows. J. Comput. Syst. Sci. 72, 468–489 (2006) 8. Chen, J., Kleinberg, R.D., Lov´ asz, L., Rajaraman, R., Sundaram, R., Vetta, A.: (Almost) tight bounds and existence theorems for single-commodity confluent flows. J. ACM 54, 16 (2007) 9. Bodlaender, H.: Treewidth: Algorithmic techniques and results. In: Privara, I., Ruˇziˇcka, P. (eds.) MFCS 1997. LNCS, vol. 1295, pp. 29–36. Springer, Heidelberg (1997) 10. Fortune, S., Hopcroft, J., Wyllie, J.: The directed subgraph homeomorphism problem. Theoretical Computer Science 10, 111–121 (1980) 11. Garey, M.R., Johnson, D.S.: Computers and Intractability, A Guide to the Theory of NP-Completeness. W.H. Freeman and Company, New York (1979) 12. Johnson, T., Robertson, N., Seymour, P.D., Thomas, R.: Directed tree-width. Journal of Combinatorial Theory, Series B 82, 138–154 (2001) 13. Kaibel, V., Peinhardt, M.A.F.: On the bottleneck shortest path problem. Technical Report 06-22, Konrad-Zuse-Zentrum f. Informationstechnik Berlin (2006)
Preprocessing Speed-Up Techniques Is Hard Reinhard Bauer, Tobias Columbus, Bastian Katz, Marcus Krug, and Dorothea Wagner Faculty of Informatics, Karlsruhe Institute of Technology (KIT) {Reinhard.Bauer,Bastian.Katz,Marcus.Krug,Dorothea.Wagner}@kit.edu, [email protected]
Abstract. During the last years, preprocessing-based techniques have been developed to compute shortest paths between two given points in a road network. These speed-up techniques make the computation a matter of microseconds even on huge networks. While there is a vast amount of experimental work in the field, there is still large demand on theoretical foundations. The preprocessing phases of most speed-up techniques leave open some degree of freedom which, in practice, is filled in a heuristical fashion. Thus, for a given speed-up technique, the problem arises of how to fill the according degree of freedom optimally. Until now, the complexity status of these problems was unknown. In this work, we answer this question by showing NP-hardness for the recent techniques.
1
Introduction
Computing shortest paths in graphs is used in many real-world applications like route-planning in road networks or for finding good connections in railway timetable information systems. In general, Dijkstra’s algorithm computes a shortest path between a given source and a given target. Unfortunately, the algorithm is slow on huge datasets. Therefore, it cannot be directly used for applications like car navigation systems or online working route-planners that require an instant answer of a source-target query. Often, this problem is coped with by dividing the computation of the shortest paths into two stages. In the offline stage, some data is precomputed that is used in the online stage to answer a source-target query heuristically faster than Dijkstra’s algorithm. Such an approach is called a speed-up technique (for Dijkstra’s algorithm). During the last years, speed-up techniques have been developed for road networks (see [1] for an overview), that make the shortest path computation a matter of microseconds even on huge road networks consisting of millions of nodes and edges. Usually, the offline stage leaves open some degree of freedom, like the choice of how to partition a graph or of how to order a set of nodes. The decision taken to fill the respective degree of freedom has direct impact on the search space of the online stage and therefore on the runtime of a query. Currently,
Partially supported by the DFG (project WAG54/16-1).
T. Calamoneri and J. Diaz (Eds.): CIAC 2010, LNCS 6078, pp. 359–370, 2010. c Springer-Verlag Berlin Heidelberg 2010
360
R. Bauer et al.
these decisions are made in a purely heuristical fashion. A common trade-off is between preprocessing time/space and query time/search space. In this paper we show the NP-hardness of preprocessing the offline stage such that the average search space of the query becomes optimal. For each technique, we demand that the size of the preprocessed data should be bounded by a given parameter. This model is used because practitioners in the field usually compare their results by absolute query times, size of the search space, size of preprocessing and time needed for the preprocessing. In practice, the basic technique can be enriched by various heuristic improvements. We will not consider such improvements and stick to the basic core of each technique. This implies that, for the sake of simplicity, some techniques are slightly altered. The techniques considered are ALT [2], Arc-Flags [3,4], SHARC [5], Highway Node Routing / Multilevel-Overlay Graph [6,7,8] and Contraction Hierarchies [9]. We left out Geometric Containers [10,11], Highway Hierarchies [12,13] and Reach-Based Pruning [14,15,16] as their offline stage only contains tuning parameters but no real degree of freedom. However, two interesting aspects of Reach-Based Pruning are included. We further did not work on Transit Node Routing [17,18] as this is a framework for which also parts of the query-algorithm are to be specified. Related Work. There is a huge amount of work on speed-up techniques. An overview on experimental work can be found in [1]. There is large demand on a theoretical foundation for the field and there exists only few theoretical work: In [19] results are given for a problem that is related to the technique of inserting shortcuts to the underlying graph. Recently, a graph-generator for road networks was given [20] and it is shown that graphs evolving from that generator possess a property called low highway dimension. For graphs with this property, a special preprocessing technique is proposed and runtime guarantees for Reach-Based Routing, Contraction Hierarchies, Transit Node Routing and Sharc using that preprocessing technique are given.
2
Preliminaries
Some proofs have been omitted due to space restrictions. These proofs can be found in [21]. Throughout the work G = (V, E, len) denotes a directed weighted graph with n nodes, m edges and positive length function len : E → + . Given an edge (u, v) we call u the source node and v the target node of (u, v). Further, (u, v) is an incoming edge of v and an outgoing edge of u. With G we denote the reverse graph, i.e. the graph (V, {(v, u) | (u, v) ∈ E}). A path P from x1 to xk in G is a finite sequence x1 , x2 , . . . , xk of nodes such that (xi , xi+1 ) ∈ E, i = 1, . . . , k − 1. The length of a path P in G is the sum of the length of all edges in P . A shortest path between nodes s and t is a path from s to t with minimum length.
Preprocessing Speed-Up Techniques Is Hard
361
Given two nodes s and t, the distance dist(s, t) from s to t is the length of a shortest path between s and t and infinity if no s-t-path exists. Dijkstra’s algorithm. Given a graph G = (V, E) with length function len : E → + and a root s ∈ V , Dijkstra’s algorithm finds the distances from s to all nodes in the graph. For each node v in the graph, the algorithm maintains a status marker, indicating exactly one of the states unvisited, visited or settled and a distance label d(v). A min-based priority queue Q is provided that contains all visited nodes, keyed by the distance label. Each node v is initialized to be unvisited and d(v) is set to be infinity. Then, d(s) is set to be 0, s is set to be visited and inserted into Q. While there are visited nodes, the algorithm extracts one node v with minimal distance label from Q, marks v as finished and relaxes all of its outgoing edges (v, w). An edge (v, w) is relaxed as follows: If d(w) ≤ d(v) + len(v, w) nothing is to be done. Otherwise d(w) is set to be d(v) + len(v, w). If w is already visited, its priority in the queue is updated, otherwise it is marked as visited and inserted into the queue. There are many possibilities to break ties when extracting nodes from the queue. Throughout this work, we additionally identify every node uniquely with an integer between 1 and |V |. Among all nodes with minimal distance in the queue, the smallest integer gets extracted first. In this work we focus on s-t-queries, i.e. queries for which only a shortest s-t is of interest. Hence, the algorithm can break after the node t has been marked as settled. The search-space of the query is the set of nodes, settled up to that point. Bidirectional Search. This approach starts a Dijkstra’s search rooted at s on G (the forward search) and one rooted at t on G (the backward search). Whenever a node has been settled it is to be decided if the algorithm changes to the opposite search. A simple approach is to swap the direction every time a node is settled. The distance balanced bidirectional search changes to the other direction iff the minimal distance label of nodes in the queue is greater than the minimal distance label of nodes in the contrary queue. There are different possible stopping criteria for bidirectional search which get specified for the particular speed-up technique applied. During the run of the algorithm, the tentative distance is min{dist(s, u)+dist(u, t)| u has been settled by both searches}. Finally, dist(s, t) = min{dist(s, v)+dist(v, t)} over all nodes v, that get settled from both directions. The search-space of a bidirectional search is the union of the searchspaces of forward and backward search. We consider the search space to be a multi-set, i.e. when computing the size of the search space we count nodes that get settled in both directions twice. Speed-up techniques. The query of each speed-up technique we consider is either a modified Dijkstra’s algorithm or a modified bidirectional search. The output of an s-t-query is dist(s, t). We do not consider extra techniques like pathunpacking (see [1] for a description). For a given technique, we write VF (s, t) for the size of the search space of an s-t-query when choosing F to fill the particular degree of freedom.
362
3
R. Bauer et al.
Reach-Based Pruning
Reach is a centrality measure indicating whether a node lies in the middle of a long shortest path. More formally, the reach RP (vi ) of a node vi with respect to a path P = (v1 , . . . , vk ) is min{len(v1 , . . . , vi ), len(vi , . . . , vk )}. The reach R(v) of a node with respect to a graph G is max{P ∈SP | v∈P } RP (v) where SP denotes the set of all shortest paths in G. For ease of notation, we consider a single vertex to be a path of length 0. There exist different variants of how to use reach for pruning the searchspace of a bidirectional Dijkstra’s search, all of them sharing the same main idea. We use the self-bounding query explained later. In practice the approach is mixed with other ingredients like ALT, contraction and the computation of upper bounds for reach-values which we do not consider here. Further, inspired by Contraction Hierarchies we relax the stopping criterion. This has been shown to be reasonable by experimental tests. The reach-query is bidirectional Dijkstra’s algorithm with the following two modifications: First, no stopping criterion is used, hence all vertices reachable from the source get settled. Second, a node v is not settled if R(v) is smaller than its priority in the queue. Note that v can still get visited. We denote by d+ (v) and d− (v) the length of the shortest path from s and to t respectively, found by visiting or settling node v. Finally, dist(s, t) is given by min(d+ (v) + d− (v)) over all nodes v that are visited or settled from both directions. Search-Space Minimal Reach. In case shortest paths are not unique the technique still computes correct distances even if only considering one shortest path for each source-target pair. The Problem MinReach is that of choosing these shortest paths such that the resulting average search-space becomes minimal. More formally, we choose a set P of shortest paths and compute R(v) by max{P ∈P| v∈P } RP (v). We denote by VP (s, t) the search space of the s-t-reachquery using this reach-values for pruning. Problem ( MinReach). Given a graph G = (V, E, len), choose P ⊆ SP such that P contains at least one shortest s-t path for each pair of nodes s, t ∈ V for which there is an s-t-path and such that s,t∈V VP (s, t) is minimal. Theorem 1. Problem MinReach is NP-hard(even for directed acyclic graphs). Proof. We make a reduction from Exact Cover by 3-Sets (X3C). W.l.o.g we may assume c∈C = U . Given an X3C-instance (U, C) with |U | = 3q we construct a MinReach-instance G = (V, E) as follows: V = {a} ∪ C ∪ U where a is an additional vertex. There is an edge (a, c) for each c ∈ C. There is an edge (c, u) ∈ C × U if, and only if u ∈ c. All edge lengths are 1. The construction is polynomial, see Figure 1 for a visualization. It is R(u) = 0 for u ∈ {a} ∪ U . Hence, these nodes only get settled as start nodes from the forward search or as target nodes from the backward search. Given the set P, we denote the search space starting at node z by VP+ (z) and VP− (z) for forward and backward search, respectively. We decompose
Preprocessing Speed-Up Techniques Is Hard
363
a
C
U Fig. 1. Graph G constructed from the X3C-instance {1, 2, 3}, {2, 3, 4}, {3, 4, 6}, {4, 5, 6}
⎛ s,t∈V
⎞
⎜ ⎟ ⎜ ⎟ ⎜ + ⎟ + − − |VP (s, t)| = |V | ⎜|V (a)| + |V (s)| + |V (t)| + |V (t)|⎟ ⎜ ⎟ s∈U∪C t∈U t∈{a}∪C ⎝ ⎠
=|U∪C|
=|C|+1
Claim. There is a set P such that |V | [(1 + q) + |U ∪ C| + |C| + 1 + 2|U |] ≥ s,t∈V VP (s, t) if and only if there is an exact cover for (U, C). “if“: When computing the reach-values of nodes in C we only have to consider paths that start with a and end in U because paths consisting of only one edge do not contribute to reach-values greater than 0. Let C ⊆ C be an exact cover of (U, C). Further let C (u) denote the c ∈ C with u ∈ c . We set P = {(a, C (u), u)| u ∈ U }. Then, for each c ∈ C we have R(c) = 1 if there is a path (a, c, u) in P and R(c) = 0 otherwise. Hence, |V + (a)| = 1 + q and |V − (u)| = 2 for each u ∈ U . This yields the claimed bound. “only if“: Let P ⊆ SP be such that |V | [(1 + q) + |U ∪ C| + |C| + 1 + 2|U |] ≥ s,t∈V VP (s, t). We show that C = {c ∈ C| (a, c, u) ∈ P} is an exact cover of (U, C). As P has to include one shortest a-u path for each u ∈ U we know C covers of U . With the above decomposition of the search-space we know that |V + (a)| + t∈U |V − (t)| ≤ 1 + q + 2|U |. It is V + (a) = {a} ∪ {c ∈ C| R(c) ≥ 1} = {a} ∪ C and, for u ∈ U , V − (u) = {u} ∪ {c ∈ C| R(c) ≥ 1, u ∈ c} = {u} ∪ {c ∈ C| (a, c, u) ∈ P} ≥ 2. Hence |C | ≤ q. External Shortcuts for Reach-Based Pruning. This is an enhancement for reach-based pruning similar to problem ExtShortcutsArcFlags. We assume that, given the input graph G and a parameter k, we are allowed to insert a set S of k shortcuts to G. The resulting graph G is the input of the search technique MinReach and we denote the resulting search-space of an s-t-query by VS (s, t). One can solve the MinReach-part of the preprocessing-phase by a heuristic approach. In that case, one can show the NP-hardness of inserting shortcuts for a wide range of strategies. We show that it is N P -hard to insert the shortcuts even if we are given an oracle that optimally solves problem MinReach in constant time.
364
R. Bauer et al.
Problem ( ExtShortcutsReach). Given a graph G = (V, E, len) and a positive integer k, insert a set S of k shortcuts to G, such that s,t∈V VS (s, t) is minimal. Theorem 2. Problem ExtShortcutsReach is NP-hard (even for directed acyclic graphs and even if there is an oracle that solves Problem MinReach in constant time). Proof. We make a reduction from X3C. Let (U, C) be an instance of X3C with |U | = 3q. W.l.o.g we may assume c∈C = U . We construct an instance (G = (V, E, len), k = q) of ExtShortcutsReach as follows: the set V consists of two nodes c− and c+ for each c ∈ C, one node u for each u ∈ U , one additional node a and an additional set M with |M | to be specified later. There is an edge (c+ , u) with length 2 iff u ∈ c. Further, there are edges (a, c− ) with length 2 and (c− , c+ ) with length 1 for each c ∈ C. Moverover, there is an edge (m, a) with length 1 for each m ∈ M . We set k = q. The transformation is polynomial as |M | will be polynomial in the input size, see Figure 2 for a visualization. M edge length
1 a 2 C− 1 C+ 2 U
Fig. 2. Graph G constructed from the X3C-instance {1, 2, 3}, {2, 3, 4}, {3, 4, 6}, {4, 5, 6}
Given the set S, we denote the search space starting at node z by VS+ (z) and VS− (z) for forward and backward search, respectively. It is R(a) ≤ 1 and R(m) = 0 for m ∈ M . Hence − VS (s, t) = |V | V (z) + V + (z) +|V | (V − (z) +V + (z)) s,t∈V z∈M z∈{a}∪C − ∪C + ∪U =|1|
≤2|{a}∪C − ∪C + ∪U|2
We call a shortcut assignment S set covering if S contains, for each u ∈ U , a shortcut (a, c+ ) such that u ∈ c. Claim. Let S be set-covering. Then P can be chosen such that m∈M VS+ (m) ≤ 2|M |. Let m be in M . It is R(u) = 0 for u ∈ U . Hence V + (m) ∩ U = ∅. Further, for c+ ∈ C + we have R(c+ ) ≤ 2 and dist(m, c+ ) = 4. Hence V + (m) ∩ C + = ∅. As S
Preprocessing Speed-Up Techniques Is Hard
365
is set-covering, we can choose P such that paths starting in M ∪ {a} and ending in U do not to contain a node in C − . If we do so, R(c− ) ≤ 2 < dist(m, c− ) for c− in C − . Hence V + (m) ⊆ {m, a}. ∗ Claim. Assume |M | > k. Let S and u∗ ∈ U be such that ∈ S and such (a, u ) +
∗ + that for all c ∈ C with u ∈ c, we have (a, c )
∈ S . Then m∈M VS (m) ≥ 3|M |.
As |M | > k we have at least one node m ∈ M such that (m , v)
∈ S for all v ∈ V . Hence, (m , a, c− ) is the only shortest path for c− ∈ C and R(a) ≥ 1. Therefore a gets settled from each m ∈ M . Further, a shortest m -u∗ -path starts − − − − with (m , a, c− ∗ ) for a c∗ ∈ C . Hence, R(c∗ ) ≥ 3 and c∗ gets settled from all m ∈ M. Claim. We specify |M | = max{k, 2|{a∪C − ∪C + ∪U }|2 }+1. Then s,t∈V VS (s, t) ≤ |V |(2|{a ∪ C − ∪ C + ∪ U }|2 + |M | + 2|M |) if and only if there is an exact cover for (U, C). Let C be an exact cover of (U, C). Then {(a, c+ )| c ∈ C } is set-covering and the bound on the search-space holds with the above claims. On the other hand let s,t∈V VS ∗ (s, t) ≤ |V |(2 · |{a} ∪ C − ∪ C + ∪ U |2 + |M | + 2|M |). With the last claim we know that for each u ∈ U there must be either a shortcut (a, u) ∈ S ∗ or a shortcut (a, c+ ) with u ∈ c. We gain a shortcut assignment S out of S ∗ by copying all shortcuts of the form (a, c+ ) in S and taking, for each shortcut of the form (a, u) ∈ S ∗ , one arbitrary shortcut (a, c+ ) with u ∈ c. The set {c | (a, c+ ) ∈ S } is a cover of (U, C) of size q.
4
Highway Node Routing (Min-Overlay Graph)
Given the input graph G = (V, E) this technique chooses a sequence V := V0 ⊇ V1 ⊇ . . . ⊇ VL of sets of nodes. Then, a sequence (G0 , G1 , . . . , GL ) of graphs is computed which is defined by G0 := G and for each l > 0 by Gl = (Vl , El ) with ∈ El := {(s, t) ∈ Vl × Vl | ∀shtst s-t-paths (s, u1 , . . . , uk , t) in Gl−1 is u1 , . . . , uk
Vl }. The length of an edge (u, v) in Gi+1 is the length of a shortest u-v-path in Gi . Note that, given nodes u, v ∈ V1 for which the the edge (u, v) is the only shortest u-v path in G0 , (u, v) is contained in E1 . The level i of a node v, is the highest index i such that v ∈ Vi . The multi-level overlay graph G is given by G = (V, E1 ∪ . . . ∪ EL ). The query is a modified distance-balanced bidirectional Dijkstra’s algorithm in G. From a node of level i, only edges in Ei ∪ . . . ∪ EL are relaxed. The forward (backward) search is aborted when all keys in the forward (backward) priority queue are greater than or equal to the tentative distance. For the NPcompleteness proof, we restrict to 2-level min-overlay graphs: Problem ( HighwayNodePreProcess). Given a graph G = (V, E) and an integer F ≥ |E|, choose V1 ⊆ V , such that |E ∪ E1 | ≤ F and s,t∈V VV1 (s, t) is minimal. We observe that a feasible solution always must exist as we could choose V1 = V . Theorem 3. Problem HighwayNodePreProcess is NP-hard.
366
5
R. Bauer et al.
ALT
Goal-directed search is a variant of Dijkstra’s algorithm which assigns a different priority to the nodes in the queue. For a node v, let p(v) denote the priority of v in the queue when applying Dijkstra’s algorithm (that means p(v) is the tentative distance to v). Goal-directed search adds a potential Πt (v) depending on the target t to the nodes priority, i.e. the priority of v (when applying goal-directed search) is Πt (v) + p(v). An equivalent formulation (that implicitely substracts the constant Πt (s) from the priority) is as follows. Given the potential function Πt : V → + , goal-directed search is Dijkstra’s algorithm applied on G with altered edge lengths len(u, v) = len(u, v)−Πt(u)+Πt (v) for all edges (u, v) ∈ E. A potential is called feasible if len(u, v) ≥ 0 for every edge (u, v). The ALTalgorithm [2] is goal-directed search with a special potential function. Initially, a set L ⊂ V of ‘landmarks’ is chosen. For a landmark l ∈ L we define Πtl+ (v) := dist(v, l) − dist(t, l)
(1)
:= dist(l, t) − dist(l, v)
(2)
Πtl− (v)
We use the convention ∞ − ∞ := 0. Accordingly, for a set L of landmarks, the potential is ΠtL (v) := max Πtl+ (v), Πtl− (v), 0 . l∈L
Note that this potential is feasible and that ΠtL (t) = 0. We denote by VL (s, t) and VΠ (s, t) the search space of an s-t-ALT-query using landmarks L and potential Π, respectively. The problem MinALT is that of assigning a given number of landmarks to a graph (and thus using only a given amount of preprocessing space), such that the expected number of settled nodes gets minimal. Problem ( MinALT). Given a directed graph G = (V, E, len) and an integer r, find a set L ⊂ V with |L| = r such that s,t∈V VL (s, t) is minimal. Theorem 4. Problem MinALT is NP-hard.
6
Arc-Flags
Main Technique. This approach partitions the set of nodes V into k cells V = (V1 , V2 , . . . , Vk ). For a node w, we write V(w) = Vi iff w ∈ Vi . To each edge (u, v) a k-bit vector F(u,v) is attached, such that F(u,v) (Vi ) is true iff a shortest path starting with the edge (u, v) and ending at a node t ∈ Vi exists. The ArcFlags s-t-query is the variant of Dijkstra’s algorithm which only relaxes edges (u, v) for which F(u,v) (V(t)) is true. Problem ( ArcFlags). Given a graph G = (V, E, len) and an integer k, find a k-partition V = {V1 , . . . , Vk } of V such that s,t∈V VV (s, t) is minimal.
Preprocessing Speed-Up Techniques Is Hard
367
Theorem 5. Problem ArcFlags is NP-hard. Search-Space Minimal Arc-Flags. This problem models a special aspect of the arc-flag technique. In case shortest paths are not unique, the situation may occur that one can improve the search-space by changing some flags from true to false while still guaranteeing the query to compute the correct distance. We consider the partition V = (V1 , V2 , . . . , Vk ) of the graph G = (V, E) to be already given and change the rule of how to compute the vectors F(u,v) : For each pair of nodes s and t there shall be at least one shortest path s = v1 , . . . , v = t such that F(vi ,vi+1 ) (V(t)) is true for i = 1, . . . , − 1. We may assume that for each edge (u, v) with F(u,v) (Vi ) = true there is at least one shortest path starting with (u, v) that leads to Vi . The problem MinFlags is that of how to assign values to the vectors F(u,v) such that the resulting average search-space of an arc-flags query becomes minimal. Problem ( MinFlags). Given a graph G = (V, E, len) and a partition V = (V1 , . . . , Vk ) of V , compute an arc-flag assignment F = (F(u,v) )(u,v) for G such that s,t∈V VF (s, t) is minimal. Theorem 6. Problem MinFlags is NP-hard (even for directed acyclic graphs). External Shortcuts for Arc-Flags. This problem models an enhancement of the arc-flag technique that is used within the SHARC-algorithm. We are in the situation that the graph G = (V, E, len), a h-partition V = (V1 , . . . Vh ) of G and an integer k are already given. A shortcut is an edge (u, v) that is added to the graph for which len(u, v) = dist(u, v). A shortest path v1 , v2 , . . . , v is called canonical if it is edge-minimal among all shortest v1 -v -paths and if (v1 , . . . , v ) is lexicographically minimal among all edge-minimal shortest v1 -v -paths. The query is similar to the arc-flag query but the preprocessing stage differs. We are allowed to add k shortcuts to the graph, afterwards the vectors F(u,v) get computed as follows: F(u,v) (Vi ) is true iff a canonical shortest path starting with the edge (u, v) and ending at a node t ∈ Vi exists. W.l.o.g we do not insert shortcuts that are already present in the graph. Problem ( ExtShortcutsArcFlags). Given a graph G = (V, E, len), a partition V = (V1 , . . . , Vh ) of V and a positive integer k, insert a set S of k shortcuts to G, such that s,t∈V VS (s, t) is minimal. Theorem 7. Problem ExtShortcutsArcFlags is NP-hard(even for directed acyclic graphs).
7
Contraction Hierarchies
Throughout this section we work on undirected graphs. This is no restriction as the results also hold for directed graphs with edges always being symmetric. Given the input graph G = (V, E), the preprocessing of Contraction Hierarchies (CH) consists of distuingishing a total order ≺ on V and iteratively contracting
368
R. Bauer et al.
the ≺-least node until G is empty. A node v is contracted as follows: For each pair of edges {u, v}, {v, w} such that (u, v, w) is the only shortest u-w-path, a new edge (u, w) called a shortcut is introduced with length len{u, v} + len{v, w} to G. Afterwards, v and all of its adjacent edges are removed from G. The output of the preprocessing is ≺ and the graph H≺ (G) = (V, E ∪ E ) where E is the set of all edges that got inserted due to node contraction. We call H≺ := H≺ (G) the contraction hierarchy of G and denote by |H≺ | the number of edges |E | . The CH-query is bidirectional Dijkstra’s algorithm on H≺ (G) applying two changes. Firstly, no special stopping criterion exists, the whole reachable subgraph gets settled. Secondly, when settling node u, only edges {u, v} with u ≺ v get relaxed . Problem ( CH Preprocessing). Given a graph G = (V, E), a length function len : E → + and a number K ∈ ≥0 , find an order ≺ on V , such that |H≺ (G)| ≤ K and s,t∈V V≺ (s, t) is minimal?
Theorem 8. Problem CH Preprocessing is NP-hard.
8
Conclusion
Speed-up techniques have been widely studied experimentally for the last years, especially for road-networks. There is large interest in a theoretical foundation of the techniques developed and some first work on the topics have been published [20,19]. In this work we focused on the preprocessing phases of the recent techniques. These usually incorporate a degree of freedom that, in practice, is filled in a heuristical manner. Until now, the complexity status of filling the according degree of freedom was unknown. We settled this question by showing that all variants considered are NP-hard to optimize. There are numerous open questions for the topic. A reasonable next step to enhance this work is the development of approximation- or fixed parameter tractable algorithms for the preprocessing phase. Efficient algorithms for special graph classes would help to show the bounds of intractability. When working with special graph classes (either for giving algorithms or showing the complexity status) modeling the two main applications for speed-up techniques, road-networks and public transportation networks would be helpful. Until now there is no experimentally verified model for these two applications (but some first work [20,22]). From a more theoretical point of view we have the question which of the problems can be solved efficiently on trees. Another interesting question is the following: We assume preprocessing time and space is unbounded, how good can a speed-up technique actually get? Obviously, ALT and Arc-Flags can encode All-Pairs Shortest-Path in a way that a shortest s-t path and dist(s, t) can be queried in time that is linear in the size of the shortest-path subgraph which yields optimal search-space for these techniques (but of course, the runtime of ALT would not be optimal in this case). The situation is not so clear for Highway-Node Routing, Reach, Highway-Hierarchies
Preprocessing Speed-Up Techniques Is Hard
369
and Contraction Hierarchies. One can show that the average CH-search space of an s-t-query can not guarantee to be better than Ω(n) for arbitrary graphs and Ω(log n) for graphs with bounded degree [21]. Is the second bound tight?
References 1. Delling, D., Sanders, P., Schultes, D., Wagner, D.: Engineering Route Planning Algorithms. In: Lerner, J., Wagner, D., Zweig, K.A. (eds.) Algorithmics of Large and Complex Networks. LNCS, vol. 5515, pp. 117–139. Springer, Heidelberg (2009) 2. Goldberg, A.V., Harrelson, C.: Computing the Shortest Path: A* Search Meets Graph Theory. In: Proceedings of the 16th Annual ACM–SIAM Symposium on Discrete Algorithms (SODA 2005), pp. 156–165 (2005) 3. Lauther, U.: An Extremely Fast, Exact Algorithm for Finding Shortest Paths in Static Networks with Geographical Background. In: Geoinformation und Mobilit¨ at - von der Forschung zur praktischen Anwendung. IfGI prints. vol. 22. pp. 219–230 (2004) 4. Hilger, M., K¨ ohler, E., M¨ ohring, R.H., Schilling, H.: Fast Point-to-Point Shortest Path Computations with Arc-Flags. In: Demetrescu, C., Goldberg, A.V., Johnson, D.S. (eds.) The Shortest Path Problem: Ninth DIMACS Implementation Challenge. DIMACS Book, vol. 74, pp. 41–72. American Mathematical Society, Providence (2009) 5. Bauer, R., Delling, D.: SHARC: Fast and Robust Unidirectional Routing. ACM Journal of Experimental Algorithmics 14 (May 2009); 2.4 Special Section on Selected Papers from ALENEX 2008 6. Schulz, F., Wagner, D., Weihe, K.: Dijkstra’s Algorithm On-Line: An Empirical Case Study from Public Railroad Transport. In: Vitter, J.S., Zaroliagis, C.D. (eds.) WAE 1999. LNCS, vol. 1668, pp. 110–123. Springer, Heidelberg (1999) 7. Schultes, D., Sanders, P.: Dynamic Highway-Node Routing. In: Demetrescu, C. (ed.) WEA 2007. LNCS, vol. 4525, pp. 66–79. Springer, Heidelberg (2007) 8. Holzer, M., Schulz, F., Wagner, D.: Engineering Multi-Level Overlay Graphs for Shortest-Path Queries. In: Proceedings of the 8th Workshop on Algorithm Engineering and Experiments (ALENEX 2006), pp. 156–170. SIAM, Philadelphia (2006) 9. Geisberger, R., Sanders, P., Schultes, D., Delling, D.: Contraction Hierarchies: Faster and Simpler Hierarchical Routing in Road Networks. In: McGeoch, C.C. (ed.) WEA 2008. LNCS, vol. 5038, pp. 319–333. Springer, Heidelberg (2008) 10. Wagner, D., Willhalm, T.: Geometric Speed-Up Techniques for Finding Shortest Paths in Large Sparse Graphs. In: Di Battista, G., Zwick, U. (eds.) ESA 2003. LNCS, vol. 2832, pp. 776–787. Springer, Heidelberg (2003) 11. Wagner, D., Willhalm, T., Zaroliagis, C.: Geometric Containers for Efficient Shortest-Path Computation. ACM Journal of Experimental Algorithmics 10, 1.3 (2005) 12. Sanders, P., Schultes, D.: Highway Hierarchies Hasten Exact Shortest Path Queries. In: Brodal, G.S., Leonardi, S. (eds.) ESA 2005. LNCS, vol. 3669, pp. 568–579. Springer, Heidelberg (2005) 13. Sanders, P., Schultes, D.: Engineering Highway Hierarchies. In: Azar, Y., Erlebach, T. (eds.) ESA 2006. LNCS, vol. 4168, pp. 804–816. Springer, Heidelberg (2006)
370
R. Bauer et al.
14. Gutman, R.J.: Reach-Based Routing: A New Approach to Shortest Path Algorithms Optimized for Road Networks. In: Proceedings of the 6th Workshop on Algorithm Engineering and Experiments (ALENEX 2004), pp. 100–111. SIAM, Philadelphia (2004) 15. Goldberg, A.V., Kaplan, H., Werneck, R.F.: Reach for A*: Efficient Point-to-Point Shortest Path Algorithms. In: Proceedings of the 8th Workshop on Algorithm Engineering and Experiments (ALENEX 2006), pp. 129–143. SIAM, Philadelphia (2006) 16. Goldberg, A.V., Kaplan, H., Werneck, R.F.: Better Landmarks Within Reach. In: Demetrescu, C. (ed.) WEA 2007. LNCS, vol. 4525, pp. 38–51. Springer, Heidelberg (2007) 17. Sanders, P., Schultes, D.: Robust, Almost Constant Time Shortest-Path Queries in Road Networks. In: Demetrescu, C., Goldberg, A.V., Johnson, D.S. (eds.) 9th DIMACS Implementation Challenge - Shortest Paths (November 2006) 18. Bast, H., Funke, S., Matijevic, D., Sanders, P., Schultes, D.: In Transit to Constant Shortest-Path Queries in Road Networks. In: Proceedings of the 9th Workshop on Algorithm Engineering and Experiments (ALENEX 2007), pp. 46–59. SIAM, Philadelphia (2007) 19. Bauer, R., D’Angelo, G., Delling, D., Wagner, D.: The Shortcut Problem – Complexity and Approximation. In: Nielsen, M., Kucera, A., Miltersen, P.B., Palamidessi, C., Tuma, P., Valencia, F.D. (eds.) SOFSEM 2009. LNCS, vol. 5404, pp. 105–116. Springer, Heidelberg (2009) 20. Abraham, I., Fiat, A., Goldberg, A.V., Werneck, R.F.: Highway Dimension, Shortest Paths, and Provably Efficient Algorithms. In: Proceedings of the 21st Annual ACM–SIAM Symposium on Discrete Algorithms (SODA 2010), pp. 782–793 (2010) 21. Bauer, R., Columbus, T., Katz, B., Krug, M., Wagner, D.: Preprocessing Speed-Up Techniques is Hard. Technical Report 2010-04, ITI Wagner, Faculty of Informatics, Universit¨ at Karlsruhe, TH (2010), http://digbib.ubka.uni-karlsruhe.de/volltexte/1000016080 22. Eppstein, D., Goodrich, M.T.: Studying (non-planar) road networks through an algorithmic lens. In: Proceedings of the 16th ACM SIGSPATIAL international conference on Advances in geographic information systems. ACM Press, New York (2008)
Communication Requirements for Stable Marriages Jen-Hou Chou and Chi-Jen Lu Institute of Information Science, Academia Sinica, Taipei, Taiwan {jhchou,cjlu}@iis.sinica.edu.tw
Abstract. We study the stable marriage problem in a distributed environment, in which there are 2n players, n men and n women, each holding a private ranking of the n persons of the opposite set, and there is a server who communicates with the players and finds a matching for them. We restrict our attention on two communication models: the sketch model and the query model. In the sketch model, each player compresses his/her ranking into a sketch and sends it to the server, while in the query model, the server itself adaptively queries individual bits on each player’s ranking. We show that for the server to output even a slightly stable matching, in which a small constant fraction of matched pairs are stable, it must receive Ω(n2 log n) bits from the players in the sketch model, and it must query Ω(n2 log n) bits on their rankings in the query model. This implies that even to find a slightly stable matching, it is impossible to have an algorithm which compresses the input into a sketch of sub-linear size or to have an algorithm which runs in sub-linear time.
1
Introduction
Consider a society in which there are n men and n women, each holding a preference over the n persons of the opposite sex. The goal is to find a complete one-toone matching between men and women in which no pair of man and woman prefer each other to their partners in the matching. This is known as the stable marriage problem, a classic problem introduced by Gale and Shapley [4], who also showed that for any problem instance, a stable marriage always exists and can be found in polynomial time using, for example, a man proposing algorithm. There are also several variants of this problem. One variant is to allow incomplete preference lists: a person can have interests in only a subset of persons of the opposite sex [5], while another variant is to allow preferences with ties: a person can like two or more persons equally [7]. One can also combine these two variants to allow preferences which are incomplete and have ties [8,15]. In this variant, one problem instance can have several stable matchings of different sizes, and the problem of finding the largest one among them has been shown
Also with Department of Computer Science, National Chiao-Tung University, Hsinchu, Taiwan. The work was supported in part by the National Science Council under the Grant NSC97-2221-E-001-012-MY3.
T. Calamoneri and J. Diaz (Eds.): CIAC 2010, LNCS 6078, pp. 371–382, 2010. c Springer-Verlag Berlin Heidelberg 2010
372
J.-H. Chou and C.-J. Lu
to be NP-hard [16]. In fact, it turns out to be NP-hard even for finding a stable matching whose size is within the ratio 19/21 of the optimal one [6]. On the other hand, approximation algorithms have also been proposed [10,11,12], and the best approximation ratio we are aware of is 3/5 [14]. There is also a variant called the hospital/residents problem, which is a many-to-one version of the stable marriage problem [5,19]. It has found applications in real systems, including NRMP [18] in the U.S., CaRMS [1] in Canada, SPA [21] in Scotland, and JRMP [13] in Japan. More information can be found in a recent survey by Iwama and Miyazaki [9]. In this paper, we return to the original setting of the stable marriage problem in which the preferences are complete and have no tie, and hence a stable marriage can always be found in polynomial time. On the other hand, we are interested in the situation in which the society is huge, with a very large number of men and women, so that it may become too expensive to find a stable matching. A natural question then is: how cheap can it be if we settle for a matching which is only slightly stable? Slightly Stable Matching. Eriksson and H¨aggstr¨ om [2] measured the (in)stability of a matching by counting the number of pairs, called blocking pairs, who prefer each other to their partners in the matching, and they provided a simple algorithm for finding a matching with an expected number of o(n2 ) blocking pairs over a randomly chosen input. Flor´een et al. [3] showed that for the variant with incomplete preference lists when each person only has preference over D people, a matching with at most εn blocking pairs can be found by an early termination of the Gale-Shapley algorithm in O(D2 /ε) rounds. This works well when D is small, but it deteriorates rapidly as D grows, and it becomes useless for the case of complete preference lists, with D = n, as the number of rounds becomes O(n2 /ε). In this paper, we measure the stability of a matching by counting its number of partners which are stable in the sense that none of the members in these partners is involved in a blocking pair with someone else. Note that our measure of stability seems somewhat easier to achieve (which makes lower bound results stronger), in the sense that the number of unstable partners is at most twice the number of blocking pairs, while the number of blocking pairs does not seem to have a good upper bound in terms of the number of unstable partners. Our Models. The situation we are interested in, with a very large number of men and women and thus a large input size, can be seen as falling into the area of research on massive data sets. Since the input size is huge, one may not have enough memory to store or enough time to read the whole input, which gives rises to the research on sketching algorithms and sub-linear time algorithms. We would like to study the classic stable marriage problem in such a new perspective, and also with a distributed flavor as well. This motivates us to consider the following two computation/communication models: the sketch model and the query model. In both models, there are n men and n women, each holding a private input representing his/her preference over the n persons of the opposite sex, and there is a server who is responsible for finding a (slightly) stable matching for them. We assume that the 2n persons do
Communication Requirements for Stable Marriages
373
not communicate with each other, while the server tries to obtain information from them in order to find a good matching. The two models differ in how the server obtains information. In the sketch model, each person tries to compress his/her private input into a shorter string called sketch and sends it to the server, while in the query model, it is the server who actively queries the individual bits on each person’s private input, possibly in an adaptive way. In fact, the sketch model can be seen as the simultaneous message model of Yao in the area of communication complexity [22], while the query model can be seen as the standard random access model, which, for example, is used for sub-linear time algorithms. Note that these two models seem incomparable in power: in the sketch model, the server can obtain arbitrary summary, instead of just subset of bits, from each person’s input, while in the query model, the server can have its queries on a person’s input depend adaptively on the bits it learns previously from other inputs. On the other hand, both of our models are special cases of the general communication model in which the server and the persons can communicate arbitrary information with each other adaptively. Note that the total input length is 2n log2 (n!) = Θ(n2 log n). Therefore, in each model, that amount of communication suffices for the server to know the whole input and compute the stable matching. One may wonder whether it is possible to communicate a smaller number of bits. Ng [17] showed a lower bound of Ω(n2 log n) bits for a model related to our query model, in which the input is represented as a sequence of numbers, each of log2 n bits, and the server can only query one number at a time from the input. Segal [20] showed a lower bound of Ω(n2 ) bits for the more general communication model, in which there is no server involved and the 2n persons communicate with each other to find a stable matching for themselves. One may again wonder whether it is possible break such lower bounds if the server is only required to output a slightly stable matching. Our Results. We provide negative answers to this question in both of our models. We showed that even to output a matching in which only an ε fraction of its partners are stable, the server must receive at least Ω(ε2 n2 log(εn)) bits in the sketch model for any ε ∈ (0, 1], while the server must query at least Ω(ε2 n2 log n) bits in the query model for any ε ∈ [(64/ log2 n)2/3 , 1]. Thus, in both models, Ω(n2 log n) bits of communication are required even for finding a matching with only a small constant fraction of stable partners. Our lower bounds in these two models also rule out the possibility of achieving a sub-linear communication complexity in the simultaneous message model or having a sub-linear time algorithm for this problem. For the original stable marriage problem in which every matched partner must be stable, we derive tighter lower bounds with concrete constant factors. In the sketch model, we show that the lower bound is 2n log2 (n!), which means that even one bit of compression is impossible, and the simplest way of sending out each player’s input is actually the best way. In the query model, we show that the lower bound is (1/6)n2 log2 n. The basic idea behind our proofs is the following. In both models, if the server does not receive enough information, many different inputs all look the same to it, and hence it must output the same matching for them. From these many different
374
J.-H. Chou and C.-J. Lu
inputs, one can find two inputs with very different unique stable matchings, so that the same matching produced by the server must be very unstable for one of them. However, a naive argument as this may only show that half of the matched pairs are unstable for one of the two inputs. To show that all but a small number of the matched pairs are unstable for some input, we need a more careful approach. Our approach starts by finding an input X satisfying some property which makes it easy to be confused with many other different inputs. Next, we show that if the server does not receive enough bits from this input X, then from X and the matching M for X, we can construct another input X by changing the preferences of many players in a way that it still looks the same to the server but the edges in M involving these players now become unstable.
2
Preliminaries
Let us first introduce some notations and terminologies. For n ∈ N, let [n] denote the set {1, . . . , n}. A permutation of [n] is a sequence of n elements (w1 , . . . , wn ) in which wi ∈ [n] for any i and wi = wj for any i = j. Let Pn denote the set of all permutations of [n]. All logarithms will have base two. Next, we define the stable marriage problem. In this problem, there are 2n players, including n men and n women, together with a server S. Each man holds as his private input a ranking over the n women, which is represented by a permutation in Pn , while each woman also holds a ranking over the n men as her private input. These 2n rankings constitute the input of the problem. Given a ranking (w1 , . . . , wn ) of a player p, we say that wj is ranked before wk by p or equivalently p prefers wj to wk , if j < k (i.e., wj appears before wk in the sequence). A matching for these players is a set of n edges between men and women such that every man (woman) appears in exactly one edge, and we call the woman (man) on the other end of the edge his (her) partner. The goal is for the server to output a matching which is stable or slightly stable in the following sense. Definition 1. Consider an input X and a matching M . We call a pair (m, w) of man and woman a blocking pair if m prefers w to his partner in M and at the same time w also prefers m to her partner in M . We call an edge (m, w) in the matching M stable if neither m nor w belongs to a blocking pair. We say that M is a stable matching if every edge of it is stable, and we say that M is an ε-stable matching if at least ε fraction of its edges are stable. In order for the server S to output a good matching, it must receive enough information about the rankings from the players. In this paper, we consider the following two models: the query model and the sketch model. In the sketch model, each player tries to compress his/her private input into a shorter string, called sketch, according to some predefined function, and then sends it as a message to S. After receiving all the messages, S then does some computation and outputs a matching. In this model, we measure the total number of bits that are sent by players to S. In the query model, players do not send messages to S; instead, S itself can query individual bits from every player’s input in an adaptive way.
Communication Requirements for Stable Marriages
375
After the queries, S then does some computation and outputs a matching. In this model, we measure the total number of bits on the whole input which are queried by S. In both models, we do not allow any communication among the players themselves. We will consider a special type of inputs, called women-canonical inputs, in which every woman holds the same ranking (1, . . . , n). It is known that such an input always has a unique stable matching. Lemma 1. [17] For any women-canonical input, there is a unique stable matching. According to the lemma, no matter which stable marriage algorithm we apply on such an input, we always get the same matching. Let us see what happens when we apply a standard women-proposing algorithm on such an input. It runs in n rounds. Before round i, the men in [i − 1] have been matched to some i − 1 women, and in round i, man i is the most preferred man who is still unmatched, so he can choose his favorite woman who has not been chosen by those men in [i − 1]. As a result, we have the following lemma. Lemma 2. Consider any women-canonical input. For any man i with ranking (w1 , . . . , wn ), his partner in the unique stable matching is the first woman in his ranking who is not the partner of any man in [i − 1].
3
Sketch Model
In this section, we provide communication lower bounds in the sketch model. Our first result, Theorem 1 below, shows that in order to find a stable matching, the players cannot send a number of bits less than the total input length. That is, no compression is possible, and the best way for each player is simply to send out his/her own input. Theorem 1. Any algorithm in the sketch model which outputs a stable matching must communicate at least 2n log(n!) bits. Our second result, Theorem 2 below, shows that even to find a matching which is stable for a small fraction of players, the players still have to send a large number of bits. In particular, to find a matching which is stable for even a small constant fraction of players, the players still have to send a number of bits which is in the same order of the total input length. Theorem 2. For any ε ∈ (0, 1], any algorithm in the sketch model which outputs an ε-stable matching must communicate at least Ω(ε2 n2 log(εn)) bits. Note that if we ignore the constant factors, then Theorem 1 in fact follows from Theorem 2 with ε = 1. However, we choose to keep Theorem 1 because it gives an optimal bound, and it has a much simpler proof which contains the basic ideas that we will extend to prove the harder Theorem 2. Next, we will prove the two theorems in the following two subsections.
376
3.1
J.-H. Chou and C.-J. Lu
Proof of Theorem 1
Consider any algorithm in the sketch model for this problem. We will show that there exists some input on which every person in the algorithm must send at least log(n!) bits to the server S. Observe that in the sketch model, the message sent by each person depends only on his/her own part, but not on any other person’s part, of the whole input. Thus it suffices to show that every person must send that many bits on at least one (but possibly different) input. This is because from each such input, we can take out the corresponding part (ranking) of that person, and by concatenating all these parts together, we have a new input on which every person must send that many bits. To show that every person must send at least log(n!) bits to the server S on at least one input, the basic proof idea is the following. Suppose otherwise that this does not hold for some person. Then we will find two different inputs X and X , differing only in that person’s ranking, such that they have different unique stable matchings, but S cannot distinguish between X and X and consequently must output the same matching for them, a contradiction. More precisely, suppose that there is some person, say man t, who always sends less than log(n!) bits for any of his rankings. Then there must be two different rankings W = (w1 , . . . , wn ) and W = (w1 , . . . , wn ) from which he sends the same message. Let i be the first place in which W and W differ, so that wj = wj for j < i and wi = wi . We would like to find rankings for all other persons in a way so that man t will take the i’th woman on his ranking, as the first i − 1 women on his ranking are all taken by other men who are ranked before him by every woman. For convenience, let us rename the n men so that man t now is renamed as man i. By letting every woman have the ranking (1, . . . , n), this renaming makes him the i’th preferred man by every woman. Let X be the input such that all men have the same ranking W while all women have the same ranking (1, . . . , n), and let X be the input such that this man i now has W as his ranking while the rest is the same as X. Clearly, given the two different inputs X and X , the server S receives the same message and thus outputs the same matching. According to Lemma 1, X has a unique stable matching, and so does X . However, according to Lemma 2, the unique stable matchings of X and X are different, with man i matched to woman wi and wi respectively, as women w1 , . . . , wi−1 are taken by the first i − 1 men. Thus, the same matching produced by S must be unstable for either X or X , a contradiction. We have shown that to solve the stable matching problem, every man must send at least log(n!) bits for some input. By switching the roles between men and women, one can have the same bound for every woman. Now since the message sent by each person does not depend on the rankings of all other persons, we can give every person the ranking for which the person must send at least log(n!) bits. This resulting new input has the desired property that for this input, every person must send at least log(n!) bits, and a total of at least 2n log(n!) bits must be communicated. This proves Theorem 1.
Communication Requirements for Stable Marriages
3.2
377
Proof of Theorem 2
Let = εn and let I denote the collection of those men who always send less than log(!/n) bits for any input. Our goal is to show that |I| ≤ n − . For the sake of contradiction, let us assume that |I| > n − , and we will show that in this case, there exists some input on which the sever fails to output an ε-stable matching. As in the proof of Theorem 1, we start by finding an input X in which every man has the same input W , for some W ∈ Pn , while every woman has the same input (1, . . . , n), again after some possible renaming. Then with the matching M produced by the server for the input X, we want to construct another input X , in which the rankings of those men in the collection I are changed in a way that their messages remain the same but the edges connecting them in M become unstable. Before trying to find them, let us introduce some notions first. Definition 2. For each man, we partition all of his possible input rankings into several groups which we call message-groups, such that each group consists of those rankings from which he produces the same message. Definition 3. For a man i, we call a woman j safe in his ranking W if there is no woman who is ranked after her in W but is ranked before her in some ranking W in the same message-group of W , and we call her unsafe otherwise. We call a ranking W bad for a man if less than women are safe in W , and we call W good otherwise. To construct the input X, we need one ranking W which is bad at the same time for every man in I. The existence of such a W is guaranteed by the following lemma, the proof of which we omit due to the page limit. Lemma 3. There exists a ranking W ∈ Pn which is bad for every man in I. Fix one such bad W , and suppose W = (w1 , . . . , wn ). By definition, for every man in I, more than n − women are unsafe in W . Since |I| > n − , we can find a collection T ⊆ I of more than n − men such that every man t ∈ T has a different unsafe woman, denoted as wit .1 For our convenience, let us rename the n men so that the man who has wit as his unsafe woman is now renamed as man it . The renaming also changes the set T into a new set which we denote as T (for example, by renaming man t ∈ T to man it , man it replaces man t and becomes an element of T ). Now observe that after the renaming, for any man i ∈ T , the woman wi is unsafe in W , which means that there is some ranking W (i) in the same message-group of W such that some woman wk is ranked after wi (with k > i) in W but is ranked before wi in W (i) . Now let X be the input in which every man has the same ranking W while every woman has the same ranking (1, . . . , n). Let M be the matching produced by the server S given the input X. Then let X be the input modified from X such that the ranking of any man i ∈ T is 1
We can do this for the men in I sequentially: after finding i − 1 different unsafe women for the first i − 1 men in I, the number of unsafe women left for the i’th man in I is still more than n − − (i − 1) ≥ 0 when i ≤ n − + 1.
378
J.-H. Chou and C.-J. Lu
Xi
=
W (i) if (i, wi ) ∈ M, W if (i, wi ) ∈ / M,
while the ranking of every other person remains the same as in X. From the discussion before, we know that the server S outputs the same matching M for both inputs X and X since S can not distinguish them apart. Furthermore, the input X satisfies the following property: – Property A: For every man i ∈ T , if (i, wi ) ∈ / M , then Xi = W = (i) (w1 , . . . , wn ), and if (i, wi ) ∈ M , then Xi = W , in which some woman wk who is ranked after wi in Xi = W is now ranked before wi . Then the following lemma (proof omitted due to the page limit) shows that with respect to such an input X , most of the edges in M are unstable. Lemma 4. For any man i ∈ T , the edge of M connecting i is unstable in M with respect to X . Since |T | = |T | > n − = (1 − ε)n, we know from this lemma that the matching M produced by S for the input X is not ε-stable, a contradiction. Thus, we can conclude that the size of I must be at most n − , which means that there must be at least = εn men, each sending at least log(!/n) = log(!) − log n ≥ Ω(εn log(εn)) bits for some input. As in the proof of Theorem 1, this implies the existence of an input which requires a total of at least Ω(ε2 n2 log(εn)) bits of communication, and we have Theorem 2.
4
Query Model
In this section, we provide communication lower bounds in the query model. Our first result, Theorem 3 below, shows that in order to find a stable matching, the server must query a constant fraction of bits from the whole input. Theorem 3. Any algorithm in the query model which outputs a stable matching must query at least (1/6)n2 log n bits from the input. Our second result, Theorem 4 below, shows that even to find a matching which is stable for a small fraction of players, the server still has to query a good fraction of the input bits. In particular, to find a matching which is stable for a small constant fraction of players, the server still has to query a constant fraction of the input bits. Theorem 4. For any ε ∈ [(64/ log n)2/3 , 1], any algorithm in the query model which outputs an ε-stable matching must query Ω(ε2 n2 log n) bits from the input.
Communication Requirements for Stable Marriages
379
Note again that when ignoring the constant factors, Theorem 3 follows from Theorem 4 with ε = 1, but we choose to keep Theorem 3 because it gives a better constant factor and provides the basic ideas which we will extend to prove Theorem 4. We remark that the range of ε in Theorem 4 can be improved but we do not attempt to optimize it as it would complicate our presentation. Next, we will prove the two theorems in the following two subsections. 4.1
Proof of Theorem 3
The basic idea is that if the server S makes only a small number of queries, then many different inputs look the same to it but have different unique stable matchings. More precisely, we will look for an input X satisfying some property, and we will show that if the server S queries less than (1/6)n2 log n bits on X, we can find a different input X which looks the same to S but has a different unique stable matching. The input X we consider has the form that all men hold the same ranking W , for some W = (w1 , . . . , wn ) ∈ Pn , while all women hold the same ranking (1, . . . , n). By Lemmas 1 and 2, we know that such an input has a unique stable matching which matches man i to woman wi , for every i ∈ [n]. The ranking W we are looking for is one with many neighbor pairs, which is defined next. Definition 4. We say that man i with the ranking W = (w1 , . . . , wn ) has a neighbor pair (wj , wk ), if j ≤ i < k and there is only one bit position in which wj and wk differ. We call the two bits on that position in wj and wk their difference bits. The following lemma shows the existence of a ranking W with many neighbor pairs. The proof is by a probabilistic argument which we omit due to the page limit. Lemma 5. There is some W ∈ Pn such that if every man has W as his ranking, then the total number of neighbor pairs of all men is at least (1/6)n2 log n. Let us fix one such W , and let X be the input in which every man has this W as his ranking while every woman has the ranking (1, . . . , n). Next, we show that for any man i and any neighbor pair (wj , wk ) of his, the server S must query at least one of the two difference bits. Suppose otherwise. Then let W ∈ Pn be the ranking derived from W by swapping wj and wk , and let X be the input which differs from the input X only in man i’s ranking, which is changed from W to W . Note that the two inputs X and X look the same to S, and hence S must output the same matching for them. According to Lemma 1, X has a unique stable matching, and so does X . However, according to Lemma 2, the unique stable matchings of X and X are different, with man i matched to woman wi and wk respectively, which means that the same matching produced by S must be unstable for either X or X . Therefore, to avoid the contradiction, S must query at least one of the two difference bits.
380
J.-H. Chou and C.-J. Lu
Note that for any man i, any bit on his ranking can only be the difference bit of at most one neighbor pair. This is because if a bit is the difference bit on some wj ∈ [n], then by flipping that bit, we can obtain only one number in [n]. This means that the number of bits that S must query on X is at least the total number of neighbor pairs. That is, if S queries less than (1/6)n2 log n bits on X, then S must miss both difference bits of some neighbor pair of some man, and we can find another input X on which the same matching S outputs is not stable for X . Thus, we have Theorem 3. 4.2
Proof of Theorem 4
We would like to extend the idea in the proof of Theorem 3 to find an input for which the matching produced by the server is very unstable. For this, we would like to borrow the idea from the proof of Theorem 2. That is, we start by finding some input X in which every man has the same ranking W ∈ Pn while every woman has the same ranking (1, . . . , n). Then with the matching M produced by the server for X, we would like to construct another input X which looks the same to S and satisfies Property A there so that we can apply Lemma 4 to show the existence of many unstable pairs. However, since the model is different now, we need a different way to find such inputs. Following the proof of Theorem 3, we would like to find a ranking W with many neighbor pairs, but instead of having a large total number of neighbor pairs, now we need something stronger: many men have many neighbor pairs in W . The existence of such a W is guaranteed by the following lemma. The proof again is by a probabilistic argument which we omit due to the page limit. Lemma 6. Let I denote the interval [(ε/8)n, n − (ε/8)n]. Then there exist a ranking W ∈ Pn and a collection T ⊆ I of at least (1 − ε/2)n men such that for every man i ∈ T , the number of neighbor pairs he has in W is at least νi =
i(n − i) log n . 2 n−1
Now let us fix one such W , and let X be the input in which every man has the ranking W and every woman has the ranking (1, . . . , n). We want to show that S must query many bits from X in order to cover all the neighbor pairs of many men. For this, we next show that any collection of (ε/2)n men from T must have a large total number of neighbor pairs. Note that the value of νi decreases as i decreases from n/2 or as i increases from n/2. Thus, the number of neighbor pairs that any collection of (ε/2)n men from T have is at least
n−(ε/8)n
(3ε/8)n−1
i=(ε/8)n
νi +
i=n−(3ε/8)n+1
(3ε/8)n−1
νi =
i(n − i)
i=(ε/8)n
log n n−1
(ε/4)n log n ≥ i(n − i) n − 1 i=1
≥ Ω(ε2 n2 log n).
Communication Requirements for Stable Marriages
381
This implies that if S does not query that many bits from X, it can only cover all the neighbor pairs of at most (ε/2)n men in T , which means that there must exist a set T ⊆ T of at least |T |− (ε/2)n ≥ (1 − ε)n men, each having a neighbor pair in W such that none of its two difference bits is queried by S. For each man i ∈ T , let (wj , wk ) be that neighbor pair in W , and let W (i) be the ranking in Pn obtained from W by swapping wj and wk in W . Then we follow the approach in Subsection 3.2. Let M be the matching produced by the server S on input X. Let X be the input modified from X such that the ranking of any man i ∈ T is (i) W if (i, wi ) ∈ M, Xi = W if (i, wi ) ∈ / M, while the ranking of every other person remains the same. From the discussion before, we know that S must output the same matching M for the two different inputs X and X since S can not distinguish them apart. Note that the inputs X and X do satisfy Property A in Subsection 3.2, so we can again apply Lemma 4 there to show that every edge in M connecting a man in T is unstable with respect to the input X . This means that the matching M produced by S for the input X is not ε-stable, a contradiction. We have shown that if the server S does not query Ω(ε2 n2 log n) bits from X, then by changing the input to X , the matching produced by S is not ε-stable. This implies that for S to always output an ε-stable matching, it must query at least Ω(ε2 n2 log n) bits from some input, and we have Theorem 4.
References 1. Canadian Resident Matching Service, http://www.carms.ca/ 2. Eriksson, K., H¨ aggstr¨ om, O.: Instability of matchings in decentralized markets with various preference structures. International Journal of Game Theory 36, 409–420 (2008) 3. Flor´een, P., Kaski, P., Polishchuk, V., Suomela, J.: Almost stable matchings in constant time. eprint arXiv: 0812.4893 (2008) 4. Gale, D., Shapley, L.: College admissions and the stability of marriage. American Mathematical Monthly 69, 9–15 (1962) 5. Gale, D., Sotomayor, M.: Some remarks on the stable matching problem. Discrete Applied Mathematics 11, 223–232 (1985) 6. Halld´ orsson, M.M., Iwama, K., Miyazaki, S., Yanagisawa, H.: Improved approximation results for the stable marriage problem. ACM Transactions on Algorithms 3(3), Article No. 30 (2007) 7. Irving, R.W.: Stable marriage and indifference. Discrete Applied Mathematics 48, 261–272 (1994) 8. Iwama, K., Manlove, D.F., Miyazaki, S., Morita, Y.: Stable marriage with incomplete lists and ties. In: Wiedermann, J., Van Emde Boas, P., Nielsen, M. (eds.) ICALP 1999. LNCS, vol. 1644, pp. 443–452. Springer, Heidelberg (1999) 9. Iwama, K., Miyazaki, S.: A survey of the stable marriage problem and its variants. In: Proceedings of the International Conference on Informatics Education and Research for Knowledge-Circulating Society, pp. 131–136. IEEE Computer Society, Washington (2008)
382
J.-H. Chou and C.-J. Lu
10. Iwama, K., Miyazaki, S., Okamoto, K.: A (2−c(log N/N ))-approximation algorithm for the stable marriage problem. In: Hagerup, T., Katajainen, J. (eds.) SWAT 2004. LNCS, vol. 3111, pp. 349–361. Springer, Heidelberg√(2004) 11. Iwama, K., Miyazaki, S., Yamauchi, N.: A (2 − c(1/ N ))-approximation algorithm for the stable marriage problem. In: Deng, X., Du, D.-Z. (eds.) ISAAC 2005. LNCS, vol. 3827, pp. 902–914. Springer, Heidelberg (2005) 12. Iwama, K., Miyazaki, S., Yamauchi, N.: A 1.875-approximation algorithm for the stable marriage problem. In: Proceedings of the 18th Annual ACM-SIAM Symposium on Discrete Algorithms, pp. 288–297. Society for Industrial and Applied Mathematics, Philadelphia (2007) 13. Japan Residency Matching Program, http://www.jrmp.jp/ 14. Kir´ aly, Z.: Better and simpler approximation algorithms for the stable marriage problem. In: Halperin, D., Mehlhorn, K. (eds.) ESA 2008. LNCS, vol. 5193, pp. 623–634. Springer, Heidelberg (2008) 15. Manlove, D.F.: Stable marriages with ties and unacceptable partners. Computing Science Department Research Report, TR-1999-29, University of Glasgow (1999) 16. Manlove, D.F., Irving, R.W., Iwama, K., Miyazakki, S., Morita, Y.: Hard variants of stable marriage. Theoretical Computer Science 276(1-2), 261–279 (2002) 17. Ng, C.: Lower bounds for the stable marriage problem and its variants. SIAM Journal on Computing 19(1), 71–77 (1990) 18. National resident matching program, http://www.nrmp.org/ 19. Roth, A.E.: The evolution of the labor market for medical interns and residents: a case study in game theory. Journal of Political Economy 92(6), 991–1016 (1984) 20. Segal, I.: The communication requirements of social choice rules and supporting budget sets. Journal of Economic Theory 136, 341–378 (2007) 21. Scottish PRHO Allocations, http://www.dcs.gla.ac.uk/~ rwi/SPA.html 22. Yao, A.C.: Some complexity questions related to distributive computing. In: Proceedings of the 11st Annual ACM Symposium on the Theory of Computing, pp. 209–213. ACM Press, New York (1979)