We present a linear time algorithm for computing an implicit linear space representation of a minimum cycle basis (MCB) in weighted partial 2-trees; i.e., graphs of treewidth two. The implicit representation can be made explicit in a running time that is proportional to the size of the MCB. For planar graphs, Borradaile, Sankowski, and Wulff-Nilsen [Min st-cut Oracle for Planar Graphs with Near-Linear Preprocessing Time, FOCS 2010] showed how to compute an implicit O(n log n) space representation of an MCB in O(n log 5 n) time. For the special case of partial 2-trees, our algorithm improves this result to linear time and space. Such an improvement was achieved previously only for outerplanar graphs [Liu and Lu: Minimum Cycle Bases of Weighted Outerplanar Graphs, IPL 110:970-974, 2010].
IntroductionA cycle basis of a graph G is a minimum-cardinality set C of cycles in G such that every cycle C in G can be written as the exclusive-or sum of a subset of cycles in C. A minimum cycle basis (MCB) of G is a cycle basis that minimizes the total weight of the cycles in the basis. Minimum cycle bases have numerous applications in the analysis of electrical networks, biochemistry, periodic timetabling, surface reconstruction, and public transportation, and have been intensively studied in the computer science literature. We refer the interested reader to [16] for an exhaustive survey. It is-both from a practical and a theoretical viewpoint-an interesting task to compute minimum cycle bases efficiently.All graphs considered in this work are simple graphs G = (V, E) with a non-negative edge-weight function w : E → R ≥0 . (Computing MCBs for graphs with cycles of negative weight is an NP-hard problem [16]. In all previous work that we are aware of it is therefore assumed that the edge-weights are non-negative.) Throughout this work, m = |E| denotes the size of the edge set and n = |V | the size of the vertex set of G.
Previous WorkThe first polynomial-time algorithm for computing MCBs was presented by Horton in 1987 [15]. His algorithm has running time O(m 3 n). This was improved subsequently in a series of papers by different authors, cf. [16] or [18] for surveys of the history. The currently fastest algorithms for general graphs are a deterministic O(m 2 n/ log n) algorithm of Amaldi, Iuliano, and Rizzi [2] and a Monte Carlo based algorithm by Amaldi, Iuliano, Jurkiewicz, Mehlhorn, and Rizzi [1] of running time O(m ω ), where ω is the matrix multiplication constant.The algorithm from [1] is deterministic on planar graphs, and has a running time of O(n 2 ). This improved the previously best known bound by Hartvigsen and Mardon [13], which is of order n 2 log n. The currently best known algorithm on planar graphs is due to Borradaile, Sankowski, and Wulff-Nilsen [7]. It constructs an O(n log n) space implicit representation of an MCB in planar graphs in time O(n log 5 n). 5 ⋆ This is the full version of [11] which has appeared in the