6
$\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 Answers 2

3
$\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 versions 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$
2
  • $\begingroup$ It doesn't seem to work on Mathematica 11 @kglr. Can anyone confirm this? $\endgroup$
    – no-one
    Commented Oct 20, 2017 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
    Commented Oct 20, 2017 at 4:07
3
$\begingroup$

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

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

RandomGraph[{1000, 2000}, VertexSize -> 5, GraphStyle -> "Default" ]
$\endgroup$
3
  • $\begingroup$ Could you make GraphElementData["GraphStyle"] list "Default" as well? $\endgroup$
    – Szabolcs
    Commented Apr 12, 2018 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
    Commented Apr 12, 2018 at 11:43
  • 3
    $\begingroup$ It's "LargeNetworkDefault" $\endgroup$
    – halmir
    Commented Apr 12, 2018 at 17:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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