I have a problem with Graph plot scaling of vertex sizes when I go from 999 vertices to 1000 vertices. The following code scales the vertex size properly when the numNodes = 999; but not numNodes = 1000. Very strange like something goes haywire in plotting graphs 1000 nodes or larger.
ClearAll["Global`*"];
(* Define some utility functions *)
addVertices[G_, numVertices_] := (
GN = G;
vc = VertexCount[GN];
(* Preferential Attachment Part A *)
For[i = 1, i <= numVertices, i++,
(* Preferential Attachment Part A Barabasi / Albert Method *)
(* The rich get richer... *)
GN = EdgeAdd[
GN, (vc + i) \[UndirectedEdge] RandomChoice[GraphCenter[GN]]];
(* Preferential Attachment Experiment 1 *)
GN = EdgeAdd[
GN, (vc + i) \[UndirectedEdge] RandomChoice[GraphPriphery[GN]]];
];
Return[Graph[GN, VertexLabels -> Automatic,
PlotLabel -> "New G with additional vertices"]]
)
If[$KernelCount < 1, LaunchKernels[]];
Framed[Style[
StringJoin["Running [", ToString[$KernelCount], "] kernels"]],
Background -> LightBlue]
numNodes = 1000;
m = 2; (* Parameter of attachment *)
G = Graph[RandomGraph[BarabasiAlbertGraphDistribution[numNodes, m]],
VertexStyle -> White];
vcount = VertexCount[G];
heatIndex = Table[VertexDegree[G, i], {i, 1, vcount}] ;
Length[Range[Max[heatIndex]]];
tempRange = Table[ColorData["TemperatureMap"][r], {r, 0., 1., 1/%}];
tempDegree = Table[tempRange[[heatIndex[[i]]]], {i, 1, vcount}];
vs = Table[i -> tempDegree[[i]], {i, 1, vcount}];
vh = Table[
i -> (Log[numNodes]*m*heatIndex[[i]])/(Max[heatIndex]), {i, 1,
vcount}];
pl = Style[
StringJoin[
"Heat/Size Map of Random Barabasi/Albert Graph\nO(V) = ",
ToString[numNodes], ", Diameter G = ", ToString[GraphDiameter[G]],
", m = ", ToString[m]], Bold, FontFamily -> "Comic Sans MS"];
G = Graph[G, VertexStyle -> vs, VertexSize -> vh, PlotLabel -> pl];
vd = Thread[VertexList@G -> Normalize[VertexDegree@G, Total]]*
Log[VertexDegree@G] // N;
G2 = SetProperty[G, VertexSize -> vd]`
See the following for additional backup material. Vertex sizes scaled by vertex degree?