2

Let's say I have a rather large adjacency matrix for a partial order relation. Say an 80x80 matrix. What is the best way to display Hasse diagram? I have tried AdjacencyGraph and it does a not so bad job of displaying the graph, but it is definitely not a "good" Hasse diagram. Any help would be greatly appreciated!

EDIT

I was successfully able to draw the graph using

Needs["Combinatorica`"];
Hasse = ShowGraph[HasseDiagram[FromAdjacencyMatrix[hasseMatrix, Type -> Directed]]]

after using the information from the answer @Dr.belisarius gave.

jix816
  • 97
  • 6
  • Take a look at HasseDiagram[ ] on the Combinatorica package – Dr. belisarius Jan 21 '16 at 05:27
  • http://reference.wolfram.com/mathematica/Combinatorica/tutorial/Combinatorica.html – Dr. belisarius Jan 21 '16 at 05:29
  • I have tried to use HasseDiagram[], but for whatever reason it just spits HasseDiagram[insert.graph.here] as output. Perhaps I am not loading Combinatorica correctly? – jix816 Jan 21 '16 at 05:40
  • 1
    If you work on this, sooner or later you will come across the function TransitiveReductionGraph. I wanted to warn you now that that function is known to be buggy. Check the link to determine whether the bug would affect your results. – Szabolcs Jan 21 '16 at 08:56

1 Answers1

3

For example (Partial order here is vertex reachability)

SeedRandom@42;
<< Combinatorica`
g = System`RandomGraph[{9, 7}, VertexLabels -> "Name"];
g1 = System`Graph[VertexList@g, DirectedEdge @@@ EdgeList@g]; 
ShowGraph[ HasseDiagram[ MakeGraph[VertexList[g1], 
                        GraphDistance[g1, #1, #2] =!= Infinity &]], VertexNumber -> True]

Mathematica graphics

Dr. belisarius
  • 115,881
  • 13
  • 203
  • 453
  • 1
    Thank you! This is exactly what I want except I would like to feed in a matrix as the input. This is awesome, though! I wasn't able to get Mathematica to draw HasseDiagrams at all until this example. I was beginning to think it was some sort of installation malfunction, but, alas, it was user error. – jix816 Jan 21 '16 at 06:56
  • 2
    @jix816 Glad to hear that. May the force ... etc – Dr. belisarius Jan 21 '16 at 07:00