Message Boards Message Boards

GROUPS:

Plot a semi-lattice so that it has symmetry?

Posted 3 months ago
332 Views
|
12 Replies
|
5 Total Likes
|

Attached is what I sent Wolfram support ...

Attachments:
12 Replies

The Mathematica StackExchange has a lot of useful information:

In particular, look at the answer by @kglr and use Graph with the appropriate GraphLayout unless you know for certain that you need the obsoleted TreePlot / GraphPlot (a very rare situation).

Very helpful! Thank you. That said, I find the solutions surprisingly complex. Graph layout is a tough problem, but I'm wrestling with how to make the most basic case as simple as I can. Again, as you observe, the StackExchange stuff has a wealth of information.

For completeness's sake, let me repeat @kglr's idea here:

For this specific graph, we can use MultipartiteEmbedding. Observing that the size of the "graph layers" (also obtainable by First@GraphDistanceMatrix[g]) as successive integers up to 6,

Graph[rules,
 GraphLayout -> {"MultipartiteEmbedding", "VertexPartition" -> Range[6]}
]

Mathematica graphics

Rotating the layout is most easily performed with my IGraph/M package (which, in my admittedly very biased opinion, is an absolute must for working with graphs in Mathematica ;-).

Graph[rules,
  GraphLayout -> {"MultipartiteEmbedding", "VertexPartition" -> Range[6]}
  ] // IGVertexMap[RotationTransform[-Pi/2], VertexCoordinates]

Mathematica graphics

You may want an extra scaling transform:

Graph[rules,
  GraphLayout -> {"MultipartiteEmbedding", "VertexPartition" -> Range[6]}
  ] // IGVertexMap[RotationTransform[-Pi/2] /* ScalingTransform[{1, 1/2}], VertexCoordinates]

Mathematica graphics


P.S. I took the rules from your notebook:

rules = {{0, 0} -> {1, 0}, {0, 0} -> {0, 1},
  {1, 0} -> {2, 0}, {1, 0} -> {1, 1}, {0, 1} -> {1, 1}, {0, 1} -> {0, 
    2},
  {2, 0} -> {3, 0}, {2, 0} -> {2, 1}, {1, 1} -> {2, 1}, {1, 1} -> {1, 
    2}, {0, 2} -> {1, 2}, {0, 2} -> {0, 3},
  {3, 0} -> {4, 0}, {3, 0} -> {3, 1}, {2, 1} -> {3, 1}, {2, 1} -> {2, 
    2}, {1, 2} -> {2, 2}, {1, 2} -> {1, 3}, {0, 3} -> {1, 3}, {0, 
    3} -> {0, 4},
  {4, 0} -> {5, 0}, {4, 0} -> {4, 1}, {3, 1} -> {4, 1}, {3, 1} -> {3, 
    2}, {2, 2} -> {3, 2}, {2, 2} -> {2, 3}, {1, 3} -> {2, 3}, {1, 
    3} -> {1, 4}, {0, 4} -> {1, 4}, {0, 4} -> {0, 5}}

P.P.S. The reason why GraphLayout -> "LayeredEmbedding" doesn't work well could be that it effectively lays out a spanning tree. This is just a guess. Take a look at FindSpanningTree[rules].

I agree, this is same hypothesis I came up with.

It's solving a different problem, and important problem, but a different one.

--Mark

I am unable to install IGraphM ... I assume this is an error on my part. Please help. Thank you. Here's what happens ...

In[87]:= Needs["PacletManager`"]

In[88]:= PacletInstall["~/Downloads/IGraphM-0.3.99.1.paclet"]

During evaluation of In[88]:= PacletInstall::fnotfound: Paclet file /Users/marktuttle/Downloads/IGraphM-0.3.99.1.paclet not found.

Out[88]= $Failed

In[89]:= PacletInstall["IGraphM", "Site" -> "http://raw.githubusercontent.com/paclets/PacletServer/master"]

During evaluation of In[89]:= PacletInstall::notavail: No paclet named IGraphM is available for download from any currently enabled paclet sites.

Out[89]= $Failed

Thanks for letting me know about the problems.

In[88]:= PacletInstall["~/Downloads/IGraphM-0.3.99.1.paclet"]

During evaluation of In[88]:= PacletInstall::fnotfound: Paclet file /Users/marktuttle/Downloads/IGraphM-0.3.99.1.paclet not found.

I believe this could only happen if you provided an incorrect file path. You could type PlacetInstall[], position the cursor within the [], then use Insert -> File Path... (not Insert -> File...) from the menu to insert the correct path to the downloaded file.

In[89]:= PacletInstall["IGraphM", "Site" -> "http://raw.githubusercontent.com/paclets/PacletServer/master"]

During evaluation of In[89]:= PacletInstall::notavail: No paclet named IGraphM is available for download from any currently enabled paclet sites.

This second problem is not due to you doing something incorrectly. Something is wrong with the paclet server that was being used. I reverted to the old installation instructions, which should work, and should be the simplest way to install:

Please let me know if it worked.

I was able to download the file from Github, if that helps.

Download+Install seems to work - thank you!

But Graph function still not defined - see attached. Thank you.

This still may be a user error on my part, obviously.

Attachments:

The paclet server should be fixed now.

The Graph symbol is built-in, and it is very strange that it does not work. I cannot reproduce the problem. Try restarting the kernel (i.e. Quit[]). Perhaps you loaded some packages that may conflict with Graph, such as Combinatorica?

Re-starting does nothing helpful.

But, you're correct; apparently loading the Combinatorica package interferes with the built-in Graph function. This is very naughty - that this happens - but I'm very impressed that you know about this problem.

Now, instead of loading the hole package, trying to just use a function from Combinatorica did not do what I hoped, e.g., (I struggle with the evaluation rules of Mathematica) ...

In[51]:= (counts1X2sList = Map[Combinatorica`Compositions[#, 2] &, Range[0, 5]])

Out[51]= {CombinatoricaCompositions[0, 2], CombinatoricaCompositions[1, 2], CombinatoricaCompositions[2, 2], CombinatoricaCompositions[3, 2], CombinatoricaCompositions[4, 2], CombinatoricaCompositions[5, 2]}

The usage System`Graph fixed it.

Now I can load Combinatorica (the only way I seem to be able to get the Compositions function), and then using the System version of Graph your version works great!

Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract