Function Repository Resource:

VertexSizeScaledGraph (1.0.0) current version: 1.1.0 »

Source Notebook

Visualize a graph with scaled vertex size based on degree of connectivity

Contributed by: Soutick Saha

ResourceFunction["VertexSizeScaledGraph"][graph]

visualize a graph with scaled VertexSize based on VertexDegree.

Details and Options

GraphPlot is used by default when total EdgeCount is more than 10000.
"MaxVertexSize" in Options is the maximum possible size of a vertex or it is the size of the vertex with maximum VertexDegree.
"VertexSizeScalingFunction" is a pure function that can act on reals and integers.
VertexSizeScaledGraph can take all options of Graph and GraphPlot and the following Options:
"MaxVertexSize"1maximum size of a vertex
"VertexSizeScalingFunction"Automatichow VertexSize is scaled

Examples

Basic Examples (4) 

Visualize the VertexSizeScaledGraph of the Golomb graph:

In[1]:=
ResourceFunction["VertexSizeScaledGraph"][GraphData["GolombGraph"]]
Out[1]=

Limit the maximum vertex size with various graphs:

In[2]:=
ResourceFunction["VertexSizeScaledGraph"][GraphData[#], "MaxVertexSize" -> 0.4] & /@ {"BislitCube", "PetersenGraph", "SoiferGraph", "TilleyGraph", "FritschGraph", "HerschelGraph"}
Out[2]=

Visualize VertexSizeScaledGraph of a RandomGraph:

In[3]:=
n = 50;
m = 6*n;
ResourceFunction["VertexSizeScaledGraph"][RandomGraph[{n, m}]]
Out[4]=

Also works on directed graphs:

In[5]:=
ResourceFunction["VertexSizeScaledGraph"][
 Graph[DirectedEdge @@@ RandomSample[Subsets[Range[8], {2}], 20]], "MaxVertexSize" -> 0.3]
Out[5]=

Options (3) 

MaxVertexSize (1) 

Set the maximum VertexSize of a Graph:

In[6]:=
ResourceFunction["VertexSizeScaledGraph"][
 ResourceData["Bipartite Diseasome Network"], "MaxVertexSize" -> 50, VertexStyle -> RGBColor[0.68, 0.68, 0], EdgeStyle -> RGBColor[0., 0.061999999999999944`, 0.06799999999999995]
  ]
Out[6]=

VertexSizeScalingFunction (2) 

VertexSizeScaledGraph of the Actinobacillus Actinomycetemcomitans Metabolic Network scaled in two different ways:

In[7]:=
ResourceFunction["VertexSizeScaledGraph"][
 ResourceData[
  "Actinobacillus Actinomycetemcomitans Metabolic Network"], "VertexSizeScalingFunction" -> (Log2[#] &), "MaxVertexSize" -> 30, VertexStyle -> RGBColor[0.91, 0.68, 0], EdgeStyle -> RGBColor[0, 0.58, 0.61]]
Out[7]=

In[8]:=
ResourceFunction["VertexSizeScaledGraph"][
 ResourceData[
  "Actinobacillus Actinomycetemcomitans Metabolic Network"], "VertexSizeScalingFunction" -> (#^0.5 &), "MaxVertexSize" -> 40, VertexStyle -> RGBColor[0.91, 0.68, 0], EdgeStyle -> RGBColor[0, 0.58, 0.61]]
Out[8]=

Neat Examples (2) 

VertexSizeScaledGraph of a Disease Gene Network:

In[9]:=
ResourceFunction["VertexSizeScaledGraph"][
 ResourceData["Disease Gene Network"], VertexStyle -> RGBColor[0.6, 0.68, 0], EdgeStyle -> RGBColor[0, 0, 0.61], "MaxVertexSize" -> 100]
Out[9]=

VertexSizeScaledGraph containing randomly chosen genes from the co-expression network in human tissues:

In[10]:=
(* Evaluate this cell to get the example input *) CloudGet["https://www.wolframcloud.com/obj/58ddd791-4fd1-424e-a348-35ad77154c37"]
Out[11]=

Publisher

WolframChemistry

Version History

  • 1.1.0 – 01 November 2024
  • 1.0.0 – 25 October 2024

Source Metadata

Related Resources

License Information