Best choice for graph theory class: Jupyter running Sage kernel, or Jupyter+Python+NetworkX ?

584 views
Skip to first unread message

Robert Talbert

unread,
Nov 13, 2015, 4:04:23 PM11/13/15
to Teaching with Jupyter Notebooks
Hi. I teach a two-semester course on discrete structures for computer science. Next semester I'll be teaching two sections of part 2 of the sequence which focuses strongly on graph theory. I've been learning about Jupyter notebooks this semester and I'm ready to use them on a wide scale in my class. But I am having a hard time deciding on which of the following deployments would be best: 
  • Option 1: Students use Jupyter notebooks connected to the Sage kernel, then use all the built-in math functions in Sage for working with graphs. 
  • Option 2: Students use Jupyter notebooks connected to the Python3 kernel, then use the NetworkX library to work with graphs (along with matplotlib for visualizing graphs and scipy for more computational stuff like working with adjacency matrices). 
Before I say anything else: I am going to have students set themselves up on SageMath Cloud where it is really easy to use Jupyter notebooks running the Sage kernel. What this issue is all about is how students can do their work _offline_ because as great as SageMath Cloud is, it still IMO suffers from more than the occasional issue of buffering, dropped connections, or interrupted calculations -- it happens often enough with my students that I need to have a reliable option for them working offline.

The big advantage of Option 1 (Sage running in Jupyter) is that the graph theory functionality, graph visualization tools, and math tools are all just right there in the same place. No extra libraries needed. But, the major downside is that for me at least, getting Jupyter to connect to my locally-running Sage kernel has been a hit and miss process.  I have it working now, but I am not confident that I could give foolproof instructions to every student I have on how to get this to work on their machines, nor could I help students who have problems with it. I am hesitant to step into a situation of requiring technology of students when I myself am not fully confident I can provide support. Also, the Sage installation process itself is not always painless, and in fact AFAIK there is still an issue with Sage refusing to build if you're using a Mac running the latest OS X. 

The advantage of Option 2 (Jupyter + Python + NetworkX) is that there is no issue of trying to connect Jupyter to the Sage kernel -- just use "pure" Python, and import the other libraries as needed. It's a much simpler process in that regard. But the downside there is that all the math functionality I want students to use is located in 2--3 different libraries and they are not necessarily as intuitive as Sage. And I know from experience that students don't like having to manage lots of different tools in a math course. 

So, I'd be interested in knowing everyone's thoughts on that. 

William Stein

unread,
Nov 16, 2015, 8:15:38 PM11/16/15
to Teaching with Jupyter Notebooks


On Friday, November 13, 2015 at 1:04:23 PM UTC-8, Robert Talbert wrote:
Hi. I teach a two-semester course on discrete structures for computer science. Next semester I'll be teaching two sections of part 2 of the sequence which focuses strongly on graph theory. I've been learning about Jupyter notebooks this semester and I'm ready to use them on a wide scale in my class. But I am having a hard time deciding on which of the following deployments would be best: 
  • Option 1: Students use Jupyter notebooks connected to the Sage kernel, then use all the built-in math functions in Sage for working with graphs. 
  • Option 2: Students use Jupyter notebooks connected to the Python3 kernel, then use the NetworkX library to work with graphs (along with matplotlib for visualizing graphs and scipy for more computational stuff like working with adjacency matrices). 
Before I say anything else: I am going to have students set themselves up on SageMath Cloud where it is really easy to use Jupyter notebooks running the Sage kernel. What this issue is all about is how students can do their work _offline_ because as great as SageMath Cloud is, it still IMO suffers from more than the occasional issue of buffering, dropped connections, or interrupted calculations -- it happens often enough with my students that I need to have a reliable option for them working offline.


I see that nobody responded to your message yet.  I use SageMathCloud all day every day.  If the situation is really so bad that you can't even consider using SMC to teach a course, than this problem is far more important than anything else I'm working on involving SMC.   In fact, anything we do to grow SMC is only going to make matters worse before this problem is addressed.   If anything, we should probably be discouraging growth so long as SMC's reliability is so bad that people can't even consider seriously using it for a course.   

I want to strongly encourage you to report any serious stability issues you have along the above lines to he...@sagemath.com immediately, including a link to the relevant Jupyter notebook.    Often when people report issues with "it crashes weirdly" it turns out that the real problem is that they are running out of memory, or the code itself really is segfaulting or something else, and running in the command line can clarify the situation.   

Also: another important question -- when you say that "occasional issue of buffering, dropped connections, or interrupted calculations -- it happens often enough with my students that I need to have a reliable option for them working offline." are you talking about for-pay projects running on members only servers, or are you talking about free projects?   Free projects really do compete for resources with hundreds of other users, and those should absolutely *not* be expected to work all the time without pauses/interrupted calculations, etc.   It's perhaps worth considering whether the time and frustrating your students will spend installing and configuring software is worth more than $5, which is roughly the most it costs per quarter per student to use SMC if you purchase a course plans.
Reply all
Reply to author
Forward
0 new messages