binomial_tree#

binomial_tree(n, create_using=None)[source]#

Returns the Binomial Tree of order n.

The binomial tree of order 0 consists of a single node. A binomial tree of order k is defined recursively by linking two binomial trees of order k-1: the root of one is the leftmost child of the root of the other.

(Source code, png)

../../_images/networkx-generators-classic-binomial_tree-1.png
Parameters:
nint

Order of the binomial tree.

create_usingNetworkX graph constructor, optional (default=nx.Graph)

Graph type to create. If graph instance, then cleared before populated.

Returns:
GNetworkX graph

A binomial tree of \(2^n\) nodes and \(2^n - 1\) edges.