Skip to content

Commit

Permalink
Rename collapse_edges
Browse files Browse the repository at this point in the history
  • Loading branch information
mglisse committed Dec 9, 2023
1 parent 36effe9 commit ec52ef5
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions src/python/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ if(PYTHONINTERP_FOUND)
# Cython modules
set(GUDHI_PYTHON_MODULES "${GUDHI_PYTHON_MODULES}'off_utils', ")
set(GUDHI_PYTHON_MODULES "${GUDHI_PYTHON_MODULES}'simplex_tree', ")
set(GUDHI_PYTHON_MODULES "${GUDHI_PYTHON_MODULES}'edge_collapse', ")
set(GUDHI_PYTHON_MODULES "${GUDHI_PYTHON_MODULES}'rips_complex', ")
set(GUDHI_PYTHON_MODULES "${GUDHI_PYTHON_MODULES}'cubical_complex', ")
set(GUDHI_PYTHON_MODULES "${GUDHI_PYTHON_MODULES}'periodic_cubical_complex', ")
Expand All @@ -78,6 +77,7 @@ if(PYTHONINTERP_FOUND)
set(GUDHI_PYTHON_MODULES_EXTRA "${GUDHI_PYTHON_MODULES_EXTRA}'weighted_rips_complex', ")
set(GUDHI_PYTHON_MODULES_EXTRA "${GUDHI_PYTHON_MODULES_EXTRA}'dtm_rips_complex', ")
set(GUDHI_PYTHON_MODULES_EXTRA "${GUDHI_PYTHON_MODULES_EXTRA}'cover_complex', ")
set(GUDHI_PYTHON_MODULES_EXTRA "${GUDHI_PYTHON_MODULES_EXTRA}'flag_filtration', ")

add_gudhi_debug_info("Python version ${PYTHON_VERSION_STRING}")
add_gudhi_debug_info("Cython version ${CYTHON_VERSION}")
Expand Down Expand Up @@ -330,7 +330,7 @@ if(PYTHONINTERP_FOUND)
file(COPY "gudhi/hera/__init__.py" DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/gudhi/hera")
file(COPY "gudhi/datasets" DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/gudhi" FILES_MATCHING PATTERN "*.py")
file(COPY "gudhi/sklearn" DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/gudhi/")
file(COPY "gudhi/edge_collapse.py" DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/gudhi")
file(COPY "gudhi/flag_filtration" DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/gudhi/")


# Some files for pip package
Expand Down
2 changes: 1 addition & 1 deletion src/python/doc/edge_collapse.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
Edge collapse
=============

.. autofunction:: gudhi.collapse_edges
.. automodule:: gudhi.flag_filtration.edge_collapse
4 changes: 2 additions & 2 deletions src/python/doc/rips_complex_user.rst
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ regular Rips complex.

Another option which is especially useful if you want to compute persistent homology in "high" dimension (2 or more,
sometimes even 1), is to build the Rips complex only up to dimension 1 (a graph), then use
:func:`~gudhi.SimplexTree.collapse_edges` to reduce the size of this graph, and finally call
:func:`~gudhi.SimplexTree.flag_filtration.edge_collapse.reduce_graph` to reduce the size of this graph, and finally call
:func:`~gudhi.SimplexTree.expansion` to get a simplicial complex of a suitable dimension to compute its homology. This
trick gives the same persistence diagram as one would get with a plain use of `RipsComplex`, with a complex that is
often significantly smaller and thus faster to process.
Expand Down Expand Up @@ -157,7 +157,7 @@ or
cplx.expansion(2)


This way, you can easily add a call to :func:`~gudhi.SimplexTree.collapse_edges` before the expansion,
This way, you can easily add a call to :func:`~gudhi.SimplexTree.flag_filtration.edge_collapse.reduce_graph` before the expansion,
use a different metric to compute the matrix, or other variations.

Distance matrix
Expand Down
Empty file.
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
# Modification(s):
# - YYYY/MM Author: Description of the modification

from ._edge_collapse import _collapse_edges
from .._edge_collapse import _collapse_edges


def collapse_edges(input_edges, nb_iterations=1):
def reduce_graph(input_edges, nb_iterations=1):
"""Simplify a clique filtration, preserving its persistent homology.
The clique filtration is represented as a sparse weighted graph, giving for each edge its 2 vertices
and its filtration value, and the output is in the same format. An edge may be represented arbitrarily as (i, j)
Expand Down
2 changes: 1 addition & 1 deletion src/python/test/test_collapse_edges.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
- YYYY/MM Author: Description of the modification
"""

from gudhi import collapse_edges
from gudhi.flag_filtration.edge_collapse import reduce_graph as collapse_edges
import numpy as np
from scipy.sparse import coo_matrix
import pytest
Expand Down

0 comments on commit ec52ef5

Please sign in to comment.