Math 385 - Fall 2016

Sage is a free open source mathematical software package that can do lots of things. In particular, it can handle graphs.

To use Sage, just go to: https://sagecell.sagemath.org/.

Below are some interactive examples of how to use Sage.

Examples from Class

Creating a Specific Graph

To create a specific graph, you use the Graph() function. The input is a Python dictionary of the form {0:[1,2,3],1:[3],2:[4,5],4:[5]}. This tells Sage to draw an edge from vertex 0 to vertices 1,2, and 3. Then draw an edge from 1 to 3 and from 2 to 4 and 2 to 5, and finally to draw an edge from 4 to 5. Click on the evaluate button below to see the result.

There are lots of commands that you can apply to a graph. For example, here are some commands to try:

Just copy and paste these commands into the box above. You should also try creating different graphs and seeing how the Graph() function works. For a complete list of commands that are available see: http://doc.sagemath.org/html/en/reference/graphs/sage/graphs/generic_graph.html

Other Examples of Sage in Action

Here are some more examples using Sage to compute different things.