maximal_independent_vertex_sets

maximal_independent_vertex_sets#

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

Return an iterator over all maximal independent vertex sets of a graph.

Parameters:
gGraph

Graph to be used. Edge directions are ignored.

Returns:
setsiterator over numpy.ndarray

The vertices of every maximal independent set.

See also

maximal_independent_vertex_set

A single maximal independent vertex set

largest_independent_vertex_sets

Independent vertex sets of maximum size

maximal_cliques

All maximal cliques

Notes

An independent vertex set is a set of vertices no two of which are adjacent (ignoring the edge directions), and it is maximal if no other vertex can be added to it, i.e. if every vertex outside it is adjacent to one of its vertices. The sets are the maximal cliques of the complement graph (see maximal_cliques()), whose number can grow exponentially with the size of the graph.

Examples

>>> g = gt.circular_graph(6)
>>> print(len(list(gt.maximal_independent_vertex_sets(g))))
5