# Mirror image of graph

I need to display a directed acyclic graph (say Hasse diagram of partial order) oriented with minimal elements at the bottom, maximal elements at the top as is conventional for Hasse diagrams.

I tried it for:

graph1 = Graph[{b \[DirectedEdge] a, c \[DirectedEdge] a, d -> b,
e -> b}, EdgeStyle -> Arrowheads[.04],
VertexLabels -> Placed["Name", Center], VertexSize -> 0.2,
VertexStyle -> White, VertexLabelStyle -> Directive[Red, 15],
EdgeStyle -> Blue, VertexShapeFunction -> "Square"]


Using:

graph2 = ReverseGraph[graph1,VertexCoordinates -> GraphEmbedding[graph1]]


However, this merely reverses the arrows. I need to take the mirror image of the graph (with respect to a horizontal line drawn above the graph) so that minimal elements end up at the bottom, maximal at the top.

So a ^ shaped Hasse diagram, should end up as a v shaped diagram. However nodes need to stay in the correct order: the vertices that were the minimal elements in ^ (the two bottom elements with arrows drawn down from the top element, i.e. minimum) should end up as minimal elements in the result (with arrows drawn up from the bottom element, i.e. minimum).

Is there an operation that achieves it?

I tried HasseDiagram.

HasseDiagram[graph1,
VertexLabels -> Placed["Name", Center], VertexSize -> 0.2,
VertexStyle -> White, VertexLabelStyle -> Directive[Red, 15],
EdgeStyle -> Blue, VertexShapeFunction -> "Square"]


It did not produce the right output, but also the output indicated an "upside-down" hasse diagram. Again, it would need to be displayed with maximal elements at the top, minimum at the bottom.

graph2 = SetProperty[graph1,
VertexCoordinates ->  ReflectionTransform[{0, -1}] @ GraphEmbedding[graph1]] Show[graph1, graph2, Axes -> {True, False}, Ticks -> False] Alternatively, you can use the built-in graph layout "LayeredDigraphEmbedding" with the option "Orientation" -> Top or "Orientation" -> Bottom:

SetProperty[graph1,
{ImageSize -> Medium,
GraphLayout -> {"LayeredDigraphEmbedding", "Orientation" -> #}}] & /@
{Top, Bottom} // Row • Many thanks kglr – Mike Feb 24 at 19:01
• @Mike, my pleasure. Thank you for the accept. – kglr Feb 24 at 19:02