Javascript editor to manipulate knot diagrams

390 views
Skip to first unread message

Jason Suagee

unread,
Mar 4, 2014, 7:25:59 AM3/4/14
to sage...@googlegroups.com

Hello Sage mentors and fellow posters,


My name Jason Suagee and I'm a 4th year PhD student in mathematics at George Washington University in Washington DC. I am primarily interested in working on a javascript editor for manipulating knot diagrams as part of the knot theory project. My background in knot theory comes mostly from Rolfsen's classical Knots and Links book, which was the primary textbook for a two semester course in knot theory that I am currently taking this academic year.


In my own work I focus on symmetric combinatorial decompositions of 3-manifolds, which is a cross between low dimensional topology and topological graph theory. Where this intersects with knot theory is that much of knot theory is actually used as a tool to describe 3-manifolds. In particular, one of the most useful methods to present a 3-manifold is by performing Dehn surgery on the components of a link in S^3. So manipulation of link diagrams can be a big part of what low dimensional topologists do on a regular basis.

But manipulating a link diagram on paper can be a real headache, as I have found out this year. It would be beneficial if there was a graphical way by computer to do these manipulations. I have thought out a rough framework with which to approach this design problem and will share it in the post below.


By the way, I have been a Sage user for the past 4 years and love it! I was quite happy to sport a Sage sticker at the joint math meeting this year in Baltimore.


Best,

Jason

jsu...@gmail.com

Jason Suagee

unread,
Mar 4, 2014, 7:38:37 AM3/4/14
to sage...@googlegroups.com

These are just some thoughts on the direction the javascript editor might go:


We can represent link diagrams by signed planar graphs where the sign on the edges gives us the crossing information (as depicted in http://en.wikipedia.org/wiki/Knots_and_graphs). We could then fill in the arc components of the link by using Bezier curves. An advantage of using this framework is that we can leverage existing planar graph drawing algorithms that have working computer implementations.


We can enable the user to perform isotopy moves on the link diagram by using the vertices of the underlying planar graph as control points to click and drag. There are several other parameters that I can think of that can be manipulated, but I won't flood this post with all of them.


Reidemeister moves change the underlying graph, so they have to be treated differently from isotopy of the diagram. We would need a way of selecting the arc components on which we are performing a Reidemeister move (For more complex diagrams this might involve grouping 2 or more arc components together so that they act as one arc component during the move).


Also, if we want to be able to perform calculations about 3-manifolds, we have to be able to add and/or remove link components to the diagram which might drastically change the underlying graph. We also would want to keep track of surgery coefficients associated to link components, which involves computing linking numbers.


[An interesting idea would be to create the data structure for the link diagram so that it is actually a record of all of the moves performed (isotopy, Reidemeister, etc..), sort of like a word processor document. The user could undo moves because there would be a history included in the data structure.]


If additional time permits:

Might want to create useful methods for creating knots, like ways to construct satellites of knots or cables of knots. Maybe adapt this so that the user can also work with braid representations of knots and links. There is also a move called the Rolfsen Twist, which I would like to implement. A picture of it can be found in this google book link:


http://books.google.com/books?id=ahLKzRUTBbUC&pg=PA162&lpg=PA162&dq=rolfsen+twist&source=bl&ots=5rJU2Jv_AK&sig=-QRvjTVqX7H8nSm6SZYv_GEfaJE&hl=en&sa=X&ei=xMQVU_fCHOXa2QXMzIGoCQ&ved=0CCkQ6AEwAA


Some things that would be good to set up:

#connected components

Fundamental group presentations (not always a useful invariant, but it's easy to get a presentation)

Linking numbers

Maybe someone working on the other end of the project could implement methods to calculate the Torsion invariants and the Alexander Polynomial in the case where the diagram is just a knot.

Additionally, the Jone's polynomial can be calculated directly from the Tutte polynomial of the underlying graph (although this is algorithmically hard).


Possible extensions:

This all might be later extended to become a graphical Kirby Calculus tool, but that is just a thought at this point.

Miguel Angel Marco

unread,
Mar 4, 2014, 10:13:38 AM3/4/14
to sage...@googlegroups.com
Welcome.

I really like your ideas, and it seems clear that you have done a lot of thinking on the subject. What i had in mind was also a 3d editor (knotplot style), but you have convinced me that working with the planar projections themselves can also be useful. 

Did you take a look to knotscape? Dima did a patched version that runs ok in moder systems, together with a graphical editor. It is mentioned in this thread:

I think that what you had in mind was something far more complete than that, but maybe it can serve as a starting concept. I specially like the idea of making the curves look smooth. There is an old program called knot (http://www.math.kobe-u.ac.jp/~kodama/knot.html) that does that, although it is so old that some of its dependencies are no longer available in current distros. I have not been able to compile it, but i remember using it in the past. It is installed in some older versions of the knoppixmath/mathlibre live dvd.


The only problem i see is that we would need another mentor, or co-mentor, since i don't have the needed experience with javascript. Maybe Volker? 

Jason Suagee

unread,
Mar 5, 2014, 4:14:13 AM3/5/14
to sage...@googlegroups.com

I attempted to get knotscape working, but the program hung when I clicked on one of the menu buttons (this might be an issue with Tcl or Tk). I was able to check out the link drawing utility linkscape, so I have a good idea of how that works. Since knotscape hung I don't know how it plots a knot, is it a 3D representation (similar to that of say Mathematica). In order to get knotscape to work with my linux distro I would probably have to downgrade Tcl and Tk to an older version, which I don't particularly want to get into right now.


One of the knot theorists at my university, Alex Shumakovitch, expressed to me yesterday his desire for a particular kind of knot diagram manipulation interface that was more natural, or closer to how a person might manipulate an actual knot. While manipulating a knot diagram one often combines many Reidemeister moves into one, for instance when pulling an arc component over a complicated part of the knot. What he was saying is that it would be neat if you could do all of this manipulation on a computer without chugging through individual Reidemeister moves. I can post a scanned picture if this is unclear which will illustrate what I mean when I am at the university tomorrow.


If you try to manipulate an actual real knot though you'll quickly run into a problem: parts of the knot become very complicated, a lot goes on in a small amount of space whereas other parts of the knot may not have anything going on. If you're manipulating a diagram on a computer you would want to be able to resize/readjust the diagram to create more room for these complicated parts.


While I had originally conceived of something 2D, Alex gave me the impression that what he would like would be more useful. So I thought a bit about how his idea might be made to work:


It would be pretty hard to do. You could plot the knot using OpenGL, or WebGL since most people use Sage through the notebook interface which runs on a browser. Instead of allowing a full 3D environment with no preferred viewing angle, which could end up being disorienting for the user, you could restrict the knot to a bounding box that is a thickened plate (say if your looking at it from the point (1,1,1), the area where the knot would be depicted would be in {(x,y,z) : -1 < x < 1, -1 < y < 1, -0.1 < z < 0.1} ). Below, I'm going to call this kind of depiction of a knot a “thickened planar drawing”.


I haven't been able to come up with a good way of emulating physical knot manipulation yet, although I haven't had much time to think about it. It would have to be computationally feasible, so that probably rules out schemes which involve a lot of computational geometry (like intersection checking to make sure components of the link don't pass each other and stay reasonably spaced out). There is a whole area of knot theory called physical knot theory which might contain something useful?


Perhaps we could use the fact that the knot would be a thickened planar diagram, since it lies in a thickened plate, to reduce the amount of computational geometry that needs to be performed.


The other part of the picture is how you resize/readjust the drawing after you have performed a manipulation. All I can think of at the moment is that you could look at a planar knot diagram for the drawing (just project down into the x,y-plane). You could then use a force-directed graph drawing algorithm to re-render/adjust the underlying signed planar graph that I mentioned in the last post. The graph then could be used to re-render the knot diagram, which can be translated back into a thickened planar drawing.


If we pursued this strategy of a 3D representation I don't think that any of the other things that I said, like linking numbers and surgery coefficients, could be simultaneously accomplished over one summer by one person. According to the scheme it's conceptually easy to recover a planar knot diagram from the 3D drawing, so another programmer could work on the project from that perspective (calculating everything from some planar diagram representation), while another person works on building a 3D manipulation tool.


I acknowledge that this direction for your project might be too involved for one summer. I think it might be possible to do though. Let me know what you think. I might not respond till Thursday because I teach back to back all day today and might be pretty tired when I get home.

Miguel Angel Marco

unread,
Mar 5, 2014, 4:58:56 AM3/5/14
to sage...@googlegroups.com
Take a look at knotplot. It uses an interactive 3d window. It is proprietary software, but the methods are described in the author's thesis:
In general, it is a  nice lecture about the subject of implementing knot theory into a software. Chapter 7 describes his methods to "relax" a knot in space. It actually works quite well. 


El martes, 4 de marzo de 2014 13:25:59 UTC+1, Jason Suagee escribió:

Dima Pasechnik

unread,
Mar 5, 2014, 6:14:39 AM3/5/14
to sage...@googlegroups.com
On 2014-03-05, Jason Suagee <jsu...@gmail.com> wrote:
>
>
> I attempted to get knotscape working, but the program hung when I clicked
> on one of the menu buttons (this might be an issue with Tcl or Tk). I was
> able to check out the link drawing utility linkscape, so I have a good idea
> of how that works. Since knotscape hung I don't know how it plots a knot,
> is it a 3D representation (similar to that of say Mathematica). In order to
> get knotscape to work with my linux distro I would probably have to
> downgrade Tcl and Tk to an older version, which I don't particularly want
> to get into right now.

Would you mind providing more details on what exactly goes wrong, with
Tcl/Tk vesrions involved? (perhaps by opneing an issue on the github
repo https://github.com/dimpase/knotscap)

[...]
>
> While I had originally conceived of something 2D, Alex gave me the
> impression that what he would like would be more useful. So I thought a bit
> about how his idea might be made to work:
>
>
> It would be pretty hard to do. You could plot the knot using OpenGL, or
> WebGL since most people use Sage through the notebook interface which runs
> on a browser.

nowadays these things are normally done using higher level interfaces to WebGL,
such as tree.js


Jason Grout

unread,
Mar 5, 2014, 8:10:51 AM3/5/14
to sage...@googlegroups.com
On 3/5/14, 5:14, Dima Pasechnik wrote:
> nowadays these things are normally done using higher level interfaces to WebGL,
> such as tree.js

Do you mean three.js?

Just FYI, we are developing a low-level three.js<->python bridge that we
plan to integrate into the sage 3d plotting system. Our (rough) work is
here: https://github.com/jasongrout/pythreejs, and I've been posting
examples to the sage-cell google group.

Regardless of whether you use pythree.js or not, I think using the
IPython comm/widget architecture would maybe be a good idea---changes to
the knot editor could easily be reflected in the python world, and vice
versa.

Thanks,

Jason

Miguel Angel Marco

unread,
Mar 5, 2014, 5:44:21 PM3/5/14
to sage...@googlegroups.com
Does it mean that it would be possible to edit the knot on the notebook (or cell) and update the sage object on real time? Or is it more like the graph editor, where there is a button to "save" the status of the editor into the sage object?

Jason Grout

unread,
Mar 5, 2014, 5:46:32 PM3/5/14
to sage...@googlegroups.com
On 3/5/14, 16:44, Miguel Angel Marco wrote:
> Does it mean that it would be possible to edit the knot on the notebook
> (or cell) and update the sage object on real time? Or is it more like
> the graph editor, where there is a button to "save" the status of the
> editor into the sage object?


It would be pretty straightforward to do it either way.

Jason

Jason Suagee

unread,
Mar 6, 2014, 2:10:49 PM3/6/14
to sage...@googlegroups.com

Nevermind, there was no bug in knotscape, I just forgot to read the tutorial. My apologies.

Jason Suagee

unread,
Mar 6, 2014, 2:11:10 PM3/6/14
to sage...@googlegroups.com

Robert Scharein’s method of smoothing the knot seems entirely reasonable to implement. What’s the legality of implementing his methods? Can we just borrow the techniques that he uses in his thesis?


Here’s more of a research question which I just thought of:

Regarding the bounding box check referred to on page 125, I wonder if in fact one could just use the Taxi-cab metric instead of the regular Euclidean distance to perform the collision avoidance calculations. Would the relaxation algorithm essentially run the same way (you might have to increase the number of beads to get it to work)? The Taxi-cab metric has the benefit that it is much easier to evaluate, which can allow you to have a lot more beads and get a smoother knot diagram. Scharein says that he got a speed increase of about five-fold by relying mostly on the bounding box method for collision avoidance.


Otherwise:

Push/Pull rockets described on page 130 could be used to interactively modify the diagram. The user would select a bead with the mouse and give it a push in a given direction. The diagram is 3 dimensional so how the user specifies the direction to move the bead would have to be worked out. However, if we could constrain the diagram to be mostly planar, then we could specify the direction by just pushing the mouse.


Also, there is some discussion on this mailing list of getting a Sage app working for tablets. Wouldn’t it be a nice idea to create a knot manipulation interface for a tablet that was touch based? The user could manipulate the knot with his fingers using the Push/Pull rockets idea.

Dima Pasechnik

unread,
Mar 6, 2014, 4:20:58 PM3/6/14
to sage...@googlegroups.com
On 2014-03-06, Jason Suagee <jsu...@gmail.com> wrote:
>
>
> Robert Scharein’s method of smoothing the knot seems entirely reasonable to
> implement. What’s the legality of implementing his methods? Can we just
> borrow the techniques that he uses in his thesis?

Why not? Does he claim a patent on that stuff?
It's another question whether it's legal to take someone's else
code and put it into Sage, or look at someone's else
code while doing a Sage implementation (these would depend
on the code's license). But ideas from published books/papers/theses
are pretty much up for grabs.

HTH.

Miguel Angel Marco

unread,
Mar 7, 2014, 3:52:49 AM3/7/14
to sage...@googlegroups.com


El jueves, 6 de marzo de 2014 20:11:10 UTC+1, Jason Suagee escribió:

Robert Scharein’s method of smoothing the knot seems entirely reasonable to implement. What’s the legality of implementing his methods? Can we just borrow the techniques that he uses in his thesis?


If it is not patented (which i am not sure about, but i have seen no patent claim at all in his website or software) we can do our own implementation based on his thesis. What we could not do is to make a derivative of his code; but if we don't have access to his source code, we wouldn't be doing a derivative work, just a reimplementation of the same ideas. 
 

Here’s more of a research question which I just thought of:

Regarding the bounding box check referred to on page 125, I wonder if in fact one could just use the Taxi-cab metric instead of the regular Euclidean distance to perform the collision avoidance calculations. Would the relaxation algorithm essentially run the same way (you might have to increase the number of beads to get it to work)? The Taxi-cab metric has the benefit that it is much easier to evaluate, which can allow you to have a lot more beads and get a smoother knot diagram. Scharein says that he got a speed increase of about five-fold by relying mostly on the bounding box method for collision avoidance.


Well, i guess the way to find out is to implement both and compare. But it seems reasonable that the taxi-cab metric would be useful to detect collisions too (although it is possible that in some cases the resulting relaxation doesn't look as "natural").
 

Otherwise:

Push/Pull rockets described on page 130 could be used to interactively modify the diagram. The user would select a bead with the mouse and give it a push in a given direction. The diagram is 3 dimensional so how the user specifies the direction to move the bead would have to be worked out. However, if we could constrain the diagram to be mostly planar, then we could specify the direction by just pushing the mouse.


knotplot already does that: once you have sketched the knot, go to the "dyn" tab and click "go", then the knot gets relaxed. If then you go to the "edit" tab (without unchecking the "go" button"), you can move the vertices and edges of the knot with the physical relaxation still running in real time.

Dima Pasechnik

unread,
Mar 7, 2014, 5:14:29 AM3/7/14
to sage...@googlegroups.com
On 2014-03-07, Miguel Angel Marco <miguel....@gmail.com> wrote:
>
>
> El jueves, 6 de marzo de 2014 20:11:10 UTC+1, Jason Suagee escribió:
>>
>> Robert Scharein’s method of smoothing the knot seems entirely reasonable
>> to implement. What’s the legality of implementing his methods? Can we just
>> borrow the techniques that he uses in his thesis?
>>
>
> If it is not patented (which i am not sure about, but i have seen no patent
> claim at all in his website or software) we can do our own implementation
> based on his thesis. What we could not do is to make a derivative of his
> code; but if we don't have access to his source code, we wouldn't be doing
> a derivative work, just a reimplementation of the same ideas.

I don't think we need to worry about violating a patent here.
No, really, there is no "practical" significance in this work.

Jason Suagee

unread,
Mar 9, 2014, 12:17:32 AM3/9/14
to sage...@googlegroups.com

Good that there is no possible legal issue.


So, I've been playing around with knotplot a bit, and have been looking at his thesis which explains it pretty well. There are a lot of options to play around with and I'm still trying to figure out most of them.


From my perspective, when it comes to visualization knotplot is really good at smoothing out knots and resizing/readjusting the complicated parts of the diagrams, as I referred to above. I think knot support in Sage should definitely incorporate these methods.


Editing a knot in knotplot can be pretty difficult though, at least as I experienced it. Most of the editing I was trying to do was with the push/pull rockets, where you can grab a node or a stick between nodes, and push it in some direction that you want that part of the knot to go. You can constrain the push force to lie in say the xy plane, or a single axis direction, and you can rotate the viewing orientation. Theoretically you can make any adjustments to the knot that you want by switching force directions, rotating the view as necessary, and stopping and starting the smoothing dynamics as often as needed, but its not intuitive or easy. When it comes to knot manipulation, my opinion is that knotplot is not actually a good substitute for old fashioned planar knot diagrams. Also, since everything is going on in 3D, I can see that it would be easy to loose track mid-process of what you were trying to do with the knot or link in the first place.


The only thing about planar knot diagrams is that on paper at least, you have to constantly erase and redraw your knot, and mistakes are easily made. Also, you don't have automatic smoothing and rearranging of complex parts that you get with knotplot.


I think you can combine both of these approaches though and produce a very good tool to manipulate knot diagrams (and interface to all the other calculation goodies that you need). The main idea I am considering is that you can restrict the knot drawing to be mostly planar (to be relatively near the xy-plane) by adding in an external force which compresses the knot into a region near the xy-plane. For instance a force with magnitude proportional to z^4 directed towards the xy-plane, which would keep the knot roughly within a squashed rectangular region that would look like this:


R: -20 < x < 20, -20 < y < 20, -1 < z < 1


If the user then wanted to do some manipulation on the knot, such as what would amount to a combination of Reidemeister 2 moves for instance, he could pull a piece of the knot out of the region R, apply a push/pull force with the mouse to the part of the knot he wished to move, lift it out of the region R, and then let it go when it had reached the place he wanted it to be. The affected part of the knot would then just fall back down into the region R, and the smoothing dynamics would do the rest.


(What I just wrote smooths under the rug a lot of user interface details, but its just a general idea.)


The diagram could also be made stable by basically making the thickness of the knot a large enough fraction of the height of the region R (in this case the height is 2, so if the thickness of the knot were say 2/3 the diagram would be stable).


There are some other benefits to this approach. It would be very easy to get a planar diagram (just project down into the xy-plane), and it would be easier to keep a step by step record of how the knot was rearranged during a manipulation process (also because of the ease of getting planar diagrams). It would also be fairly easy to convert other more compact representations of a knot into this form. You just have to specify a height function for points in the planar diagram.


I can start working on a proposal for this, but I just wanted to check if this sounds like something you would want, or if you have any suggestions that I should consider?

Dima Pasechnik

unread,
Mar 9, 2014, 5:07:49 AM3/9/14
to sage...@googlegroups.com
perhaps another interesting part might be to look at invariants
knotplot computes, such as Alexander polynomial, and ways to getting
them imported into Sage; as far as I remember, knotplot outputs tables
of coefficients of these polynomials; anything you would design should
produce Sage polynomials...



Miguel Angel Marco

unread,
Mar 9, 2014, 6:49:52 AM3/9/14
to sage...@googlegroups.com
That sounds great to me. In fact, that is pretty much what i had in mind. One more question: it could be a good idea to include some kind of force that avoids too vertical edges, since they would look like cusps in the plane projection. But that is a detail that could be perfectly figured out later.

Miguel Angel Marco

unread,
Mar 9, 2014, 6:53:27 AM3/9/14
to sage...@googlegroups.com
The backend class for links (where the methods to compute the invariants would be) whould probably be a separate project.

Jason Suagee

unread,
Mar 13, 2014, 12:25:18 PM3/13/14
to sage...@googlegroups.com
Just an update: 

I am preparing a proposal draft for this project. There have been a lot of details to consider and it is taking more time to put together than I originally thought. The draft should be ready in about two days at which point I will share it. By the way, who should I send it to?

Miguel Angel Marco

unread,
Mar 13, 2014, 4:22:07 PM3/13/14
to sage...@googlegroups.com
AFAIK you should write it on the google melange website.

Miguel Angel Marco

unread,
Mar 17, 2014, 9:23:31 AM3/17/14
to sage...@googlegroups.com
How is the proposal writing going? Amit Jamadagni is working on a proposal for the backend part. Maybe it could be a good idea if you two got in contact and shared some ideas.


El martes, 4 de marzo de 2014 13:25:59 UTC+1, Jason Suagee escribió:

Amit Jamadagni

unread,
Mar 17, 2014, 1:07:45 PM3/17/14
to sage...@googlegroups.com
Hello all, 
      I am been working on my proposal for the implementation on the back-end. I have posted the link to my proposal on the other google thread (I kindly request to refer to it for all the details).  I am really looking forward to discuss the ideas of how we can get the entire machinery (back-end + front-end) to work. I hope we (It would  be great if the discussion can be done in the presence of our mentor) can discuss it here or on irc chat about what we require in common and on how one could facilitate as well compliment each other's work keeping it as independent as possible. Thanks.


--
You received this message because you are subscribed to the Google Groups "sage-gsoc" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sage-gsoc+...@googlegroups.com.
To post to this group, send email to sage...@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-gsoc.
For more options, visit https://groups.google.com/d/optout.

Jason Suagee

unread,
Mar 17, 2014, 1:51:49 PM3/17/14
to sage...@googlegroups.com
Hi Amit, I looked at your proposal and it looked good. I also look forward to potentially working with you. 

I still have to upload official documentation that I am a current student at my university, so I am unable to submit the proposal at the moment. There is a big snow storm where I am now which will prevent me from going to my university to get this document until tomorrow. I will go in tomorrow so that I can submit the proposal. In the meantime I will include a draft in a pdf attachment. (I'll have to translate it to the appropriate format later before I submit it.)

In the draft I do not talk about the interface between the Sage notebook and the javascript/canvas element where the knot plotting will be done. The canvas element is what I would like to use to do the rendering of the knot. This is a good reason to have a contact point who knows about the Sage interface to the canvas (specifically, the show() or plot3d() methods, if you pass them the keyword viewer=canvas3d, will use the use the canvas element to display the plot. How all this comes together I haven't figured out yet.)

The draft does not contain any mention of classes or deliverables yet. I mainly thought out most of the algorithmic details. I also have not included a timeline yet. Your comments would be appreciated.
unified1.pdf

Amit Jamadagni

unread,
Mar 18, 2014, 8:34:59 AM3/18/14
to sage...@googlegroups.com
Hi Jason,
       I have gone through the attached document, on a quick glance I could get the structure but understanding the details is taking time for me. I would like to know how my work can compliment yours on the front end. In sense it would great if you could sketch an outline of what features from the backend (There was a section in the document on what you expected from the backend) you would like me to work on so that the editor could be more complete. I guess we need to work on this as the deadline is fast approaching. I would like to know if we could communicate via irc at some particular time. It would give a more clearer picture to construct our proposals as well. Thanks.

Burcin Erocal

unread,
Mar 18, 2014, 8:54:28 AM3/18/14
to sage...@googlegroups.com
Hi,

I'm not a mentor for this project and I have not followed the related
discussion on this list. But here is my 5 cents...

On Tue, 18 Mar 2014 18:04:59 +0530
Amit Jamadagni <bitsja...@gmail.com> wrote:

> Hi Jason,
> I have gone through the attached document, on a quick glance I
> could get the structure but understanding the details is taking time
> for me. I would like to know how my work can compliment yours on the
> front end. In sense it would great if you could sketch an outline of
> what features from the backend (There was a section in the document
> on what you expected from the backend) you would like me to work on
> so that the editor could be more complete. I guess we need to work on
> this as the deadline is fast approaching. I would like to know if we
> could communicate via irc at some particular time. It would give a
> more clearer picture to construct our proposals as well. Thanks.

I don't think you include anything in your timeline based on progress
on a different project.

As we all know, it is very hard to estimate schedules for software
projects. Trying to manage such dependencies within the scope of GSoC
would complicate evaluation of individual work extremely difficult for
program admins and mentors.

Please keep it simple and base the proposals on existing functionality
only or provide clear contingency plans if you absolutely must rely on
someone else's work.


Cheers,
Burcin

Jason Suagee

unread,
Mar 18, 2014, 8:49:38 AM3/18/14
to sage...@googlegroups.com
Hi Amit, I'm on the gsoc channel now. I'm in the middle of office hours but I don't have any students at the moment. 

Amit Jamadagni

unread,
Mar 18, 2014, 9:42:35 AM3/18/14
to sage...@googlegroups.com
Hello Erocal,
       I would like to mention that I am working on the backend of the project and Jason is working on the front end editor for the same topic, I was requesting him to present his views on what he would expect from the back end so as to make the working of the editor more complete in its functionality. I would also like to mention that we are working on completely independent ideas and have a pretty thin intersection.

 @Jason are you on the gsoc channel or sagemath channel and how do I identify you ?? Thanks

Jason Suagee

unread,
Mar 18, 2014, 10:36:31 AM3/18/14
to sage...@googlegroups.com
Hi Burcin,

Thanks for your input.

Actually, I think the backend would be pretty much independent of the user interface part that I would be working on. The only thing that has to be coordinated is how to exchange planar knot diagrams, or some other data structure to represent planar knot diagrams.

I think that Amit wants to implement much of his part using braid representations (am I correct Amit?). All I'm asking from him is to work together to come up with a shared data structure for representing planar diagrams. After that both projects are pretty much independent.

I'm about to put together a timeline and should post it later today.


Jason Suagee

unread,
Mar 18, 2014, 10:47:01 AM3/18/14
to sage...@googlegroups.com
My knickname on #gsoc is jason_ (not jasonDC, that's some other guy). If you want I'll be on in about an hour, just send let me know by email and I'll go on the irc channel.

I saw you there briefly, but I had a student in office hours at that moment.

Amit Jamadagni

unread,
Mar 18, 2014, 10:54:44 AM3/18/14
to sage...@googlegroups.com
My nick is esornep (esornep620 at some times), my apologies I was not on irc. I would also be joining in about an hour from now. I hope we could discuss there and post back the results in the same thread and the changes could reflect in our proposal. Thanks.

Jason Suagee

unread,
Mar 18, 2014, 9:46:16 PM3/18/14
to sage...@googlegroups.com
Here is an updated proposal draft that is cleaned up a bit, and with a timeline.

Amit, I will be free after 14:00 my time until 17:00 GMT - 4:00. If you want to meet again on irc let me know. I'm going to take a look at Plink tomorrow during that time and try to see if I can think up a good way to export/import planar knot diagram data.
proposal_draft_2.pdf

Miguel Angel Marco

unread,
Mar 19, 2014, 9:27:50 AM3/19/14
to sage...@googlegroups.com
I have just given a quick look at your proposal, but i definitely like what i see. I see you have put a lot of work into it.

Just an idea: have you considered using just the 3d curves (that is, the coordinates of its vertices) as the data to be exchanged with the backend? 

Miguel Angel Marco

unread,
Mar 20, 2014, 6:38:09 AM3/20/14
to sage...@googlegroups.com
Ok, i have finally read your proposal, and it seems quite good to me. Just a couple of comments:

As an inspiration for the javescript-sage communication, you can take a look at the graph editor code. Also take a look at the work of Jason Grout on pythreejs.

As of the data structure to interchange with the backend, i think the best option would be to use the 3d coordinates of the vertices of the piecewise linear aproximation of the link. Consider that, in "real life" (i.e. biochemistry, numerical simulations, etc...) knots appear in that form. 

Also, it would be nice if the editor ould serve not just to manipulate an exisiting knot/link, but also to quickly create one (a la plink).

Miguel Angel Marco

unread,
Mar 20, 2014, 6:47:13 AM3/20/14
to sage...@googlegroups.com
And also, even if it is not really necessary, maybe some madeup images of how do you imagine that the editor would look like can also be an improvment for your proposal.

Jason Suagee

unread,
Mar 21, 2014, 10:39:53 AM3/21/14
to sage...@googlegroups.com

OK, I just submitted the proposal (I realized that it was due in only a few hours).


Using the 3d coordinates of the vertices would be fine for exporting to the backend. It makes the job of programming the editor that much easier. Also, to reload a knot from a file all you would have to do is read back the coordinate data. For computation of invariants the backend probably will want a more simplified representation of the knot, but that is easy enough to compute within Sage given the coordinate data.


Your right, for inputing a knot from scratch it's good to have something that works like plink. This is really a different kind of thing than the rest of the project idea, which is 3D. I could implement a link drawing tool, but I'm wondering if we could just incorporate some of the plink code into Sage?


I looked at the graph_editor code. I did not know that you could just enter the following into a sage notebook input frame:


from sage.misc.html import html

html( INSERT ANY HTML HERE )


and what you get in the output frame is what you inserted. This will definitely help me to figure out the backend interface.


Miguel Angel Marco

unread,
Mar 22, 2014, 11:49:56 AM3/22/14
to sage...@googlegroups.com
Good, i remember jason grout commenting something about a way to pass information between sage and interactive graphs,  but i am not sure about the state of it. It could be a good idea to ask him.

Abot the editor, i guess somethig like plink could be done also in 3d. think of the knotplot sketch tool with a fixed viewpoint, and a tool to switch the sign of the crossings. Does that sound reasonable?

Jason Suagee

unread,
Mar 23, 2014, 12:04:57 PM3/23/14
to sage...@googlegroups.com
I just sent Jason Grout an email asking for assistance in understanding how information sharing works between sage and the graph editor. I'll let you know as soon as I hear back from him.

I'll continue looking at the source code for the graph_editor in the meantime.


Jason Suagee

unread,
Apr 10, 2014, 7:49:38 PM4/10/14
to sage...@googlegroups.com


Sorry to take so long to post back. I have been going to conferences and haven't had much time to work on anything the past 2 weeks.


Jason Grout recommended that we use the widget/comm idea from ipython to facilitate the communication between the front end and backend of the knot editor. He said that what was done in the past for the graph editor was a kludge (for non-native english speakers this is an expression for something which is kind of hacked together). I don't know if this is the direction that you would want to go? I could replicate the kludge idea or try this new method using the ipython notebook interface (or maybe the qtconsole, which I have not tried yet).


I have experimented some with the ipython notebook interface for sage (sage -ipython notebook). I can load some javascript into an output frame and get it to be evaluated, although I cannot as yet figure out how to sync what is going on in the output frame with the python backend. (That would be where the widget idea comes in I suppose.)


I have a question: My version of sage uses ipython 0.13, whereas ipython is now up to version 2.0, I think. Does the current source for sage use any version of ipython >= 1.0. There are no available examples that I could find of the use of widgets in ipython ver. < 1.0, and the module structure of ipython has changed from ver. < 1.0 to >= 1.0. The change in module structure is making experimentation more difficult.


I have to be honest, I feel like a fish out of water dealing with this part of the project. I can handle the algorithmic parts fine but this part of dealing with the backend/frontend communication might turn out to be pretty difficult. I have an associate/friend who is used to programming in javascript (among other things), and he offered to give me some pointers and provide a little help along the way. So I wouldn't totally be on my own.


Please let me know if there is still interest in this project going forward.

Jason Grout

unread,
Apr 11, 2014, 5:35:32 PM4/11/14
to sage...@googlegroups.com
On 4/10/14, 18:49, Jason Suagee wrote:
>
> Sorry to take so long to post back. I have been going to conferences and
> haven't had much time to work on anything the past 2 weeks.
>
>
> Jason Grout recommended that we use the widget/comm idea from ipython to
> facilitate the communication between the front end and backend of the
> knot editor. He said that what was done in the past for the graph editor
> was a kludge (for non-native english speakers this is an expression for
> something which is kind of hacked together). I don't know if this is the
> direction that you would want to go? I could replicate the kludge idea
> or try this new method using the ipython notebook interface (or maybe
> the qtconsole, which I have not tried yet).

>
>
> I have experimented some with the ipython notebook interface for sage
> (sage -ipython notebook). I can load some javascript into an output
> frame and get it to be evaluated, although I cannot as yet figure out
> how to sync what is going on in the output frame with the python
> backend. (That would be where the widget idea comes in I suppose.)


Yes, that's correct.


>
>
> I have a question: My version of sage uses ipython 0.13, whereas ipython
> is now up to version 2.0, I think. Does the current source for sage use
> any version of ipython >= 1.0. There are no available examples that I
> could find of the use of widgets in ipython ver. < 1.0, and the module
> structure of ipython has changed from ver. < 1.0 to >= 1.0. The change
> in module structure is making experimentation more difficult.
>

We recently upgraded to IPython 1.2.1
(http://trac.sagemath.org/ticket/14713). You'd have to run a dev
version of Sage to get that.

I don't think it'd be very hard at all to upgrade to IPython 2.0 (which
is what you need for widgets). I'm running it on the Sage cell server
right now with (I think) no changes to Sage.


>
> I have to be honest, I feel like a fish out of water dealing with this
> part of the project. I can handle the algorithmic parts fine but this
> part of dealing with the backend/frontend communication might turn out
> to be pretty difficult. I have an associate/friend who is used to
> programming in javascript (among other things), and he offered to give
> me some pointers and provide a little help along the way. So I wouldn't
> totally be on my own.


Right now we have at least three different ways for web interfaces to
communicate with Sage backends:

* sage notebook (e.g., *.sagenb.org): I don't know anyone actively
working on this. This is the hack I mentioned above.

* sage cell server: we piggy-backed on the IPython infrastructure and
messaging/widget system. I think it's a nice design and lends itself to
clear, simple communication.

* sage cloud: William's the one to talk about this...

* well, really I guess there's a fourth, and that is with standard
interacts.

Going forward, I'd say that one possible good route would be to get the
IPython widget/comm message system working in the cloud sage worksheets
(or a close approximation thereof) and use that. If that layer is
compatible with IPython, then the same widget will work from the IPython
notebook and the cell server too.


Thanks,

Jason


Jason Suagee

unread,
Apr 16, 2014, 9:19:25 AM4/16/14
to sage...@googlegroups.com
OK, I was gone for the weekend (a friend's wedding). I compiled the
dev version of sage and got it working with ipython 2.0. I forgot how
long sage can take to compile!

One thing is that the sage extension has trouble loading with the
newer version of ipython.

if I run:

%load_ext sage.misc.sage_extension

I get an error that ends with

/home/jason/opt/sage-6.1.beta1/local/lib/python2.7/site-packages/sage/misc/sage_extension.py
in <module>()
257 # apparently we will have stateful transformations then.
258 # see also https://github.com/ipython/ipython/pull/2402>
--> 259 from IPython.core.inputsplitter import (transform_ipy_prompt,
transform_classic_prompt,
260 transform_help_end,
transform_escaped,
261
transform_assign_system, transform_assign_magic,

ImportError: cannot import name transform_ipy_prompt

I can send the full error report if you want.

What I noticed is that there might have been a name change from
ipython 0.xx to 2.0 (of transform_ipy_prompt,
transform_classic_prompt, etc..). I made some changes in the code in
the sage_extension.py file and it then loaded the extension, although
I'm not sure it's doing anything now because, for instance, 2^3
returns 1 and not 8.

I'll look into how to use the widgets later today after I finish teaching.

Jason Suagee

unread,
Apr 16, 2014, 9:34:40 AM4/16/14
to sage...@googlegroups.com
Oh by the way, Can you tell me when I might know whether or not this project is selected to go forward for the summer. I am scheduled to teach a course over the summer, and if this project goes ahead I will have to inform the chair of the department that he needs to assign a different instructor to the course that I was going to teach. I appreciate any information that you can offer.

Thanks,
Jason

Miguel Angel Marco

unread,
Apr 16, 2014, 11:08:30 AM4/16/14
to sage...@googlegroups.com
I think the anouncement of accepted proposals will be next week.

Miguel Angel Marco

unread,
Apr 22, 2014, 9:31:52 AM4/22/14
to sage...@googlegroups.com
I am sorry that your proposal wasn't finally selected. Anyways, if you are still interested in working on it (not inside the GSoC program, but on your own pace), i can try to help you as much as i can.

Jason Suagee

unread,
Apr 27, 2014, 9:01:11 PM4/27/14
to sage...@googlegroups.com
Thanks Miguel. In about 1-2 weeks the semester will wind down at my university and I will have some time to spend on it, and at that point I might need some help getting started. Of course it will all depend on if I have enough time to put into this over this summer. I will let you know in about 1-2 weeks.

Thank you again for your offer of assistance!
Reply all
Reply to author
Forward
0 new messages