Finding independent sets with particular properties in in SageMath

Viewed 26

By using the IndependentSets module in SageMath, we can list all the independent sets of a graph. Suppose I have a bipartite graph on the Symmetric Group with partite sets consisting of even and odd permutations.

How do I enumerate and list out all those independent sets which consists of equal number of elements from even and odd permutations. What all methods and functions do I need to use. Is there some built in function for listing the type of a symmetric group element as even or odd.

My idea of pseudo-code idea would be:

G=BipartiteGraph()
I=IndependentSets(G)
for list in I:
   for i in list:
       if enumerate(type(list[i])=='even')==enumerate(type(list[i]=='odd'):
add list in list1

print(list1)

However, I encountered the error that list indices must be integers or slices and not permutation group elements. How do rectify this? Any hints?

0 Answers
Related