summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoryuichi-ike <yuichi.ike.1990@gmail.com>2020-05-13 09:54:47 +0900
committeryuichi-ike <yuichi.ike.1990@gmail.com>2020-05-13 09:54:47 +0900
commitfd7112b7e665d495543d9647f675a14f75061bbf (patch)
treeb3ce0738be05f39b15fbf465bd441d3b5e2ee80c
parentc60caee5623d0b1ef55e7b2a5854604080419df1 (diff)
documents modified
-rw-r--r--src/python/doc/rips_complex_ref.rst42
-rw-r--r--src/python/doc/rips_complex_sum.inc3
-rw-r--r--src/python/doc/rips_complex_user.rst48
3 files changed, 51 insertions, 42 deletions
diff --git a/src/python/doc/rips_complex_ref.rst b/src/python/doc/rips_complex_ref.rst
index a5b4ffed..9ae3c49c 100644
--- a/src/python/doc/rips_complex_ref.rst
+++ b/src/python/doc/rips_complex_ref.rst
@@ -23,45 +23,3 @@ Weighted Rips complex reference manual
:show-inheritance:
.. automethod:: gudhi.weighted_rips_complex.WeightedRipsComplex.__init__
-
-Basic examples
---------------
-
-The following example computes the weighted Rips filtration associated with a distance matrix and weights on vertices.
-
-.. testcode::
-
- from gudhi.weighted_rips_complex import WeightedRipsComplex
- dist = [[], [1]]
- weights = [1, 100]
- w_rips = WeightedRipsComplex(distance_matrix=dist, weights=weights)
- st = w_rips.create_simplex_tree(max_dimension=2)
- print(list(st.get_filtration()))
-
-The output is:
-
-.. testoutput::
-
- [([0], 2.0), ([1], 200.0), ([0, 1], 200.0)]
-
-Combining with DistanceToMeasure, one can compute the DTM-filtration of a point set, as in `this notebook <https://github.com/GUDHI/TDA-tutorial/blob/master/Tuto-GUDHI-DTM-filtrations.ipynb>`_.
-
-.. testcode::
-
- import numpy as np
- from scipy.spatial.distance import cdist
- from gudhi.point_cloud.dtm import DistanceToMeasure
- from gudhi.weighted_rips_complex import WeightedRipsComplex
- pts = np.array([[2.0, 2.0], [0.0, 1.0], [3.0, 4.0]])
- dist = cdist(pts,pts)
- dtm = DistanceToMeasure(2, q=2, metric="precomputed")
- r = dtm.fit_transform(dist)
- w_rips = WeightedRipsComplex(distance_matrix=dist, weights=r)
- st = w_rips.create_simplex_tree(max_dimension=2)
- print(st.persistence())
-
-The output is:
-
-.. testoutput::
-
- [(0, (3.1622776601683795, inf)), (0, (3.1622776601683795, 5.39834563766817)), (0, (3.1622776601683795, 5.39834563766817))]
diff --git a/src/python/doc/rips_complex_sum.inc b/src/python/doc/rips_complex_sum.inc
index 6feb74cd..f7580714 100644
--- a/src/python/doc/rips_complex_sum.inc
+++ b/src/python/doc/rips_complex_sum.inc
@@ -11,6 +11,9 @@
| | | |
| | This complex can be built from a point cloud and a distance function, | |
| | or from a distance matrix. | |
+ | | | |
+ | | Weighted Rips complex constructs a simplicial complex from a distance | |
+ | | matrix and weights on vertices. | |
+----------------------------------------------------------------+------------------------------------------------------------------------+----------------------------------------------------------------------+
| * :doc:`rips_complex_user` | * :doc:`rips_complex_ref` |
+----------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------+
diff --git a/src/python/doc/rips_complex_user.rst b/src/python/doc/rips_complex_user.rst
index 8efb12e6..adb002a8 100644
--- a/src/python/doc/rips_complex_user.rst
+++ b/src/python/doc/rips_complex_user.rst
@@ -347,3 +347,51 @@ until dimension 1 - one skeleton graph in other words), the output is:
points in the persistence diagram will be under the diagonal, and
bottleneck distance and persistence graphical tool will not work properly,
this is a known issue.
+
+Weighted Rips Complex
+---------------------
+
+Example from a distance matrix and weights
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+The following example computes the weighted Rips filtration associated with a distance matrix and weights on vertices.
+
+.. testcode::
+
+ from gudhi.weighted_rips_complex import WeightedRipsComplex
+ dist = [[], [1]]
+ weights = [1, 100]
+ w_rips = WeightedRipsComplex(distance_matrix=dist, weights=weights)
+ st = w_rips.create_simplex_tree(max_dimension=2)
+ print(list(st.get_filtration()))
+
+The output is:
+
+.. testoutput::
+
+ [([0], 2.0), ([1], 200.0), ([0, 1], 200.0)]
+
+Example from a point cloud combined with DistanceToMeasure
+----------------------------------------------------------
+
+Combining with DistanceToMeasure, one can compute the DTM-filtration of a point set, as in `this notebook <https://github.com/GUDHI/TDA-tutorial/blob/master/Tuto-GUDHI-DTM-filtrations.ipynb>`_.
+
+.. testcode::
+
+ import numpy as np
+ from scipy.spatial.distance import cdist
+ from gudhi.point_cloud.dtm import DistanceToMeasure
+ from gudhi.weighted_rips_complex import WeightedRipsComplex
+ pts = np.array([[2.0, 2.0], [0.0, 1.0], [3.0, 4.0]])
+ dist = cdist(pts,pts)
+ dtm = DistanceToMeasure(2, q=2, metric="precomputed")
+ r = dtm.fit_transform(dist)
+ w_rips = WeightedRipsComplex(distance_matrix=dist, weights=r)
+ st = w_rips.create_simplex_tree(max_dimension=2)
+ print(st.persistence())
+
+The output is:
+
+.. testoutput::
+
+ [(0, (3.1622776601683795, inf)), (0, (3.1622776601683795, 5.39834563766817)), (0, (3.1622776601683795, 5.39834563766817))]