# how to move the root from a tree?

I have the code :

myVertexes = {"xxx", "yyy", "Block3", "p5", "Block2",
"Block1", "p3", "p2", "p1"};
myVertexLabels =
Table[myVertexes[[i]] ->
Placed[Rotate[
Panel[myVertexes[[i]],
Background ->
If[AnyTrue[{"Criminals", "human", "macho"},
# == myVertexes[[i]] & ], Orange, Orange]], -\[Pi]/2],
Center],
{i, Length[myVertexes]}];

myEdgeShape[el_, ___] := Arrow[el, 0.2];

TreeCFGNVM =
TreeGraph[{"xxx" -> "yyy", "yyy" -> "Block3",
"yyy" -> "Block2", "yyy" -> "Block1",
"Block3" -> "p5", "Block1" -> "p1", "Block1" -> "p2",
"Block1" -> "p3"},
DirectedEdges -> True, EdgeShapeFunction -> myEdgeShape,
VertexLabels -> myVertexLabels];

TreeCFGNVM = Rotate[Image[TreeCFGNVM], \[Pi]/2]


Is it possible to move the note xxx on the left of yyy ? (also I wonder why the picture of the tree is so low resolution ?) ## 1 Answer

myVertexes = {"xxx", "yyy", "Block3", "p5", "Block2", "Block1", "p3", "p2", "p1"};
myVertexLabels =
Table[myVertexes[[i]] -> Placed[Panel[myVertexes[[i]]], Center], {i, Length[myVertexes]}];

myEdgeShape[el_, ___] := Arrow[el, 0.2];

TreeCFGNVM =
TreeGraph[{"xxx" -> "yyy", "yyy" -> "Block3", "yyy" -> "Block2",
"yyy" -> "Block1", "Block3" -> "p5", "Block1" -> "p1",
"Block1" -> "p2", "Block1" -> "p3"}, DirectedEdges -> True,
EdgeShapeFunction -> myEdgeShape, VertexLabels -> myVertexLabels,
ImageSize -> 500,
GraphLayout -> {"LayeredEmbedding", "RootVertex" -> "xxx",
"Orientation" -> "Left"},
ImagePadding -> 20] • Thank you Sir for the answer ! :) You saved me a lot of trouble – TraceKira Nov 27 '14 at 11:41