Technical requirements
In this chapter, we will primarily use the NetworkX package for working with trees and networks. This package can be installed using your favorite package manager, such as pip:
python3.10 -m pip install networkx
We usually import this under the nx alias, following the conventions established in the official NetworkX (https://networkx.org/documentation/stable/) documentation, using the following import statement:
import networkx as nx
The code for this chapter can be found in the Chapter 05 folder of this book’s GitHub repository at https://github.com/PacktPublishing/Applying-Math-with-Python-2nd-Edition/tree/main/Chapter%2005.