On Thu, 28 Aug 2014, Nathann Cohen wrote:

Yes, you do need this induced=True otherwise the chain contains all
other (smaller) posets :-P

But

def has_isomorphic_subposet(A, B):
    for x in Subsets(A.list(), k=B.cardinality()):
        if A.subposet(x).is_isomorphic(B):
            return True
    return False

def has_isomorphic_subposet2(A, B):
    if A.hasse_diagram().subgraph_search(B.hasse_diagram(),induced=True) is 
None:
        return False
    return True

Diamond=Poset( ([1,2,3,4], [[1,2],[1,3],[2,4],[3,4]]) )
N5=Poset( ([1,2,3,4,5], [[1,2],[1,3],[3,4],[2,5],[4,5]]) )
print has_isomorphic_subposet(N5, Diamond)
print has_isomorphic_subposet2(N5, Diamond)

outputs

True
False

And it should be much faster than the listing from your trac ticket
(which you can close if your problem is solved, or recycle into a
ticket to implement the feature)

If there is an easy solution for this, I can make a function to finite posets class. Hence I'm not going to close ticket yet.

--
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.

Reply via email to