Skip to content

Commit

Permalink
doc + removal of unnecessary flag in edge modifier
Browse files Browse the repository at this point in the history
  • Loading branch information
hschreiber committed Jan 16, 2025
1 parent 9a526f6 commit aac903d
Show file tree
Hide file tree
Showing 7 changed files with 142 additions and 114 deletions.
7 changes: 1 addition & 6 deletions src/Zigzag_persistence/concept/EdgeModifier.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,11 @@ namespace zigzag_persistence {

/**
* @brief Methods whose purposes are to modify the filtration value of a given edge following a rule.
* The concept is for example realized by @ref Square_root_edge_modifier.
* The concept is for example realized by @ref Identity_edge_modifier or @ref Square_root_edge_modifier "".
*/
template <typename Filtration_value>
class EdgeModifier {
public:
/**
* @brief Indicates that the modifier should not be ignored.
*/
static constexpr bool isActive_ = true;

/**
* @brief Applies the modifier to the given value and returns it.
*
Expand Down
6 changes: 0 additions & 6 deletions src/Zigzag_persistence/concept/PointRange.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,22 +32,16 @@ class PointRange {
public:
/**
* @brief Returns begin iterator.
*
* @return Begin iterator.
*/
auto begin();

/**
* @brief Returns end iterator.
*
* @return End iterator.
*/
auto end();

/**
* @brief Returns size of the range.
*
* @return Size of the range.
*/
std::size_t size();

Expand Down
8 changes: 7 additions & 1 deletion src/Zigzag_persistence/concept/StableFilteredComplex.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class StableFilteredComplex {

/**
* @brief Handle to specify a simplex. The simplex handles have to be stable, that is, they do not invalidate when
* a simplex is added or removed from the complex (except for the removed simplices them selves of course).
* a simplex is added or removed from the complex (except for the removed simplices them-selves of course).
*/
typename Simplex_handle;

Expand Down Expand Up @@ -98,6 +98,12 @@ class StableFilteredComplex {
* @return A iterable range over the star of @p simplex.
*/
auto star_simplex_range(const Simplex_handle simplex);

/**
* @brief Returns a range over the vertices of a simplex. The vertices have to be ordered monotonously by their
* labels.
*/
auto simplex_vertex_range(Simplex_handle sh) const;
};

} // namespace zigzag_persistence
Expand Down
2 changes: 2 additions & 0 deletions src/Zigzag_persistence/concept/ZigzagOptions.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ namespace zigzag_persistence {
*
* @brief List of options used for the filtered zigzag persistence computation. An implementation of this concept is
* @ref Default_filtered_zigzag_options "", which inherits from @ref Default_zigzag_options for the common types.
* Another implementation is
* @ref Gudhi::zigzag_persistence::Default_oscillating_rips_zigzag_options "Default_oscillating_rips_zigzag_options".
*/
struct FilteredZigzagOptions {
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,15 @@ using Filtration_value = double;
using Point = std::vector<double>;
using Barcode = std::vector<Gudhi::persistence_matrix::Persistence_interval<int, Filtration_value> >;

//prints computed zigzag barcode
void print_barcode(const Barcode& bars) {
std::clog << "Resulting barcode:" << std::endl;
for (auto& bar : bars) {
std::clog << bar << std::endl;
}
}

//prints initial points
void print_points(const std::vector<Point>& points) {
std::clog << "Number of points: " << points.size() << std::endl;
for (const Point& p : points) {
Expand All @@ -34,6 +36,7 @@ void print_points(const std::vector<Point>& points) {
std::clog << std::endl;
}

//computes some random 2-dimensional point cloud
std::vector<Point> build_point_cloud(unsigned int numberOfPoints, int seed) {
std::vector<Point> finalPoints;
std::set<Point> points;
Expand All @@ -56,6 +59,9 @@ std::vector<Point> build_point_cloud(unsigned int numberOfPoints, int seed) {
}

int main(int argc, char* const argv[]) {
//nu, mu: lower and upper multiplier, see introduction page.
//max_dim: maximal dimension to which the complex should be extended. If -1: no limits.
//seed (optional): fixes seed for the randomly computed point cloud.
if (argc != 5 && argc != 6) {
std::clog << "Usage: ./comp nu mu max_dim numberOfPoints [seed]" << std::endl;
return 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,17 +66,30 @@ struct Simplex_tree_options_oscillating_rips {
static const bool stable_simplex_handles = true;
};

/**
* @ingroup zigzag_persistence
*
* @brief Filtered zigzag options such that the class directly uses the simplex handles of the complex of the
* oscillating Rips iterator as cell IDs. More or less assumes that the complex is a @ref Gudhi::Simplex_tree on
* the way a handle accesses its key.
*/
template <class StableFilteredComplex>
struct Default_oscillating_rips_zigzag_options : Default_filtered_zigzag_options {
using Cell_key = typename StableFilteredComplex::Simplex_handle;
using Filtration_value = typename StableFilteredComplex::Filtration_value;
using Dimension = int; // it is `int` in the simplex tree
struct Hash {
using Cell_key = typename StableFilteredComplex::Simplex_handle; /**< Cell IDs are simplex handles. */
using Filtration_value = typename StableFilteredComplex::Filtration_value; /**< Filtration value type. */
using Dimension = int; /**< As in the @ref Simplex_tree "". */
/**
* @brief Hash method for simplex handles from the @ref Simplex_tree "".
*/
struct Cell_key_hash {
std::size_t operator()(const Cell_key& sh) const {
return sh->second.key();
}
};
struct KeyEqual {
/**
* @brief Equality method for simplex handles from the @ref Simplex_tree "".
*/
struct Cell_key_equal {
bool operator()(const Cell_key& sh1, const Cell_key& sh2) const {
return sh1->second.key() == sh2->second.key();
}
Expand All @@ -100,7 +113,8 @@ struct Default_oscillating_rips_zigzag_options : Default_filtered_zigzag_options
* @tparam F Callback method type for the zigzag barcode output.
* @tparam edge_range_type Either @ref Edge_range_type::BOOST_RANGE or @ref Edge_range_type::VECTOR.
* Default value: @ref Edge_range_type::BOOST_RANGE.
* @tparam StableFilteredComplex Data structure to store and build the computed complex at each step.
* @tparam StableFilteredComplex A version of the @ref Simplex_tree "". Used to store and build the computed complex
* at each step.
* @param points Point cloud.
* @param nu Lower multiplier.
* @param mu Upper multiplier.
Expand Down Expand Up @@ -182,7 +196,8 @@ void compute_oscillating_rips_persistence(
* @tparam PointRange Range containing the point cloud.
* @tparam edge_range_type Either Edge_range_type::BOOST_RANGE or Edge_range_type::VECTOR.
* Default value: Edge_range_type::BOOST_RANGE.
* @tparam StableFilteredComplex Data structure to store and build the computed complex at each step.
* @tparam StableFilteredComplex A version of the @ref Simplex_tree "". Used to store and build the computed complex
* at each step.
* @param points Point cloud.
* @param nu Lower multiplier.
* @param mu Upper multiplier.
Expand Down
Loading

0 comments on commit aac903d

Please sign in to comment.