# Choosing a List as VertexWeight for a TreeGraph

I would like to map every vertex of my TreeGraph to an List.

g=TreeGraph[{1, 2, 3, 4, 5}, {1 \[DirectedEdge] 2, 1 \[DirectedEdge] 3,
1 \[DirectedEdge] 4, 1 \[DirectedEdge] 5},
VertexWeight -> {{1}, {4}, {9}, {16}, {25}}]


It seems that g is not a valid graph whereas the next one is valid

gg=TreeGraph[{1, 2, 3, 4, 5}, {1 \[DirectedEdge] 2, 1 \[DirectedEdge] 3,
1 \[DirectedEdge] 4, 1 \[DirectedEdge] 5},
VertexWeight -> {1, 4, 9, 16, 25}]


So it seems that we can't use a List as a Weight of a Vertex.

But the VertexWeight documentation says clearly

The weight can be any expression.

So I don't understant why gg works well whereas g doesn't work.

Best Regards

• Welcome to Mathematica.SE! I suggest the following: 1) As you receive help, try to give it too, by answering questions in your area of expertise. 2) Read the faq! 3) When you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge. Also, please remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign!
– user9660
Nov 16, 2014 at 14:20
• Looks like List is treated as an exception for some reason. VertexWeight -> foo /@ {1,4,16,25,} works as stated in the docs. As an aside, if you really have to use Lists as weights, you could use VertexWeight -> (Defer /@ {{1}, {4}, {9}, {16}, {25}}) .
– kglr
Nov 16, 2014 at 15:06