On Fri, 22 Aug 2014, Nathann Cohen wrote:
Does Sage has a function to check if poset A contains a subposet
isomorphic to subposet B?
Not... exactly. There is no Poset method that does that, but there is a
DiGraph method that does that. But then, it depends on what you call a
subposet of a poset.
Case 1: You say that a poset B is a subposet of a poset A if there is a set
of points in A that induce a poset isomorphic to B. In this case, you want
to ensure that the transitive closure of A contains the transitive closure
of B and your problem is solved by
I mean this one.
A.hasse_diagram().transitive_closure().subgraph_search(B.hasse_diagram().tr
ansitive_closure())
Seems to work, thanks.
If you need this feature, however (and as you wrote to sage-devel, not
to sage-support :-P) it would be cool if you could write a ticket to
implement all this at poset-level. It would just call the digraph
routines, but it needs to be documented and interfaced properly.
OK. First question is name of the function. I would say A.has_subposet(),
but should it be A.has_isomorphic_subposet() or even B.is_subposet()?
Next, short description. There are three different style used for
True/False -functions:
- Returns True if the poset has a unique minimal element.
- Returns True if the poset is totally ordered, and False otherwise.
- Returns whether f is an EL labelling of self
(Last one also misses a dot.) Is there some style manual?
And after that I should see logic behind posets.py vs. hasse_diagram.py at
.../combinat/posets/. Source for last one says "This should not be called
directly, use Poset instead; all type checking happens there." However, I
think that there is nothing to check for?
Maybe I'll start with ".is_lattice()"; now there are
is_meet_semilattice() and is_join_semilattice() but not ready function
to check for poset being lattice. (And there is, besides is_top() and
is_bottom(), also is_bounded().)
--
Jori Mäntysalo
--
You received this message because you are subscribed to the Google Groups
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.