#13223: Implement Poset.is_graded using a polynomial time (linear?) algorithm.
-------------------------------------+-------------------------------------
Reporter: nthiery | Owner: sage-combinat
Type: enhancement | Status: needs_work
Priority: minor | Milestone: sage-6.4
Component: combinatorics | Resolution:
Keywords: sd40 | Merged in:
Authors: Jori Mäntysalo | Reviewers:
Report Upstream: N/A | Work issues:
Branch: | Commit:
u/jmantysalo/implement_poset_is_graded_using_a_polynomial_time__linear___algorithm_|
a9896c7e9f9e8e6c6f52a25a3370c2d595e2fecf
Dependencies: #13222 | Stopgaps:
-------------------------------------+-------------------------------------
Comment (by ncohen):
Hello !
Just looked at the code again, but I do not see what possible improvement
you expect. Algorithmically, things are done correctly. Now, if you really
need to save some time on this function you can change a couple of lines
to avoid creating lists unnecessarily, turn the Python list into a C
arrays, things like that. But I think that the Poset code still needs
other improvements before this kind of things begin to be the critical
costs.
About definitions, though: what is implemented is not equivalent to
`return all(rf(i) == rank for i in maxes)`, for you need to do the same
with mins. This `Poset` is not graded according to the definition
involving "all maximal chains":
{{{Poset(DiGraph({1:[2],3:[2],4:[3]})).show()}}}
It would be interesting to compare the speed of `rank_dict` and
`is_graded` though, as their code is very similar.
Nathann
--
Ticket URL: <http://trac.sagemath.org/ticket/13223#comment:17>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica,
and MATLAB
--
You received this message because you are subscribed to the Google Groups
"sage-trac" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-trac.
For more options, visit https://groups.google.com/d/optout.