sagemath / sage

Main repository of SageMath
https://www.sagemath.org
Other
1.31k stars 450 forks source link

Webs and spiders #31209

Open BruceWestbury opened 3 years ago

BruceWestbury commented 3 years ago

The terminology of webs and spiders is due to Kuperberg. Here we implement webs as planar graphs with boundary.

CC: @tscrim @mantepse

Component: combinatorics

Keywords: planar graph

Author: Bruce Westbury

Branch/Commit: public/ticket-31209 @ 5a49b8e

Issue created by migration from https://trac.sagemath.org/ticket/31209

BruceWestbury commented 3 years ago

Branch: u/Bruce/spider

mantepse commented 3 years ago
comment:2

Wonderful!

See also #25901 and #25173


New commits:

9332771Moved spherical_spider.py to combinat directory
mantepse commented 3 years ago

Commit: 9332771

7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 3 years ago

Branch pushed to git repo; I updated commit sha1. New commits:

a870d6aDid some debugging
7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 3 years ago

Changed commit from 9332771 to a870d6a

7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 3 years ago

Changed commit from a870d6a to e5051e7

7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 3 years ago

Branch pushed to git repo; I updated commit sha1. New commits:

5a61bc6Added faces, is_separable methods
6d6ba0fCorrected `_repr_` for closed diagrams
e5051e7All existing doctests pass.
7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 3 years ago

Changed commit from e5051e7 to 1f99737

7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 3 years ago

Branch pushed to git repo; I updated commit sha1. New commits:

3be0b4aAdded doctests
ce172c4Added is_simple
b402a8fAdded method plot for drawing a diagram.
1f99737Corrected doctest
7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 3 years ago

Branch pushed to git repo; I updated commit sha1. New commits:

8e1943bCreated _layout for plot and _latex_
d08f08bRemoved ClonableElement
9d0a09dChanged to richcmp
7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 3 years ago

Changed commit from 1f99737 to 9d0a09d

7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 3 years ago

Branch pushed to git repo; I updated commit sha1. New commits:

1274e5fDebugged from_permutation
a5bd8c6Improved coverage, fixed errors reported by patchbot
7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 3 years ago

Changed commit from 9d0a09d to a5bd8c6

fchapoton commented 3 years ago
comment:9

WTF

if not π in BaxterPermutations():

Please avoid unicode identifiers.

fchapoton commented 3 years ago
comment:10

Sorry for the "wtf", do not take it personally.

But please, please, do not do that. Let us keep the code identifiers ASCII.

Some comments on the question here:

https://stackoverflow.com/questions/2649544/unicode-identifiers-in-python

fchapoton commented 3 years ago
comment:11

by the way, Gretzler is Getzler

BruceWestbury commented 3 years ago
comment:12

Replying to @fchapoton:

by the way, Gretzler is Getzler

Thanks for spotting that mistake.

BruceWestbury commented 3 years ago
comment:13

Replying to @fchapoton:

Sorry for the "wtf", do not take it personally.

No problem with WTF

But please, please, do not do that. Let us keep the code identifiers ASCII.

I don't have strong views on this and will change this.

Some comments on the question here:

https://stackoverflow.com/questions/2649544/unicode-identifiers-in-python

I would still like to understand why this is bad practice. The discussion in the link is interesting and has some gotchas I didn't know about. Using unicode for function names as in the discussion would get a WTF from me. I also would not think of using a unicode identifier outside of a mathematical context.

I have simply used a greek letter as a local identifier following standard practice in mathematical literature. My understanding is that this is fine in a notebook.

7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 3 years ago

Branch pushed to git repo; I updated commit sha1. New commits:

1bb2424Removed unicode identifier, started on improving drawing edges.
7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 3 years ago

Changed commit from a5bd8c6 to 1bb2424

7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 3 years ago

Changed commit from 1bb2424 to d88ac28

7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 3 years ago

Branch pushed to git repo; I updated commit sha1. New commits:

6c199bcFinished _stitch and implements polygon
2fc92a9Fixed doctests to use polygon
d88ac28All tests passed!
fchapoton commented 3 years ago
comment:16

failing doctest, and pyflakes plugin not green

7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 3 years ago

Branch pushed to git repo; I updated commit sha1. New commits:

bfdcea0Merge branch 'develop' into spider
1cfa02aCompleted ccoverage and fixed pyflakes
7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 3 years ago

Changed commit from d88ac28 to 1cfa02a

BruceWestbury commented 3 years ago
comment:18

Replying to @fchapoton:

failing doctest, and pyflakes plugin not green

The pyflakes is now green.

All tests passed! when I ran them locally. The bot says four tests failed but they seem to be elsewhere.

fchapoton commented 3 years ago
comment:19

sorry, but I am not going to make a full review

arxiv links could use the arxiv role :arxiv:`....`

BruceWestbury commented 3 years ago
comment:20

Replying to @fchapoton:

sorry, but I am not going to make a full review

I am not expecting a positive review as it does not yet do the calculation I want it for. I paused here because i) I needed a break and ii) Travis said it was better to break up a large project to make life easier for the reviewer.

I am now ready to continue with this project.

tscrim commented 3 years ago
comment:21

Some quick comments:

7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 3 years ago

Changed commit from 1cfa02a to abdbf06

7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 3 years ago

Branch pushed to git repo; I updated commit sha1. New commits:

26a74ddPreliminary corrections
abdbf06Removed `_element_constructor_` so SphericalSpider is no longer callable.
7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 3 years ago

Changed commit from abdbf06 to 8d8de0a

7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 3 years ago

Branch pushed to git repo; I updated commit sha1. New commits:

8d8de0aAdded file to module_list.rst and edited entry in combinat/all.py
BruceWestbury commented 3 years ago
comment:24

Thank you Travis. I think your comments have been more or less dealt with.

7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 3 years ago

Changed commit from 8d8de0a to 31122ad

7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 3 years ago

Branch pushed to git repo; I updated commit sha1. New commits:

5364d6fStarted work on Boundary and Boundaries classes
e59e87dAdded Parent class Boundaries and Element class Boundary
f1ce071Removed Vector, Boundary, Boundaries
eaf7a86Removed Boundary and started work on doctests
64b81aeWorked on doctests
319c26bMore work on doctests
1bc8803Added preprocessing to SphericalSpider
c989010Changed Strand from NamedTuple to namedtuple
31122adAll tests passed!
BruceWestbury commented 3 years ago
comment:26

I have now implemented SphericalSpider as a Parent parametrised by the boundary values.

There are two issues that seem to me to be "work arounds". One is that I have both Strand and halfedge. I can almost do away with halfedge and work with "is" and "equal by value". My best guess at the problem I encountered is that dictionaries don't work with "is". I have not tried overwriting hash. The other is that I have included four methods of SphericalSpider as static methods (namely, vertex, loop, empty, polygon). This seems clumsy.

7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 3 years ago

Changed commit from 31122ad to cb66fa7

7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 3 years ago

Branch pushed to git repo; I updated commit sha1. New commits:

ebbc703Removed halfedge and Strand from all.py
7a0b180Added the static method from_Guass_code
61d9c5bMinor changes
cb66fa7Implemented linear extension of rotate
7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 3 years ago

Branch pushed to git repo; I updated commit sha1. New commits:

c7881d8Started implementing WebAlgebra
0c4db0dAdded replace_linear (without tests)
a0b91e1Added more methods for skein relations (without tests)
da81cd7Added methods one_basis, product_on_basis, U to WebAlgebra
4d4c111Added homomorphism from braid group to Temperley-Lieb algebra
5a2ef54Added from_diagram
bf64788Debugged from_diagram
7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 3 years ago

Changed commit from cb66fa7 to bf64788

BruceWestbury commented 3 years ago
comment:29

I have been making progress with adding functionality. In particular, you can almost calculate the Jones polynomial. However it seems to me that the code is getting unwieldy and I could do with some advice on making this more organised and adding more structure. For example, the next stage is to work with quotients given by skein relations.

7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 3 years ago

Changed commit from bf64788 to eed5b86

7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 3 years ago

Branch pushed to git repo; I updated commit sha1. New commits:

7739575Added FreeLinearSpider
41a2bdbWorked on doctests
c3ab274Started adding skein relations for rank two Lie algebras
031c5e6A2 relations completed
eed5b86B2 and G2 skein relations added
7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 3 years ago

Changed commit from eed5b86 to 5934f86

7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 3 years ago

Branch pushed to git repo; I updated commit sha1. Last 10 new commits:

3c5353aImproved doctests and check for crossings
f666282Corrected search to check embedding preserves data on halfedges
cedb49eAdded doctest for apply_linear
a2c8056Added doctest for apply_rule
77515f1Corrected canonical()
28f415bGot doctest for simplify to work
34e0bf6Improved doctets
2d82e0cRevise normalize
f019cf9Simplified and corrected normalise
5934f86Simplfy passes doctest
7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 3 years ago

Changed commit from 5934f86 to f09f0c2

7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 3 years ago

Branch pushed to git repo; I updated commit sha1. New commits:

5c6dedfThrashing around
a79a13dRemoved the class FreeSphericalSpider
1f1d4d5Finished from_gauss_code
dc31cb0Made cp and b immutable
b312940Made e immutable
089f14fFinished making cp and e immutable
f09f0c2More doctests (simplify)
7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 3 years ago

Branch pushed to git repo; I updated commit sha1. New commits:

f3d2b4aPasses pycodestyle
7ed8c4ca-6d56-4ae9-953a-41e42b4ed313 commented 3 years ago

Changed commit from f09f0c2 to f3d2b4a