Place graph vertex labels in circles
You can change Rectangle[...]
to Disk[{xc, yc}, Min[w, h]]
or use any other function of w
and h
to control the disk radius.
But ... you can also get the same result without having to define a custom VertexShapeFunction
using the options:
options = Sequence[VertexStyle -> LightYellow,
VertexSize -> 0.15,
VertexLabels -> Placed["Name", Center],
VertexLabelStyle -> Directive[20, Red, Bold, Italic],
GraphLayout -> "CircularEmbedding", ImageSize -> 350,
EdgeStyle -> Blue];
Graph[{1 <-> 2, 2 <-> 3, 3 <-> 1}, options]
You can also use the option PlotTheme -> "IndexLabeled"
in versions 12.0+:
Graph[{1 <-> 2, 2 <-> 3, 3 <-> 1}, PlotTheme -> "IndexLabeled",
VertexStyle -> Yellow, VertexSize -> Medium,
VertexLabelStyle -> Directive[Italic, 16], EdgeStyle -> Blue]