I have made an animated graph that shows the changes of certain functions in time with different vertex sizes and colors:
gr = TreeGraph[RandomInteger[#] <-> # + 1 & /@ Range[0, 30],
VertexSize -> 0];
Manipulate[
Show[{SetProperty[
gr, {VertexSize ->
Table[ii -> 0.4 Sin[ii tstep]^2, {ii, VertexList[gr]}],
VertexStyle ->
Table[ii -> ColorData["Rainbow"][Cos[ii tstep]^2], {ii,
VertexList[gr]}]}],
Graphics[
Text[Style[StringJoin["T=" , ToString[tstep]], Bold, 20],
Scaled[{0, 1}]], ImageSize -> {250, 100}]}], {tstep, 0, 5, 0.1}]
A sample result looks like this:
How can I add a legend to show the scale of vertex sizes and colors? The closest solution I found was this one but I don't know how to implement the scaling part for what's shown in the legend to follow the style of the graph nodes.