def test_frontier_sampler(): """ Testing the number of nodes. """ sampler = FrontierSampler() graph = nx.watts_strogatz_graph(200, 10, 0) new_graph = sampler.sample(graph) assert sampler.number_of_nodes == new_graph.number_of_nodes()
def test_frontier_sampler(): """ Testing the number of nodes. """ sampler = FrontierSampler() 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 sampler = FrontierSampler(number_of_nodes=25) graph = nx.watts_strogatz_graph(100, 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 sampler = FrontierSampler() graph = nk.nxadapter.nx2nk(nx.watts_strogatz_graph(200, 10, 0)) new_graph = sampler.sample(graph) assert sampler.number_of_nodes == new_graph.numberOfNodes() assert type(new_graph) == NKGraph sampler = FrontierSampler(number_of_nodes=25) graph = nk.nxadapter.nx2nk(nx.watts_strogatz_graph(100, 10, 0)) new_graph = sampler.sample(graph) assert sampler.number_of_nodes == new_graph.numberOfNodes() assert type(new_graph) == NKGraph
new_graph = sampler.sample(graph) #----------------------------------------------- # Community Structure Expansion Sampler Example #----------------------------------------------- sampler = CommunityStructureExpansionSampler() new_graph = sampler.sample(graph) #-------------------------- # Frontier Sampler Example #-------------------------- sampler = FrontierSampler() new_graph = sampler.sample(graph) #--------------------------- # ForestFire Sampler Example #--------------------------- sampler = ForestFireSampler() new_graph = sampler.sample(graph) #----------------------------- # Random Walk Sampler Example #-----------------------------
"""Frontier sampler example""" import networkx as nx from littleballoffur.exploration_sampling import FrontierSampler graph = nx.watts_strogatz_graph(1000, 10, 0) sampler = FrontierSampler() new_graph = sampler.sample(graph)