Table of Contents
Fetching ...

Identifying all snarls and superbubbles in linear-time, via a unified SPQR-tree framework

Francisco Sena, Aleksandr Politov, Corentin Moumard, Manuel Cáceres, Sebastian Schmidt, Juha Harviainen, Alexandru I. Tomescu

TL;DR

Snarls and superbubbles are key bubble-like structures in pangenome graphs, but previous methods either struggled with linear-time enumeration or lacked a unified framework. The authors introduce a linear-size representation of snarls and a linear-time algorithm based on a SPQR-tree decomposition of the underlying undirected graph, jointly enabling efficient identification of snarls and superbubbles. Their approach is implemented in BubbleFinder and demonstrates strong performance across diverse pangenome datasets, providing speedups over specialized tools and offering a unifying perspective that could extend to other bubble-like structures. The work advances practical pangenomics by delivering provably linear-time, scalable algorithms that leverage 2-separators and SPQR-trees for comprehensive structural decomposition.

Abstract

Snarls and superbubbles are fundamental pangenome decompositions capturing variant sites. These bubble-like structures underpin key tasks in computational pangenomics, including structural-variant genotyping, distance indexing, haplotype sampling, and variant annotation. Snarls can be quadratically-many in the size of the graph, and since their introduction in 2018 with the vg toolkit, there has been no work on identifying all snarls in linear time. Moreover, while it is known how to find superbubbles in linear time, this result is a highly specialized solution only achieved after a long series of papers. We present the first algorithm identifying all snarls in linear time. This is based on a new representation of all snarls, of size linear in the input graph size, and which can be computed in linear time. Our algorithm is based on a unified framework that also provides a new linear-time algorithm for finding superbubbles. An observation behind our results is that all such structures are separated from the rest of the graph by two vertices (except for cases which are trivially computable), i.e. their endpoints are a 2-separator of the underlying undirected graph. Based on this, we employ the well-known SPQR tree decomposition, which encodes all 2-separators, to guide a traversal that finds the bubble-like structures efficiently. We implemented our algorithms in C++ (available at https://github.com/algbio/BubbleFinder) and evaluated them on various pangenomic datasets. Our algorithms outcompete or they are on the same level of existing methods. For snarls, we are up to two times faster than vg, while identifying all snarls. When computing superbubbles, we are up to 50 times faster than BubbleGun. Our SPQR tree framework provides a unifying perspective on bubble-like structures in pangenomics, together with a template for finding other bubble-like structures efficiently.

Identifying all snarls and superbubbles in linear-time, via a unified SPQR-tree framework

TL;DR

Snarls and superbubbles are key bubble-like structures in pangenome graphs, but previous methods either struggled with linear-time enumeration or lacked a unified framework. The authors introduce a linear-size representation of snarls and a linear-time algorithm based on a SPQR-tree decomposition of the underlying undirected graph, jointly enabling efficient identification of snarls and superbubbles. Their approach is implemented in BubbleFinder and demonstrates strong performance across diverse pangenome datasets, providing speedups over specialized tools and offering a unifying perspective that could extend to other bubble-like structures. The work advances practical pangenomics by delivering provably linear-time, scalable algorithms that leverage 2-separators and SPQR-trees for comprehensive structural decomposition.

Abstract

Snarls and superbubbles are fundamental pangenome decompositions capturing variant sites. These bubble-like structures underpin key tasks in computational pangenomics, including structural-variant genotyping, distance indexing, haplotype sampling, and variant annotation. Snarls can be quadratically-many in the size of the graph, and since their introduction in 2018 with the vg toolkit, there has been no work on identifying all snarls in linear time. Moreover, while it is known how to find superbubbles in linear time, this result is a highly specialized solution only achieved after a long series of papers. We present the first algorithm identifying all snarls in linear time. This is based on a new representation of all snarls, of size linear in the input graph size, and which can be computed in linear time. Our algorithm is based on a unified framework that also provides a new linear-time algorithm for finding superbubbles. An observation behind our results is that all such structures are separated from the rest of the graph by two vertices (except for cases which are trivially computable), i.e. their endpoints are a 2-separator of the underlying undirected graph. Based on this, we employ the well-known SPQR tree decomposition, which encodes all 2-separators, to guide a traversal that finds the bubble-like structures efficiently. We implemented our algorithms in C++ (available at https://github.com/algbio/BubbleFinder) and evaluated them on various pangenomic datasets. Our algorithms outcompete or they are on the same level of existing methods. For snarls, we are up to two times faster than vg, while identifying all snarls. When computing superbubbles, we are up to 50 times faster than BubbleGun. Our SPQR tree framework provides a unifying perspective on bubble-like structures in pangenomics, together with a template for finding other bubble-like structures efficiently.

Paper Structure

This paper contains 26 sections, 43 theorems, 3 equations, 7 figures, 4 tables, 9 algorithms.

Key Result

Theorem 1

Given a bidirected graph $G$, there exists a representation of all snarls of $G$ of size $|V(G)| + |E(G)|$ consisting of sets $T_1, T_2, \dots, T_k$ and $S_1, S_2, \dots, S_\ell$, where Moreover, this representation can be computed in time $O(|V(G)| + |E(G)|)$.

Figures (7)

  • Figure 1: Block-cut trees and representing quadratically many snarls in linear size. (a) A bidirected graph $G$ with snarls $\{a+, d-\}$, $\{a+, f+\}$, $\{a+, g-\}$, $\{d-, f+\}$, $\{d-, g-\}$, $\{f+, g-\}$ (blue) and $\{g+, k-\}$ (green). (b) The block-cut tree of $G$. Block nodes are drawn as ellipses, and cutnodes as squares. Tree edges are bold dashed lines. On the cutnodes, we annotate the incidence signs for each block, using the special value $0$ for mixed signs. (c) The two sign-cut graphs of $G$), which are obtained by splitting the sign-consistent cutvertices (here, only $g$). The tips of the sign-cut graph on the left are $\{a+,d-,f+,g-\}$ (in blue), and those on the right are $\{g+,k-\}$ (in green). This is a linear-size representation of quadratically-many tip-tip snarls (i.e. all pairs of vertices in each tip set). Cutvertex $e$ has at least one $0$, hence it is not sign-consistent, and hence it is not split. Cutvertex $g$ has no $0$, and thus it is split. No snarl can have endpoints in distinct sign-cut graphs (e.g. across the red cut), because otherwise $g$ would disprove its minimality.
  • Figure 2: Concepts of SPQR trees. (a) An undirected graph $H$. (b) The SPQR tree of $H$. Tree edges are bold dashed lines. Red edges are virtual and black solid edges are real edges. Node $\mu$ is an R-node and its skeleton is 3-connected. Node $\nu$ is a P-node with $k=3$. The virtual edge $e_\nu$ of $\mathop{\mathrm{skeleton}}\nolimits(\mu)$ pertains to $\nu$ and the virtual edge $e_\mu \in E(\mathop{\mathrm{skeleton}}\nolimits(\nu))$ pertains to $\mu$. The tree edge $\{\nu,\mu\}$ induces a separation of $H$ with vertex sets $\{a,b,c,d,f\}$ and $\{b,c,e\}$. (c) The graph $\mathop{\mathrm{expansion}}\nolimits(e_\mu)$. The real edges appearing to the left of the separation induce $\mathop{\mathrm{expansion}}\nolimits(e_\mu)$. (d) The graph $\mathop{\mathrm{expansion}}\nolimits(e_\nu)$.
  • Figure 3: Snarls and 2-separators in the SPQR tree. (a) A bidirected graph. The snarls are $\{a+, e+\}$ (green), $\{c+, b-\}$ (yellow), $\{c-, b+\}$ (gray), $\{e-, h+\}$ (blue), $\{a-, h-\}$ (orange), $\{f-, g+\}$ (red), $\{g-, i+\}$ (purple). Snarl $\{c+, b-\}$ is contained in snarl $\{a+, e+\}$. (b) The corresponding block-cut tree. Blocks are marked with a B, and cutnodes with a C. There is one cutnode $g$, which separates the two blocks. (c) The SPQR tree of the largest block. Its nodes are marked with their types and contain their skeletons. Red edges are virtual, and dashed black edges connect pairs of virtual edges. The snarls $\{a+, e+\}$ (green), $\{e-, h+\}$ (blue) are highlighted. Snarl $\{g-, i+\}$ is not part of the block. Snarl $\{f-, g+\}$ is a special case that spans the whole block and is handled when finding snarls in the sign-cut tree (see \ref{['thm:where-are-snarls-after-cutting']} and \ref{['prop:snarls-both-tips-component']}). Snarls $\{c+, b-\}$, $\{c-, b+\}$ and $\{a-, h-\}$ are single-edge snarls that are handled separately (see \ref{['prop:snarl-edge-case']}). (d) The snarl components of $\{a+, e+\}$ (green) and $\{e-, h+\}$ (blue). Vertex $e$ is in both snarl components.
  • Figure 4: Snarls and 2-separators in S, P and R nodes. Red edges are virtual, and are marked with $+$ or $-$ at their endpoints if all their represented incidences at that endpoint are $+$ or $-$. If the incidences are mixed, we mark them with a $0$. No vertex has dangling blocks. (a) and (b) are P-nodes without a consistent partitioning of the edges at their endpoints. (c) is a P-node with a consistent partitioning of the edges, and hence it contains the snarls $\{a-, b+\}$ and $\{a+, b-\}$. (d) is an S-node where for $b$ and $c$ the signs are partitioned between the two virtual edges, and for $a$ and $d$ the signs are mixed. Hence, it contains the snarls $\{b+, c-\}$ and $\{b-, c+\}$. (e) is a pair of adjacent R-nodes. Since the signs of $b$ and $d$ are partitioned along the boundaries of the R-nodes, they contain the snarls $\{b+, d-\}$ and $\{b-, d+\}$.
  • Figure 5: (a) A bidirected graph. The snarls are $\{a+, e+\}$ (green), $\{c+, b-\}$ (yellow), $\{c-, b+\}$ (gray), $\{e-, h+\}$ (blue), $\{a-, h-\}$ (orange), $\{f-, g+\}$ (red), $\{g-, i+\}$ (purple). Snarl $\{c+, b-\}$ is contained in snarl $\{a+, e+\}$. (b) The corresponding biedged graph. The outer edges are black, and the inner edges are dashed in gray. The snarls are highlighted in the same colors.
  • ...and 2 more figures

Theorems & Definitions (78)

  • Theorem 1
  • Proposition 1: SPQR trees and separation/split pairs
  • Lemma 1: SPQR trees require linear space onlinegraphalgorithms
  • Definition 1: Snarl, Snarl component
  • Definition 2: Sign-cut graphs
  • Lemma 2
  • Lemma 3
  • Theorem 2
  • Theorem 3: Snarls and split pairs
  • Proposition 2: Snarls and S-nodes
  • ...and 68 more