Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

Over on StackOverflow I asked a similar question for the n=3 case, but the answer given doesn't easily generalize.

How can I make a diagram such as this:

Finite Topological Spaces

But for a general n-element space instead?

share|improve this question
    
It is unclear how such diagrams would work for n>=4: you face a problem similar to that of drawing Venn diagrams. What solution do you have in mind to make clear diagrams? (One idea would be to limit the marked subsets to a basis for the topology rather than attempting to show every open set in it.) –  whuber Jan 17 '12 at 22:38
2  
Using just the basis is a good solution. It also occurred to me that this is a special case of visualizing HyperGraphs. –  Tobi Lehman Jan 17 '12 at 22:52
add comment

1 Answer

up vote 10 down vote accepted

I suspect this is a fundamentally difficult problem, because as you pointed out, it boils down to drawing hypergraphs which, it seems, Mathematica does not have built in support for.

It isn't hard though, to automatically generate some kind of visualization of topologies.

I used the elegant topologyQ function proposed by kguler over at the stackoverflow question you linked to:

topologyQ[x_List] := Intersection[x, #] === # &[
Union[{Union @@ x}, Intersection @@@ Rest@#, Union @@@ #] &@
Subsets@x]

And then a little bit of (substantially less elegant) code I wrote myself:

RandomTopoTable[n_] := 
Module[{Sets = 
 Reverse[Sort[
  RandomSample[#, RandomChoice[Range[Length[#]]]] &[
   Subsets[Range[n]]]]], 
GenerateRow = 
 Function[{set}, {#, Background -> If[MemberQ[set, #], Red, White],
     Frame -> True} & /@ Range[n]]}, 
{If[topologyQ[Sets] && MemberQ[Sets, Range[n]],
  Style["GOOD", Darker[Green]], Style["BAD", Red]], 
  Grid[({Range[n]}~Join~((Item @@@ # &) /@ (GenerateRow /@ Sets))), 
  Frame -> All, Background -> {Lighter[Gray], None}]}];

Table[Column[RandomTopoTable[3]], {20}]

And this is the output for n=3, but it works for other choices of n too:

output of my code

This is presenting a random sample of the subsets of the subsets of original set, e.g. a random selection of "potential topologies".

share|improve this answer
    
I like this, the visualization is reminiscent of a cellular automata. –  Tobi Lehman Jan 18 '12 at 17:12
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.