maximum_independent_set#

maximum_independent_set(G)[source]#

Returns an approximate maximum independent set.

Independent set or stable set is a set of vertices in a graph, no two of which are adjacent. That is, it is a set I of vertices such that for every two vertices in I, there is no edge connecting the two. Equivalently, each edge in the graph has at most one endpoint in I. The size of an independent set is the number of vertices it contains [1].

A maximum independent set is a largest independent set for a given graph G and its size is denoted \(\alpha(G)\). The problem of finding such a set is called the maximum independent set problem and is an NP-hard optimization problem. As such, it is unlikely that there exists an efficient algorithm for finding a maximum independent set of a graph.

The Independent Set algorithm is based on [2].

Parameters:
GNetworkX graph

Undirected graph

Returns:
isetSet

The apx-maximum independent set

Raises:
NetworkXNotImplemented

If the graph is directed or is a multigraph.

Notes

Finds the \(O(|V|/(log|V|)^2)\) apx of independent set in the worst case.

References

[2]

Boppana, R., & Halldórsson, M. M. (1992). Approximating maximum independent sets by excluding subgraphs. BIT Numerical Mathematics, 32(2), 180–196. Springer.

Examples

>>> G = nx.path_graph(10)
>>> nx.approximation.maximum_independent_set(G)
{0, 2, 4, 6, 9}