Skip to content

Commit

Permalink
Trac #19215: Posets: Add is_series_parallel()
Browse files Browse the repository at this point in the history
Add a function to see if a poset is series-parallel (or "N-free").

First wait for #19659 to get closed. Series-parallel decomposition is
just recursive applying of `connected_components()` and
`ordinal_sum_decomposition()`.

URL: http://trac.sagemath.org/19215
Reported by: jmantysalo
Ticket author(s): Jori Mäntysalo
Reviewer(s): Frédéric Chapoton
  • Loading branch information
Release Manager authored and vbraun committed Apr 15, 2016
2 parents 3140f80 + b4b3254 commit 63d5fea
Showing 1 changed file with 33 additions and 1 deletion.
34 changes: 33 additions & 1 deletion src/sage/combinat/posets/posets.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@
:meth:`~FinitePoset.is_graded` | Return ``True`` if all maximal chains of the poset has same length.
:meth:`~FinitePoset.is_ranked` | Return ``True`` if the poset has a rank function.
:meth:`~FinitePoset.is_rank_symmetric` | Return ``True`` if the poset is rank symmetric.
:meth:`~FinitePoset.is_series_parallel` | Return ``True`` if the poset can be built by ordinal sums and disjoint unions.
:meth:`~FinitePoset.is_eulerian` | Return ``True`` if the poset is Eulerian.
:meth:`~FinitePoset.is_incomparable_chain_free` | Return ``True`` if the poset is (m+n)-free.
:meth:`~FinitePoset.is_slender` | Return ``True`` if the poset is slender.
Expand Down Expand Up @@ -2549,9 +2550,40 @@ def is_connected(self):
"""
return self._hasse_diagram.is_connected()

def is_series_parallel(self):
"""
Return ``True`` if the poset is series-parallel, and ``False``
otherwise.
A poset is *series-parallel* if it can be built up from one-element
posets using the operations of disjoint union and ordinal
sum. This is also called *N-free* property: every poset that is not
series-parallel contains a subposet isomorphic to the 4-element
N-shaped poset where `a > c, d` and `b > d`.
See :wikipedia:`Series-parallel partial order`.
EXAMPLES::
sage: VA = Poset({1: [2, 3], 4: [5], 6: [5]})
sage: VA.is_series_parallel()
True
sage: big_N = Poset({1: [2, 4], 2: [3], 4:[7], 5:[6], 6:[7]})
sage: big_N.is_series_parallel()
False
TESTS::
sage: Poset().is_series_parallel()
True
"""
# TODO: Add series-parallel decomposition later.
N = Poset({0: [2, 3], 1: [3]})
return not self.has_isomorphic_subposet(N)

def is_EL_labelling(self, f, return_raising_chains=False):
r"""
Returns ``True`` if ``f`` is an EL labelling of ``self``.
Return ``True`` if ``f`` is an EL labelling of ``self``.
A labelling `f` of the edges of the Hasse diagram of a poset
is called an EL labelling (edge lexicographic labelling) if
Expand Down

0 comments on commit 63d5fea

Please sign in to comment.