### Constructing a dictionary where the values are lists

I want to construct a dictionary where the keys are the subsets of the vertex set **$V$** of a randomly generated graph and the values are the maximal indipendent sets (denoted **MI** in the code) for which the function:

~~$$w(A,B)=\sum\limits_{i\in ~~$$\omega (A,B)=\sum\limits_{i\in A\triangle B}2^i \quad \text{where} \quad A\triangle B=(A\setminus B) \cup (B\setminus A) $$

is minimized, for $A\subset V$ and $B\subset MI$. I am having difficulties on encoding the information in a dictionary. I have spent quite some time and I can not figure out how to do it. Here is the code:

```
sage: from sage.graphs.independent_sets import IndependentSets
sage: def generate(n):
... n_0=randint(1,n)
... G=graphs.RandomGNP(n_0,0.4)
... V=set(G.vertices())
... MI=list(IndependentSets(G, maximal = True))
... d={}
...
... for
```~~i ~~A in Subsets(V):
... ~~alpha_i=[]
... print(i)
... ~~omega_A=[] #omega_A will contain the values ω(A,B) for ~~j ~~B⊂MI
... print(A)
... for B in MI:
... ~~delta_ij=set(i).symmetric_difference(set(j))
... print(delta_ij)
...
... alpha_ij=0
~~delta_AB=set(A).symmetric_difference(set(B))
... print(delta_AB)
...
... omega_AB=0 #we initialize ω(A,B) for a pair (A,B)
... for k in ~~delta_ij:
... alpha_ij=alpha_ij+2^k
... print(alpha_ij)
... alpha_i.append(alpha_ij)
... print(alpha_i)
...
... ll=MI[alpha_i.index(min(alpha_i))]
... d.update(tupple(i):ll)
~~delta_AB:
... omega_AB=omega_AB+2^k #calculate the function ω
... print(omega_AB)
... omega_A.append(omega_AB) #add the found value to omega_A
... print(omega_A)
...
... ll=MI[omega_A.index(min(omega_A))] #find the max. ind. set which minimizes ω(A,B
... d.update(tuple(A):ll) #add the found element to the dictionary d
... print('*******')
...
... print("dictionary",d)

When I compile it I get

```
Traceback (most recent call last):
...
SyntaxError: invalid syntax
```

Basically it wont let me use `MI[alpha_i.index(min(alpha_i))]`

as a value. In other cases I tried to use lists as values and it seemed to work.