<jupyter_start><jupyter_text>test(10,[(1, -6), (5, 7), (5, -3), (-2, 3), (2, -1), (7, 3), (0, -5), (-3, 2), (-5, -10), (-5, -4)]) sample = [(5, 0), (1, -4), (0, 0), (9, 12), (-3, -9), (-1, -14), (6, -9), (-7, 8), (-3, -8), (-8, 1), (-14, 10), (11, 6), (-4, 11), (7, 7)]walls_with = generate_walls_with_sample(sample)walls = generate_rival_dict(walls_with).keys()print(list(walls))world = generate_neighborhoods_from_walls(walls) sample = [(1, -6), (5, 7), (5, -3), (-2, 3), (2, -1), (7, 3), (0, -5), (-3, 2), (-5, -10), (-5, -4)]walls_with = generate_walls_with_sample(sample)walls = generate_rival_dict(walls_with).keys()print(list(walls))world = generate_neighborhoods_from_walls(walls)<jupyter_code>sorted([1,2,1,3])
def generate_k_neighborhood_dict(k, world_with_orders):
    k_dict = {}
    for land,order in world_with_orders:
        k_neighborhood = tuple(sorted(order[:k]))
        if k_neighborhood in k_dict:
            k_dict[k_neighborhood].append(land)
        else:
            k_dict[k_neighborhood] = [land]
    
    print(f"The total number of {k}-neighborhoods is {len(k_dict)}.")
    return k_dict
sample = [(1, -6), (5, 7), (5, -3), (-2, 3), (2, -1)]
world = generate_neighborhoods_with_nearness(sample, show_plot=True)
k_dicts = []
for k in range(len(sample)):
    k_dicts.append(generate_k_neighborhood_dict(k, world))
[{key: len(k_dict[key]) for key in k_dict} for k_dict in k_dicts]
def generate_k_neighborhoods(sample, k, bound=False, show_plot=False):
    world = generate_neighborhoods_with_nearness(sample, show_plot=show_plot)
    k_dict = generate_k_neighborhood_dict(k, world)
    print(f"The numbers of neighborhoods for each {k}-neighborhood are as follows:")
    print({key: len(k_dict[key]) for key in k_dict})
    return [world, k_dict]
k_world = generate_k_neighborhoods([(1, -6), (5, 7), (5, -3), (-2, 3)], 2)<jupyter_output><empty_output>
StarcoderdataJupyterStructuredCleanDedup