Opened 11 years ago
Closed 9 years ago
#8148 closed defect (duplicate)
looking at the dual of a poset: IndexError
Reported by: | jhpalmieri | Owned by: | sage-combinat |
---|---|---|---|
Priority: | major | Milestone: | sage-duplicate/invalid/wontfix |
Component: | combinatorics | Keywords: | |
Cc: | sage-combinat, brunellus, mjo | Merged in: | |
Authors: | Reviewers: | Lukáš Lánský | |
Report Upstream: | N/A | Work issues: | |
Branch: | Commit: | ||
Dependencies: | Stopgaps: |
Description (last modified by )
In Sage 4.3.2.alpha0:
sage: Q = Poset({1: [], 3: [], 2: [1, 3]}) sage: Q.show() # works fine sage: Q.dual().show() ... IndexError: list index out of range
Note that the following works, and is what I'm using in my code right now:
sage: Poset(Q.hasse_diagram().reverse()).show()
Actually, though, this fails if Q is defined instead to be
sage: Q = Poset({1: [], 2: [1]}) sage: Q.show() # works fine, although the picture looks a little funny sage: Poset(Q.hasse_diagram().reverse()).show() ... RuntimeError: Error building image
See #10998 instead.
Attachments (2)
Change History (11)
comment:1 Changed 9 years ago by
- Cc brunellus added
comment:2 Changed 9 years ago by
Changed 9 years ago by
comment:3 Changed 9 years ago by
- Status changed from new to needs_review
I guess this fix should help -- dual() created new Poset using FinitePoset? constructor that requires a DiGraph? in its argument to be rather refined one. Especially that the range(n) should be a linear extension of poset defined by a DiGraph?. That wasn't true, because dual() reversed the orientation of edges. Poset constructor is much more liberal.
comment:4 Changed 9 years ago by
- Cc mjo added
This is probably the best fix at the moment (although it would be nice if FinitePoset?() could be used by itself).
For the patch, can you add the ticket number to the doctest somewhere?
I would also create a "TESTS:" section under examples, since this isn't really a useful example independent of the fact that it demonstrates this bug.
You can give the doctest a little introduction, too. For example,
TESTS: We should get a valid FinitePoset back if we call dual() on a finite poset (trac #8148):: sage: ...
It's the double-colon that says "here comes a doctest."
Changed 9 years ago by
comment:5 Changed 9 years ago by
Thanks! I tried to rewrite this to use FinitePoset? immediately. Does it make sense? I tried to run it to few examples, but maybe there is something I overlooked.
comment:6 Changed 9 years ago by
Hi!
Sorry, I should have been more reactive to spare you this patch. In principle, this is fixed by #10998 which is almost finished, and I hope to get in soon. Could you double check this?
Cheers,
Nicolas
comment:7 Changed 9 years ago by
- Milestone changed from sage-4.8 to sage-duplicate/invalid/wontfix
Hi, I guess such situations are inevitable in distributed projects. :-) Your patch really solves this issue.
comment:8 Changed 9 years ago by
- Status changed from needs_review to positive_review
(the procedure for closing tickets... positive review + milestone to wontfix)
comment:9 Changed 9 years ago by
- Description modified (diff)
- Resolution set to duplicate
- Reviewers set to Lukáš Lánský
- Status changed from positive_review to closed