summaryrefslogtreecommitdiff
path: root/src/cython/example
diff options
context:
space:
mode:
authorvrouvrea <vrouvrea@636b058d-ea47-450e-bf9e-a15bfbe3eedb>2016-05-09 10:59:11 +0000
committervrouvrea <vrouvrea@636b058d-ea47-450e-bf9e-a15bfbe3eedb>2016-05-09 10:59:11 +0000
commitd9780fc1fda42d78038c327b05203e55e3b40fd0 (patch)
tree1f2c4e3ef4fe3a6650bc0a556a508dadddd53b03 /src/cython/example
parent134aaa68ab6a5983a9569a123a18550535afa2ef (diff)
Directory re-organization for Gudhi modules
git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/ST_cythonize@1154 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: acfc931aee37c65ee2828e3873e9727b308e5d76
Diffstat (limited to 'src/cython/example')
-rwxr-xr-xsrc/cython/example/Simplex_tree_example.py65
1 files changed, 65 insertions, 0 deletions
diff --git a/src/cython/example/Simplex_tree_example.py b/src/cython/example/Simplex_tree_example.py
new file mode 100755
index 00000000..e9459588
--- /dev/null
+++ b/src/cython/example/Simplex_tree_example.py
@@ -0,0 +1,65 @@
+#!/usr/bin/env python
+
+import gudhi
+
+st = gudhi.SimplexTree()
+
+print("#######################################################################")
+print("SimplexTree creation from insertion")
+if st.insert([0,1]):
+ print("Inserted !!")
+else:
+ print("Not inserted...")
+
+if st.find([0,1]):
+ print("Found !!")
+else:
+ print("Not found...")
+
+if st.insert([0,1,2], filtration=4.0):
+ print("Inserted !!")
+else:
+ print("Not inserted...")
+
+# FIXME: Remove this line
+st.set_dimension(3)
+print("dimension=", st.dimension())
+
+st.set_filtration(4.0)
+st.initialize_filtration()
+print("filtration=", st.get_filtration())
+print("filtration[1,2]=", st.filtration([1,2]))
+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("#######################################################################")
+print("SimplexTree creation from Rips")
+st_from_rips = gudhi.SimplexTree(points=[[0,0],[1,0],[0,1],[1,1]],max_dimension=1,max_edge_length=42)
+
+print("filtered_tree=", st_from_rips.get_filtered_tree())
+print("star([0])=", st_from_rips.get_star_tree([0]))
+print("coface([0],1)=", st_from_rips.get_coface_tree([0], 1))
+
+
+print("#######################################################################")
+print("MiniSimplexTree creation from insertion")
+triangle012 = [0, 1, 2]
+edge03 = [0, 3]
+mini_st = gudhi.MiniSimplexTree()
+mini_st.insert(triangle012)
+mini_st.insert(edge03)
+# FIXME: Remove this line
+mini_st.set_dimension(2);
+
+edge02 = [0, 2]
+if mini_st.find(edge02):
+ # Only coface is 012
+ print("coface(edge02,1)=", mini_st.get_coface_tree(edge02, 1))
+print("filtered_tree=", mini_st.get_filtered_tree())
+