If you are new to NetworkX take a look at the tutorial.
The examples show some simple and complicated ways to use NetworkX.