Group Abstract Group Abstract

Message Boards Message Boards

0
|
7.3K Views
|
7 Replies
|
1 Total Like
View groups...
Share
Share this post:

Use VertexSize with more than 999 Vertices?

Mathematica Version 11.1/ Windows 10

I'm working om a dataset with 4000+ Vertices and wanted to make some of the Vertices a bit larger. After spending a lot of time I found some suggestions like here: http://community.wolfram.com/groups/-/m/t/45871 But it seems that the VertexSize is limited to a maximum of 1000 Vertices. I couldn't find any documentation to such a limit and I would really think it's a pity to find this is bug. So perhaps there's a workaround.

(The code is clumsy but I found it to be the most predictable)

> h = RandomGraph[{999, 800}, ImageSize -> {800, 800}]

enter image description here

vertexdata = {VertexList[h], 
    Rescale@BetweennessCentrality[h]/50}\[Transpose];
vertexes = 
  Property[#[[1]], {VertexStyle -> RandomChoice[{ Yellow, Red, Blue}],
       VertexSize -> Scaled[#[[2]]]}] & /@ vertexdata;
Graph[vertexes, EdgeList[h]]

enter image description here

Now I change the number of vertices to 1000 and the Graphs is shown directly with small vertices (points)

enter image description here

I execute the same code and the result is not as desired. Only the colors are changed but not the size.

enter image description here

Attachments:
POSTED BY: l van Veen
7 Replies

Actually, this may not be a bug. VertexSize -> Scaled[s] is not a documented syntax. It does happen to work in some cases, but that is just a coincidence. The correct usage is VertexSize -> {"Scaled", s}.

This evaluates:

GraphElementData["Circle"][{0, 0}, name, {.5, .5}]

But this doesn't:

GraphElementData["Circle"][{0, 0}, name, Scaled[{.5, .5}]]

The sizes passed to the vertex function are expected to be a pair of numbers, not a Scaled form. The VertexSize -> {"Scaled", s} specification still allows for scaled sizes, but translates these to plain numbers before passing them to the vertex shape function.

Another comment: with either VertexShapeFunction -> "Circle" or VertexShapeFunction -> (Disk[#1, #3]&), you may want to add EdgeForm[Black] to the vertex style.

POSTED BY: Szabolcs Horvát
POSTED BY: l van Veen
POSTED BY: Szabolcs Horvát
POSTED BY: l van Veen

Hi Scabolcs, Where did you use the VertexShapeFunction. When I use it I get errors (Unknown box name with Graph Elements [Circle]) or it doesn't change anything. When I use

Graph[Range[1000], {}, VertexShapeFunction -> "Circle"]

the graph output is a blank. With Range[999] I see the 999 vertices. So where in my code did you use the VertexShapeFunction -> "Circle"? Thx!

POSTED BY: l van Veen

I played a bit with this. An explicit setting of VertexShapeFunction -> "Circle" should fix it.

I suspect that the drawing method changes for large graphs, either to optimize appearance or rendering performance.

POSTED BY: Szabolcs Horvát
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard