"Nicolas M. Thiery" <nicolas.thi...@u-psud.fr> writes: > The rationale for using 0,...,n-1 is that this makes the code > simpler and quite faster, in particular when the elements of the > poset are large objects with expensive hash function. That's a > standard approach in the Sage library (see e.g. Mike's patch to > have permutation groups with any domain, or Florent's > FiniteSetMaps).
I admit that I don't *quite* understand. If I have a Poset and ask for it's Hasse diagram, it should not make a difference in speed or readability whether a) Hasse diagram internally converts to 0..n-1 or b) Hasse diagram requires elements 0..n-1. (of course, the conversion should only be done once). > In principle, this is completely transparent to the user, and in > particular independent of the wrapping issue above. Martin: if you > have a counter example, please provide it so that we can fix it! OK, will do if I ever run across it, but it seems to me that either I have imagined it only or it was fixed recently. (looking at Mikes domain patch for PermGroup suggests the latter) > - One of the very basic question that a mathematician wants to ask to > a finite poset is its Hasse diagram, that is the digraph of its > cover relations (e.g. as Christian points out, to view it). This is > the purpose of the hasse_diagram() method, and has nothing to do > with the internal data structure above. This is why I argue for > keeping the following behaviour: > > sage: P = Poset([['a','b','c'], [['a','b'],['a','c']]]) > sage: G = P.hasse_diagram() > sage: G.edges() > [(a, c, None), (a, b, None)] > > but on the other hand to make G a plain DiGraph. Indeed we > currently have: > > sage: G > Hasse diagram of a poset containing 3 elements > > which is a broken object because HasseDiagram expects its vertices > to be 0,...,n-1: In general it seems to me that it is better to have more specialised parents (i.e., HasseDiagram) with easy conversion routines to the more general. But in the case at hand, I don't mind. Martin -- You received this message because you are subscribed to the Google Groups "sage-combinat-devel" group. To post to this group, send email to sage-combinat-devel@googlegroups.com. To unsubscribe from this group, send email to sage-combinat-devel+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/sage-combinat-devel?hl=en.