persistent homology?

447 views
Skip to first unread message

Pierre

unread,
May 12, 2017, 4:49:20 AM5/12/17
to sage-support
Hi !

Is there any interface between Sage and persistent homology software? For example this:

http://gudhi.gforge.inria.fr/

or this:

http://mrzv.org/software/dionysus/index.html

(Older threads here or on sage-devel seemed to indicate that the answer was "no", but they're quite old.)

Incidentally, if anybody has managed to install GUDHI either on Mac OSX or on SMC, i'd be interested to know how this was achieved.

Thanks!

Pierre

Dima Pasechnik

unread,
May 12, 2017, 7:20:14 AM5/12/17
to sage-support
thanks for the links. Last time I looked into it a couple of years ago, the software landscape in this area consisted of some closed-source efforts mostly. It's great these two can be used easily now.
(it's perhaps telling that dionysus only got its GPL license a month ago :-))

The only related effort that has some connection to Sage is Kenzo (https://github.com/gheber/kenzo), which has a persistent homology computation package; more precisely, it can compute persistent homology groups, which are basically reincarnation of groups in Leray spectral sequence (cf https://arxiv.org/abs/1308.0801).
(I don't know what the exact status of Kenzo in Sage is ATM)

Dima

John H Palmieri

unread,
May 12, 2017, 10:23:43 AM5/12/17
to sage-support
Sage has no interface to any persistent homology software. Please write one!

--
John

kcrisman

unread,
May 12, 2017, 1:57:31 PM5/12/17
to sage-support


On Friday, May 12, 2017 at 10:23:43 AM UTC-4, John H Palmieri wrote:
Sage has no interface to any persistent homology software. Please write one!

--


+1 this would be a fantastic addition to Sage. 

Pierre

unread,
May 14, 2017, 6:23:45 AM5/14/17
to sage-support
Thanks everyone for the answers. If i ever reach the stage when i can run gudhi on some computer, and then the stage when i can install it on my own computer, then i'll contemplate the project of writing an interface to sage -- but don't hold your breath...

Dima Pasechnik

unread,
May 14, 2017, 6:43:06 AM5/14/17
to sage-support
I am in contact with the author of dionysus, who expressed the interest of it to be added to Sage.
(he is releasing a new version soon, which is easier to install apparently)

slelievre

unread,
Aug 25, 2017, 10:02:24 PM8/25/17
to sage-support
Sun 2017-05-14 11:23:45 UTC+1, Pierre:


> Thanks everyone for the answers. If i ever reach the stage when
> i can run gudhi on some computer, and then the stage when i can
> install it on my own computer, then i'll contemplate the project of
> writing an interface to sage -- but don't hold your breath...

I successfully installed Gudhi in a CoCalc project, see below.
I can invite you as a collaborator on that project if that would help.

Visiting the home page at [0], I picked the menu item
[Download] > [Get the sources] which got me to [1],
where I found that I probably wanted item [2] listed there.


Back to [0], the [Installation] menu has four items:
- [C++ documentation], pointing to [3]
- [C++ installation manual], pointing to [4]
- [Python documentation], pointing to [5]
- [Python installation manual], pointing to [6]


Following the instructions at [4] I ran the following commands in a terminal

    $ DIRNAME='2017-08-22-15-45-31_GUDHI_2.0.1-rc1'
    $ TARBALL=$DIRNAME'.tar.gz'
    $ curl -C - --retry 99 -o $TARBALL $URL$TARBALL
    $ tar xzf $TARBALL
    $ cd $DIRNAME
    $ mkdir build
    $ cd build/
    $ cmake ..
    $ make

This worked well, ending with this message

    [100%] Do not forget to add /projects/acf3855b-c4e1-46dc-b895-ec496577848b/2017-08-22-15-45-31_GUDHI_2.0.1-rc1/build/cython/ to your PYTHONPATH before using examples or tests

I then continued and ran the tests:

    $ make test

which also completed successfully.

Following the instructions at [6] I then ran the following

    $ make cython
    $ cd cython
    $ export PYTHONPATH='$PYTHONPATH:/path-to-gudhi/build/cython'
    $ ctest -R py_test

and everything worked fine.

[The next instruction at [6] was about building the documentation
with sphinx-doc; that did not work; but we don't really need it.]

Pierre

unread,
Aug 26, 2017, 5:29:32 AM8/26/17
to sage-support
Thank you so much!! I'll try all of that when I have time (next week). I had tried to compile on cocalc (then SMC), i got some error messages, mentioning Qt among other things.

a couple of questions:
** are the instructions for python2 or python3 ?
** are you able to play with gudhi in a jupyter notebook ?
** can I change 

DIRNAME='2017-08-22-15-45-31_GUDHI_2.0.1-rc1'

to

DIRNAME='gudhi'       ?  

It would be more readable :-) 

thanks again!
Pierre

Dima Pasechnik

unread,
Aug 26, 2017, 6:10:04 AM8/26/17
to sage-support
I imagine that interoperability with Sage will need Python2.

slelievre

unread,
Aug 27, 2017, 5:27:33 AM8/27/17
to sage-support
Le samedi 26 août 2017 11:29:32 UTC+2, Pierre a écrit :

> Thank you so much!! I'll try all of that when I have time (next week).
> I had tried to compile on cocalc (then SMC), i got some error messages,
> mentioning Qt among other things.
>
> a couple of questions:
> ** are the instructions for python2 or python3?

I don't think it matters.

> ** are you able to play with gudhi in a jupyter notebook?

I don't know how to use gudhi at all, so I haven't tried.
We could try together if you want.

> ** can I change 
>
> DIRNAME='2017-08-22-15-45-31_GUDHI_2.0.1-rc1'
> to
> DIRNAME='gudhi'       ?  
>
> It would be more readable :-) 


You can rename the directory at any point (even after building everything):

    $ mv 2017-08-22-15-45-31_GUDHI_2.0.1-rc1 gudhi

Or you could add one line to the instructions I first sent:
between `tar xzf $TARBALL $DIRNAME` and `mkdir build`,
just run

    $ mv $DIRNAME gudhi

Pierre

unread,
Sep 12, 2017, 3:25:20 AM9/12/17
to sage-support
I tried to follow the instructions, in a brand new cocalc project. This failed, with

 $ URL='https://gforge.inria.fr/frs/download.php/file/37020/'
    $ DIRNAME='2017-08-22-15-45-31_GUDHI_2.0.1-rc1'
    $ TARBALL=$DIRNAME'.tar.gz'
    $ curl -C - --retry 99 -o $TARBALL $URL$TARBALL
    $ tar xzf $TARBALL
    $ cd $DIRNAME
    $ mkdir build
    $ cd build/
    $ cmake ..



-- The C compiler identification is GNU 5.4.0
-- The CXX compiler identification is GNU 5.4.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- GUDHI version : 2.0.1-rc1
++ GUDHI_SUB_DIRECTORIES list is:";test;utilities"
++ GUDHI_MODULES list
is:"common;Alpha_complex;Bitmap_cubical_complex;Bottleneck_distance;Contraction;Hasse_complex;Persistent_cohomology;Rips_complex;Simpl
ex_tree;Skeleton_blocker;Spatial_searching;Subsampling;Tangential_complex;Witness_complex"
-- Found Doxygen: /usr/bin/doxygen (found version "1.8.11")
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - not found
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE
-- Boost version: 1.58.0
-- Found the following Boost libraries:
--   system
--   filesystem
--   unit_test_framework
--   program_options
--   thread
--   chrono
--   date_time
--   atomic
-- Found GMP: /usr/lib/x86_64-linux-gnu/libgmp.so
-- GMP_LIBRARIES = /usr/lib/x86_64-linux-gnu/libgmp.so
-- Found GMPXX: /usr/lib/x86_64-linux-gnu/libgmpxx.so
-- GMPXX_LIBRARIES = /usr/lib/x86_64-linux-gnu/libgmpxx.so
CMake Error at /usr/lib/x86_64-linux-gnu/cmake/CGAL/CGALExports.cmake:83
(message):
  The imported target "CGAL::CGAL_Qt5" references the file

     "/usr/lib/x86_64-linux-gnu/libCGAL_Qt5.so.11.0.1"

  but this file does not exist.  Possible reasons include:

  * The file was deleted, renamed, or moved to another location.

  * An install or uninstall procedure did not complete successfully.

  * The installation package was faulty and contained

     "/usr/lib/x86_64-linux-gnu/cmake/CGAL/CGALExports.cmake"

  but not all the files it references.

Call Stack (most recent call first):
  /usr/lib/x86_64-linux-gnu/cmake/CGAL/CGALConfig.cmake:12 (include)
  cmake/modules/GUDHI_third_party_libraries.cmake:26 (find_package)
  CMakeLists.txt:37 (include)


CMake Warning (dev) at
/usr/lib/x86_64-linux-gnu/cmake/CGAL/CGALExports.cmake:12 (include):
  Policy CMP0011 is not set: Included scripts do automatic cmake_policy PUSH
  and POP.  Run "cmake --help-policy CMP0011" for policy details.  Use the
  cmake_policy command to set the policy and suppress this warning.

  The included script

    /usr/lib/x86_64-linux-gnu/cmake/CGAL/CGALExports.cmake

  affects policy settings.  CMake is implying the NO_POLICY_SCOPE option for
  compatibility, so the effects are applied to the including context.
Call Stack (most recent call first):
  /usr/lib/x86_64-linux-gnu/cmake/CGAL/CGALConfig.cmake:12 (include)
  cmake/modules/GUDHI_third_party_libraries.cmake:26 (find_package)
  CMakeLists.txt:37 (include)
This warning is for project developers.  Use -Wno-dev to suppress it.

-- Configuring incomplete, errors occurred!
See also "/home/user/2017-08-22-15-45-31_GUDHI_2.0.1-rc1/build/CMakeFiles/CMakeOutput.log".
See also "/home/user/2017-08-22-15-45-31_GUDHI_2.0.1-rc1/build/CMakeFiles/CMakeError.log".

slelievre

unread,
Sep 12, 2017, 8:55:30 PM9/12/17
to sage-support
Tue 2017-09-12 07:25:20 UTC, Pierre:

> I tried to follow the instructions, in a brand new cocalc project.
> This failed, with [...]

There have been major CoCalc changes since the successful
installation I reported three weeks ago. Notably, CoCalc projects
now run under Ubuntu 16.04.3 (vs previously 15.10).

Trying again in this new setting, I get the same failure as you.
This Bash Jupyter notebook shows the failure:


The CoCalc developers are looking into this.

Linden Disney

unread,
Oct 15, 2020, 1:22:36 PM10/15/20
to sage-support
I am just starting a project involving persistent homology, did anything end up happening with this? 

John H Palmieri

unread,
Oct 15, 2020, 1:57:24 PM10/15/20
to sage-support
No, I do not believe so.

Linden Disney

unread,
Oct 15, 2020, 2:02:58 PM10/15/20
to sage-support
Ah ok, it may be the case that working with the R interface and using TDAstats (https://cran.r-project.org/web/packages/TDAstats/index.html) might now be the best solution, but I may comment on this again when I have landed on what I will use. 

Dima Pasechnik

unread,
Oct 15, 2020, 2:18:03 PM10/15/20
to sage-support
On Thu, Oct 15, 2020 at 7:02 PM Linden Disney <disne...@gmail.com> wrote:
>
> Ah ok, it may be the case that working with the R interface and using TDAstats (https://cran.r-project.org/web/packages/TDAstats/index.html) might now be the best solution, but I may comment on this again when I have landed on what I will use.
>
> On Thursday, October 15, 2020 at 6:57:24 PM UTC+1 John H Palmieri wrote:
>>
>> No, I do not believe so.

Kenzo (to which Sage has an interface) has a module to compute
persistent homology, see
https://arxiv.org/pdf/1403.7086v2.pdf
http://www.unirioja.es/cu/anromero/persistent-homology.zip
and https://github.com/gheber/kenzo/issues/18
(something one could revive)

HTH
Dima

>>
>>
>> On Thursday, October 15, 2020 at 10:22:36 AM UTC-7, Linden Disney wrote:
>>>
>>> I am just starting a project involving persistent homology, did anything end up happening with this?
>>>
>>> On Wednesday, September 13, 2017 at 1:55:30 AM UTC+1 slelievre wrote:
>>>>
>>>> Tue 2017-09-12 07:25:20 UTC, Pierre:
>>>>
>>>> > I tried to follow the instructions, in a brand new cocalc project.
>>>> > This failed, with [...]
>>>>
>>>> There have been major CoCalc changes since the successful
>>>> installation I reported three weeks ago. Notably, CoCalc projects
>>>> now run under Ubuntu 16.04.3 (vs previously 15.10).
>>>>
>>>> Trying again in this new setting, I get the same failure as you.
>>>> This Bash Jupyter notebook shows the failure:
>>>>
>>>> https://cocalc.com/projects/57b64f7e-e45e-4171-a0f0-bb53ab8befb1/files/install-gudhi.ipynb
>>>>
>>>> The CoCalc developers are looking into this.
>
> --
> You received this message because you are subscribed to the Google Groups "sage-support" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to sage-support...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/sage-support/01d5b6eb-1e67-413a-bcf6-36935f7d2a22n%40googlegroups.com.

Guillaume Rousseau

unread,
May 26, 2021, 4:24:25 PM5/26/21
to sage-support
Hello all,
I know I am a bit late to the party, but I have written a Sage module for computing persistent homology, and I just submitted a ticket !

Linden Disney

unread,
May 29, 2021, 7:26:20 AM5/29/21
to sage-support
Great to see that you've added to Zomorodian paper! Have you done any benchmarking of this yet? In the end I used Ripser++ (https://github.com/simonzhang00/ripser-plusplus) which worked relatively well, but it seems to me that the current opinion in the field is that some sort of distributed persistence, or something that can be parallelised further, will be the future way forward for feasible calculations. 

Guillaume Rousseau

unread,
May 30, 2021, 3:42:24 AM5/30/21
to sage-support
I have not yet benchmarked it but am working on it, however it is definitely slower in comparison to Ripser / gudhi and co. (although if I understand correctly Ripser only computes homology for Vietoris-Rips complexes?), since it is a very direct python implementation of Zomorodian's algo with close to no optimization... I wrote this code as part of a project for my master's degree internship, and this was my first time dealing with homology, let alone persistent homology, so my knowledge of the subject is rather limited. However it does add native support of persistent homology to Sage, and hopefully some other contributors will add to my code and implement better algos and optimizations !
Reply all
Reply to author
Forward
0 new messages