Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place. Commercial Alternative to JupyterHub.
Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place. Commercial Alternative to JupyterHub.
Math 152 - Intro to Mathematical Software
2017-02-24
Kiran Kedlaya; University of California, San Diego
adapted from lectures by William Stein, University of Washington
** Lecture 19: Combinatorics (part 2): Graphs **
Announcement: next week, my office hours will take place Monday 3-4; Zonglin's office hours will take place Tuesday 10-12.
Also, to answer a question from last time: there is indeed support for integer linear programming in Sage (i.e., finding integer solutions of linear equations which optimize other linear constraints). See http://doc.sagemath.org/html/en/reference/numerical/sage/numerical/mip.html.
In combinatorics, a graph is not the plot of a function; it is a mathematical abstraction of a network. It consists of a (usually finite) set of vertices, together with a collection of unordered pairs of vertices called edges.
How does this concept arise naturally? https://en.wikipedia.org/wiki/Graph_theory
There are many ways to construct a graph in Sage. Perhaps the easiest one is to specify a list of pairs of vertices (letting Sage guess what the vertices are).
Another way to specify a graph is via an adjacency matrix. This is a symmetric matrix of 0s and 1s that tells you which pairs of vertices are edges.
You can also find some standard examples using the networkx package...
... or the graphs object.
This includes various types of random graphs.
There are many operations available for graphs: http://doc.sagemath.org/html/en/reference/graphs/sage/graphs/generic_graph.html#sage.graphs.generic_graph.GenericGraph.igraph_graph
Some standard ones include...