I've used TreeForm, and I appreciate that the syntax is fairly short, especially in comparison with TreeGraph.
Is it possible specify a different colors in TreePlot for coloring a section of the nodes and the paths to those nodes?
I've used TreeForm, and I appreciate that the syntax is fairly short, especially in comparison with TreeGraph.
Is it possible specify a different colors in TreePlot for coloring a section of the nodes and the paths to those nodes?
Anyway, Treegraph offers a lot of flexibility:
nodes = {RandomInteger[#] , # + 1} & /@ Range[0, 30];
rn = Range@Length@nodes;
crules = Rule @@@ Partition[Riffle[rn, ColorData[15, "ColorList"]], 2];
g = TreeGraph[UndirectedEdge @@@ nodes, VertexSize -> 0.4, VertexStyle -> crules];
HighlightGraph[g, PathGraph@FindShortestPath[g, 1, 30], GraphHighlightStyle -> "Dashed"]

Terse code is nice, flexibility is wonderful.
framedWithColor[color_] := Function[{position, label},
{Text[Framed[label, Background -> color], position]}
];
TreeForm[
{{1, 2}, {3, 4}},
VertexRenderingFunction -> framedWithColor[Pink]
]
The terminal nodes of TreeForm are apparently all wrapped in an insidious HoldForm such that one cannot easily give them separate colors.
That is:
ii = 0;
TreeForm[Nest[{#, ++ii} &, ii, 3],
VertexRenderingFunction -> ({Black,
Text[#2, #1,
Background -> (Hue[
Switch[#2, 0, 0.1, HoldForm@1, 0.2, 2, 0.3, 3, 0.4, List,
0.8, _, 0]])]} &)]
TreeGraph[]supports all possible operations on Graphs- – Dr. belisarius Nov 27 '14 at 14:37TreeGraph[]is much more flexible thanTreePlot[]andTreeForm[]for this kind of things. I told you before, but you don't like it :). See my comment under your previous question – Dr. belisarius Nov 27 '14 at 14:41TreePlotseems to accept anything as a node (number, string, etc.), whereasTreeGraphseems to require a number. – iwantmyphd Jan 22 '15 at 00:41