network generation in python + networkx