image_output_1.png
import igraph as ig

import igraph as ig

import matplotlib.pyplot as plt

import matplotlib.pyplot as plt

import igraph as ig
import matplotlib.pyplot as plt

g = ig.Graph.Famous('Zachary')

# Compute cliques
cliques = g.cliques(4, 4)

# Plot each clique highlighted in a separate axes
fig, axs = plt.subplots(3, 4, figsize = (20,10))
axs = axs.ravel()
for clique, ax in zip(cliques, axs):
    ig.plot(
        ig.VertexCover(g, [clique]),
        mark_groups=True, palette=ig.RainbowPalette(),
        edge_width=0.5,
        target=ax,
    )

plt.axis('off')
plt.show()

import igraph as ig
import matplotlib.pyplot as plt
g = ig.Graph.Famous('Zachary')
cliques = g.maximal_cliques(min=4)
fig, axs = plt.subplots(1, 4, figsize=(20, 10))
axs = axs.ravel()
for clique, ax in zip(cliques, axs):
    ig.plot(ig.VertexCover(g, [clique]), mark_groups=True, palette=ig.RainbowPalette(), edge_width=0.5, target=ax)
plt.axis('off')
plt.show()