# Highlight graph same vertices multiple circle

I have a graph on which I want to highlight overlapping subset of vertices with a colored ring of larger radius and different color. So that I can see the vertices with multiple highlights. But with HighlightGraph I don't see any such option. This is what I was trying. But these are not rings, and I cannot check the overlaps with it.

With[{G = CompleteGraph[8],
H = {{1, 2, 3, 4}, {2, 3, 5, 6}, {2, 5, 7, 8}},
C = {Red, Orange, Cyan}},
HighlightGraph[G, Table[Style[H[[i]], Circle[], C[[i]]], {i, 1, Length@H}]]
]


 Module[{
G = CompleteGraph[8],  H = {{1, 2, 3, 4}, {2, 3, 5, 6}, {2, 5, 7, 8}},
C = {Red, Orange, Cyan}, S = {.05, .03, .01}, pos
},
Show[G, Graphics[
]]]


• Thanks That worked, Nice But this is not graph anymore, it becomes a graph object. Commented Jan 10, 2018 at 11:37
• @NeelBasu you can still work with original graph, this is for a visualization, or do you need a graph at the end?
– Kuba
Commented Jan 10, 2018 at 11:38
• Nope so far this is okay with Graphics. But these are filled circle, Can you make them transparent ? Commented Jan 10, 2018 at 11:44
• @NeelBasu Replace Point with whatever you want.
– Kuba
Commented Jan 10, 2018 at 11:44

Using a custom VertexShapeFunction:

ClearAll[vShape]
vShape[h_, c_, s_] := Module[{hc = Thread /@
hr = #[[1, 1]] -> #[[All, 2]] & /@ GatherBy[Join @@ hc, First];
If[MemberQ[Union@Flatten@h, #2], Through[(#2 /. hr)@#], Disk[#, Scaled[.01]]] &]


Examples:

H = {{1, 2, 3, 4}, {2, 3, 5, 6}, {2, 5, 7, 8}};
Col = {Red, Orange, Cyan};
S = {.05, .03, .01};

CompleteGraph[8, VertexShapeFunction -> vShape[H, Col, S]]


CompleteGraph[8,  VertexShapeFunction ->
vShape[{{1, 2, 3}, {2, 3, 4}, {1, 3, 5}, {1, 2, 4, 6}},
{Orange, Green, Blue, Directive[Thick, Red]}, Range[.01, .04, .01]]]


• With Complete Graph it works fine. But when I was trying this on my actual graph, which is big an rectangular. all these circles came as eclipses. So I removed Scaled. Commented Jan 10, 2018 at 18:52