grinpy.invariants.independence.is_k_independent_set(G, nbunch, k)

Return whether or not the nodes in nbunch 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.
  • nbunch – A single node or iterable container or nodes.
  • k (int) – A positive integer.

True if the nodes in nbunch comprise a k-independent set, False otherwise.

Return type: