def green_classes(self, side = "twosided"):
            r"""
            INPUT:

             - ``side`` -- "left", "right", or "twosided"

            Depending on the value of ``side``, returns respectively
            the `L`-classes, `R`-classes, or `J`-classes of ``self``,
            sorted decreasingly along a linear extension of
            respectively `L`, `R` or `J`-order.

            EXAMPLES::

                sage: M = Semigroups().Finite().example(('a','b')); M
                An example of a finite semigroup: the left regular band generated by ('a', 'b')
                sage: M.green_classes()
                [{'a'}, {'b'}, {'ab', 'ba'}]
                sage: M.green_classes(side="left")
                [{'a'}, {'b'}, {'ab', 'ba'}]
                sage: M.green_classes(side="right")
                [{'b'}, {'a'}, {'ab'}, {'ba'}]
            """
            G = self.cayley_graph_cached(side=side, simple=True).strongly_connected_components_digraph()
            from sage.combinat.posets.posets import Poset
            P = Poset(G, facade = True)
            return P.linear_extension()
示例#2
0
        def classes(self): # Or discrete composition_series?
            r"""
            Return the classes of ``self``

            The classes of ``self`` are the strongly connected components
            of its Cayley graph. For a group, those would be the orbits.

            EXAMPLES::

                sage: M = Semigroups().SetsWithAction().example(); M
                Representation of the monoid generated by <2,3> acting on Z/10 Z by multiplication
                sage: M.classes()
                [{1, 3, 9, 7}, {5}, {0}, {8, 2, 4, 6}]

            This for example means that, in `\ZZ/10\ZZ`, any element of
            ``\{1,3,9,7\}`` is reachable from any other by successive
            multiplications by `2` and `3`.

            .. seealso: :meth:`cayley_graph`, :meth:`class_of`
            """
            G = self.cayley_graph(simple=True).strongly_connected_components_digraph()
            from sage.combinat.posets.posets import Poset
            P = Poset(G, facade=True)
            return P.linear_extension()