sagemath / sage

Main repository of SageMath
https://www.sagemath.org
Other
1.45k stars 481 forks source link

Some examples to plot() for posets. #18545

Closed f29946bc-ee7b-48cd-9abc-3445948c551d closed 7 years ago

f29946bc-ee7b-48cd-9abc-3445948c551d commented 9 years ago

Even after #11284 there are "hidden" useful features on drawing poset. Also one can not use element_shape instead of vertex_shape etc.

CC: @paulmasson @fchapoton @tscrim

Component: combinatorics

Author: Jori Mäntysalo

Branch/Commit: 546226b

Reviewer: Kevin Dilks, Frédéric Chapoton, Travis Scrimshaw

Issue created by migration from https://trac.sagemath.org/ticket/18545

f29946bc-ee7b-48cd-9abc-3445948c551d commented 9 years ago

Branch: u/jmantysalo/some_examples_to_plot___forposets

7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 9 years ago

Branch pushed to git repo; I updated commit sha1. New commits:

e377fdaExamples and little modification to plot() of posets.
7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 9 years ago

Commit: e377fda

f29946bc-ee7b-48cd-9abc-3445948c551d commented 9 years ago
comment:3

Frédéric: This is my suggestion to plot() of posets. Examples are kind of artificial, but I am sure that there is no good real-life example using every one of possible options.

I also added some keywords, so that now you can say for example element_shape instead of vertex_shape. There is still some unorthogonal things, but they should be done on graph side. I would except to have vertex_shapes={'s': [1, 2]} when we have vertex_color={'red': [1, 2]} and so on.

I hope that users can now better see what is available. I think that at least coloring of some elements can be a good thing. Think for example showing elements of Frattini sublattice in red.

f29946bc-ee7b-48cd-9abc-3445948c551d commented 9 years ago

Author: Jori Mäntysalo

7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 9 years ago

Changed commit from e377fda to b279046

7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 9 years ago

Branch pushed to git repo; I updated commit sha1. New commits:

b279046Added cover_style.
f29946bc-ee7b-48cd-9abc-3445948c551d commented 9 years ago
comment:5

Back to needs_work because of #13827 and #18936.

7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 7 years ago

Changed commit from b279046 to 57e36aa

7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 7 years ago

Branch pushed to git repo; I updated commit sha1. This was a forced push. New commits:

57e36aaModify plot() of posets.
f29946bc-ee7b-48cd-9abc-3445948c551d commented 7 years ago

Description changed:

--- 
+++ 
@@ -1,10 +1 @@
-Even after #11284 there are "hidden" useful features on drawing poset. We should add something like coloring elements by their value or for example their rank on poset. Simple example is enought to show that there is more to look for.
-
-And more important, something like
-
-```
-P=Poset({1:[2]})
-P.show(element_labels={1:2, 2:1}, vertex_colors={"red": P.maximal_elements()})
-```
-
-needs a warning.
+Even after #11284 there are "hidden" useful features on drawing poset. Also one can not use `element_shape` instead of `vertex_shape` etc.
f29946bc-ee7b-48cd-9abc-3445948c551d commented 7 years ago
comment:7

This is a rewrite with simpler code, I hope. Also examples are new.

The example is kind of artificial, but I guess there is no real-world example that would show most of the options. Anyways, one could see that double irreducibles are not in the Frattini sublattice and that the Frattini sublattice need not be a connected inside the lattice. So this is almost reasonable example.

7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 7 years ago

Changed commit from 57e36aa to 0b35f58

7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 7 years ago

Branch pushed to git repo; I updated commit sha1. New commits:

0b35f58Forgot figsize-option.
1adc0eef-8957-46d9-975b-2dd71dfbd9ba commented 7 years ago
comment:9

I've been meaning to add something to the documentation for poset display options, so I'm glad to see this ticket already exists.

Is it really worth creating aliases in the code for slightly modified terminology? Especially since in all the literature I've seen where one wants to assign labels to the covering relations in a poset, they are called 'edge labelings'. It would also have implications for ticket 19396 (if I ever get around to it), which is about adding edge labels as an optional part of the poset data structure.

I was thinking about just having text that says "The poset plot method passes to the plot method for digraphs (link to Digraph display options), where poset elements are vertices, and covering relations are edges.", and then having a few key examples.

The two key examples that I think definitely need to be in here are for displaying order ideals of a poset (done with P.plot(vertex_colors={'blue':order_ideal}), and showing how to use vertex_labels to display linear extensions on the Hasse diagram.

f29946bc-ee7b-48cd-9abc-3445948c551d commented 7 years ago
comment:10

Replying to @kevindilks:

Is it really worth creating aliases in the code for slightly modified terminology?

I was thinking about #20691 and mirrored this change. This ticket still makes it possible to use vertex_color etc, new names are just aliases. (Or overriding aliases to be strict.)

Especially since in all the literature I've seen where one wants to assign labels to the covering relations in a poset, they are called 'edge labelings'.

Good point. OTOH we already have cover_relations() etc. Hmm...

The two key examples that I think definitely need to be in here are for displaying order ideals of a poset (done with P.plot(vertex_colors={'blue':order_ideal}), and showing how to use vertex_labels to display linear extensions on the Hasse diagram.

What about edge_colors (or cover_colors), what kind of example to do for those? Also an example with more than one additional color would be nice.

(Side question: Are you interested in congruence-related tickets like #22306?)

f29946bc-ee7b-48cd-9abc-3445948c551d commented 7 years ago
comment:11

I got no comments from the devel-list. Let's try to CC Frédéric.

The more I think this, more I come to conclusion that this aliasing is good and natural thing. We already have, say, order on graphs and cardinality for posets. Or 'water vapor' translates to Finnish 'löyly' in sauna and 'höyry' otherwise. That is how language works.

f29946bc-ee7b-48cd-9abc-3445948c551d commented 7 years ago
comment:12

Ping.

fchapoton commented 7 years ago
comment:13

I lost my previous (longer) comment, here is a summary

7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 7 years ago

Branch pushed to git repo; I updated commit sha1. This was a forced push. New commits:

d222342Modify plot() of posets.
24b36a1Forgot figsize-option.
7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 7 years ago

Changed commit from 0b35f58 to 24b36a1

7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 7 years ago

Branch pushed to git repo; I updated commit sha1. New commits:

5c59619Reviewer notes.
7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 7 years ago

Changed commit from 24b36a1 to 5c59619

f29946bc-ee7b-48cd-9abc-3445948c551d commented 7 years ago
comment:16

Like this?

fchapoton commented 7 years ago
comment:17

In my opinion, you should keep somewhere the note explaining that the options of graphs are also available.

You should also keep the explanations about "layout", which is an input and must therefore be documented.

7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 7 years ago

Changed commit from 5c59619 to b71a6f5

7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 7 years ago

Branch pushed to git repo; I updated commit sha1. New commits:

b71a6f5Undo removing a note-block.
f29946bc-ee7b-48cd-9abc-3445948c551d commented 7 years ago
comment:19

Replying to @fchapoton:

In my opinion, you should keep somewhere the note explaining that the options of graphs are also available.

OK, added that.

You should also keep the explanations about "layout", which is an input and must therefore be documented.

So is heights, but 1) Posets.PentagonPoset().show(heights={0:[0], 1:[2], 2:[1], 3:[3], 4:[4]}) does not really work as you would guess, and Posets.PentagonPoset().show(layout='circular')... well, it works but whoever wants that? IMO it is meaningfull only when the user thinks poset as a Hasse diagram, and then he/she can use .hasse_diagram() first.

fchapoton commented 7 years ago
comment:20

could you please take the opportunity to correct the typo

Plot of the empy poset::

that you introduced in a previous ticket ?

7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 7 years ago

Changed commit from b71a6f5 to 546226b

7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 7 years ago

Branch pushed to git repo; I updated commit sha1. New commits:

546226bA typo.
f29946bc-ee7b-48cd-9abc-3445948c551d commented 7 years ago
comment:22

Typo corrected.

f29946bc-ee7b-48cd-9abc-3445948c551d commented 7 years ago
comment:23

More comments on this?

f29946bc-ee7b-48cd-9abc-3445948c551d commented 7 years ago
comment:24

Just pinging...

tscrim commented 7 years ago

Reviewer: Kevin Dilks, Frédéric Chapoton, Travis Scrimshaw

tscrim commented 7 years ago
comment:25

Let it be so.

f29946bc-ee7b-48cd-9abc-3445948c551d commented 7 years ago
comment:26

Thanks Travis!

...next one should be the poset constructor, I think...

vbraun commented 7 years ago

Changed branch from u/jmantysalo/some_examples_to_plot___forposets to 546226b