Пример #1
0
def open_string_alexander(crossings):
    crossings_copy = pickle.loads(pickle.dumps(crossings))
    loose = []
    for c in crossings_copy:
        for i in range(4):
            if c.adjacent[i] is None:
                loose.append(c.crossing_strands()[i])
    connect_loose_strands(crossings_copy, loose[0], loose[1])
    K = Link(crossings_copy)
    K.simplify(mode='level')
    return K.alexander_polynomial() if len(K) > 0 else 1
Пример #2
0
def open_string_evaluation(crossings, function, simplify='level'):
    crossings_copy = pickle.loads(pickle.dumps(crossings))
    loose = []
    for c in crossings_copy:
        for i in range(4):
            if c.adjacent[i] is None:
                loose.append(c.crossing_strands()[i])
    connect_loose_strands(crossings_copy, loose[0], loose[1])
    K = Link(crossings_copy)
    if simplify:
        K.simplify(mode=simplify)
    if len(K) > 0:
        return function(K)