Table of Contents
Fetching ...

Subtree Mode and Applications

Jialong Zhou, Ben Bals, Matei Tinca, Ai Guan, Panagiotis Charalampopoulos, Grigorios Loukides, Solon P. Pissis

TL;DR

This work introduces the Subtree Mode (SM) problem, the analogous problem in a leaf-colored tree, where the task is to compute the most frequent color in the leaves of the subtree of a given node.

Abstract

The mode of a collection of values (i.e., the most frequent value in the collection) is a key summary statistic. Finding the mode in a given range of an array of values is thus of great importance, and constructing a data structure to solve this problem is in fact the well-known Range Mode problem. In this work, we introduce the Subtree Mode (SM) problem, the analogous problem in a leaf-colored tree, where the task is to compute the most frequent color in the leaves of the subtree of a given node. SM is motivated by several applications in domains such as text analytics and biology, where the data are hierarchical and can thus be represented as a (leaf-colored) tree. Our central contribution is a time-optimal algorithm for SM that computes the answer for every node of an input $N$-node tree in $O(N)$ time. We further show how our solution can be adapted for node-colored trees, or for computing the $k$ most frequent colors, in the optimal $O(N)$ time, for any given $k=O(1)$. Moreover, we prove that a similarly fast solution for when the input is a sink-colored directed acyclic graph instead of a leaf-colored tree is highly unlikely. Our experiments on real datasets with trees of up to 7.3 billion nodes demonstrate that our algorithm is faster than baselines by at least one order of magnitude and much more space efficient. Last, we present case studies showing the effectiveness of our approach in pattern mining and sequence-to-database search applications.

Subtree Mode and Applications

TL;DR

This work introduces the Subtree Mode (SM) problem, the analogous problem in a leaf-colored tree, where the task is to compute the most frequent color in the leaves of the subtree of a given node.

Abstract

The mode of a collection of values (i.e., the most frequent value in the collection) is a key summary statistic. Finding the mode in a given range of an array of values is thus of great importance, and constructing a data structure to solve this problem is in fact the well-known Range Mode problem. In this work, we introduce the Subtree Mode (SM) problem, the analogous problem in a leaf-colored tree, where the task is to compute the most frequent color in the leaves of the subtree of a given node. SM is motivated by several applications in domains such as text analytics and biology, where the data are hierarchical and can thus be represented as a (leaf-colored) tree. Our central contribution is a time-optimal algorithm for SM that computes the answer for every node of an input -node tree in time. We further show how our solution can be adapted for node-colored trees, or for computing the most frequent colors, in the optimal time, for any given . Moreover, we prove that a similarly fast solution for when the input is a sink-colored directed acyclic graph instead of a leaf-colored tree is highly unlikely. Our experiments on real datasets with trees of up to 7.3 billion nodes demonstrate that our algorithm is faster than baselines by at least one order of magnitude and much more space efficient. Last, we present case studies showing the effectiveness of our approach in pattern mining and sequence-to-database search applications.

Paper Structure

This paper contains 47 sections, 17 theorems, 3 equations, 9 figures, 2 tables.

Key Result

Lemma 1

Given a string $S$ of length $n$ over an integer alphabet of size $n^{\mathcal{O}(1)}$, the suffix tree $\textsf{ST}(S)$ of $S$ can be constructed in $\mathcal{O}(n)$ time.

Figures (9)

  • Figure 1: SNP-based phylogenetic tree.
  • Figure 2: The suffix tree of $S_0\$_0S_1\$_1=\texttt{aaaab}\texttt{\$}_0\texttt{aab}\texttt{\$}_1$.
  • Figure 3: Suffix tree $\textsf{ST}(S)$ for $S=\texttt{banana\$}$; the squares denote starting positions in $S$.
  • Figure 4: In Step $1$ of the algorithm, the single-color trees $\mathcal{T}_0, \ldots, \mathcal{T}_3$ are created from $\mathcal{T}$. Note that each (internal) node $v$ of $\mathcal{T}_i$, for all $i\in[0,4)$, is annotated with one node $\phi_i(v)$ of $\mathcal{T}$; e.g., $\phi_i(v)=a$ for all root nodes $v$ in $\mathcal{T}_i$. In Step $2$, every internal node in $\mathcal{T}_0, \ldots, \mathcal{T}_3$ stores the count of its leaf descendants. In Step 3, the internal nodes of $\mathcal{T}$ store (frequency, color) pairs.
  • Figure 5: DAG $\mathcal{D}$ for $A$ and $B$.
  • ...and 4 more figures

Theorems & Definitions (37)

  • Example 1
  • Example 2
  • Example 3
  • Example 4
  • Example 5
  • Lemma 1: DBLP:conf/focs/Farach97
  • Proposition 1
  • proof
  • Lemma 2: DBLP:journals/corr/abs-1101-4068
  • Proposition 2
  • ...and 27 more