Opened 12 years ago

Closed 12 years ago

#11214 closed defect (fixed)

Size of a poset's Hasse diagram

Reported by: Rob Beezer Owned by: Sage Combinat CC user
Priority: minor Milestone: sage-4.7.1
Component: combinatorics Keywords:
Cc: Florent Hivert Merged in: sage-4.7.1.alpha0
Authors: Rob Beezer Reviewers: Nicolas M. Thiéry
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Status badges

Description (last modified by Rob Beezer)

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. 
Please use cardinality instead.
  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. 
Please use cardinality instead.
  #!/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

Attachments (1)

trac_11214-hasse-diagram-size.patch (1.7 KB) - added by Rob Beezer 12 years ago.

Download all attachments as: .zip

Change History (4)

Changed 12 years ago by Rob Beezer

comment:1 Changed 12 years ago by Rob Beezer

Authors: Rob Beezer
Cc: Florent Hivert added
Description: modified (diff)
Status: newneeds_review

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

Reviewers: Nicolas M. Thiéry
Status: needs_reviewpositive_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
Resolution: fixed
Status: positive_reviewclosed
Note: See TracTickets for help on using tickets.