def nd2(p, k):
    assert is_prime(p) and p > 2
    assert k >= 1

    q = p**k
    G = gbc(GF(q))

    # REMARK: missing frist layer
    second_layer = []
    for node in G.nodes():
        if G.degree()[node] == q:
            second_layer.append(node)
    third_layer = []
    for node in G.nodes():
        if G.degree()[node] == q + 1:
            third_layer.append(node)
    kind_table = {}
    for node in G.nodes():
        if node in second_layer:
            kind_table[node] = 'second'
        elif node in third_layer:
            kind_table[node] = 'third'
        else:
            raise Exception

    removed_third = []
    for n in G.neighbors(second_layer[0]):
        if n in third_layer:
            removed_third.append(n)
    G.remove_nodes_from(removed_third)
    G.remove_node(second_layer[0])

    return G
Beispiel #2
0
def nd2(p, k):
    assert is_prime(p) and p > 2
    assert k >= 1

    q = p**k
    G = gbc(GF(q))

    # REMARK: missing frist layer
    second_layer = []
    for node in G.nodes():
        if G.degree()[node] == q:
            second_layer.append(node)
    third_layer = []
    for node in G.nodes():
        if G.degree()[node] == q + 1:
            third_layer.append(node)
    kind_table = {}
    for node in G.nodes():
        if node in second_layer:
            kind_table[node] = 'second'
        elif node in third_layer:
            kind_table[node] = 'third'
        else:
            raise Exception

    removed_third = []
    for n in G.neighbors(second_layer[0]):
        if n in third_layer:
            removed_third.append(n)
    G.remove_nodes_from(removed_third)
    G.remove_node(second_layer[0])

    return G
def nd2_plus(p, k):
    assert is_prime(p)
    assert k >= 1

    q = p**k
    G = gbc(GF(q))

    for node in G.nodes():
        if G.degree()[node] == q:
            G.remove_node(node)
            break

    return G
Beispiel #4
0
def nd2_plus(p, k):
    assert is_prime(p)
    assert k >= 1

    q = p**k
    G = gbc(GF(q))

    for node in G.nodes():
        if G.degree()[node] == q:
            G.remove_node(node)
            break

    return G
def nd2(p, k):
    assert is_prime(p)
    assert k >= 1

    q = p**k
    G = gbc(GF(q))

    for node in G.nodes():
        if G.degree()[node] == q:
            G.remove_nodes_from(G.neighbors(node))
            G.remove_node(node)
            break

    return G
Beispiel #6
0
def nd2(p, k):
    assert is_prime(p)
    assert k >= 1

    q = p**k
    G = gbc(GF(q))

    for node in G.nodes():
        if G.degree()[node] == q:
            G.remove_nodes_from(G.neighbors(node))
            G.remove_node(node)
            break

    return G
def nd2(p, k):
    assert is_prime(p)
    assert k >= 1

    q = p**k
    G = gbc(GF(q))

    second_layer = []
    for node in G.nodes():
        if G.degree()[node] == q:
            second_layer.append(node)
    tmp = set(G.neighbors(second_layer[0]))
    for s in second_layer[1:]:
        tmp = tmp.intersection(G.neighbors(s))
    first_node = tmp.pop()
    assert tmp == set()
    third_layer = []
    for node in G.nodes():
        if G.degree()[node] == q + 1 and node != first_node:
            third_layer.append(node)
    kind_table = {}
    for node in G.nodes():
        if node == first_node:
            kind_table[node] = 'first'
        elif node in second_layer:
            kind_table[node] = 'second'
        elif node in third_layer:
            kind_table[node] = 'third'
        else:
            raise Exception

    removed_third = []
    for n in G.neighbors(second_layer[0]):
        if n in third_layer:
            removed_third.append(n)
    G.remove_nodes_from(removed_third)
    G.remove_node(second_layer[0])
    G.remove_node(G.neighbors(second_layer[1])[0])

    return G
Beispiel #8
0
def nd2(p, k):
    assert is_prime(p)
    assert k >= 1

    q = p**k
    G = gbc(GF(q))

    second_layer = []
    for node in G.nodes():
        if G.degree()[node] == q:
            second_layer.append(node)
    tmp = set(G.neighbors(second_layer[0]))
    for s in second_layer[1:]:
        tmp = tmp.intersection(G.neighbors(s))
    first_node = tmp.pop()
    assert tmp == set()
    third_layer = []
    for node in G.nodes():
        if G.degree()[node] == q + 1 and node != first_node:
            third_layer.append(node)
    kind_table = {}
    for node in G.nodes():
        if node == first_node:
            kind_table[node] = 'first'
        elif node in second_layer:
            kind_table[node] = 'second'
        elif node in third_layer:
            kind_table[node] = 'third'
        else:
            raise Exception

    removed_third = []
    for n in G.neighbors(second_layer[0]):
        if n in third_layer:
            removed_third.append(n)
    G.remove_nodes_from(removed_third)
    G.remove_node(second_layer[0])
    G.remove_node(G.neighbors(second_layer[1])[0])

    return G