Ask Your Question
1

Can't make subposets

asked 2010-11-14 14:25:48 +0100

hoyland gravatar image

updated 2015-01-13 18:04:33 +0100

FrédéricC gravatar image

I'm running into a problem trying to construct a subposet.

sage: L #poset of permutations
Finite poset containing 14 elements
sage: L.random_subposet(.5)
Finite poset containing 10 elements
sage: SPG=ShortestPathGraph(L) #constructs a graph that is the Hasse diagram 
                               #of L with some edges deleted
sage: SPG
Digraph on 14 vertices
sage: S=Poset(SPG)
sage: S.random_subposet(.5)

results in an error message ending

AttributeError: 'Permutation_class' object has no attribute 'parent'

I get the same error when I try to construct a specific subposet (what I actually want to do), but I can't create duplicate the error in a small example. random_subposet() works just fine for a small poset created from a digraph whose vertices are permutations. Any ideas what could be going on? (I suspect whatever it is may have to be in ShortestPathGraph, given that I can't duplicate the error with a small digraph, but that doesn't really make sense, so I'd appreciate that sort of answer as well.)

edit retag flag offensive close merge delete

2 Answers

Sort by » oldest newest most voted
0

answered 2012-04-13 04:34:11 +0100

sewowg gravatar image

updated 2012-04-13 17:57:25 +0100

niles gravatar image

spam deleted

edit remove flag flag offensive (2) delete link more
0

answered 2012-04-13 18:04:35 +0100

niles gravatar image

You just need to add a parent() method to the appropriate object. Since I don't know how these objects are defined, I can't give you an example, but you should be able to work it out by searching the source code for where the parent() method is getting called, and adding such a method to the objects you're using. An easy way to do that would be to define a subclass, define the parent() method there, and then use instances of the subclass instead of the original class.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 2010-11-14 14:25:48 +0100

Seen: 387 times

Last updated: Apr 13 '12