kneser_graph#

kneser_graph(n, k)[source]#

Returns the Kneser Graph with parameters n and k.

The Kneser Graph has nodes that are k-tuples (subsets) of the integers between 0 and n-1. Nodes are adjacent if their corresponding sets are disjoint.

Parameters:
n: int

Number of integers from which to make node subsets. Subsets are drawn from set(range(n)).

k: int

Size of the subsets.

Returns:
GNetworkX Graph

Examples

>>> G = nx.kneser_graph(5, 2)
>>> G.number_of_nodes()
10
>>> G.number_of_edges()
15
>>> nx.is_isomorphic(G, nx.petersen_graph())
True