1.2.6: Graphs
A graph is a diagram in which points—called “nodes” or “vertices” (plural of “vertex”)—are connected by edges. Graphs are a ubiquitous tool in discrete mathematics and in computer science. They are incredibly useful for representing, and visualizing, relationships and structures, from concrete things like networks of various kinds to abstract structures such as the possible outcomes of decisions. There are many different kinds of graphs in the literature which differ, e.g., according to whether the edges are directed or not, have labels or not, whether there can be edges from a node to the same node, multiple edges between the same nodes, etc. Directed graphs have a special connection to relations.
A directed graph \(G = \tuple{V, E}\) is a set of vertices \(V\) and a set of edges \(E \subseteq V^2\) .
According to our definition, a graph just is a set together with a relation on that set. Of course, when talking about graphs, it’s only natural to expect that they are graphically represented: we can draw a graph by connecting two vertices \(v_1\) and \(v_2\) by an arrow iff \(\tuple{v_1, v_2} \in E\) . The only difference between a relation by itself and a graph is that a graph specifies the set of vertices, i.e., a graph may have isolated vertices. The important point, however, is that every relation \(R\) on a set \(X\) can be seen as a directed graph \(\tuple{X, R}\) , and conversely, a directed graph \(\tuple{V, E}\) can be seen as a relation \(E \subseteq V^2\) with the set \(V\) explicitly specified.
The graph \(\tuple{V, E}\) with \(V = \{1, 2, 3, 4\}\) and \(E = \{\tuple{1,1}, \tuple{1, 2}, \tuple{1, 3}, \tuple{2, 3}\}\) looks like this:
This is a different graph than \(\tuple{V', E}\) with \(V' = \{1, 2, 3\}\) , which looks like this:
Consider the less-than-or-equal-to relation \(\le\) on the set \(\{1, 2, 3, 4\}\) as a graph and draw the corresponding diagram.