Opened 6 years ago

Closed 6 years ago

Last modified 6 years ago

#14732 closed enhancement (fixed)

Realize a poset as a graph

Reported by: chrisjamesberg Owned by: sage-combinat
Priority: major Milestone: sage-5.11
Component: combinatorics Keywords: FindStatDays01
Cc: tscrim, VivianePons, stumpc5 Merged in: sage-5.11.beta2
Authors: Chris Berg Reviewers: Travis Scrimshaw, Christian Stump
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Description (last modified by chrisjamesberg)

This implements a method on posets which returns the graph obtained by forgetting the orientation of the Hasse diagram.

Attachments (2)

posets_to_graph.patch (1.6 KB) - added by chrisjamesberg 6 years ago.
trac_14732-review-ts.patch (960 bytes) - added by tscrim 6 years ago.

Download all attachments as: .zip

Change History (17)

comment:1 Changed 6 years ago by chrisjamesberg

  • Keywords FindStatDays 01 added
  • Status changed from new to needs_review

comment:2 Changed 6 years ago by chrisjamesberg

  • Keywords FindStatDays01 added; FindStatDays 01 removed

comment:3 Changed 6 years ago by tscrim

  • Reviewers set to Travis Scrimshaw
  • Status changed from needs_review to positive_review

Looks good. Thanks.

comment:4 Changed 6 years ago by nthiery

The description could be more specific. Maybe something like "The graph obtained by forgetting the orientation of the Hasse diagram"?

Is there a strong use case (e.g. for findstat) for this feature to make it deserve a method of its own? I mean Graph(P.hasse_diagram()) is pretty explicity and short.

comment:5 follow-up: Changed 6 years ago by VivianePons

Hi Nicolas,

actually there is a strong use case: in FindStat? we need the method to consider the map between posets and graphs. When people look for a stat on posets, this maps allows us to also look on graphs.

From a pure Sage point of vue, I think it is actually a nice shortcut: not everyone thinks of transforming the poset into a Hasse diagram.

comment:6 Changed 6 years ago by chrisjamesberg

  • Description modified (diff)

Changed 6 years ago by chrisjamesberg

comment:7 Changed 6 years ago by tscrim

  • Status changed from positive_review to needs_work

Need to make the returned graph hashable.

Changed 6 years ago by tscrim

comment:8 Changed 6 years ago by tscrim

  • Status changed from needs_work to needs_review

comment:9 Changed 6 years ago by stumpc5

  • Reviewers changed from Travis Scrimshaw to Travis Scrimshaw, Christian Stump
  • Status changed from needs_review to positive_review

The review patch looks good to me! (The patchbot complain doesn't seem to be related to the patch.)

comment:10 in reply to: ↑ 5 ; follow-up: Changed 6 years ago by nthiery

Grumble, my comment never made it through; stupid trac. Well, it's kind of late now, but since I had typed it in ....

Replying to VivianePons:

actually there is a strong use case: in FindStat? we need the method to consider the map between posets and graphs. When people look for a stat on posets, this maps allows us to also look on graphs.

From a pure Sage point of vue, I think it is actually a nice shortcut: not everyone thinks of transforming the poset into a Hasse diagram.

I would find more natural to have hasse_diagram be a combinatorial map from posets to directed graphs (possibly with an alias to_digraph, or just digraph for consistency with crystals). And to have another combinatorial map from directed graphs to graphs. The composition of the two maps is not super canonical.

Have fun at Findstat Days 1!

Last edited 6 years ago by nthiery (previous) (diff)

comment:11 in reply to: ↑ 10 Changed 6 years ago by nthiery

Last edited 6 years ago by nthiery (previous) (diff)

comment:12 Changed 6 years ago by jdemeyer

  • Merged in set to sage-5.11.beta2
  • Resolution set to fixed
  • Status changed from positive_review to closed

comment:13 Changed 6 years ago by ncohen

I would like to make here the same comment I made in #14734. This patch creates a function that replaces the sequence of characters Graph(P.hasse_diagram()). It totally convinces me that this has NOTHING to do in Sage, and that the only reason that it is added is because of a third-party project.

It totally convinces me that you should find a non-intruding way to build your website, saving us the addition of the empty functions you need for your personal use.

Nathann

Last edited 6 years ago by ncohen (previous) (diff)

comment:14 follow-up: Changed 6 years ago by VivianePons

Hi Nathan

thank's for being so friendly.

Just to say, of course we did it because it is useful for Findstat (you can name it, it's not forbidden). But I don't see how it affects anything in anyway for users and how it is bad in anyway for Sage. I actually think it it makes it better, because I for example would never think of doing Graph(P.hasse_diagram()) to transform the Poset into a Graph. The fact that you know it because you usually work with this object doesn't mean everyone knows this.

comment:15 in reply to: ↑ 14 Changed 6 years ago by ncohen

Yo !

Just to say, of course we did it because it is useful for Findstat (you can name it, it's not forbidden).

I thought I named it several time, and I did not want to avoid it. I just wanted to make clear that find_stat is a project which is totally distinct from Sage, and so we have no reason to change our software for it.

But I don't see how it affects anything in anyway for users and how it is bad in anyway for Sage. I actually think it it makes it better, because I for example would never think of doing Graph(P.hasse_diagram()) to transform the Poset into a Graph.

.... Oh. Well, if this is really the problem you want to solve perhaps you could have tried to make this work instead :

sage: P = posets.RandomPoset(5,.1)
sage: Graph(P)

Much more natural, don't you think ?

The fact that you know it because you usually work with this object doesn't mean everyone knows this.

That's not my point. "Make a Graph from a poset" means nothing in the first place, a poset is not a graph and several graphs would make sense. The Hasse Diagram istelf, or its undirected version, or the transitive closure, or the undirected version of it.

What I mean is that you really add a function there "because you want a function from Posets to Graphs, whatever it is".

Besides I just noticed that as I asked during the talk you gave, this combinatorial_map thing actually replaces each function it touches by a class. And so Sage computes stuff when a users runs code that are ONLY USEFUL for your f..... website.

That's bad work.

Nathann

Last edited 6 years ago by ncohen (previous) (diff)
Note: See TracTickets for help on using tickets.