def test_create_algorithm_creates_neighbour_sampling_algorithm_correctly_no_params(
):
    algorithm = forcelayout._create_algorithm(
        dataset=dataset, algorithm=forcelayout.NeighbourSampling)

    assert type(algorithm) is forcelayout.NeighbourSampling
    assert len(algorithm.nodes) == len(dataset)
def test_create_algorithm_creates_spring_force_algorithm_correctly():
    algorithm = forcelayout._create_algorithm(
        dataset=dataset,
        algorithm=forcelayout.SpringForce,
        iterations=10,
        distance=mock_distance_fn)
    assert type(algorithm) is forcelayout.SpringForce
    assert len(algorithm.nodes) == len(dataset)
    assert algorithm.iterations == 10
    assert algorithm.distance_fn is mock_distance_fn
def test_create_algorithm_creates_hybrid_algorithm_correctly():
    algorithm = forcelayout._create_algorithm(
        dataset=dataset,
        algorithm=forcelayout.Hybrid,
        iterations=10,
        hybrid_remainder_layout_iterations=11,
        hybrid_refine_layout_iterations=12,
        sample_set_size=3)
    assert type(algorithm) is forcelayout.Hybrid
    assert len(algorithm.nodes) == len(dataset)
    assert algorithm.sample_layout_iterations == 10
    assert algorithm.remainder_layout_iterations == 11
    assert algorithm.refine_layout_iterations == 12
    assert algorithm.random_sample_size == 3
def test_create_algorithm_creates_neighbour_sampling_algorithm_correctly():
    algorithm = forcelayout._create_algorithm(
        dataset=dataset,
        algorithm=forcelayout.NeighbourSampling,
        iterations=10,
        neighbour_set_size=3,
        sample_set_size=2,
        distance=mock_distance_fn)
    assert type(algorithm) is forcelayout.NeighbourSampling
    assert len(algorithm.nodes) == len(dataset)
    assert algorithm.iterations == 10
    assert algorithm.neighbour_set_size == 3
    assert algorithm.sample_set_size == 2
    assert algorithm.distance_fn is mock_distance_fn
def test_create_algorithm_creates_hybrid_algorithm_correctly_no_params():
    algorithm = forcelayout._create_algorithm(dataset=dataset,
                                              algorithm=forcelayout.Hybrid)
    assert type(algorithm) is forcelayout.Hybrid
    assert len(algorithm.nodes) == len(dataset)
def test_create_algorithm_creates_spring_force_algorithm_correctly_no_params():
    algorithm = forcelayout._create_algorithm(
        dataset=dataset, algorithm=forcelayout.SpringForce)

    assert type(algorithm) is forcelayout.SpringForce
    assert len(algorithm.nodes) == len(dataset)