📚 The CoCalc Library - books, templates and other resources
License: OTHER
Math 157: Intro to Mathematical Software
UC San Diego, winter 2018
February 7, 2018: Combinatorics (part 2 of 2): Graphs
Administrivia:
All waitlisted students have been cleared to enroll in the course. Thank you for your patience.
Graphs
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. (More precisely, this is an undirected graph without self-loops. If the pairs are ordered, this would be a directed graph or digraph.)
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. Here are some standard ones (which I'll explain as we go along).