As scientific data becomes larger and more complex, sophisticated techniques are required for its effective analysis and visualization. Topology-based methods are particularly useful in this context due to their ability to capture features directly, and interact with them at multiple resolutions. Reeb graphs are an efficient solution that encodes the behavior of level sets of scalar functions defined on manifold meshes of arbitrary topology, and therefore their efficient computation is an important challenge. In this paper, we present a new algorithm that computes Reeb graphs in an efficient manner, to enable in-practice use of the Reeb graph for various visualization and analysis tasks.

Topology-based techniques are becoming more common to solve complex visualization and data analysis challenges. In particular, the contour tree [10] is now commonly recognized as an efficient solution to capture the structure of scalar fields. Thanks to simple, robust and fast algorithms [23], [7], it has a wide spectrum of applications, including seed-set computation for fast isosurface extraction [24], topologically clean isosurface extraction [8], feature-extraction [4], feature-driven visualization metaphors [26], and automated transfer function design [27]. Algorithms for computing the contour tree [23], [7] require the scalar-valued data to be defined on a simply connected domain (a very restrictive topological constraint), but many scientific experiments and computer-aided design simulations do not meet this requirement. Then, the more general notion of Reeb graph [21] is needed. Only a few algorithms exist for computing Reeb graphs on volumetric meshes, and they are computationally expensive and therefore not practically applicable for use in interactive applications.

This paper presents an algorithm to compute Reeb graphs on volumetric meshes in ℝ^{3} (in particular tetrahedral meshes) that runs in practice with the same efficiency as a contour-tree algorithm, enabling the practical generalization of contour tree based visualization techniques to meshes of arbitrary topology. Our approach is based on the key concept of *loop surgery*, inspired from surgery theory [25]. In particular, we transform the input domain by a sequence of symbolic cuts such that the Reeb graph of the input scalar field defined on the transformed domain is guaranteed to be loop free, and hence computable with efficient contour tree algorithms. Then, some *inverse symbolic cuts* are performed in the topology domain to convert the computed contour tree into the Reeb graph of the original scalar field. We show that these *symbolic cuts* can be computed in an efficient manner, with reasonable computation overhead with respect to contour tree computation. Extensive experiments show that for volumetric meshes our approach is orders of magnitude faster than state-of-the-art techniques, while maintaining a smaller memory footprint, as shown by the largest experiments. To demonstrate the potential of our approach, we picked a contour tree based visualization technique and extended it to volumetric meshes of arbitrary topology while still maintaining its interactive appeal. In particular, we implement an algorithm for fast topologically-clean isosurface extraction, and apply it in the context of pressure analysis for mechanical design.

### 1.1 Related work

A preliminary contour tree algorithm was introduced by de Berg and van Kreveld [10]. Extending the previous work by Tarasov and Vyalyi [23], Carr et al. [7] presented a very elegant, simple, robust and fast algorithm for contour tree computation on simply connected simplicial complexes of arbitrary dimension, hereafter called the *join-split* algorithm. This approach implicitly exploits the fact that, over simply connected domains, the topological evolution of the connected components of the sub- and sur-level sets of the input field captures all the information about that of the connected components of level sets. Consequently, level-set connectivity tracking is efficiently achieved by only keeping track of the connectivity of the sub- and sur- level sets with a computationally inexpensive Union-Find data structure. The *O*(*n*log *n* + *Na*(*N*)) complexity of the join-split algorithm can be proven to be optimal for computing contour trees. The relationship between the topology of the sub- and sur- level sets and that of level sets no longer holds on domains of arbitrary topology. This remark motivates research for efficient Reeb graph computation algorithms.

Approximation algorithms exist for computing Reeb graphs based on image domain regular partitioning [5], [16], [28], but they can lead to inaccurate results due to dependence on sampling rates or thresholds. The first combinatorial algorithm for Reeb graph computation on PL 2-manifolds was introduced by Shinagawa and Kunii [22], with an *O*(*n*_{t}^{2}) time complexity where *n*_{t} stands for the number of triangles in the mesh. Cole-McLaughlin et al. [9] introduced an optimal algorithm for PL 2-manifolds, with *O*(*n*_{e}log(*n*_{e})) time complexity (where *n*_{e} is the number of edges) by taking advantage of the mono-dimensionality of level sets in the special case of PL 2-manifolds by maintaining them dynamically in a sorted representation. Since it can be computed efficiently for PL 2-manifolds, the Reeb graph has been a very popular shape abstraction for several computer graphics tasks, such as surface parameterization [29], shape retrieval [16], character animation [3], and others. We defer the reader to [6] for a comprehensive survey on the applications of Reeb graphs in shape modeling.

Many properties of two-dimensional domains exploited by the above algorithms do not hold for three-dimensional domains, making the problem more challenging. There are only a few techniques for the computation of Reeb graphs in higher dimensions and thus usable for volumetric meshes. Pascucci et al. [19], presented a streaming approach taking as an input streamed meshes of arbitrary dimension. Due to its intrinsic ability to handle non-manifold meshes, the algorithm computes Reeb graphs by considering the restriction of the input field to the 2-skeleton of the mesh, whose Reeb graph is proved to equal that of the original field. However, isosurfaces have to be maintained, and since no natural order is possible for two-dimensional level sets (unlike the case of triangular meshes [9]), the algorithm exhibits a quadratic worse case time complexity. Doraiswamy and Natarajan [13] proposed an extension of Cole-McLaughlin et al.'s approach [9] to three-dimensions by dynamically maintaining isosur-faces with a complex data structure based on a spanning tree, resulting in a time complexity of *O*(*n*_{t}log^{2} *n*_{t}), where *n*_{t} is the number of triangles in the mesh. They showed that an implementation with a lighter data structure performed better in practice despite a complexity of *O*(*ng*log^{2}
*n*), where *g* is the maximum genus of an isosurface. The same authors also introduced recently another algorithm [12] with improved practical performance, which extends a previous approach [20] from surface to tetrahedral meshes. In [12], the authors adapt image domain regular partitioning techniques by partitioning the domain precisely along critical level sets and deducing the Reeb graph from the domain partition. With practical fields studied in scientific visualization or computer-aided design simulations, the number of critical points is often linear with the number of vertices in the mesh, and the size of the partition boundaries can also be proportional to the number of tetrahedra, resulting rapidly in a quadratic run-time behavior in practice.

### 1.2 Contributions

This paper makes the following new contributions:

We introduce a new procedure called *loop surgery* to reduce the problem of computing a Reeb graph to that of a contour tree. We believe this is an important result, since the join-split algorithm [7] for computing contour trees is well known to have not only optimal theoretical complexity, but also simple and practical implementation

We describe a practical algorithm for computing Reeb graphs with complexity *O*(*n*log *n* + *gN*). For practical examples *g*, which is equal to the number of handles of the domain, is a small constant, and systematic experiments show a speedup over previous algorithms by several orders of magnitude on average

We provide a proof showing necessary and sufficient conditions for a loop free Reeb graph to be computed correctly by the join-split contour tree algorithm

We extend topologically-clean isosurface extraction to volumetric meshes of arbitrary topology, and apply it in the context of mechanical design, where it enables a direct visualization of the major trends of physical simulations.

SECTION 2

## Preliminary Results

In this section, we briefly describe the formal setting of our approach and present some preliminary results on the topology of Reeb graphs on tetrahedral meshes. We defer the reader to [17] and [15] for reference books on Morse theory and homology.

### 2.1 Background and definitions

Consider a real-valued function *f:M* → ℝ defined on a manifold *M*. One fundamental way to study the function *f* is to extract its level sets. For a given scalar *w* the level set *L*(*w*) is defined as the inverse image of *w* onto *M* through *f* *L*(*w*) = *f*^{−}^{1}(*w*). We call each connected component of the level set *L*(*w*) a *contour*. A *sub-level set* is defined as the inverse image of the open interval (*−*∈*,w*) onto *M* through *f* *L*^{−}(*w*) = {*x* ∈ *M| f* (*x* *<w*}. Symmetrically, a *sur-level set* is the inverse image of the open interval (∈ *w,*) onto *M* through *f* *L*^{−}(*w*) = {*x* ∈ *M| f* (*x* *> w*}.

One aspect that is well understood in Morse theory [17] is the evolution of the homology classes of the contours of *f* while *w* changes continuously in ℝ. The points at which the topology of a contour changes are called *critical points* and the corresponding function values are called critical values. If all of the critical points of *f* are non-degenerate and have distinct values, then *f* is a *Morse function*.

A *retraction* is defined [15] as a continuous map such that its image is a subset of the domain and the restriction of the map to the image is the identity. We define a *contour retraction* of a manifold *M* under a function *f* to be a continuous map that retracts each contour (connected component of level set) to a single point. Notice that, by continuity, adjacent contours are retracted to adjacent points; distinct contours are retracted to distinct points. This gives the definition:

The *Reeb graph ℛ*(*f*) is the *contour retract* of *M* under *f*.

The Reeb graph is represented as a graph consisting of *nodes* and *arcs*. Branching in *ℛ*(*f*) occurs only at critical values of *f* Figure 2(b) shows a simple scalar function with the associated Reeb graph. A Reeb graph is called a *contour tree* when it has no loops. For example, this is true when *M* is simply connected.

Note that *f* can be decomposed into *f* = *ψ ° φ*, where *φ*: *M* → *ℛ*(*f*) is a contour retraction that maps points in the same contour of *f* to the same point of *ℛ*(*f*), and *ψ*: *ℛ*(*f*) → ℝ is a continuous function that maps points of *ℛ*(*f*) to a scalar value in ℛ

Consider the case where the domain of *f*: *M →* ℝ is a simplicial complex with boundary, with *n* vertices and *N* simplices. Within each simplex of *M*, the function *f* is the linear interpolation of its values at the vertices, and we say that *f* is a piecewise-linear (PL) function. The following operations on a simplicial complex *M* are used to identify critical points. The *star* of a simplex *u* is the set of simplices that contain *u* as a face: *St*(*u*) = {*σ* ∈ *M|u* ≤ *σ*}, where *u* ≤ *σ* denotes that *u* is a face of *σ*. The *link* of the simplex *u* is the set of simplices in the closure of the star of *u* that are not also in its star *i.e.* where denotes the closure of the star. In PL functions, critical points can only occur at vertices. The *lower link* of *u* is the subset of the link containing only simplices with all their vertices lower in function value than *u*: *Lk*^{−}(*u*) = {*σ* ∈ *Lk*(*u*)*| v* ≤ *σ* → *f*(*v* *<f* (*u*)}. Symmetrically, the *upper link* is *Lk*^{+}(*u*) = {*σ* ∈ *Lk*(*u*)*| v* ≤ *σ* → *f*(*u* *<f* (*v*)}. Similarly, the lower star of *u* is *St*^{−}(*u*) = {*σ* ∈ *St*(*u*)*| v* ≤ *σ* → *f*(*v* *<f*(*u*)}. A vertex *u* in *M* is *regular* if and only if both *Lk*^{−}(*u*) and *Lk*^{+}(*u*) are simply connected, otherwise *u* is a critical point of *f* (notice that both must be simply connected since *M* has a boundary).

### 2.2 Loops in Reeb graphs on PL 3-manifolds in ℝ^{3}

Consider a scalar function *f* defined on a PL 3-manifold mesh *M* in ℝ^{3} The key idea of *loop surgery* is to define a sequence of operations that transform *M* to *M′* with *f′*: *M′* → ℝ^{3} valued by *f* such that *ℛ*(*f′*) becomes loop-free, and then efficiently computable with contour tree algorithms. Therefore, we carefully characterize the loops (indepen-dent cycles) of *ℛ*(*f*) prior to introducing loop surgery.

Let *∂ M* be the boundary of *M*. Since *M* is compact and embeddable in ℝ^{3} ∂ *M* is necessarily non-empty, orientable and closed [11] but possibly disconnected.

Let *f*_{∂} be the restriction of *f* to *∂ M*. We will first assume that both *f* and *f*_{∂} are PL Morse functions (degenerate cases will be discussed later). Let *ℝ(f*_{∂}) be the Reeb graph of *f*_{∂}. Then, we have the following relation [9]:
TeX Source
$$\# loops(\Re (f_\partial)) = g$$
where *g* is the sum of the genera of the boundary components of *M*. The key property that will allow us to implement loop surgery in an efficient manner is the fact than the topology of *M* is closely related to that of *∂M*. In particular, the number of handles of *M* is the first Betti number *β*_{1}(*M*), which is given by the following relation [11]:
TeX Source
$$\beta _1 (M) = g$$
where *β*_{1}(*M*) is the number of independent 1-cycles in *M*, formally the rank of the first homology group of *M*. In simpler words, this relation expresses the fact that each handle of the volume *M* corresponds to a tunnel of its boundary surface.

As discussed in [9] in any dimension the construction of the Reeb graph can lead to the removal of 1-cycles, but not to the creation of new ones. Therefore, the number of loops of *ℛ*(*f*) cannot be greater than the first Betti number of *M*:
TeX Source
$$\# loops(\Re (f)) \le \beta _1 (M)$$

In conclusion, the number of loops of *ℛ*(*f*) cannot be greater than the number of loops of *ℛ*(*f*_{∂}):
TeX Source
$$\eqalign{\# loops(\Re (f)) \le \beta _1 (M) = G = \# loops(\Re (f_\partial)) \cr \chi = 2 - 2g = n_v^\partial - n_e^\partial + n_f^\partial \cr}$$
A direct extension of the equation 4 is the following lemma:

**Lemma 1.** *The existence of loops in ℛ*(*f* *implies the existence of corresponding tunnels in both M and ∂ M, and thus of corresponding loops in ℛ*(*f*_{∂})*. The inverse is not necessarily true.*

A result of this lemma is that one can deduce information about the loops of *ℛ*(*f*) by just studying *R*(*f*_{∂}).

### 2.3 Loop surgery

When *f*_{∂} is PL Morse, there exists a unique pair of saddle points for each loop, consisting of an "opening" split saddle and a "closing" join saddle. The existence of such pairs is guaranteed by extended persistence [2]. We uniquely associate each loop with the closing saddle of this pair, and call that saddle a *loop saddle*. Moreover, by lemma 1, each loop in *ℛ*(*f*) can also be associated with the same loop saddle as the corresponding loop in *ℛ*(*f*_{∂}). Notice that some loop saddles of *ℛ*(*f*_{∂}) may not be associated with any loop of *ℛ*(*f*).

Loop surgery consists of transforming the domain *M* such that *ℛ*(*f*) becomes loop-free. In other words, loop surgery breaks the loops of *ℛ*(*f*) and reflects that transformation on *M*. Since we have an injection from the loops of *ℛ*(*f*) to the set of loop saddles, it is sufficient to reason only with the loop saddles to achieve these transformations. In particular, for each loop saddle *s*_{i} with value *f*(*s*_{i}), we define its *cutting surface ℒ*_{i} as a contour of *f* (a connected component of isosurface inside the volume) at value *f*(*s*_{i} *− ∊* such that *f* (*s*_{i} *− ∊* is a regular value of *f*, there is no critical value in [*f*(*s*_{i} *− ∊, f*(*s*_{i})) and *ℒ*_{i} intersects one of the connected components of the lower star *St*^{−}(*s*_{i}) in the volume. The symbolic cuts transforming *M* into *M′* consist of cutting *M* along each defined cutting surface, as illustrated in Figures 2(c) and 2(d).

On the topology domain, cutting along a cutting surface at a regular value is equivalent to cutting an arc of *ℛ*(*f*) and creating a new pair of critical nodes (a minimum and a maximum, as illustrated in figure 2(e)). Since we have an injection from the set of loops of *ℛ*(*f*) to the set of cutting surfaces, the Reeb graph of the function *f′*: *M′* → ℝ *f′* being the function valued by *f* after symbolic cuts, is guaranteed to be loop free: all the possible loops have indeed been broken, as shown in figure 2(e).

Once the loop-free Reeb graph *ℛ*(*f′*) is computed *inverse cuts* can be applied in a straightforward manner by removing pairs of minimum and maximum nodes generated by the same cutting surface, and gluing together the corresponding arcs.

### 2.4 Loop free Reeb graph computation

The algorithm presented by Carr et al. [7] computes the contour tree by tracking the joining of sub- and sur-level set components. Traditionally, simply-connectedness of *M* has been used as a condition to ensure correctness of this algorithm. However, a Reeb graph can be loop free even when the domain is not simply connected, as shown in figure 3(b). This is especially important, since our loop surgery procedure does not guarantee that the domain is divided into simply connected regions. Therefore, we prove necessary and sufficient conditions for this contour tree algorithm to work. The following lemma shows when a saddle creates a loop in the Reeb graph.

**Lemma 2.** *Let f*: M → R *be a Morse function and n be a degree-3 node of ℛ*(*f* *corresponding to a join saddle s (see figure 4). If the contours joined by the saddle are on the boundary of the same sub-level set component, then there exists a loop in ℛ*(*f* *for which n is the highest saddle.*

*Proof.* Refer to figure 4 in the following. Given *n* *s* *f*, and *ℛ*(*f*), let *e* be a small number such that there is no critical value in the range [*f*(*s* *− ∊, f* (*s*)). The existence of such an epsilon is guaranteed because the critical values of a Morse function are distinct. Let *w* = *f* (*s* *− ∊*, and *a* and *b* be the points on the two downward arcs from *n* such that the value of their corresponding contours *c*_{a} and *c*_{b} is *w* *i.e.* *f*(*c*_{a}) = *f*(*c*_{b}) = *w*. By construction *n* is a join saddle, therefore there exists a path *p*^{+} in *M* connecting a point in *c*_{a} with a point in *c*_{b} such that all its interior is in the sur-level set *L*^{+}(*w*). The map *ϕ* : *M* → *ℛ*(*f*), mapping points in the same contour in *M* to the same point in *ℛ*(*f*), is a continuous surjection (by definition of a contour retraction), therefore a connected component *p*^{+} in *M* is mapped to a connected component *ϕ* *f*(*p*^{+}) in *ℛ*(*f*), such that *a* and *b* are connected in *ℛ*(*f*) by a path *q*^{+} ⊆ *ϕ*(*p*^{+}) whose interior is strictly above *w*. Since by hypothesis *c*_{a} and *c*_{b} are on the boundary of the same sub-level set component, there exists also a path *p*^{−} in *M* connecting a point in *c*_{a} with a point in *c*_{b} such that all its interior is in the sub-level set *L*^{−}(*w*). Therefore *a* and *b* are also connected in *ℛ*(*f*) by a path *q*^{−} ⊆ *ϕ*(*p*^{−}) whose interior is strictly below *w*. The two paths *q*^{+} +*q*^{−} form a loop.

By applying lemma 2, we prove necessary and sufficient conditions for computing correct loop free Reeb graphs using tracking of suband sur-level sets.

**Lemma 3** *Let f* : M → R *be a Morse function. Its Reeb graph ℛ*(*f* *is loop free if and only if every degree-3 node in ℛ*(*f* *corresponds to a saddle of f where distinct components of sub- or sur-level sets join. Proof.* First we prove that if a Reeb graph *ℛ*(*f*) is loop free, every degree-3 node *n* corresponds to a saddle *s* of *f* that joins distinct components of sub- or sur-level sets. Assume that there exists a degree-3 node that joins contours that are on the boundary of the same sub- or sur-level set component. By lemma 2, there must be a loop in *ℛ*(*f*). This contradicts the hypothesis statement that *ℛ*(*f*) is loop free.

Next, we prove that if every degree-3 node corresponding to a saddle in *ℛ*(*f*) joins distinct sub- or sur-level set components, then *ℛ*(*f*) is loop free. Assume for contradiction that *ℛ*(*f*) has a loop *s* is the highest join saddle in the loop, and *n* the corresponding degree-3 node. Pick *∊* *w* *a* *b* *c*_{a}, and *c*_{b} as before. The paths *q*^{+} and *q*^{−} exist in *ℛ*(*f*) connecting *a* and *b* in a loop. Since *ϕ* is a contour retraction, any connected component of *ℛ*(*f*) is a connected subset of *M*. Therefore *ϕ*^{−}1(*q*^{−}) is a connected component in *M*, connecting *c*_{a} to *c*_{b} in *L*^{−}(*w*). Therefore *c*_{a} and *c*_{b} are on the boundary of the same connected component of *L*^{−}(*w*), which contradicts the hypothesis. The same argument holds for split saddles.

Lemma 3 shows that we can use the contour tree algorithm presented by Carr et al. [7] to compute loop free Reeb graphs, by tracking the connectivity evolution of sub- and sur- level sets. Performing loop surgery guarantees that *ℛ*(*f′*) is loop free, and then computable with the contour tree algorithm.

Our algorithm for Reeb graph computation is summarized by the following pseudocode:

Algorithm 1. Reeb Graph Overview

INPUT: f, M
(0) M′ = M, GL = {}
(1) **if** *genus_diagnostic*(*∂* M) > 0 **then**
(2) S *∂* = *find_loop_saddles*(M *∂* M, f)
(3) **for each** s **in** S *∂*
(4) M′ = *cut*(M′ *cutting_surface*(s))
(5) GL = GL ∪ *node_pairs*(s)
(6) RG = *contour_tree*(M')
(7) **for each** p **in** GL
(8) RG = *glue*(RG, p)
(9) **return** RG

The input is a PL function f, and a simplicial mesh M. In lines (1-5), the domain is symbolically cut to ensure that its Reeb graph is loop free. If a diagnostic (line 1) shows that the domain has no handles (section 3.1.1), then no loop surgery needs to be done. Otherwise, loop saddles (section 3.1.2) are detected (line 2), and the domain is symbolically cut (line 4) along cutting surfaces (section 3.1.3). We keep track of the extra pairs of nodes created in the Reeb graph by each cut (line 5). Since the Reeb graph is guaranteed to be loop free, we compute it (line 6) using a modified version of the join-split algorithm (section 3.2). Finally, the loop free Reeb graph is transformed into the correct Reeb graph of the input function by inverse cuts (lines 7-8) (section 3.3).

### 3.1 Loop surgery

The purpose of *loop surgery* is to symbolically cut the domain such that *ℛ*(*f′*) is guaranteed to be loop free. This procedure corresponds to lines 1-5 of algorithm 1.

#### 3.1.1 Genus diagnostic

We first check if any loop surgery is needed by checking the presence of tunnels on the boundary *∂M*. This implements the *genus diagnostic* function in line 1 of algorithm 1. In particular, we use the Euler formula on each connected component of *∂ M*:
TeX Source
$$\chi = 2 - 2g = n_v^\partial - n_e^\partial + n_f^\partial$$
where *n*_{v}^{∂} *n*_{e}^{∂} and *n*_{f}^{∂} stand for the numbers of vertices, edges and triangles of the considered component of *∂M*. The sum of the genera *g* of the connected components of *∂ M* then gives the number of tunnels in *∂ M* and hence the number of cuts needed to ensure that *R*(*f′*) is loop free. Loop surgery is needed only if the sum of the genera is non-zero.

#### 3.1.2 Loop saddles

If the domain is cut at every loop saddle (defined in section 2.3) then *ℛ*(*f′*) is loop free. In this section, we implement *find loop saddles* in line 2 of algorithm 1. One technique for finding loop saddles is computing the Reeb graph of the boundary (using an existing technique such as [19]), and then identifying the loop saddles using extended persistence [2]. However, the benefits of using a simpler technique for finding a small superset of loop saddles outweigh the cost of performing additional cuts.

By lemma 1, we know that loop saddles must exist as a subset of the saddles on the boundary, therefore, we carefully select these from the set of all saddles of *f*_{∂} in a three-step process: *(i)* all saddles of *f*_{∂} are identified; *(ii)* we apply lemma 3 and remove from these the ones that join distinct sub- or sur-level set components; and *(iii)*, we further remove those that do not join the same sub-level set component in the volume. The rules we employ resolve degenerate saddles implicitly. These steps are explained in detail below.

*(i)* Saddles of *f*_{∂} occur at vertices of *∂ M*. A vertex *x* ∈ *∂ M* is a saddle if and only if the number of connected components of its lower link is greater than one. This number can be computed by a simple link traversal technique [9]. The set of all the saddles on the boundary is denoted *S*_{∂}.

*(ii)* We remove saddles of *S*_{∂} that do not open or close a loop. To use the result of lemma 2 in determining whether or not the saddle can be part of a loop, we identify the sub- and sur-level set associated with each connected component of the lower and upper link of a saddle of *S*_{∂}. The classification of sub- and sur- level set components is computed by constructing the join tree and the split tree in the join-split contour tree algorithm [7]. The join sweep that builds the join tree processes vertices of *∂ M* in order of increasing function value, maintaining sub-level sets via a Union-Find data structure. In the computed join tree of *f*_{∂}, the number of downward arcs of each node is equal to the number of distinct sub-level set components of *f*_{∂} that are joined at the corresponding vertex. Similarly, a split sweep builds the split tree by processing vertices of *∂M* from highest to lowest. The resulting split tree provides the information about the evolution of sur-level set components. When the number of downward arcs in the join tree equals the number of connected components of the lower link or the number of upward arcs in the split tree equals the number of connected components of the upper link, the saddle does not open or close a loop in *ℛ*(*f*_{∂}). These saddles are removed from *S*_{∂}. In practice, this step removes 87% of the saddles of *S*_{∂} on average.

*(iii)* The set *S*_{∂} now contains exactly those saddles that correspond to the opening or closing of a loop on the boundary. Furthermore, the sub- and sur-level set component associated with each connected component of the lower and upper link of every saddle is also known from step *(ii)*. Let *s* be a saddle of *S*_{∂}. If two or more connected components of *Lk*^{−}_{∂}(s) are part of the same sub-level set component, then by lemma 2 *s* forms a loop in *ℛ*(*f*_{∂}). However, if they also belong to the same contour of *f* in the volume, then *s* does not create a loop in *ℛ*(*f*). Therefore, we keep only saddles *s* in *S*_{∂} where distinct connected components in *Lk*^{−}_{∂}(s) are the boundary components of the same sub-level set component, and are also disconnected in the link of *s* in the volume *Lk*^{-}(s) All other saddles are removed from *S*_{∂}. In practice, this step removes 50% of the remaining saddles of *S*_{∂}.

#### 3.1.3 Cutting surfaces

We symbolically cut *M* through a sequence of symbolic cuts, implementing lines (3-5) of the algorithm. According to lemma 3, to ensure that *ℛ*(*f*) be loop free, every saddle must join distinct sub-level set components. A saddle *s* in *S*_{∂} does not have this property, therefore we perform symbolic cuts on *M* such that each connected component of the lower link of *s* has a unique sub-level set component.

A symbolic cut is an isosurface traversal that updates pointers in the tetrahera that are crossed. A cutting surface *ℒ* is a simple data structure with a unique identifier that is the record of the symbolic cut. Let *s* be a saddle of *S*_{∂} with value *f* (*s*), and let *C*_{i} and *C*_{j} be connected components in *Lk*^{−}(*s*). We perform a cut with value *f* (*s* *− ∊* for every pair *C*_{i} and *C*_{j} that are on the boundary of the same sub-level set component. We start the traversal at a tetrahedron in the star of *s* that has a vertex in *C*_{i}, formally The sub-level set information necessary to compare *C*_{i} and *C*_{j} is found in step *(ii)* of loop saddle identification (section 3.1.2). We skip components of *Lk*^{−}(*s*) that do not touch the boundary. Each symbolic cut produces a new sub-level set component, which is recorded in the cutting surface data structure. For example, if *n* components of *Lk*^{−}(*s*) initially are on the boundary of the same sub-level set component *n−*1 symbolic cuts will be performed.

To keep track of the symbolic cuts in the rest of the algorithm, each tetrahedron crossed by any cutting surface stores a pointer for each of its vertices to the highest cutting surface passing below and the lowest cutting surface passing above the vertex. Additionally, each vertex is marked with a *top* flag if it lies above a cutting surface crossing the tetrahedron, and also a *bottom* flag if it lies below a cutting surface crossing the tetrahedron. Finally, each saddle that generates symbolic cuts stores pointers to the corresponding cutting surfaces.

### 3.2 Loop free Reeb graph computation

By lemma 3, a loop free Reeb graph can be computed using a contour tree algorithm. Since we cut *M* only symbolically, we use a modified version of the join-split algorithm [7] that behaves "as if *M* were actually transformed into *M′*. Building the loop free Reeb graph using the modified join-split algorithm implements line (8) in algorithm 1.

The following pseudo-code for computing the join tree simulates the cuts and uses a Union-Find data structure (using path compression and union by rank) implemented to return the highest element of a set.

Vertices are processed in order of increasing function value (lines 0,1), and we add the vertex *ℒ* to the join tree and to a new set in the Union-Find (lines 2,3). If *ℒ* is a saddle that generated a symbolic cut (line 4), we simulate *M* being cut. We also simulate the existence of a new sub-level set and a new minimum by adding each cutting surface *6* to the join tree and the Union-Find (lines 6,7). The tetrahedra in the star of *ℒ* that have a vertex in the lower link of *ℒ* are iterated upon (line 8). For each such tetrahedron *σ*, if there is a cut *σ* crossing *σ* (line 9), we pick the highest *σ* that is below *ℒ* (line 10). This is a constant time operation due to having stored pointers in each tetrahedron in the cutting surface computation (section 3.1.3). We perform a find and then merge the sets, also adding an arc to the join tree (lines 12-14). This simulates having cut *M* by *σ*, since it disconnects part of the lower link, and instead connects *ℒ* to an "artificial" minimum, which is the node returned by the Union-Find. Next, the vertices in the lower link of *ℒ* that were not disconnected by any cutting surface are processed (lines 15-20). If no tetrahedra in the lower star of *ℒ* are crossed by a cutting surface (*i.e.* *ℒ* did not get marked as *top* in section 3.1.3 (line 21)) then the lower link of *ℒ* can be processed (lines 22-26) with no changes to the algorithm in [7]. The join tree of *f′* is returned. The split tree is computed symmetrically, and merging the two trees occurs exactly as in the join-split algorithm. This computes the loop free Reeb graph *R*(*f′*).

### 3.3 Inverse cuts

Transforming the loop-free Reeb graph *ℛ*(*f′*) into *ℛ*(*f*) requires gluing minimum-maximum pairs of each cutting surface. This implements lines 7-8 of algorithm 1. For each cutting surface, pointers in the data structure identify the minimum it generated in the join tree and the maximum it generated in the split tree. The two nodes are found in *ℛ*(*f′*), and are glued together by concatenating the up-arc of the minimum, and the down-arc of the maximum. This inverts the changes made to *ℛ*(*f′*) by loop surgery.

We implemented Reeb graph computation based on loop surgery in standard C under GNU/Linux. All the experiments presented below were run on a standard desktop computer with a 64-bit 2.83 GHz CPU and 8 GB of memory. Data-sets are courtesy of the AIM@SHAPE shape repository [1] and collaborating mechanical design experts.

In our experiments, we compare running times with recent Reeb graph computation techniques for tetrahedral meshes [19], [12]. We used the original implementations of these approaches, kindly provided by their respective authors. Furthermore, we compared the output of our approach to that presented in [19] using the exact same simulation of simplicity [14], and found the two algorithms output identical Reeb graphs for all the available data-sets.

### 4.1 Time complexity

Let *n* and *N*_{ℒ} be the number of vertices and simplices of *M*. Let *n*_{∂} *N*_{∂} and *Nℒ* be the numbers of vertices of *∂M*, the number of simplices of *∂ M*, and the number of simplices of *M* crossed by cutting surfaces. We present a complexity analysis for each step in our algorithm:

**Loop saddle extraction**: Saddle identification by link traversal requires *O*(*n*_{∂}) steps. Join tree and split tree computation both require *O*(*n*_{∂} log(*n*_{∂}) + *N*_{∂} α(*N*_{∂})) where *α*() is an exponentially decreasing function (inverse of the Ackermann function). Loop saddle distinction is performed in *O*(*g*) steps, where *g* is the genus of *∂M*.

**Symbolic cuts computation:** *O*(*g×N*_{ℒ}) steps: there are at most *O*(*g*) cuts, and each may cross at most *O*(*Nℒ*) tetrahedra.

**Loop-free Reeb graph computation**: the contour tree algorithm variant requires *O*(*nlog*(*n*) + *Nα*(*N*)) steps [7].

**Inverse cuts:** *O*(*g*) steps: there is an explicit list of cutting surfaces, and gluing the min-max pairs of each takes constant time.

**Overall bound:** *O*(*nlog*(*n*) + *Nα*(*N*) + *g × N*_{ℒ}).

The worst case scenario is reached when both *g* and *Nℒ* (loop surgery process) are linear with the size of the mesh, in which case our algorithm has a quadratic complexity. However, with real-life data *g* is a small constant, resulting in virtually linear scalability in practice.

### 4.2 Performance Comparison

We compare the running times of our approach with those of the two fastest previous techniques, presented in [19] and [12]. Notice however that these techniques provide a more general solution since they handle meshes of arbitrary dimension. Our approach, instead, has been specifically designed for volumetric meshes embedded in ℝ^{3} given their importance in visualization applications.

The scalar data used in our experiments represents a variety of physical phenomena: air turbulence, pressure, liquid oxygen diffusion, rock density, etc Table 1 reports the running times of the three methods on these data. Our approach achieves significant improvement in terms of running time for each data-set, including those with the highest number of handles, resulting in an average speedup factor of 6,500.

The approaches presented in [19] and [12] exhibit a quadratic behavior on real-life volumetric data. The streaming approach [19] becomes very memory intensive because it has to maintain the boundaries of incomplete level sets, which are represented efficiently only for surface meshes. The memory footprint of the output sensitive approach [12] is dependent on the number of critical points and the size of their contours, which in real-life data-sets can be prohibitively large. In our loop surgery, instead, it is difficult to reach with real-life data the worst case scenario of the theoretical quadratic complexity.

### 4.3 Loop surgery overhead

We analyze the internal behavior of our approach and compute the running time overhead due to loop surgery Table 2 reports the average running times of the individual steps of our approach. The running times agree with our complexity analysis, as the loop surgery overhead increases when the number of handles increases. The pressure field on the trunk data-set (Fig. 8) is a special case: it is an extremely noisy field that illustrates that we are performing more symbolic cuts than necessary, due to ambiguities in resolving degenerate critical points. Overall, we observe that the loop surgery overhead is proportional to the cost of computing the contour tree with real-life data.

### 4.4 Asymptotic stress tests

Finally, we provide a stress test to show the performance of the algorithm in a worst-case scenario. We generate meshes by tetrahedralizing a rectilinear grid on from which rows and columns have been removed, allowing us to increase the number of tets and the number of handles independently. The function value of each vertex is its *y* coordinate Figure 9 illustrates these meshes Figure 10 shows the memory footprint and the running time as a function of the number of handles and the size of the mesh (in logarithmic scale). This experiment shows that for a constant number of handles, our algorithm scales linearly with the size of the mesh (slopes of one on the log-log scale). The memory footprint follows the same linear behavior as the execution time, due to non-optimized data structures for storing cutting surfaces.

### 4.5 Limitations

A limitation of the algorithm is that it requires the mesh to be manifold with boundary to ensure that the boundary of the mesh is a 2-manifold without boundary. Another is that it is often not possible to disambiguate the behavior of contours by inspecting only the link and sub-level sets of a saddle, therefore we perform extra cuts.

SECTION 5

## Application: fast topologically clean isosurface extraction on non-simply connected domains

To demonstrate the potential and the versatility of our approach, we generalize fast topologically clean isosurface extraction to non-simply connected domains. In particular, we focus on the analysis of pressure fields in mechanical design (where the majority of meshes have handles), a case study where contour-tree based techniques could not previously apply. One experiment in the process of mechanical design involves the analysis of the resistance of mechanical pieces made of different materials to pressure stress. In such experiments, mechanical experts first consider simulation previews computed on low resolution meshes. This step illustrates the approximate behavior of the material. Its understanding is crucial to define correct parameters for the actual simulation at high resolution. However, as shown in figure 11, this preview can be noisy, making its interpretation difficult.

We overcome this problem with a fast topologically clean isosur-face extraction system. First, the Reeb graph of the low-resolution pressure stress function is computed in a pre-process. Then, local geometric measures [8] (extended to tetrahedral meshes) are computed for each arc of the Reeb graph. Then, users may select thresholds for geometric measures to simplify the Reeb graph, as described in [19]. This filtering of the arcs in our examples took at most 0.03 seconds. Our approach maintains degree two nodes in the Reeb graph, representing regular vertices of the function. Consequently, the Reeb graph provides a seed vertex for each contour the user wants to display. We store the non-simplified arcs of the Reeb graph in a balanced interval tree. An isosurface extraction query consists of searching in this tree for a valid seed set. In our examples, this is performed in less than nanoseconds, starting standard isosurface traversal techniques at these seeds in interactive times.

Figure 11 illustrates this process on pressure stress functions computed on a brake disk and a cylinder head, where the user progressively increases a simplification threshold with the hyper-volume measure [8]. The Reeb graphs are simplified, and as a result, the small connected components (noise) of the queried isosurface are progressively removed and the most important features are highlighted. This enables a direct visualization of the major trends of the simulation. In the future, we would like to introduce metrics between the Reeb graphs at low and high mesh resolutions, in order to provide quality scores for the low-resolution previews, to accelerate the validation of the final simulation.

In this paper, we present a novel algorithm for fast Reeb graph computation on tetrahedral meshes in R^{3}. By providing theoretical results on the topology of such Reeb graphs, we show their computation could be reduced to a contour tree computation through a technique called loop surgery. Experiments demonstrate in practice the scalability of the algorithm. Moreover, we show that our approach improves in term of running time, for the special case of volumetric meshes, the fastest previous techniques on real-life data by several orders of magnitude. We extend fast topologically clean isosurface extraction to non-simply connected domains in the context of mechanical design.

Reducing the computational requirements of Reeb graphs to that of contour trees enables the generalization of the contour-tree based visualization techniques to volumetric meshes of arbitrary topology and thus opens several avenues for future visualization research. Furthermore, as contour tree computation has been shown to be parallelizable [18], we plan to investigate a parallel version of the algorithm for large-scale data analysis. An extension of our approach to volumetric meshes not embeddable in ℝ^{3} and of higher dimensions would address a larger class of problems. However, as it is no longer true that such meshes necessarily admit boundary, the loop surgery concept would need to be extended and generalized.