21 | | We propose to change `HasseDiagram._meet` (resp. `_join`) and `HasseDiagram.meet_matrix()` (resp. `join_matrix`), so that the `(x,y)`-entry of the matrix is `-1` if the meet of `x` and `y` doesn't exist, instead of raising an Error. Defer the checks to where it needs. |
22 | | Then, we make the method `FinitePoset.meet(x, y)` (resp. `join(x, y)`) by applying the `_element_to_vertex` and `_vertex_to_element` conversions on `poset._hasse_diagram._meet`, |
| 22 | We propose to change `HasseDiagram._meet` (resp. `_join`), so that the `(x,y)`-entry of the matrix is `-1` if the meet of `x` and `y` doesn't exist, instead of raising an Error. Defer the checks to `HasseDiagram.meet_matrix()` (resp. `join_matrix`). We expect to have |
| 26 | h._meet[0,1] |
| 27 | -1 |
| 28 | sage: h.meet_martrix() |
| 29 | Traceback (most recent call last) |
| 30 | ... |
| 31 | ValueError: not a meet-semilattice: no bottom element |
| 32 | }}} |
| 33 | |
| 34 | Then, we make the method `FinitePoset.meet(x, y)` (resp. `join(x, y)`) by applying the `_element_to_vertex` and `_vertex_to_element` conversions on `poset._hasse_diagram._meet`. |
| 35 | |
| 36 | This extends the `meet` method current defined on `FiniteMeetSemilattice.meet` to non-semilattice finite poset. |
| 37 | {{{ |
| 38 | sage: P = Poset({"a":["b", "c", "d"], "b":["e", "f"], "c":["f"], "d":["f", "g"]} |
| 39 | ....: ) |
| 40 | sage: M = MeetSemilattice(P) |
| 41 | sage: M.meet("f","g") |
| 42 | 'd' |
| 43 | sage: P2 = Poset({"b":["e", "f"], "c":["f"], "d":["f", "g"]}) |
| 44 | sage: M2 = MeetSemilattice(P) |
| 45 | Traceback (most recent call last) |
| 46 | ... |
| 47 | ValueError: not a meet-semilattice: no bottom element |
| 48 | }}} |
| 49 | We expect to have |
| 50 | {{{ |
| 51 | sage: P.meet("f","g") |
| 52 | 'd' |
| 53 | sage: P2.meet("f","g") |
| 54 | 'd' |