This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
r""" | |
Link class | |
""" | |
#***************************************************************************** | |
# Copyright (C) 2014 | |
# | |
# Distributed under the terms of the GNU General Public License (GPL) | |
# http://www.gnu.org/licenses/ | |
#***************************************************************************** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def seifert_circles(self, oriented_gauss_code): | |
self.oriented_gauss_code = oriented_gauss_code | |
x = self.PD_code_ogc(self.oriented_gauss_code) | |
s = [[None for i in range(4)] for i in range(len(x))] | |
for i in range(len(x)): | |
s[i][0] = 'entering' | |
s[i][2] = 'leaving' | |
if self.oriented_gauss_code[1][i] == '-': | |
s[i][1] = 'leaving' | |
s[i][3] = 'entering' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#whatever is the crossing one should give the sign for that first | |
#the order of the sign is as per the ordering of the crossings as in the gauss code | |
#so for example if the gauss code is 1 -3 2 -1 3 -2 then the order of the sign of the crossings is | |
#sign of crossing 1 then 3 then at 2 and so on and so forth. | |
def PD_code_ogc(self, oriented_gauss_code): | |
self.oriented_gauss_code = oriented_gauss_code | |
gc = self.oriented_gauss_code[0] | |
gc_sign = self.oriented_gauss_code[1] | |
l = [0 for i in range(len(gc))] | |
for i in range(len(gc)): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def final_seifert_circles(self): | |
sc = self.seifert_circles() | |
regions = self.regions() | |
y = self.PD_code() | |
while True: | |
x = deepcopy(y) | |
q1 = deepcopy(regions) | |
q = [[[],[]] for i in range(len(regions))] | |
for i in range(len(regions)): | |
for j in range(len(regions[i])): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def final_seifert_circles(self): | |
sc = self.seifert_circles() | |
regions = self.regions() | |
y = self.PD_code() | |
while True: | |
q = [[[],[]] for i in range(len(regions))] | |
for i in range(len(regions)): | |
for j in range(len(regions[i])): | |
if regions[i][j] < 0: | |
q[i][0].append(regions[i][j]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sage: L = link.Link(oriented_gauss_code = [[-1, +2, -3, 4, +5, +1, -2, +6, +7, 3, -4, -7, -6,-5],['-','-','-','-','+','-','+']]) | |
sage: L.regions() | |
[[4, -11], | |
[2, -7], | |
[6, -1], | |
[13, 9], | |
[-4, -10, -12], | |
[-8, -2, -6, -14], | |
[10, -3, 8, -13], | |
[14, -5, 12, -9], |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def remove_regions(self): | |
y = self.PD_code() | |
x = deepcopy(y) | |
sc = self.seifert_circles() | |
regions = self.regions() | |
q1 = deepcopy(regions) | |
#splitting into positive and negative for each region | |
q = [[[],[]] for i in range(len(regions))] | |
for i in range(len(regions)): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def add(self): | |
y = self.subtract() | |
<some other code> | |
if do something: | |
y = None | |
else: | |
return y |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def final(self): | |
x = self.PD_code() | |
L = Link(PD_code = x) | |
y = L.remove_regions() | |
while True: | |
if y == 'No more regions': | |
break | |
else: | |
L = Link(PD_code = y) | |
y = L.remove_regions() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def remove_regions(self): | |
#self.oriented_gauss_code = oriented_gauss_code | |
z = self.PD_code() | |
x = deepcopy(z) | |
#x = self.PD_code_ogc(self.oriented_gauss_code) | |
#sc = self.seifert_circles(self.oriented_gauss_code) | |
sc = self.seifert_circles() | |
#print sc | |
#regions = self.regions(self.oriented_gauss_code) | |
regions = self.regions() |