clique_removal#
- graph_tool.structure.clique_removal(g)[git][source]#
Return an approximate maximum independent vertex set and a clique cover.
- Parameters:
- g
Graph Graph to be used. Edge directions are ignored.
- g
- Returns:
- iset
numpy.ndarray The vertices of an independent set.
- cliques
listofnumpy.ndarray Cliques that cover all vertices.
- iset
See also
ramsey_r2A clique and an independent vertex set
maximal_independent_vertex_setMaximal independent vertex set
independence_numberExact size of a largest independent vertex set
Notes
An independent vertex set is a set of pairwise non-adjacent vertices, and a clique cover is a partition of the vertices into cliques (sets of pairwise adjacent vertices), ignoring the edge directions. The clique removal algorithm [boppana-approximating-1992] applies
ramsey_r2()repeatedly, removing the clique found each time, and keeps the largest independent set, which approximates the maximum within a factor \(O(V/\log^2 V)\). The approximate maximum clique is the independent set of the complement graph (seeapprox_maximum_clique()).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"] >>> i, cs = gt.clique_removal(g) >>> print(len(i), sum([len(c) for c in cs])) 19 34