is_k_independent_set(G, nodes, k)¶
Return whether or not the nodes in nodes comprise an a k-independent set.
A set S of nodes in G is called a k-independent set it every node in S has at most k-1 neighbors in S. Notice that a 1-independent set is equivalent to an independent set.
- G (NetworkX graph) – An undirected graph.
- nodes (list, set) – An iterable container of nodes in G.
- k (int) – A positive integer.
True if the nodes in nodes comprise a k-independent set, False otherwise.