Table of Contents
Fetching ...

Sorting and Ranking of Self-Delimiting Numbers with Applications to Outerplanar Graph Isomorphism

Frank Kammer, Johannes Meintrup, Andrej Sajenko

TL;DR

We address the problem of sorting and ranking $k$ self-delimiting numbers encoded as Elias gamma codes within an $N$-bit input, and apply the results to linear-time isomorphism problems for trees, forests, and outerplanar graphs under space constraints. Our approach partitions numbers into small and large classes, uses stable presorting and radix-based sorting to achieve $O(k+N/\log N)$ time and $O(N)$ bits, and constructs dense/competitive rank structures that answer queries in constant time with inputs $p_x$ for large values. The paper also develops space-efficient representations for trees (balanced parentheses, LOUDS) and a DFS with compact iterators to realize $O(n)$-time, $O(n)$-bit isomorphism algorithms. These techniques extend to forests and maximal outerplanar graphs while maintaining the $O(n)$-bit total footprint, improving on prior $Θ(n \log n)$-bit linear-time isomorphism algorithms.

Abstract

Assume that an $N$-bit sequence $S$ of $k$ numbers encoded as Elias gamma codes is given as input. We present space-efficient algorithms for sorting, dense ranking and competitive ranking on $S$ in the word RAM model with word size $Ω(\log N)$ bits. Our algorithms run in $O(k + \frac{N}{\log N})$ time and use $O(N)$ bits. The sorting algorithm returns the given numbers in sorted order, stored within a bit-vector of $N$ bits, whereas our ranking algorithms construct data structures that allow us subsequently to return the dense/competitive rank of each number $x$ in $S$ in constant time. For numbers $x \in \mathbb{N}$ with $x > N$ we require the position $p_x$ of $x$ as the input for our dense-/competitive-rank data structure. As an application of our algorithms above we give an algorithm for tree isomorphism, which runs in $O(n)$ time and uses $O(n)$ bits on $n$-node trees. Finally, we generalize our result for tree isomorphism to forests and outerplanar graphs, while maintaining a space-usage of $O(n)$ bits. The previous best linear-time algorithms for trees, forests and outerplanar graph isomorphism all use $Θ(n \log n)$ bits.

Sorting and Ranking of Self-Delimiting Numbers with Applications to Outerplanar Graph Isomorphism

TL;DR

We address the problem of sorting and ranking self-delimiting numbers encoded as Elias gamma codes within an -bit input, and apply the results to linear-time isomorphism problems for trees, forests, and outerplanar graphs under space constraints. Our approach partitions numbers into small and large classes, uses stable presorting and radix-based sorting to achieve time and bits, and constructs dense/competitive rank structures that answer queries in constant time with inputs for large values. The paper also develops space-efficient representations for trees (balanced parentheses, LOUDS) and a DFS with compact iterators to realize -time, -bit isomorphism algorithms. These techniques extend to forests and maximal outerplanar graphs while maintaining the -bit total footprint, improving on prior -bit linear-time isomorphism algorithms.

Abstract

Assume that an -bit sequence of numbers encoded as Elias gamma codes is given as input. We present space-efficient algorithms for sorting, dense ranking and competitive ranking on in the word RAM model with word size bits. Our algorithms run in time and use bits. The sorting algorithm returns the given numbers in sorted order, stored within a bit-vector of bits, whereas our ranking algorithms construct data structures that allow us subsequently to return the dense/competitive rank of each number in in constant time. For numbers with we require the position of as the input for our dense-/competitive-rank data structure. As an application of our algorithms above we give an algorithm for tree isomorphism, which runs in time and uses bits on -node trees. Finally, we generalize our result for tree isomorphism to forests and outerplanar graphs, while maintaining a space-usage of bits. The previous best linear-time algorithms for trees, forests and outerplanar graph isomorphism all use bits.

Paper Structure

This paper contains 3 sections, 8 theorems, 1 equation, 2 figures.

Key Result

Lemma 1

(rank-select BauH17) Given access to a sequence $B = (b_1, \ldots, b_n) = \{0, 1\}^{n}$$(n \in I\!\!N)$ of $n$ bits there is an $o(n)$-bit data structure that, after an initialization of $O(n / w)$ time, supports two constant-time operations:

Figures (2)

  • Figure 1: A sketch of our storage scheme to realize dense rank. $S_{\leq N}$ is a sorted sequence of self-delimiting numbers, $B$ and $P$ are vectors partitioned into frames. For each $x \in S_{\leq N}$ we flip the $x$th bit in $B$. Afterwards we count the number of bits for each frame and store the prefix sum over the numbers in $P$. The gray stripped frames are uninitialized because no number of $S_{\leq N}$ belongs to that frame.
  • Figure 2: A sketch of our storage schema to realize competitive rank. For each region $\mathcal{R}_i$, that contains numbers out of $S'$, a pointer $F[i]$ points to a data structure storing the amount of occurrences for each of the numbers. In addition, $P_i$ stores the prefix-sum over the frames up to $A_i$. For numbers $x$ of size $>N$ the position $p_x$ of $x$ in $S$ is required as the input.

Theorems & Definitions (10)

  • Lemma 1
  • Lemma 2
  • Lemma 3
  • Theorem 4
  • Theorem 5
  • Theorem 6
  • Definition 7
  • Definition 8
  • Lemma 9
  • Lemma 10