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
Vertex separation and pathwidth in Sage #11994
Comments
comment:1
Yet another well-documented patch for Sage's library. I put the files in the graph_decompositions folder, which is also the one used by rank-decompositions in patch #11754 Now needs a review ! Nathann |
comment:2
Gee, that looks like some pretty nice bit-counting code. Any chance you could just enhance bitset.pxi and then use the bitset functions, like bitset_len()? |
comment:3
(there is lots of other code using the bitset structures, so enhancing the bitset code to be better would be a nice plus here). |
comment:4
Hello Jason ! Well, there is actually not much bit-counting going on. :-) I have to count bits very often in integers, hence the corresponding function in the code, but most of the code is really graph theoretical. I would have been glad to use bitsets (and I often do these days in Sage patches), but the code was just faster when I stored a small integer for each object, and not just a bit. So I'm using char * instead of bitsets :-) Thouh I'm a very, very good fan of bitsets in general. I just love this thing :-) Nathann |
comment:5
I assure you, I use this code a LOT myself but I really don't think there's anything in my code that could be of use in bitsets. I can actually prove it ! But I swear there are other examples as well as a wealth of personnal code using it ! I won't be proved unthankful to bitsets. NEVER Nathann |
comment:6
Just a few more comments about the Cython: "for 1<= i< n" is a backwards-compatible syntax, but I would think that the recommended syntax these days is "for i in range(n)" (see http://docs.cython.org/src/userguide/language_basics.html#integer-for-loops) I see that you import the bitset functions, but I guess you never use them in fast_digraph.pyx. The popcount function was what I was referring to when I said that it would be useful in the bitset.pxi class. P.S. I would love to have in-line commenting on patches, like on googlecode, github, or bitbucket! |
comment:7
Oh ! I'll try to remember the "i in range()" thing, it just scares me to use Python abstractions when I am in Cython, but if I can remember that it is totally equivalent for Cython.. Oops, sorry about the bitsets... Yes, in earlier versions I tried to use them but I found a workaround which improved the performances when using a different data structure... I feel guilty when I don't use bitsets in an enumerative code The important thing about the bitset function is the following : the best is to use the __builtin_popcount() function from GCC when the processor has the popcnt instruction (it is really faster), and this can be enabled by adding
at the beginning of the code. On the other hand, when the processor does not know this instruction the code crashes ("invalid instruction"). It'd be great to "use this instruction when available", and this other short code otherwise. This would really be GREAT Nathann |
comment:8
What about the popcount code in this first answer: http://stackoverflow.com/questions/1925964/profiling-a-set-implementation-on-64-bit-machines |
comment:9
Well.. So he's saying "use the builtin and trust GCC to recognize the platform". Only it does not in my situation and I need to say something to GCC about my platfom so that it compiles it with this instruction enabled. We have to find a way to provide this information when Sage gets compiled, or to let it guess if it can be used. Now the thing is that if you compile Sage'binaries on a platform that has it, and somebody else uses it....BOOM ! `:-D I'd be glad to continue this discussion somewhere else, though. This patch will be long to review, and counting bits should not be the main problem there Nathann |
comment:10
Good point, and good call on the discussion. At the very least, I guess the includes of bitset.* should be removed at some point... |
comment:11
That's for sure : updated Nathann |
Reviewer: David Coudert |
comment:12
Very nice patch Nathann ! I have some comments / improvements propositions that could be discussed
and I see
min -> \min
should translate in english ;-)
|
comment:13
Hello !!!
Patch updated ! Nathann |
comment:14
That's better ;-) However, I have now a problem to build the documentation...
|
comment:15
Right ! Fixed Nathann |
comment:16
Sorry Nathann, but I still have the same problem :(
and so I don't see the documentation. |
comment:17
Hmmm... I don't like those bugs much, sphinx has some memory of its own, even when you're dealing with several different clones (branches) in the same copy of Sage. I'll give it a try on musclotte right now, it never saw any of these patches. Nathann |
comment:18
Well, it works on musclotte ! I guess it's because you had already applied a patch for which it failed, and that updating it did not change anything. Could you try to build the doc of a different branch (did you recompile sage with sage -b before trying to build the doc ?) or in a different Sage installation ? For instance if you have one ready on one different computer ? I know it's a mess but I still do not know a way around it. It would be nice to be able to say to sphinx "ignore the documentation you've built so far, and do all the work from the start". I had found a line doing just that a long time ago, but I forgot Nathann |
comment:19
I followed precisely your instructions: create a new branch from a clean branch (original 4.7.2 distribution), then apply the patch on this new branch, test it, and build the doc, (try to) chack it, and finally return to original branch before erasing temporary branch. Believe me, on my macbook air, it takes quit a long time since it recompiles a lot of stuff each time (don't know why). I will try as soon as I can on another computer. By the way, another typo line 223 "reulting" -> "resulting" ;-)
|
comment:20
Updated ! Now that I think about it, perhaps one trick would be to rm -fr the folder SAGE_ROOT/devel/sage-/doc/output/html/en/reference, in the hope that Sphinx does it all again. But this will take some time, and you will not be able to use Sage in the meantime Nathann |
Attachment: trac_11994.patch.gz |
comment:21
OK, after a full re-installation of sage, creation of clones, and so on... I have finally understand why the doc was not properly displayed:
But the last line should be
The link to the doc should be in the devel/sage-1 directory and note in devel/sage directory. At least now I know... The function is working well, the results is true, all tests are OK, and the doc is correctly displayed. Consequently, I give a positive review ! |
comment:22
You have my thanks for the review but the mystery remains : the "sage" directory you mention is actually a symbolic link toward the "current branch". So that's probably not where the problem comes from Nathann |
Merged: sage-4.8.alpha2 |
Hello everybody !
This algorithm implements some methods to compute the vertex separation of a digraph and the pathwidth of a digraph for small graphs (less than 32 vertices)
It should be followed by many others dealing with process number an alternative methods to compute the same parameters
CC: @dcoudert
Component: graph theory
Author: Nathann Cohen
Reviewer: David Coudert
Merged: sage-4.8.alpha2
Issue created by migration from https://trac.sagemath.org/ticket/11994
The text was updated successfully, but these errors were encountered: