summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorvrouvrea <vrouvrea@636b058d-ea47-450e-bf9e-a15bfbe3eedb>2017-04-01 09:36:35 +0000
committervrouvrea <vrouvrea@636b058d-ea47-450e-bf9e-a15bfbe3eedb>2017-04-01 09:36:35 +0000
commit202bf9722358355c12e85c0718da567ce9d9a6ae (patch)
treef90ac80f9aab2d9f1ca6350608b29b7c367943a4
parent99695369a066962339d7f85a4dc4981a804b3a54 (diff)
remove bad named *_tree() functions
git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/ST_cythonize@2300 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: 512403fe0838fb2691e0af94c55772bff942b740
-rw-r--r--src/cython/cython/simplex_tree.pyx46
-rw-r--r--src/cython/doc/alpha_complex_user.rst4
-rw-r--r--src/cython/doc/rips_complex_user.rst8
-rw-r--r--src/cython/doc/simplex_tree_user.rst6
-rw-r--r--src/cython/doc/tangential_complex_user.rst2
-rwxr-xr-xsrc/cython/example/alpha_complex_from_points_example.py2
-rwxr-xr-xsrc/cython/example/rips_complex_from_points_example.py2
-rwxr-xr-xsrc/cython/example/simplex_tree_example.py6
-rw-r--r--src/cython/include/Simplex_tree_interface.h16
-rwxr-xr-xsrc/cython/test/test_alpha_complex.py4
-rwxr-xr-xsrc/cython/test/test_euclidean_witness_complex.py6
-rwxr-xr-xsrc/cython/test/test_rips_complex.py4
-rwxr-xr-xsrc/cython/test/test_simplex_tree.py15
-rwxr-xr-xsrc/cython/test/test_tangential_complex.py2
14 files changed, 57 insertions, 66 deletions
diff --git a/src/cython/cython/simplex_tree.pyx b/src/cython/cython/simplex_tree.pyx
index d26a1a93..9d40a8b5 100644
--- a/src/cython/cython/simplex_tree.pyx
+++ b/src/cython/cython/simplex_tree.pyx
@@ -46,8 +46,8 @@ cdef extern from "Simplex_tree_interface.h" namespace "Gudhi":
bint find_simplex(vector[int] simplex)
bint insert_simplex_and_subfaces(vector[int] simplex,
double filtration)
- vector[pair[vector[int], double]] get_filtered_tree()
- vector[pair[vector[int], double]] get_skeleton_tree(int dimension)
+ vector[pair[vector[int], double]] get_filtration()
+ vector[pair[vector[int], double]] get_skeleton(int dimension)
vector[pair[vector[int], double]] get_star(vector[int] simplex)
vector[pair[vector[int], double]] get_cofaces(vector[int] simplex,
int dimension)
@@ -102,14 +102,6 @@ cdef class SimplexTree:
"""
return self.pcohptr != NULL
- def get_filtration(self):
- """This function returns the main simplicial complex filtration value.
-
- :returns: The simplicial complex filtration value.
- :rtype: float
- """
- return self.thisptr.filtration()
-
def filtration(self, simplex):
"""This function returns the simplicial complex filtration value for a
given N-simplex.
@@ -136,7 +128,7 @@ cdef class SimplexTree:
.. note::
This function must be launched before persistence, betti_numbers,
- persistent_betti_numbers or get_filtered_tree after inserting or
+ persistent_betti_numbers or get_filtration after inserting or
removing simplices.
"""
self.thisptr.initialize_filtration()
@@ -214,36 +206,36 @@ cdef class SimplexTree:
return self.thisptr.insert_simplex_and_subfaces(complex,
<double>filtration)
- def get_filtered_tree(self):
- """This function returns the tree sorted by increasing filtration
- values.
+ def get_filtration(self):
+ """This function returns a list of all simplices with their given
+ filtration values.
- :returns: The tree sorted by increasing filtration values.
+ :returns: The simplices sorted by increasing filtration values.
:rtype: list of tuples(simplex, filtration)
"""
- cdef vector[pair[vector[int], double]] filtered_tree \
- = self.thisptr.get_filtered_tree()
+ cdef vector[pair[vector[int], double]] filtration \
+ = self.thisptr.get_filtration()
ct = []
- for filtered_complex in filtered_tree:
+ for filtered_complex in filtration:
v = []
for vertex in filtered_complex.first:
v.append(vertex)
ct.append((v, filtered_complex.second))
return ct
- def get_skeleton_tree(self, dimension):
- """This function returns the tree skeleton of a maximum given
- dimension.
+ def get_skeleton(self, dimension):
+ """This function returns the (simplices of the) skeleton of a maximum
+ given dimension.
:param dimension: The skeleton dimension value.
:type dimension: int.
- :returns: The skeleton tree of a maximum dimension.
+ :returns: The (simplices of the) skeleton of a maximum dimension.
:rtype: list of tuples(simplex, filtration)
"""
- cdef vector[pair[vector[int], double]] sk_tree \
- = self.thisptr.get_skeleton_tree(<int>dimension)
+ cdef vector[pair[vector[int], double]] skeletons \
+ = self.thisptr.get_skeleton(<int>dimension)
ct = []
- for filtered_complex in sk_tree:
+ for filtered_complex in skeletons:
v = []
for vertex in filtered_complex.first:
v.append(vertex)
@@ -255,7 +247,7 @@ cdef class SimplexTree:
:param simplex: The N-simplex, represented by a list of vertex.
:type simplex: list of int.
- :returns: The star tree of a simplex.
+ :returns: The (simplices of the) star of a simplex.
:rtype: list of tuples(simplex, filtration)
"""
cdef vector[int] complex
@@ -280,7 +272,7 @@ cdef class SimplexTree:
:param codimension: The codimension. If codimension = 0, all cofaces
are returned (equivalent of get_star function)
:type codimension: int.
- :returns: The coface tree of a simplex.
+ :returns: The (simplices of the) cofaces of a simplex
:rtype: list of tuples(simplex, filtration)
"""
cdef vector[int] complex
diff --git a/src/cython/doc/alpha_complex_user.rst b/src/cython/doc/alpha_complex_user.rst
index 68e53a77..2356944d 100644
--- a/src/cython/doc/alpha_complex_user.rst
+++ b/src/cython/doc/alpha_complex_user.rst
@@ -30,7 +30,7 @@ This example builds the Delaunay triangulation from the given points, and initia
repr(simplex_tree.num_simplices()) + ' simplices - ' + \
repr(simplex_tree.num_vertices()) + ' vertices.'
print(result_str)
- for filtered_value in simplex_tree.get_filtered_tree():
+ for filtered_value in simplex_tree.get_filtration():
print(filtered_value)
The output is:
@@ -164,7 +164,7 @@ Then, it is asked to display information about the alpha complex:
repr(simplex_tree.num_simplices()) + ' simplices - ' + \
repr(simplex_tree.num_vertices()) + ' vertices.'
print(result_str)
- for filtered_value in simplex_tree.get_filtered_tree():
+ for filtered_value in simplex_tree.get_filtration():
print(filtered_value)
the program output is:
diff --git a/src/cython/doc/rips_complex_user.rst b/src/cython/doc/rips_complex_user.rst
index 027c3bf7..c89409a0 100644
--- a/src/cython/doc/rips_complex_user.rst
+++ b/src/cython/doc/rips_complex_user.rst
@@ -60,7 +60,7 @@ Finally, it is asked to display information about the simplicial complex.
repr(simplex_tree.num_simplices()) + ' simplices - ' + \
repr(simplex_tree.num_vertices()) + ' vertices.'
print(result_str)
- for filtered_value in simplex_tree.get_filtered_tree():
+ for filtered_value in simplex_tree.get_filtration():
print(filtered_value)
When launching (Rips maximal distance between 2 points is 12.0, is expanded
@@ -107,7 +107,7 @@ Finally, it is asked to display information about the Rips complex.
repr(simplex_tree.num_simplices()) + ' simplices - ' + \
repr(simplex_tree.num_vertices()) + ' vertices.'
print(result_str)
- for filtered_value in simplex_tree.get_filtered_tree():
+ for filtered_value in simplex_tree.get_filtration():
print(filtered_value)
the program output is:
@@ -162,7 +162,7 @@ Finally, it is asked to display information about the simplicial complex.
repr(simplex_tree.num_simplices()) + ' simplices - ' + \
repr(simplex_tree.num_vertices()) + ' vertices.'
print(result_str)
- for filtered_value in simplex_tree.get_filtered_tree():
+ for filtered_value in simplex_tree.get_filtration():
print(filtered_value)
When launching (Rips maximal distance between 2 points is 12.0, is expanded
@@ -209,7 +209,7 @@ Finally, it is asked to display information about the Rips complex.
repr(simplex_tree.num_simplices()) + ' simplices - ' + \
repr(simplex_tree.num_vertices()) + ' vertices.'
print(result_str)
- for filtered_value in simplex_tree.get_filtered_tree():
+ for filtered_value in simplex_tree.get_filtration():
print(filtered_value)
the program output is:
diff --git a/src/cython/doc/simplex_tree_user.rst b/src/cython/doc/simplex_tree_user.rst
index c4e4c1b5..b2efca8b 100644
--- a/src/cython/doc/simplex_tree_user.rst
+++ b/src/cython/doc/simplex_tree_user.rst
@@ -45,8 +45,8 @@ Example
print(result_str)
result_str = 'num_simplices=' + repr(st.num_simplices())
print(result_str)
- print("skeleton_tree(2) =")
- for sk_value in st.get_skeleton_tree(2):
+ print("skeleton(2) =")
+ for sk_value in st.get_skeleton(2):
print(sk_value)
@@ -59,7 +59,7 @@ The output is:
[0, 1] found
num_vertices=3
num_simplices=7
- skeleton_tree(2) =
+ skeleton(2) =
([0, 1, 2], 4.0)
([0, 1], 0.0)
([0, 2], 4.0)
diff --git a/src/cython/doc/tangential_complex_user.rst b/src/cython/doc/tangential_complex_user.rst
index 6a7e6e41..24f68f85 100644
--- a/src/cython/doc/tangential_complex_user.rst
+++ b/src/cython/doc/tangential_complex_user.rst
@@ -133,7 +133,7 @@ This example builds the Tangential complex of point set read in an OFF file.
' - ' + repr(st.num_simplices()) + ' simplices - ' + \
repr(st.num_vertices()) + ' vertices.'
print(result_str)
- for filtered_value in st.get_filtered_tree():
+ for filtered_value in st.get_filtration():
print(filtered_value)
The output is:
diff --git a/src/cython/example/alpha_complex_from_points_example.py b/src/cython/example/alpha_complex_from_points_example.py
index 688edb65..7d6278ce 100755
--- a/src/cython/example/alpha_complex_from_points_example.py
+++ b/src/cython/example/alpha_complex_from_points_example.py
@@ -59,7 +59,7 @@ else:
print("[4] Not found...")
print("dimension=", simplex_tree.dimension())
-print("filtered_tree=", simplex_tree.get_filtered_tree())
+print("filtrations=", simplex_tree.get_filtration())
print("star([0])=", simplex_tree.get_star([0]))
print("coface([0], 1)=", simplex_tree.get_cofaces([0], 1))
diff --git a/src/cython/example/rips_complex_from_points_example.py b/src/cython/example/rips_complex_from_points_example.py
index 9b7fc79d..5d411b1a 100755
--- a/src/cython/example/rips_complex_from_points_example.py
+++ b/src/cython/example/rips_complex_from_points_example.py
@@ -35,6 +35,6 @@ rips = gudhi.RipsComplex(points=[[0, 0], [1, 0], [0, 1], [1, 1]],
simplex_tree = rips.create_simplex_tree(max_dimension=1)
-print("filtered_tree=", simplex_tree.get_filtered_tree())
+print("filtrations=", simplex_tree.get_filtration())
print("star([0])=", simplex_tree.get_star([0]))
print("coface([0], 1)=", simplex_tree.get_cofaces([0], 1))
diff --git a/src/cython/example/simplex_tree_example.py b/src/cython/example/simplex_tree_example.py
index bf5f17a2..3af20fcf 100755
--- a/src/cython/example/simplex_tree_example.py
+++ b/src/cython/example/simplex_tree_example.py
@@ -61,6 +61,6 @@ print("filtration[4, 2]=", st.filtration([4, 2]))
print("num_simplices=", st.num_simplices())
print("num_vertices=", st.num_vertices())
-print("skeleton_tree[2]=", st.get_skeleton_tree(2))
-print("skeleton_tree[1]=", st.get_skeleton_tree(1))
-print("skeleton_tree[0]=", st.get_skeleton_tree(0))
+print("skeleton[2]=", st.get_skeleton(2))
+print("skeleton[1]=", st.get_skeleton(1))
+print("skeleton[0]=", st.get_skeleton(0))
diff --git a/src/cython/include/Simplex_tree_interface.h b/src/cython/include/Simplex_tree_interface.h
index 6bdf7830..45ce1916 100644
--- a/src/cython/include/Simplex_tree_interface.h
+++ b/src/cython/include/Simplex_tree_interface.h
@@ -90,29 +90,29 @@ class Simplex_tree_interface : public Simplex_tree<SimplexTreeOptions> {
Base::initialize_filtration();
}
- Complex get_filtered_tree() {
+ Complex get_filtration() {
Base::initialize_filtration();
- Complex filtered_tree;
+ Complex filtrations;
for (auto f_simplex : Base::filtration_simplex_range()) {
Simplex simplex;
for (auto vertex : Base::simplex_vertex_range(f_simplex)) {
simplex.insert(simplex.begin(), vertex);
}
- filtered_tree.push_back(std::make_pair(simplex, Base::filtration(f_simplex)));
+ filtrations.push_back(std::make_pair(simplex, Base::filtration(f_simplex)));
}
- return filtered_tree;
+ return filtrations;
}
- Complex get_skeleton_tree(int dimension) {
- Complex skeleton_tree;
+ Complex get_skeleton(int dimension) {
+ Complex skeletons;
for (auto f_simplex : Base::skeleton_simplex_range(dimension)) {
Simplex simplex;
for (auto vertex : Base::simplex_vertex_range(f_simplex)) {
simplex.insert(simplex.begin(), vertex);
}
- skeleton_tree.push_back(std::make_pair(simplex, Base::filtration(f_simplex)));
+ skeletons.push_back(std::make_pair(simplex, Base::filtration(f_simplex)));
}
- return skeleton_tree;
+ return skeletons;
}
Complex get_star(const Simplex& simplex) {
diff --git a/src/cython/test/test_alpha_complex.py b/src/cython/test/test_alpha_complex.py
index 2625d529..2c76d9d7 100755
--- a/src/cython/test/test_alpha_complex.py
+++ b/src/cython/test/test_alpha_complex.py
@@ -42,7 +42,7 @@ def test_infinite_alpha():
assert simplex_tree.num_simplices() == 11
assert simplex_tree.num_vertices() == 4
- assert simplex_tree.get_filtered_tree() == \
+ assert simplex_tree.get_filtration() == \
[([0], 0.0), ([1], 0.0), ([2], 0.0), ([3], 0.0),
([0, 1], 0.25), ([0, 2], 0.25), ([1, 3], 0.25),
([2, 3], 0.25), ([1, 2], 0.5), ([0, 1, 2], 0.5),
@@ -76,7 +76,7 @@ def test_filtered_alpha():
assert filtered_alpha.get_point(4) == []
assert filtered_alpha.get_point(125) == []
- assert simplex_tree.get_filtered_tree() == \
+ assert simplex_tree.get_filtration() == \
[([0], 0.0), ([1], 0.0), ([2], 0.0), ([3], 0.0),
([0, 1], 0.25), ([0, 2], 0.25), ([1, 3], 0.25),
([2, 3], 0.25)]
diff --git a/src/cython/test/test_euclidean_witness_complex.py b/src/cython/test/test_euclidean_witness_complex.py
index 0947cc09..737f1ef4 100755
--- a/src/cython/test/test_euclidean_witness_complex.py
+++ b/src/cython/test/test_euclidean_witness_complex.py
@@ -42,7 +42,7 @@ def test_witness_complex():
assert landmarks[1] == euclidean_witness_complex.get_point(1)
assert landmarks[2] == euclidean_witness_complex.get_point(2)
- assert simplex_tree.get_filtered_tree() == [([0], 0.0), ([1], 0.0),
+ assert simplex_tree.get_filtration() == [([0], 0.0), ([1], 0.0),
([0, 1], 0.0), ([2], 0.0), ([0, 2], 0.0), ([1, 2], 0.0),
([0, 1, 2], 0.0)]
@@ -61,11 +61,11 @@ def test_strong_witness_complex():
assert landmarks[1] == euclidean_strong_witness_complex.get_point(1)
assert landmarks[2] == euclidean_strong_witness_complex.get_point(2)
- assert simplex_tree.get_filtered_tree() == [([0], 0.0), ([1], 0.0), ([2], 0.0)]
+ assert simplex_tree.get_filtration() == [([0], 0.0), ([1], 0.0), ([2], 0.0)]
simplex_tree = euclidean_strong_witness_complex.create_simplex_tree(max_alpha_square=100.0)
- assert simplex_tree.get_filtered_tree() == [([0], 0.0), ([1], 0.0),
+ assert simplex_tree.get_filtration() == [([0], 0.0), ([1], 0.0),
([2], 0.0), ([1, 2], 15.0), ([0, 2], 34.0), ([0, 1], 37.0),
([0, 1, 2], 37.0)]
diff --git a/src/cython/test/test_rips_complex.py b/src/cython/test/test_rips_complex.py
index 286a645b..c7d2ead4 100755
--- a/src/cython/test/test_rips_complex.py
+++ b/src/cython/test/test_rips_complex.py
@@ -44,7 +44,7 @@ def test_rips_from_points():
assert simplex_tree.num_simplices() == 10
assert simplex_tree.num_vertices() == 4
- assert simplex_tree.get_filtered_tree() == \
+ assert simplex_tree.get_filtration() == \
[([0], 0.0), ([1], 0.0), ([2], 0.0), ([3], 0.0),
([0, 1], 1.0), ([0, 2], 1.0), ([1, 3], 1.0),
([2, 3], 1.0), ([1, 2], 1.4142135623730951),
@@ -83,7 +83,7 @@ def test_rips_from_distance_matrix():
assert simplex_tree.num_simplices() == 10
assert simplex_tree.num_vertices() == 4
- assert simplex_tree.get_filtered_tree() == \
+ assert simplex_tree.get_filtration() == \
[([0], 0.0), ([1], 0.0), ([2], 0.0), ([3], 0.0),
([0, 1], 1.0), ([0, 2], 1.0), ([1, 3], 1.0),
([2, 3], 1.0), ([1, 2], 1.4142135623730951),
diff --git a/src/cython/test/test_simplex_tree.py b/src/cython/test/test_simplex_tree.py
index db61f84c..3ae537e3 100755
--- a/src/cython/test/test_simplex_tree.py
+++ b/src/cython/test/test_simplex_tree.py
@@ -55,7 +55,6 @@ def test_insertion():
# filtration test
st.set_filtration(5.0)
st.initialize_filtration()
- assert st.get_filtration() == 5.0
assert st.filtration([0, 1, 2]) == 4.0
assert st.filtration([0, 2]) == 4.0
assert st.filtration([1, 2]) == 4.0
@@ -64,20 +63,20 @@ def test_insertion():
assert st.filtration([0]) == 0.0
assert st.filtration([1]) == 0.0
- # skeleton_tree test
- assert st.get_skeleton_tree(2) == \
+ # skeleton test
+ assert st.get_skeleton(2) == \
[([0, 1, 2], 4.0), ([0, 1], 0.0), ([0, 2], 4.0),
([0], 0.0), ([1, 2], 4.0), ([1], 0.0), ([2], 4.0)]
- assert st.get_skeleton_tree(1) == \
+ assert st.get_skeleton(1) == \
[([0, 1], 0.0), ([0, 2], 4.0), ([0], 0.0),
([1, 2], 4.0), ([1], 0.0), ([2], 4.0)]
- assert st.get_skeleton_tree(0) == \
+ assert st.get_skeleton(0) == \
[([0], 0.0), ([1], 0.0), ([2], 4.0)]
# remove_maximal_simplex test
assert st.get_cofaces([0, 1, 2], 1) == []
st.remove_maximal_simplex([0, 1, 2])
- assert st.get_skeleton_tree(2) == \
+ assert st.get_skeleton(2) == \
[([0, 1], 0.0), ([0, 2], 4.0), ([0], 0.0),
([1, 2], 4.0), ([1], 0.0), ([2], 4.0)]
assert st.find([0, 1, 2]) == False
@@ -116,7 +115,7 @@ def test_expansion():
assert st.num_vertices() == 7
assert st.num_simplices() == 17
- assert st.get_filtered_tree() == [([2], 0.1), ([3], 0.1), ([2, 3], 0.1),
+ assert st.get_filtration() == [([2], 0.1), ([3], 0.1), ([2, 3], 0.1),
([0], 0.2), ([0, 2], 0.2), ([1], 0.3), ([0, 1], 0.3), ([1, 3], 0.4),
([1, 2], 0.5), ([5], 0.6), ([6], 0.6), ([5, 6], 0.6), ([4], 0.7),
([2, 4], 0.7), ([0, 3], 0.8), ([4, 6], 0.9), ([3, 6], 1.0)]
@@ -126,7 +125,7 @@ def test_expansion():
assert st.num_simplices() == 22
st.initialize_filtration()
- assert st.get_filtered_tree() == [([2], 0.1), ([3], 0.1), ([2, 3], 0.1),
+ assert st.get_filtration() == [([2], 0.1), ([3], 0.1), ([2, 3], 0.1),
([0], 0.2), ([0, 2], 0.2), ([1], 0.3), ([0, 1], 0.3), ([1, 3], 0.4),
([1, 2], 0.5), ([0, 1, 2], 0.5), ([1, 2, 3], 0.5), ([5], 0.6), ([6], 0.6),
([5, 6], 0.6), ([4], 0.7), ([2, 4], 0.7), ([0, 3], 0.8), ([0, 1, 3], 0.8),
diff --git a/src/cython/test/test_tangential_complex.py b/src/cython/test/test_tangential_complex.py
index c191baa4..8aa4023c 100755
--- a/src/cython/test/test_tangential_complex.py
+++ b/src/cython/test/test_tangential_complex.py
@@ -40,7 +40,7 @@ def test_tangential():
assert st.num_simplices() == 6
assert st.num_vertices() == 4
- assert st.get_filtered_tree() == \
+ assert st.get_filtration() == \
[([0], 0.0), ([1], 0.0), ([2], 0.0), ([0, 2], 0.0), ([3], 0.0), ([1, 3], 0.0)]
assert st.get_cofaces([0], 1) == [([0, 2], 0.0)]