Listing Acyclic Orientations of Graphs with Single and Multiple Sources Alessio Conte, Roberto Grossi, Andrea Marino, Romeo Rizzi
Total Page:16
File Type:pdf, Size:1020Kb
Listing Acyclic Orientations of Graphs with Single and Multiple Sources Alessio Conte, Roberto Grossi, Andrea Marino, Romeo Rizzi To cite this version: Alessio Conte, Roberto Grossi, Andrea Marino, Romeo Rizzi. Listing Acyclic Orientations of Graphs with Single and Multiple Sources. LATIN 2016: Theoretical Informatics - 12th Latin American Sym- posium, Apr 2016, Ensenada, Mexico. pp.319-333, 10.1007/978-3-662-49529-2_24. hal-01388470 HAL Id: hal-01388470 https://hal.inria.fr/hal-01388470 Submitted on 30 May 2017 HAL is a multi-disciplinary open access L’archive ouverte pluridisciplinaire HAL, est archive for the deposit and dissemination of sci- destinée au dépôt et à la diffusion de documents entific research documents, whether they are pub- scientifiques de niveau recherche, publiés ou non, lished or not. The documents may come from émanant des établissements d’enseignement et de teaching and research institutions in France or recherche français ou étrangers, des laboratoires abroad, or from public or private research centers. publics ou privés. Listing Acyclic Orientations of Graphs with Single and Multiple Sources Alessio Conte1, Roberto Grossi1, Andrea Marino1, and Romeo Rizzi2 1 Università di Pisa and Erable, Inria, conte,grossi,[email protected]? 2 Università di Verona, [email protected] Abstract. We study enumeration problems for the acyclic orientations of an undirected graph with n nodes and m edges, where each edge must be assigned a direction so that the resulting directed graph is acyclic. When the acyclic orientations have single or multiple sources specified as input along with the graph, our algorithm is the first one to provide guaranteed bounds, giving new bounds with a delay of O(m · n) time per solution and O(n2) working space. When no sources are specified, our algorithm improves over previous work by reducing the delay to O(m), and is the first one with linear delay. 1 Introduction Acyclic orientations of graphs are related to several basic problems in graph −! theory. An orientation of an undirected graph G is the directed graph G whose −! arcs are obtained assigning a direction to each edge in G. The orientation G is −! acyclic when it does not contain cycles, and a node s is a source in G if it has indegree zero. For instance, consider the graphs in Figure 1. The directed graph in (b) is an acyclic orientation for the undirected graph in (a). In particular, since the orientation has only one source (v9), it is called a single source acyclic orientation. Starting from the observation that each acyclic orientation corresponds to a partial order for the underlying graph, Iriarte [7] investigates which orientations maximize the number of linear extensions of the corresponding poset. Alon and Tarsi [1] look for special orientations to give bounds on the size of the maximum independent set or the chromatic number. Gallai, Roy, and Vitaver indepen- dently describe a well-known result stating that every orientation of a graph with chromatic number k contains a simple directed path with k vertices [6, 12, 17]. There are further problems that can be addressed by looking at acyclic orientations. For instance, Benson et al. [4] show that there exists a bijection between the set of the so-called superstable configurations of a graph and the set of its acyclic orientations with a unique source. ? This work has been partially supported by the Italian Ministry of Education, Uni- versity, and Research (MIUR) under PRIN 2012C4E3KT national research project AMANDA — Algorithmics for MAssive and Networked DAta. v6 v6 v3 v9 v3 v9 v8 v8 v2 v2 v5 v7 v5 v7 v4 v4 v1 v1 (a) (b) Fig. 1. An undirected connected graph without self-loops (a) and one of its acyclic orientations (b). Counting how many acyclic orientations can be found in a graph is a funda- mental problem in combinatorics, dating back to the 70s or earlier [16]. Linial [10] proves that this problem is #P-complete. Stanley [15] shows how the number of acyclic orientations can be computed by using the chromatic polynomial (a special case of Tutte’s polynomial). Another approach that concerns the number of acyclic orientations is the acyclic orientation game. Alon and Tuza [2] inquire about the amount of oriented edges needed to define a unique orientation of G, and find this number to be almost surely Θ(jV j log jV j) in Erdős–Rényi random graphs. Pikhurko [11] shows that the number of these edges in the worst case is 1 2 no greater than ( 4 + o(1))jV j for general graphs. Problems addressed. Our paper investigates new algorithms for enumerat- ing patterns for this interesting problem in graph theory, given an undirected connected graph G(V; E) with n nodes and m edges. single source acyclic orientations ( ): Given a node s 2 V , enumerate −! ssao all the acyclic orientations G of G, such that s is the only source. single source acyclic orientations (weak ): Given a set of nodes S ⊆ −!ssao V , enumerate all the acyclic orientations G of G such that there is exactly one source x and x 2 S. multiple source acyclic orientations (strong ): Given a set of nodes −!msao S ⊆ V , enumerate all the acyclic orientations G of G such that all the nodes in S are the only sources.3 multiple source acyclic orientations (weak ): Given a set of nodes msao−! S ⊆ V , enumerate all the acyclic orientations G of G such that if x is a source then x 2 S.4 −! acyclic orientations (ao): Enumerate all the acyclic orientations G of G. We will show that these problems can be reduced to ssao, with a one-to-one correspondence between their solutions. Many other variants with constraints on the number or choice of sources can be reduced to ssao as well: the ones 3 These orientations are possible if and only if S is an independent set. 4 Not all nodes in S must be sources, but there cannot be sources in V n S. 2 we present are some of the most representative ones. We analyze the cost of an enumeration algorithm for ssao, weak ssao, strong msao, weak msao, and ao in terms of its delay cost, which is a well-known measure of performance for enumeration algorithms corresponding to the worst-case time between any two consecutively enumerated solutions (e.g. [8]). We are interested in algorithms with guaranteed delay and space. Previous work. We are not aware of any provably good bounds for problems ssao, weak ssao, strong msao and weak msao. Johnson’s backtracking algo- rithm [9] for ssao has been presented over 30 years ago to solve problems on network reliability. However its complexity is not given and is hard to estimate, as it is based on a backtracking approach with dead ends. In his paper presenting an algorithm for ao, Squire [14] writes that he has been unable to efficiently implement Johnson’s approach because of its dead ends. Squire’s algorithm for ao uses Gray codes and has an amortized cost of O(n) per solution, but its delay can be O(n3) time for a solution. The algorithm by Barbosa and Szwarcfiter [3] solves ao with an amortized time complexity of O(n + m) per solution, delay O(n · m). The algorithm builds the oriented graph incrementally by iteratively adding the nodes to an empty directed graph. It is worth observing that by replacing each edge with a double arc and applying any algorithm for maximal feedback arc set enumeration, one can obtain all the acyclic orientations of G. State of the art approaches for the latter problem guarantee a delay Ω(n3) as shown by Schwikowski and Speckenmeyer [13]. All the techniques above for ao, including the one in [14], do not to extend smoothly to ssao, weak ssao, strong msao, and weak msao. In a previous work [5], we studied the related problem of enumerating the cyclic orientations of an undirected graph, but the proposed techniques cannot be reused for the problems in this paper. Our results. Our contribution is the design of the first enumeration algorithms with guaranteed bounds for ssao, weak ssao, strong msao, and weak msao: the complexity is O(m · n) delay per solution using O(n2) space. For ao, we also show how to obtain O(m) delay, improving the delay of [3, 13, 14], but we do not improve the amortized cost of O(n) in [14]. We therefore focus on ssao in the first part of the paper, and then show an optimization that holds for the case of ao. We guarantee that, at any given partial solution, the extensions of the partial solution will enumerate new acyclic orientations. To this aim, we solve several non-trivial issues. – We use a recursive approach where each call surely leads to a solution. For ssao this is achieved also by using a suitable ordering of the nodes. – We quickly identify the next recursion calls within the claimed time delay. – We do a careful analysis of the recursion tree, and show how to check effi- ciently for node reachability during recursion. – In the case of ao we exploit the fact that the recursion tree does not contain unary nodes. 3 The paper is organized as follows. We give the necessary definitions and terminology in Section 2. We then discuss how to solve ssao in Section 3 and further reduce the delay for ao in Section 4. In Section 5 we show how weak ssao, strong msao, weak msao, and ao reduce to ssao. We draw some conclusions in Section 6. 2 Preliminaries Given an undirected graph G(V; E) with n nodes and m edges, an orientation of −! −! −! G is the directed graph G(V; E ) where for any pair fu; vg 2 E either (u; v) 2 E −! −! −! or (v; u) 2 E .