The networkx library is one of the easiest ways to model a graph in Python. In this article we will deal with the basic functionality of networkx.

Firstly we need to install networkx (cmd -> pip install networkx)

Now we can start working with graphs. Let's create an empty graph:

`import networkx as nxG = nx.Graph()`

One of the ways to add edges and nodes:

`G.add_edge(1,2)`