Clear@doHasseE8;

doHasseE8@type_:=If[doSuperLie,
(* Recalculate rootRep on change of algebra with binarized/physics Hasse *)
If[lie==alg&&(doBinarizedHasse||physics),
rootRep=With[{i=#},
(* posHasse flips the effect of type (i.e. p vs. (OverBar[p]))  *)
{root=pRoot[If[type,If[posHasse,257-i,i],If[posHasse,i,257-i]]][[;;rank]],
(* Root vertex info *)
{Tooltip[Row@{Column[Style[#,If[MemberQ[h4,i],{Bold,Red},Black]]&/@{"Root ",i},Center],"  ",
pLbl@i,If[!showH4ΦRoots&&MemberQ[h4Φ,i],{""},pDisp@i]},pTooltipTxt@i],
(* Selectively show h4Φ members *)
Column[If[!showH4ΦRoots&&MemberQ[h4Φ,i],{""},
(* posHasse flips the effect of type (i.e. p vs. (OverBar[p])) *)
{If[type,If[posHasse,-1,1],If[posHasse,1,-1]]root/.slRep,
binRoot=Table[Mod[root[[j]],2],{j,8}];
Row@{"binarized root=",FromDigits[binRoot,2]},
binRoot}],Center]}}]&/@e8];

Module[{(*)hasseNodes,assgn,rv1,repPos1,rv1a,rv2,repPos2,rv2a,edgePos **)},
hasseNodes=GatherBy[rootVecs/.slRep,Total@#&];
assgn={};
Do[
rv1=hasseNodes[[#,i]];
repPos1=Position[rootRep[[All,1]],rv1][[1,1]];
rv1a=rootRep[[repPos1,2]];
If[#<cox-1,Do[
rv2=hasseNodes[[#+1,j]];
repPos2=Position[rootRep[[All,1]],rv2][[1,1]];
rv2a=rootRep[[repPos2,2]];

(* Add to assgn'd if the difference between nodes is +1 root *)
If[Total[rv2-rv1]==1&&Union[!Negative[rv2[[#]]-rv1[[#]]]&/@Range@rank]=={True},
AppendTo[assgn,{If[doBinarizedHasse||physics,
(* type reverses top-down vs. bottom-up 
  because LayeredGraph direction does not seem to work on "SymmetricLayeredEmbedding" *)
If[type,rv1a->rv2a,rv2a->rv1a],
If[type,rv1->rv2,rv2->rv1]],
(* Style that edge with added sRootList vertex info *)
Style[
If[rank>6,"\n   ",""]<>ToString[edgePos=position[rv2-rv1,1]]<>
If[doBinarizedHasse||physics," "<>ToString[pLbl@If[posHasse,257-sRootList[[edgePos]],sRootList[[edgePos]]],TraditionalForm],""],
If[rank>6,Small,Medium],Red,Bold]}]],
{j,Length@Position[grades,#+If[#==cox-1,0,1]]}]],
{i,Length@Position[grades,#]}]&/@Range[cox-1];
LayeredGraphPlot[assgn, Bottom,
GraphLayout->"SymmetricLayeredEmbedding",
(* Conditionally show vertex shapes *)
VertexShapeFunction->"RoundedPentagon",
VertexLabels->Placed[Automatic,Center,If[doBinarizedHasse||physics,Column[#,Center],#]&],
DirectedEdges->If[rank>8,False,True],
EdgeShapeFunction->{{"CarvedArrow","ArrowSize"->.15/rank}},
EdgeLabels->Placed[Automatic,Center,If[doBinarizedHasse||physics,Column[#,Center],#]&],
ImageSize-> rank imageSize/If[rank>10,1,4]]]/.slRep,""];

alg=lie="E8";
rank=8;
cm=cmE8;
doLie;

doHasseE8@False
Print["____________________________________________________________________________________________________________________________________________________________________________________________________________"];
doHasseE8@True