ramsey_r2

Contents

ramsey_r2#

graph_tool.structure.ramsey_r2(g)[git][source]#

Return a clique and an independent vertex set found by the Ramsey approximation.

Parameters:
gGraph

Graph to be used. Edge directions are ignored.

Returns:
cliquenumpy.ndarray

The vertices of a clique.

isetnumpy.ndarray

The vertices of an independent set.

See also

clique_removal

Independent set and clique cover

approx_maximum_clique

Approximate maximum clique

Notes

The algorithm of Boppana and Halldórsson [boppana-approximating-1992] takes the vertex \(v\) of smallest index, and is applied recursively to the subgraphs induced by the neighbors of \(v\) and by its non-neighbors, which yield the cliques \(C_1, C_2\) and the independent sets \(I_1, I_2\), respectively. The clique returned is the larger of \(C_1\cup\{v\}\) and \(C_2\), and the independent set the larger of \(I_1\) and \(I_2\cup\{v\}\); the empty graph yields two empty sets. As in the proof of Ramsey’s theorem, it follows by induction that the clique \(C\) and the independent set \(I\) returned satisfy \(\binom{|C|+|I|}{|C|} > V\). Self-loops and parallel edges are ignored. The time is \(O(V^2)\) per level of recursion in the worst case.

References

[boppana-approximating-1992]

Ravi Boppana and Magnús M. Halldórsson, “Approximating maximum independent sets by excluding subgraphs”, BIT 32, 180-196 (1992), DOI: 10.1007/BF01994876 [sci-hub, @tor]

Examples

>>> g = gt.collection.data["karate"]
>>> c, i = gt.ramsey_r2(g)
>>> print(len(c), len(i))
5 13

The clique and the independent set can be highlighted in a drawing of the network:

>>> vcolor = g.new_vp("string", val="#cccccc")
>>> for v in c:
...     vcolor[v] = "#f28c8e"
>>> for v in i:
...     vcolor[v] = "#9bbedc"
>>> gt.graph_draw(g, g.vp.pos, vertex_fill_color=vcolor,
...               edge_color="#999999", output="ramsey_r2-karate.pdf")
<...>
../_images/ramsey_r2-karate.png

Clique (red) and independent vertex set (blue) of Zachary’s karate club network found by the Ramsey approximation.#