| Author |
Comment/Response |
Otto Murphy
|
03/30/09 7:29pm
Hi, I have the following code which will be used with TreePlot to create a diagram like this:
http://en.wikipedia.org/wiki/File:Poset6.jpg
poset[n_] :=
Module[{a, i, z, subsets, b, subsub, w},
a = List @@ Table[FromCharacterCode[96 + i], {i, n}];
b = {};
For[i = n, i > 0, i--,
subsets = Subsets[a, {i}];
For[z = 1, z <= Binomial[n, i], z++,
Print[
b = Join[
b, (subsets[[z]] -> #) & /@ Subsets[subsets[[z]], {i - 1}]]
];
]]
b
]
poset[2]
The output looks like this:
During evaluation of In[91]:= {{a,b}->{a},{a,b}->{b}}
During evaluation of In[91]:= {{a,b}->{a},{a,b}->{b},{a}->{}}
During evaluation of In[91]:= {{a,b}->{a},{a,b}->{b},{a}->{},{b}->{}}
Out[92]= {Null ({"a", "b"} -> {"a"}), Null ({"a", "b"} -> {"b"}),
Null ({"a"} -> {}), Null ({"b"} -> {})}
My question is: what is that Null doing there? Why is it there?
URL: , |
|