Ticket #11189: trac_11189-bugfix_in_poset-cs.patch

File trac_11189-bugfix_in_poset-cs.patch, 2.4 KB (added by stumpc5, 9 years ago)
  • sage/combinat/posets/lattices.py

    # HG changeset patch
    # Parent 17c03d15967fff6f370559442480b8bd17966f46
    
    diff --git a/sage/combinat/posets/lattices.py b/sage/combinat/posets/lattices.py
    a b class FiniteJoinSemilattice(FinitePoset) 
    226226
    227227####################################################################################
    228228
    229 def LatticePoset(data):
     229def LatticePoset(data=None, element_labels=None, cover_relations=False, facade = None):
    230230    r"""
    231231    Construct a lattice from various forms of input data.
    232232
    def LatticePoset(data): 
    268268    if isinstance(data,FiniteLatticePoset):
    269269        return data
    270270    else:
    271         P = Poset(data)
     271        P = Poset(data=data, element_labels=element_labels, cover_relations=cover_relations, facade = facade)
    272272        if P.is_lattice():
    273273            return FiniteLatticePoset(P, category = FiniteLatticePosets())
    274274        else:
  • sage/combinat/posets/posets.py

    diff --git a/sage/combinat/posets/posets.py b/sage/combinat/posets/posets.py
    a b class FinitePoset(UniqueRepresentation,  
    678678       
    679679        EXAMPLES::
    680680       
    681             sage: D = Poset({ 0:[1,2], 1:[3], 2:[3,4] })
     681            sage: D = Poset({ 1:[2,3], 2:[4], 3:[4,5] })
    682682            sage: D.plot(label_elements=False)
    683683            sage: D.plot()
    684684            sage: type(D.plot())
    685685            <class 'sage.plot.plot.Graphics'>
    686             sage: elm_labs = {0:'a', 1:'b', 2:'c', 3:'d', 4:'e'}
     686            sage: elm_labs = {1:'a', 2:'b', 3:'c', 4:'d', 5:'e'}
    687687            sage: D.plot(element_labels=elm_labs)
    688688 
    689689        ::
    class FinitePoset(UniqueRepresentation,  
    696696            sage: P = Poset(DiGraph('E@ACA@?'))
    697697            sage: P.plot()
    698698        """
    699         if label_elements and element_labels is None:
    700             element_labels = self._elements
     699        if label_elements:
     700            if element_labels is None:
     701                element_labels = dict( [ (i,self._elements[i]) for i in range(len(self._elements)) ] )
     702            else:
     703                element_labels = dict( [ (i,element_labels[self._elements[i]]) for i in range(len(self._elements)) ] )
     704           
    701705        return self._hasse_diagram.plot(label_elements=label_elements,
    702706                            element_labels=element_labels,
    703707                            label_font_size=label_font_size,