import networkx as nx nx.barabasi_albert_graph(n, m, seed=None) # n : Number of nodes # m : Number of edges to attach from a new node to existing nodes # seed : Seed for random number generator (default=None).