Conditional tree vertex rendering?

ar = ConstantArray[RGBColor[113/255, 190/255, 236/255], 55];
ar[[{11, 23}]] = Red;



 TreePlot[{11 -> 23, 11 -> 24, 23 -> 40, 23 -> 39, 24 -> 30, 24 -> 50, 
      40 -> 55, 40 -> 45},
     VertexLabeling -> All,
     PlotStyle -> {FontSize -> 13},
     VertexRenderingFunction -> 
        ({EdgeForm[White], ar[[#2]], Disk[#1, 0.2], White, Text[#2, #1]} &),
     AspectRatio -> Automatic]

enter image description here


Here's an alternative approach that does the work in VertexRenderingFunction:

$redDisks = {11, 23};

TreePlot[{11 -> 23, 11 -> 24, 23 -> 40, 23 -> 39, 24 -> 30, 24 -> 50, 
  40 -> 55, 40 -> 45}, VertexLabeling -> All, 
 PlotStyle -> {FontSize -> 13}, VertexRenderingFunction -> 
  ({EdgeForm[White], If[MemberQ[$redDisks, #2], Red, 
     RGBColor[113/255, 190/255, 236/255]], Disk[#1, 0.2], White, 
    Text[#2, #1]} & ), AspectRatio -> Automatic]

enter image description here

Tags:

Plotting

Trees