How I count simplices for each dimension ( python GUDHI ) #915
Siwon-S-Kim
started this conversation in
Show and tell
Replies: 1 comment
-
Thanks for sharing! r=[0]*(st.dimension()+1)
for s,_ in st.get_simplices():
r[len(s)-1] += 1 But your code ends up being faster because most of the work is done in C++ (it is often hard to believe how slow Python is). In the future, we are planning to have a C++ function that returns exactly those numbers (#912) and should be significantly faster without destroying the complex. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi
I just started using GUDHI recently and I am having great time with GUDHI. Thank you developers!
I thought just giving thanks is not productive, so I decided to show something that I just come up with. I believe there is no python method to count simplices for each dimension for right now and I also believe it will be there any soon. I think this way, we can count simplices faster than brute force by for loop with
SimplexTree.get_simplices()
for each dimension. I used.num_simplices()
and.prune_above_dimension
method.where complex is GUDHI SimplexTree simplicial complex. I am not aware of usual usage of GUDHI actually, but for my case, this seems to work faster. Since I am yet to know actual structure of Simplex Tree, I cannot prove that this is efficient than brute force by for loop over
get_simplices()
.But anyway thank you developers.
Beta Was this translation helpful? Give feedback.
All reactions