예제 #1
0
def test_loop_erased_random_walk_sampler_4():

    sampler = LoopErasedRandomWalkSampler(number_of_nodes=25)

    graph = nk.nxadapter.nx2nk(nx.watts_strogatz_graph(200, 10, 0))

    new_graph = sampler.sample(graph)
    assert new_graph.numberOfEdges()+1 == new_graph.numberOfNodes()
    assert sampler.number_of_nodes == new_graph.numberOfNodes()
    assert 1 == nk.components.ConnectedComponents(new_graph).run().numberOfComponents()
    assert type(new_graph) == NKGraph
예제 #2
0
def test_loop_erased_random_walk_sampler_2():

    sampler = LoopErasedRandomWalkSampler(number_of_nodes=25)

    graph = nx.watts_strogatz_graph(100, 10, 0)

    new_graph = sampler.sample(graph)

    assert new_graph.number_of_edges() + 1 == new_graph.number_of_nodes()
    assert sampler.number_of_nodes == new_graph.number_of_nodes()
    assert nx.is_connected(new_graph)
    assert type(new_graph) == NXGraph
def test_loop_erased_random_walk_sampler():
    """
    Testing the number of nodes, connectivity and tree structure.
    """
    sampler = LoopErasedRandomWalkSampler()

    graph = nx.watts_strogatz_graph(200, 10, 0)

    new_graph = sampler.sample(graph)

    assert new_graph.number_of_edges()+1 == new_graph.number_of_nodes()
    assert sampler.number_of_nodes == new_graph.number_of_nodes()
    assert nx.is_connected(new_graph)
예제 #4
0
"""Loop erased random walk sampler example"""

import networkx as nx

from littleballoffur.exploration_sampling import LoopErasedRandomWalkSampler

graph = nx.watts_strogatz_graph(1000, 10, 0)

sampler = LoopErasedRandomWalkSampler()

new_graph = sampler.sample(graph)


예제 #5
0
new_graph = sampler.sample(graph)

#------------------------------
# Breadth First Search Sampler
#------------------------------

sampler = BreadthFirstSearchSampler(number_of_nodes=graph.number_of_nodes())

new_graph = sampler.sample(graph)

#---------------------------------
# Loop Erased Random Walk Sampler
#---------------------------------

sampler = LoopErasedRandomWalkSampler()

new_graph = sampler.sample(graph)

#-------------------------------------------
# Common Neighbor Aware Random Walk Sampler
#-------------------------------------------

sampler = NonBackTrackingRandomWalkSampler()

new_graph = sampler.sample(graph)

#-------------------------------------------
# Common Neighbor Aware Random Walk Sampler
#-------------------------------------------