First time here? Check out the FAQ!

Ask Your Question
1

Can't make subposets

asked 14 years ago

hoyland gravatar image

updated 10 years ago

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

Preview: (hide)

2 Answers

Sort by » oldest newest most voted
0

answered 13 years ago

sewowg gravatar image

updated 13 years ago

niles gravatar image

spam deleted

Preview: (hide)
link
0

answered 13 years ago

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.

Preview: (hide)
link

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: 14 years ago

Seen: 430 times

Last updated: Apr 13 '12