3
$\begingroup$

I am trying to understand when VertexSize property works on the graph. I experimented with a small number of nodes (about 100) and try to change the size of only 5 vertices out of 100 and it worked. However, when you take a graph with a large number of nodes (for example 1000 nodes and 2000 edges - RandomGraph[{1000,2000}] and try to change the size of 10 vertices, VertexSize does not seem to work. I even tried with affixing the property to the vertex by using Property but could not get to work.

So, after how many nodes does VertexSize does not work? Is there a way to get around this?

$\endgroup$
2
$\begingroup$

The following work in version 9:

RandomGraph[{1000, 2000}, 
 VertexSize -> Join[{_ -> Scaled[.01]}, Thread[Range[10] -> Scaled[.04]]]]

enter image description here

RandomGraph[{1000, 2000}, 
 VertexSize -> Join[{_ -> 3}, Thread[Range[10] -> 10]]]

enter image description here

Update: For version 11, as shown in halmir's answer, explicit setting of GraphStyle or VertexShapeFunction options gives the desired result. In particular, using the option GraphStyle with any value, e.g.

GraphStyle -> {}
GraphStyle- > "BasicBlue"
GraphStyle-> blah

with the same VertexSize settings as in the examples above gives

enter image description here

$\endgroup$
  • $\begingroup$ It doesn't seem to work on Mathematica 11 @kglr. Can anyone confirm this? $\endgroup$ – no-one Oct 20 '17 at 2:25
  • $\begingroup$ @no-one, it doesn't work in version 11 as is. If we the GraphStyle option, (regardless of the option value used) it works in version 11 too. $\endgroup$ – kglr Oct 20 '17 at 4:07
2
$\begingroup$

You could specify VertexShapeFunction or set GraphStyle -> "Default"

RandomGraph[{1000, 2000}, VertexSize -> 6, VertexShapeFunction -> "Circle"]

RandomGraph[{1000, 2000}, VertexSize -> 5, GraphStyle -> "Default" ]
$\endgroup$
  • $\begingroup$ Could you make GraphElementData["GraphStyle"] list "Default" as well? $\endgroup$ – Szabolcs Apr 12 '18 at 11:35
  • $\begingroup$ What is the GraphStyle that Mathematica uses for large graphs? It is not "LargeGraph" or "LargeNetwork", and with these styles the rendering is not as fast as with the automatically chosen style. $\endgroup$ – Szabolcs Apr 12 '18 at 11:43
  • 2
    $\begingroup$ It's "LargeNetworkDefault" $\endgroup$ – halmir Apr 12 '18 at 17:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.