-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature request: Allow (read only) access to the directed flag complex via python #57
Comments
Thanks @flomlo! I have some questions:
|
Hi,
|
I see! I would be very interested to know.
I'm not sure I see why. Computational runtime would be greatly reduced, but the final product would presumably be a Python object. |
I'll let you know once I know more details! |
ok, so the flagser/include/complex/directed_flag_complex_in_memory.h has a suspicious file name and even contains the comment So I'm pretty sure this option exists :D Now I just need to figure out how to bind C++ datastructures/objects to python (read only) in the least painful way, if even possible. In the paper it is stated that flagser usually computes the locally useful parts of the flag complex on demand, as it is done quickly enough. I'm not sure if the "locally useful" parts for my computations align with whats necessary for homology-computation. So I'm not sure if I'm motivated enough to bind the not-in-memory-flag-complexes stuff as well. Let's see. |
Hello everyone and happy new year ! @flomlo I never played with the I'll have a look on this by the end of the week, I need to understand what exactly can be outputted by the If you have already something, feel free to prepare a PR, I can help you if you're stuck in a specific issue. But from a first feeling, this feature will require two PR, one in Best, |
Hi! So far I've only theoretically analzized the The coboundaries seem to be computed on the fly are then directly written to a coboundary matrix. I'm still trying to figure out if/how I can restore the full flag complex from the Once I feel like this works I'll play around with it a bit and will do a pull request then. Binding with Just bear with my slowness, it's the first time reading (and binding) C++ code in my life, progress is slow and hard :D Best, Florian |
Hi !
Yes, I think you're right, cofaces are generated on the fly and they are not stored in memory. If I'm not wrong, what you're interested in is the data in In order to retrieve this data, the method Then what I think we should do is as follow:
In my opinion, this should be discussed directly in the flagser repository, and then we could implement a retrieving method inside of @luetge Hi Daniel, I tag you directly here instead of creating a new issue in flagser, because there's an ongoing discussion for the possibility to retrieve (in python) the From my first understanding and suggestion, do you think it's doable to retrieve this Best, |
Hi Julián, first and foremost thanks for supporting me :) After an additional day of staring at the code I'm now pretty sure that the coface-generating-magic is entirely hidden in the This would be line 258 to 306 in https://github.com/luetge/flagser/blob/7ffe92782ae639b4265a52403d2d90d3151bb67b/include/complex/directed_flag_complex_in_memory_computer.h#L258. In that code we have This is precisely the information I would like to know about on the python side. The only problem so far is that this If I can reconstruct the Otherwise, the right angle of attack (at least for me) would be somewhere around there, separating the search for cofaces and the generation of the As far as my debugging shows, the Best, |
Ok, I've now understood the final piece in the puzzle, I hope. Simplices of dimension 2 and onwards get a number (simply starting with 0, counting upwards). The particular number ( I do not see however how to quickly jump to this simplex with just the simplex index given. Furthermore, I do not see how to regain the insert_position Thus I agree with you @MonkeyBreaker: I'll have a look on where to split the |
Forgot to attach my pen-and-paper analysis of the flag complex e.flag which showcases what the |
Hi everyone, Sorry for the extremely late response. The storage of the flag complex simplices is quite straightforward (prefix trees either in memory or on the fly), all the magic that is performed in the code you are discussing is about choosing labels for the simplices of a fixed dimension (starting with label zero and counting up). This is needed to choose a basis for describing the coboundary operator with a coboundary matrix. The entries of that matrix are then computed by iterating over all possible insertion points as you rightfully pointed out. I did not have a look at that code for quite some time, but if I am not mistaken the entries of the matrix are given by (index of d+1 simplex, coefficient). Looking up index -> simplex is simply done by some sort of binary search on the tree, but the most efficient way would probably be too explicitly call the coboundary computation function to generate the matrix on demand when asked for in python (probably needs some refactoring of that part of the code). This should not have performance implications for the rest of the code, so I am happy to receive a pull request. Best, |
Hi Daniel, Thank you so much for your answer and the details. If you think that this is a valid approach, I can prepare the necessary in order to have working example. If not, I need to dig a bit more 😅 Best, |
Hi, That would work I think, happy to see it in flagser. Best, Daniel |
I'm considering offering a proper implementation of this interface and some documentation alongside to interested Master Students (CS) as a Master Thesis / Project. Not sure if the result will be up to everyone's standard, but it might be good starting point! @MonkeyBreaker: You're way deeper into serious C++ programming that I am, do you think this is a reasonable idea? Or would you recommend against? |
@flomlo well I wouldn't have at the moment any use cases on my side, but the more tools we have to explore the data, the better in my opinion ! I think it is a reasonable idea, it would be a great opportunity to think about the design when at the same time we add features. See if there are some parts that could be made more flexible. I would be more than glad to discuss about the implementation and to review the work done, but I won't be able to follow actively during the implementation. I am afraid the following months will be quite loaded on my side ... |
Motivation
The implementation of the data structure needed for the directed flag complex seems to be quite memory efficient in the
flagser
code. The same holds true for the generation of the directed flag complex.Despite betti-numbers and simplex counts, which are currently available via the pyflagser api, one can make use of the flag complex to calculate other interesting characteristics about the underlying directed graph.
Goal
pyflagser
with the option to generate the directed flag complex (viaflagser
)As the flag complex corresponding to a directed graph should not be muteable anyway (once generated), read-only access would be enough.
Current progress:
I volunteer to look into this matter, as I need it for my own project anyway.
Hit me up if you're interested in discussing details!
Versions
Python: 3.9, CPython interpreter
pyflagser: 0.4.3
The text was updated successfully, but these errors were encountered: