4. Análisis de los datos y resultados
4.6. Resultados de las tareas propuestas
In this section, we describe the auxiliary function HomotopyExpansion. We refer to the pseu- docode in Algorithm1. HomotopyExpansion exploits the following auxiliary data structures:
• declared : a length | Lowfpaq| array of Booleans;
• Ord0 and Ord1 : two ordered lists1with ordering given by increasing values of elements under the indexing i;
1Ord0 and Ord1 are equivalently described as priority queues in [162] but we present them as ordered lists since, actually cells entering before others have no priority. Only the indexing imposes the priority as it happens in an ordered list. Moreover, the algorithm requires to perform element removals which are not standard operations over a priority queue.
and the following auxiliary functions:
• num_undeclared_facetspb, Lowfpaqq which counts the number of facets c of b in Lowfpaq
such that declaredripcqs “false ;
• unpaired_facet(b, Lowfpaq) returns the only facet c of b such that undeclaredripcqs “
false;
• add_cofacets(c, Lowfpaq,Ord1) adds to Ord1 all cofacets d in Lowfpaq of c such that
num_undeclared_facets(c, Lowfpaq)“ 1.
(a) (b) (c)
(d) (e) (f)
Figure 3.2: step-by-step action of HomotopyExpansion over a the lower star of vertex 5 with respect to a scalar function.
We describe HomotopyExpansion by following the example in Figure3.2.
The array declared keeps track of the cells in Lowfpaq already classified either as part of the list
M or as part of a pair in the list V . At the beginning, declared is initialized with all entries set to false. In Figure3.2(a), we show the lower star of vertex 5 with respect to the one-filtration indicated by filtering values over vertexes. The darker cells are part of the lower star of 5. The two ordered lists Ord0 and Ord1 assign priorities to the multiple possible pairing of cells.
In the first for loop at line a in Algorithm 1, Ord0 and Ord1 are initialized. The function num_undeclared_facetspb, Lowfpaqq counts the number of facets c of b in Lowfpaq with de-
claredripcqs “ false. A cell enters Ord0 when all of its facets in Lowfpaq are already declared.
Hence, in this for loop, only a enters Ord0. Cells in Ord0 are suitable either to form a pair in V with a higher-dimensional cell or to be added to M. In the example of Figure3.2vertex 5 enters Ord0 since it has no facets in its lower star. A cell b enters Ord1 when b has only one facet c, pointed by unpaired_facetpbq, still to be declared. In this for loop, all cofacets of a in Lowfpaq
are added to Ord1. The cells in Ord1 are suitable to form a pair in V with a lower-dimensional cell. In the example of Figure3.2the edges r5, 1s, r5, 2s, r5, 3s, r5, 4s enters Ord1 since they have only vertex 5 as their cofacets in the lower star of 5. The indexing i ensures that, in the two ordered lists, faces take priority over cofaces.
In the two nested while loops at lines 12 and 13, the first cell b in Ord1 is set to form a pair in V with the cell c pointed by unpaired_facetpbq. Both c and b are updated as true in declared and all of their cofacets suitable to enter Ord1 are inserted in such ordered list by function add_cofacets. In the example of Figure 3.2(b), vertex 5 is paired with the edge r5, 1s having maximum priority in Ord1. The inner while loop ends when there is no cell to be extracted from Ord1. At that point, the first cell in Ord0 is declared critical and all of its cofacets suitable of entering Ord1 are inserted in such ordered list. In the example of Figure3.2(c), we see the red edge r5, 2s declared critical since the list Ord1 is empty and, thus, no pairing is available for the cells r5, 2s, r5, 3s, r5, 4s, currently in Ord0. This allows to update both Ord1, with the triangle r5, 3, 2s, paired with r5, 3s in Figure3.2(d). In the example, the procedure terminates with no additional critical cells declared. In Proposition 4 in [162], authors show that the outer while loop breaks if and only if all cells have been declared.
Algorithm 1 HomotopyExpansion(X , Lowfpaq, i)
Input: X cell complex # regular, with intersection property
Input: Lowfpaq list of cells in X # Lowfpaq is the lower star of a in X with respect to ˜f
Input: i indexing over the cells of Lowfpaq # i compatible with incidence relations in X restricted to Lowfpaq Output: V list of pairs of cells # discrete gradient over Lowfpaq
Output: M list of cells # Morse set relative to V 1: set V, M to be empty lists
2: set Ord0,Ord1 to be empty ordered lists # values of nodes in Ord1,Ord0 are ordered by increasing values under i 3: set declared to be an array of length | Lowfpaq| with Boolean values equal to false
# in declared entries are ordered according to increasing values of i 4: for all b in Lowfpaq do
5: # num_undeclared_facetspb, Lowfpaqq which counts the number of facets c of b in Lowfpaq such that declaredripcqs “false
6: if num_undeclared_facets(b, Lowfpaq)“ 0 then 7: insert b into Ord0
8: else if num_undeclared_facets(b, Lowfpaq)“ 1 then 9: insert b into Ord1
10: end if 11: end for
12: while Ord1‰ H or Ord0‰ H do 13: while Ord1‰ H do
14: b Ð the first element in Ord1 15: remove b from Ord1
16: if num_undeclared_facets(b, Lowfpaq)“ 0 then 17: insert b into Ord1
18: else
19: c Ð unpaired_facet(b, Lowfpaq) # unpaired_facet(b, Lowfpaq) returns the only facet c of b such that un- declaredripcqs “ false
20: add pc, bq to V 21: declaredripcqs Ð true 22: declaredripbqs Ð true 23: remove c from Ord0
24: add_cofacets(c,Lowfpaq,Ord1) # add_cofacets(c, Lowfpaq,Ord1) adds to Ord1 all cofacets d of c in Lowfpaq such that num_undeclared_facets(c, Lowfpaq)“ 1 25: add_cofacets(b, Lowfpaq,Ord1)
26: end if 27: end while 28: if Ord0‰ H then
29: b Ð the first element in Ord0 30: remove b from Ord0 31: append b to M 32: declaredripbqs Ð true
33: add_cofacets(b, Lowfpaq,Ord1) 34: end if
35: end while 36: return pV, Mq