示例#1
0
def cantor_plot():
    from general import pairing_function_plot

    points = [cantor_unpairing(i) for i in range(25)]
    arrows = [
        [0, 0, 1, 0],
        [1, 0, 0, 1],
        [0, 1, 2, 0],
        [2, 0, 1, 1],
        [1, 1, 0, 2],
        [0, 2, 3, 0],
        [3, 0, 2, 1],
        [2, 1, 1, 2],
        [1, 2, 0, 3],
        [4, 0, 3, 1],
        [3, 1, 2, 2],
        [2, 2, 1, 3],
        [1, 3, 0, 4],
        [4, 1, 3, 2],
        [3, 2, 2, 3],
        [2, 3, 1, 4],
        [4, 2, 3, 3],
        [3, 3, 2, 4],
    ]

    return pairing_function_plot(points, arrows)
示例#2
0
文件: peter.py 项目: drhagen/pairing
def peter_plot():
    from general import pairing_function_plot

    points = [peter_unpairing(i) for i in range(16)]
    arrows = [
        [0, 0, 1, 0],
        [1, 0, 0, 1],
        [0, 1, 1, 1],
        [1, 1, 2, 0],
        [2, 0, 0, 2, {
            'connectionstyle': 'arc3,rad=-0.1'
        }],
        [0, 2, 2, 1],
        [2, 1, 1, 2],
        [1, 2, 2, 2],
        [2, 2, 3, 0],
        [3, 0, 0, 3, {
            'connectionstyle': 'arc3,rad=-0.1'
        }],
        [0, 3, 3, 1],
        [3, 1, 1, 3, {
            'connectionstyle': 'arc3,rad=-0.1'
        }],
        [1, 3, 3, 2],
        [3, 2, 2, 3],
        [2, 3, 3, 3],
    ]

    return pairing_function_plot(points, arrows)
示例#3
0
文件: box.py 项目: drhagen/pairing
def box_plot():
    from general import pairing_function_plot

    points = [box_unpairing(3, 2, i) for i in range(6)]
    arrows = [
        [0, 0, 1, 0],
        [1, 0, 2, 0],
        [2, 0, 0, 1],
        [0, 1, 1, 1],
        [1, 1, 2, 1],
    ]

    return pairing_function_plot(points, arrows)
示例#4
0
文件: box.py 项目: drhagen/pairing
def bad_plot():
    from general import pairing_function_plot

    points = [[0, 0], [1, 0], [2, 0], [3, 0]]
    arrows = [
        [0, 0, 1, 0],
        [1, 0, 2, 0],
        [2, 0, 3, 0],
        [3, 0, 4, 0],
    ]

    fig = pairing_function_plot(points, arrows)

    ax = fig.axes[0]

    extra_points = [[x, y + 1] for x in range(4) for y in range(3)]
    ax.scatter(*zip(*extra_points),
               linestyle="None",
               marker='o',
               color='yellow')

    return fig
示例#5
0
def szudzik_plot():
    from general import pairing_function_plot

    points = [szudzik_unpairing(i) for i in range(16)]
    arrows = [
        [0, 0, 1, 0],
        [1, 0, 0, 1],
        [0, 1, 1, 1],
        [1, 1, 2, 0],
        [2, 0, 2, 1],
        [2, 1, 0, 2],
        [0, 2, 1, 2],
        [1, 2, 2, 2],
        [2, 2, 3, 0],
        [3, 0, 3, 1],
        [3, 1, 3, 2],
        [3, 2, 0, 3],
        [0, 3, 1, 3],
        [1, 3, 2, 3],
        [2, 3, 3, 3],
    ]

    return pairing_function_plot(points, arrows)