def test_firecoreball_sampler(): sampler = SpikyBallSampler(mode='firecoreball', distrib_coeff=2) graph = nx.watts_strogatz_graph(200, 10, 0) new_graph = sampler.sample(graph) assert sampler.number_of_nodes == new_graph.number_of_nodes() assert type(new_graph) == nx.classes.graph.Graph
def test_edgeball_sampler(): sampler = SpikyBallSampler(mode='edgeball') graph = nx.watts_strogatz_graph(200, 10, 0) new_graph = sampler.sample(graph) assert sampler.number_of_nodes == new_graph.number_of_nodes() assert type(new_graph) == nx.classes.graph.Graph
def test_fireball_sampler_fb(): graph = GraphReader("facebook").get_graph() num_nodes = int(0.2 * graph.number_of_nodes()) sampler = SpikyBallSampler(mode='fireball', number_of_nodes=num_nodes, initial_nodes_ratio=1e-3, sampling_probability=0.1) new_graph = sampler.sample(graph) assert type(new_graph) == nx.classes.graph.Graph assert sampler.number_of_nodes == new_graph.number_of_nodes()