def test_ErdosRenyi(capsys): print(Network.Model("ErdosRenyi", n_nodes=10, n_links=18)) out, err = capsys.readouterr() out_ref = "Generating Erdos-Renyi random graph with 10 " + \ "nodes and 18 links...\n" + \ "Network: undirected, 10 nodes, 18 links, link density 0.400.\n" assert out == out_ref
def test_WattsStrogatz(): net = Network.Model("WattsStrogatz", N=100, k=2, p=0.1) assert int(round(net.degree().mean())) == 4
def test_ConfigurationModel(): net = Network.Model("Configuration", degrees=[3 for _ in range(0, 1000)]) assert int(round(net.degree().mean())) == 3
def test_BarabasiAlbert_igraph(): net = Network.Model("BarabasiAlbert_igraph", n_nodes=100, n_links_each=1) assert np.allclose(net.link_density, 0.02)