# An Efficient Data Retrieval Parallel Reeb Graph Algorithm
## 4 Reeb Graph Sequential Algorithm on Triangulated Surfaces
### Dealing with Degenerate Cases  
It is possible in practice to obtain a scalar function with saddle points that have multiplicity \(m\geq 2\). The algorithm that we present in Section 4.2 can be extended to handle such cases. We need to make the following modifications.  
Figure 10: The restriction of the Reeb graph on the building blocks of a surface along with the part of the ascending paths in that part of the surface. Around each critical point, the structure of the ascending curves (orange) is identical to the structure of the Reeb graph. More precisely, the quotient space of the restriction of the function on the ascending curves the critical sets around a critical point (these are the curves highlighted by orange and red in the figure) is identical to the quotient space of the manifold locally.  
Figure 9: The building blocks of a surface. Given a scalar function \(f\) defined on a surface \(M\), Theorem 2 asserts that we can decompose the surface into the building block pieces appear in above. These pieces are genus zero surfaces with a single boundary component (disk), genus zero surfaces with three boundary components (pair of pants), and a genus zero surface with two boundary components (cylinder).  
* In step (3), we calculate the connected components of the critical set \(C_{p}\). Here, it is not enough to calculate the critical set \(C_{p}\). We also need to compute the connected components of this set. Section 4.2.1 explains this.
* We create an ascending path for each connected component in \(Lk^{+}(p)\) when the multiplicity \(m\) of a split saddle \(p\) is greater than or equal to 2.  
In the non-degenerate case, every ascending path corresponds to an edge in the Reeb graph. This is not the case anymore in the degenerate case. NCT, we describe the sequential algorithm of the Reeb graph when \(f\) has degenerate critical points.  
1. Sort the critical points of \(f\) an in ascending order. Let \(CP=\{v_{1},...,v_{n}\}\) be this set. This represents the vertex set of the Reeb graph, as we did before.
2. For each \(v\) in \(CP\), compute the connected components of \(C_{v}\) and include all of these components in a single container \(\mathcal{S}\). We will denote, by \(B^{l}_{i}\), the connected component \(j\) of the critical set \(C_{v_{i}}\). In this way, we index all of the elements in \(\mathcal{S}\).
3. Declare each set \(B^{j}_{i}\) of \(\mathcal{S}\) as not visited.
4. For each critical point \(v_{i}\) in \(CP\) and for each component in \(Lk^{+}(v_{i})\), we initiate an ascending path \(P\) as described in Section 4.2.2. For each such path, we determine the connected component \(B^{l}_{k}\) in \(\mathcal{S}\), which the path terminates, as described in Section 4.2.1. We have two cases: 1. If the connected component \(B^{l}_{k}\) is not visited, then we insert an edge between \(v_{i}\) and \(v_{k}\) and mark the component \(B^{l}_{k}\) as visited. 2. If the connected component \(B^{l}_{k}\) is visited, then we do not make any changes to the Reeb graph and terminate the current ascending path. In this case, the ascending path corresponds to an edge that already exists in the Reeb graph. See Remark 2.  
Note that the above procedure can be used to determine the edges that originate from a simple saddle. Namely, we do not need to check the type of the simple saddle point (merge or split) in step (3) of the algorithm given in Section 4.2, and for any saddle point, we use the above procedure instead.