Skip to content

Commit

Permalink
name change from 'face' to 'cell'
Browse files Browse the repository at this point in the history
  • Loading branch information
hschreiber committed Oct 21, 2024
1 parent 54c00a6 commit 5db9b3a
Show file tree
Hide file tree
Showing 11 changed files with 205 additions and 205 deletions.
8 changes: 4 additions & 4 deletions src/Zigzag_persistence/concept/ZigzagOptions.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,15 @@ namespace zigzag_persistence {
*/
struct FilteredZigzagOptions {
/**
* @brief Numerical type for the face IDs used internally and other indexations. It must be signed.
* @brief Numerical type for the cell IDs used internally and other indexations. It must be signed.
*/
using Internal_key = unspecified;

/**
* @brief Type for the face IDs used at insertion and in the boundaries given as argument.
* @brief Type for the cell IDs used at insertion and in the boundaries given as argument.
* Has to be usable as key in a hashtable, so "hashable" and comparable.
*/
using Face_key = unspecified;
using Cell_key = unspecified;

/**
* @brief Type for filtration values.
Expand All @@ -59,7 +59,7 @@ struct FilteredZigzagOptions {
*/
struct ZigzagOptions {
/**
* @brief Numerical type for the face IDs used internally and other indexations. It must be signed.
* @brief Numerical type for the cell IDs used internally and other indexations. It must be signed.
*/
using Internal_key = unspecified;

Expand Down
4 changes: 2 additions & 2 deletions src/Zigzag_persistence/doc/Intro_zigzag_persistence.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@ namespace zigzag_persistence {
* We refer to the introduction page \ref persistent_cohomology for persistent (co)homology for an introduction
* to the topic.
* Zigzag persistence is a generalization of the latter. While standard persistence only allows to grow the filtered
* complex by adding faces, zigzag persistence also allows removals. Hence the name "zigzag", as the module
* complex by adding cells, zigzag persistence also allows removals. Hence the name "zigzag", as the module
* diagram will have arrows alternating between forward and backward.
*
* The module consists of the @ref Zigzag_persistence class and two wrappers @ref Filtered_zigzag_persistence and
* @ref Filtered_zigzag_persistence_with_storage "":
* - @ref Zigzag_persistence computes the persistence of a sequence of insertions and removals. A face can be inserted
* - @ref Zigzag_persistence computes the persistence of a sequence of insertions and removals. A cell can be inserted
* or removed one at a time and the returned persistence pairs / bars are indexed on the operation numbers.
* For example, if a cycle is born at operation number 6 and dies at operation number 7, it will output a bar starting
* at 6 and ending at 7.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,25 +26,25 @@ int main() {

// It is important that the operations of insertions and removals are made **in the same order** as in the zigzag
// filtration ones wants to compute the barcode from.
// A face can be identified in the boundaries by any given numerical label, it is just important that the given
// A cell can be identified in the boundaries by any given numerical label, it is just important that the given
// filtration values are monotonous (ie., either only increasing or only decreasing).

// inserts vertex 2 at filtration value 0.1 -> birth at 0.1 of 0-cycle
zp.insert_face(2, {}, 0, 0.1);
zp.insert_cell(2, {}, 0, 0.1);
// inserts vertex 4 at filtration value 0.1 -> birth at 0.1 of 0-cycle
zp.insert_face(4, {}, 0, 0.1);
zp.insert_cell(4, {}, 0, 0.1);
// inserts edge 5 = (2,4) at filtration value 0.3 -> death at 0.3 -> outputs (0, 0.1, 0.3)
zp.insert_face(5, {2, 4}, 1, 0.3);
zp.insert_cell(5, {2, 4}, 1, 0.3);
// inserts vertex 3 at filtration value 0.4 -> birth at 0.4 of 0-cycle
zp.insert_face(3, {}, 0, 0.4);
zp.insert_cell(3, {}, 0, 0.4);
// inserts edge 6 = (2,3) at filtration value 0.4 -> death at 0.4 of the cycle born at 0.4 -> outputs nothing
zp.insert_face(6, {2, 3}, 1, 0.4);
zp.insert_cell(6, {2, 3}, 1, 0.4);
// inserts edge 9 = (3,4) at filtration value 1.2 -> birth at 1.2 of 1-cycle
zp.insert_face(9, {4, 3}, 1, 1.2);
zp.insert_cell(9, {4, 3}, 1, 1.2);
// removes edge 6 at filtration value 1.5 -> death at 1.5 -> outputs (1, 1.2, 1.5)
zp.remove_face(6, 1.5);
zp.remove_cell(6, 1.5);
// removes edge 5 at filtration value 2.0 -> birth at 2.0 of 0-cycle
zp.remove_face(5, 2.0);
zp.remove_cell(5, 2.0);

// Only the closed bars where output so far, so the open/infinite bars still need to be retrieved.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,25 +21,25 @@ int main() {

// It is important that the operations of insertions and removals are made **in the same order** as in the zigzag
// filtration ones wants to compute the barcode from.
// A face can be identified in the boundaries by any given numerical label, it is just important that the given
// A cell can be identified in the boundaries by any given numerical label, it is just important that the given
// filtration values are monotonous (ie., either only increasing or only decreasing).

// inserts vertex 2 at filtration value 0.1 -> birth at 0.1 of 0-cycle
zp.insert_face(2, {}, 0, 0.1);
zp.insert_cell(2, {}, 0, 0.1);
// inserts vertex 4 at filtration value 0.1 -> birth at 0.1 of 0-cycle
zp.insert_face(4, {}, 0, 0.1);
zp.insert_cell(4, {}, 0, 0.1);
// inserts edge 5 = (2,4) at filtration value 0.3 -> death at 0.3 -> stores (0, 0.1, 0.3)
zp.insert_face(5, {2, 4}, 1, 0.3);
zp.insert_cell(5, {2, 4}, 1, 0.3);
// inserts vertex 3 at filtration value 0.4 -> birth at 0.4 of 0-cycle
zp.insert_face(3, {}, 0, 0.4);
zp.insert_cell(3, {}, 0, 0.4);
// inserts edge 6 = (2,3) at filtration value 0.4 -> death at 0.4 of the cycle born at 0.4 -> stores nothing
zp.insert_face(6, {2, 3}, 1, 0.4);
zp.insert_cell(6, {2, 3}, 1, 0.4);
// inserts edge 9 = (3,4) at filtration value 1.2 -> birth at 1.2 of 1-cycle
zp.insert_face(9, {4, 3}, 1, 1.2);
zp.insert_cell(9, {4, 3}, 1, 1.2);
// removes edge 6 at filtration value 1.5 -> death at 1.5 -> stores (1, 1.2, 1.5)
zp.remove_face(6, 1.5);
zp.remove_cell(6, 1.5);
// removes edge 5 at filtration value 2.0 -> birth at 2.0 of 0-cycle
zp.remove_face(5, 2.0);
zp.remove_cell(5, 2.0);

// The bars are stored within the class and where not output at all for now.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,24 +26,24 @@ int main() {

// It is important that the operations of insertions and removals are made **in the same order** as in the zigzag
// filtration ones wants to compute the barcode from.
// A face has to be identified in the boundaries by the operation number the face was inserted with in the sequence.
// A cell has to be identified in the boundaries by the operation number the cell was inserted with in the sequence.

// inserts vertex 0 -> birth at 0 of 0-cycle
zp.insert_face({}, 0);
zp.insert_cell({}, 0);
// inserts vertex 1 -> birth at 1 of 0-cycle
zp.insert_face({}, 0);
zp.insert_cell({}, 0);
// inserts edge 2 = (0,1) -> death at 2 -> outputs (0, 1, 2)
zp.insert_face({0, 1}, 1);
zp.insert_cell({0, 1}, 1);
// inserts vertex 3 -> birth at 3 of 0-cycle
zp.insert_face({}, 0);
zp.insert_cell({}, 0);
// inserts edge 4 = (0,3) -> death at 4 -> outputs (0, 3, 4)
zp.insert_face({0, 3}, 1);
zp.insert_cell({0, 3}, 1);
// inserts edge 5 = (1,3) -> birth at 5 of 1-cycle
zp.insert_face({1, 3}, 1);
zp.insert_cell({1, 3}, 1);
// removes edge 4 -> death at 6 -> outputs (1, 5, 6)
zp.remove_face(4);
zp.remove_cell(4);
// removes edge 2 -> birth at 7 of 0-cycle
zp.remove_face(2);
zp.remove_cell(2);

// Only the closed bars were output so far, so the open/infinite bars still need to be retrieved.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#include <gudhi/filtered_zigzag_persistence.h>

using ZP = Gudhi::zigzag_persistence::Filtered_zigzag_persistence_with_storage<>;
using Face_handle = ZP::Face_key;
using Cell_handle = ZP::Cell_key;
using Filtration_value = ZP::Filtration_value;
using Interval_filtration = ZP::Filtration_value_interval;

Expand Down Expand Up @@ -50,7 +50,7 @@ void print_indices(ZP& zp) {
}
}

std::vector<std::vector<Face_handle> > get_boundaries() {
std::vector<std::vector<Cell_handle> > get_boundaries() {
return {{},
{},
{},
Expand Down Expand Up @@ -114,7 +114,7 @@ int main(int argc, char* const argv[]) {

ZP zp;

std::vector<std::vector<Face_handle> > simplices = get_boundaries();
std::vector<std::vector<Cell_handle> > simplices = get_boundaries();
std::vector<Filtration_value> fils = get_filtration_values();
std::vector<bool> dirs = get_directions();

Expand All @@ -125,10 +125,10 @@ int main(int argc, char* const argv[]) {
}
if (dirs[i]) {
int dim = simplices[i].size() == 0 ? 0 : simplices[i].size() - 1;
zp.insert_face(i, simplices[i], dim, fils[i]);
zp.insert_cell(i, simplices[i], dim, fils[i]);
} else {
auto id = simplices[i][0];
zp.remove_face(id, fils[i]);
zp.remove_cell(id, fils[i]);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@
#include <gudhi/filtered_zigzag_persistence.h>

using ZP = Gudhi::zigzag_persistence::Filtered_zigzag_persistence<>;
using ID_handle = ZP::Face_key;
using ID_handle = ZP::Cell_key;
using Filtration_value = ZP::Filtration_value;
using Dimension = ZP::Dimension;

enum lineType : int { INCLUSION, REMOVAL, COMMENT };

lineType read_operation(std::string& line, std::vector<ID_handle>& faces, double& timestamp) {
lineType read_operation(std::string& line, std::vector<ID_handle>& cells, double& timestamp) {
lineType type;
faces.clear();
cells.clear();
ID_handle num;

size_t current = line.find_first_not_of(' ', 0);
Expand Down Expand Up @@ -53,7 +53,7 @@ lineType read_operation(std::string& line, std::vector<ID_handle>& faces, double
while (current != std::string::npos) {
next = line.find_first_of(' ', current);
num = std::stoi(line.substr(current, next - current));
faces.push_back(num);
cells.push_back(num);
current = line.find_first_not_of(' ', next);
}

Expand Down Expand Up @@ -89,7 +89,7 @@ int main(int argc, char* const argv[]) {
while (getline(file, line, '\n') && read_operation(line, data, timestamp) == COMMENT);
double lastTimestamp = timestamp;
// first operation has to be an insertion.
zp.insert_face(id, data, 0, timestamp);
zp.insert_cell(id, data, 0, timestamp);

while (getline(file, line, '\n')) {
type = read_operation(line, data, timestamp);
Expand All @@ -100,10 +100,10 @@ int main(int argc, char* const argv[]) {
if (type == INCLUSION) {
++id;
int dim = data.size() == 0 ? 0 : data.size() - 1;
zp.insert_face(id, data, dim, timestamp);
zp.insert_cell(id, data, dim, timestamp);
} else if (type == REMOVAL) {
++id;
zp.remove_face(data[0], timestamp);
zp.remove_cell(data[0], timestamp);
}
}

Expand Down
Loading

0 comments on commit 5db9b3a

Please sign in to comment.