Opened 12 years ago

Closed 12 years ago

# Size of a poset's Hasse diagram

Reported by: Owned by: Rob Beezer Sage Combinat CC user minor sage-4.7.1 combinatorics Florent Hivert sage-4.7.1.alpha0 Rob Beezer Nicolas M. Thiéry N/A

Symptoms:

Mildly confusing. Though not harmful, it violates the intent of the isomorphism-checking code:

```sage: P = Posets.BooleanLattice(5)
sage: H = P.hasse_diagram()
sage: H.is_isomorphic(H)
/sage/sage-4.7.alpha3/local/lib/python2.6/site-packages/sage/graphs/generic_graph.py:15043:
DeprecationWarning: (Since Sage Version 4.4 (2010-05)) size is deprecated.
if self.size() != other.size():
True
```

Wrong, if the diagram is being considered as a digraph:

```sage: P = Posets.BooleanLattice(5)
sage: H = P.hasse_diagram()
sage: isinstance(H, DiGraph)
True
sage: H.num_edges()
80
sage: H.size()
/sage/sage-4.7.alpha3/local/bin/sage-ipython:1:
DeprecationWarning: (Since Sage Version 4.4 (2010-05)) size is deprecated.
#!/usr/bin/env python
32
```

Explanation:

Posets and Hasse diagrams formerly had a `size` method. In the case of a Hasse diagram, this was overriding the same-named method for digraphs, and the two had different meanings (size of base set for posets, number of edges for a digraph).

`size()` was deprecated for posets and Hasse diagrams (#8735), but a side-effect is the warning is raised for any graph-theory code called for a Hasse diagram which invokes `size()`(as above).

The deprecation was merged 12 months ago. By the time this might get reviewed and merged, it will most likely have been at least a year since the deprecation was released.

Patch removes the warning. It adds a test to the cardinality method of a Hasse diagram (should it go somewhere else?) to be sure that `size()` (finally) does the right thing for the underlying digraph.

Apply:

1. trac_11214-hasse-diagram-size.patch

### comment:1 Changed 12 years ago by Rob Beezer

Authors: → Rob Beezer Florent Hivert added modified (diff) new → needs_review

### comment:2 Changed 12 years ago by Nicolas M. Thiéry

Reviewers: → Nicolas M. Thiéry needs_review → positive_review

This looks all good to go (assuming the buildbot goes green)!

Note: this probably will commute with #10998 but we should double check that.

### comment:3 Changed 12 years ago by Jeroen Demeyer

Merged in: → sage-4.7.1.alpha0 → fixed positive_review → closed
Note: See TracTickets for help on using tickets.