Take tea, it will be long :)
I draw this with networkx , but the basic steps can be easily ported to graphviz.
The plan is as follows:
a) find the maximum clicks (just in case, the maximum clicks are not needed by the largest clicks),
b) draw a graph and remember the coordinates of the vertices that were used by the drawing program;
c) take the coordinates of the clique, calculate the center and radius of the circles surrounding it,
d) draw circles and color the vertices of the clicks of the same color (for vertices at the intersection of 2 or more maxcliques this is not possible).
Regarding c) : I was lazy to draw a narrow circle, but with some time it can be easily done. Instead, I calculated the “approaching circle”: I took the radius of the length of the longest edge of the clique and multiplied it by 1.3. In fact, with this approach, some nodes can be omitted, since only the sqrt (3) factor ensures that everyone is inside. However, taking sqrt (3) will make the circle too large (again, it is not hard). As a center, I took the middle of the largest edge.
import networkx as nx from math import * import matplotlib.pylab as plt import itertools as it def draw_circle_around_clique(clique,coords): dist=0 temp_dist=0 center=[0 for i in range(2)] color=colors.next() for a in clique: for b in clique: temp_dist=(coords[a][0]-coords[b][0])**2+(coords[a][1]-coords[b][2])**2 if temp_dist>dist: dist=temp_dist for i in range(2): center[i]=(coords[a][i]+coords[b][i])/2 rad=dist**0.5/2 cir = plt.Circle((center[0],center[1]), radius=rad*1.3,fill=False,color=color,hatch=hatches.next()) plt.gca().add_patch(cir) plt.axis('scaled')
Let's see what we get:
>> Clique to appear: [0, 5, 1, 2, 3, 6] >> Clique to appear: [0, 5, 4]
Pic: 
Another example with 3 maxcliques:
>> Clique to appear: [1, 4, 5] >> Clique to appear: [2, 5, 4] >> Clique to appear: [2, 5, 6]
