Skip to main content
Engineering LibreTexts

9: Directed graphs and Partial Orders

  • Page ID
    48258
    • Eric Lehman, F. Thomson Leighton, & Alberty R. Meyer
    • Google and Massachusetts Institute of Technology via MIT OpenCourseWare
    \( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \) \( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)\(\newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\) \( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\) \( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\) \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\) \( \newcommand{\Span}{\mathrm{span}}\) \(\newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\) \( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\) \( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\) \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\) \( \newcommand{\Span}{\mathrm{span}}\)\(\newcommand{\AA}{\unicode[.8,0]{x212B}}\)

    Directed graphs, called digraphs for short, provide a handy way to represent how things are connected together and how to get from one thing to another by following those connections. They are usually pictured as a bunch of dots or circles with arrows between some of the dots, as in Figure 9.1. The dots are called nodes or vertices and the lines are called directed edges or arrows; the digraph in Figure 9.1 has 4 nodes and 6 directed edges.

    Digraphs appear everywhere in computer science. For example, the digraph in Figure 9.2 represents a communication net, a topic we’ll explore in depth in Chapter 10. Figure 9.2 has three “in” nodes (pictured as little squares) representing locations where packets may arrive at the net, the three “out” nodes representing destination locations for packets, and the remaining six nodes (pictured with little circles) represent switches. The 16 edges indicate paths that packets can take through the router.

    Another place digraphs emerge in computer science is in the hyperlink structure of the World Wide Web. Letting the vertices \(x_1, \cdots , x_n\) correspond to web pages, and using arrows to indicate when one page has a hyperlink to another, results in a digraph like the one in Figure 9.3—although the graph of the real World Wide Web would have \(n\) be a number in the billions and probably even the trillions. At first glance, this graph wouldn’t seem to be very interesting. But in 1995, two students at Stanford, Larry Page and Sergey Brin, ultimately became multibillionaires from the realization of how useful the structure of this graph could be in building a search engine. So pay attention to graph theory, and who knows what might happen!

    clipboard_e58639efd2881aae0be8956501f5c2d18.png
    Figure 9.1 A 4-node directed graph with 6 edges.
    clipboard_efc86bdddb39636446a74b01404e6493c.png
    Figure 9.2 A 6-switch packet routing digraph.
    clipboard_eb97c600243df2f508ace3c808a6230f3.png
    Figure 9.3 Links among Web Pages.
    clipboard_e9c66461c79e8b1dcb4cfa5a67ba28a98.png
    Figure 9.4 A directed edge \(e = \langle u \rightarrow v\rangle\). The edge \(e\) starts at the tail vertex, \(u\), and ends at the head vertex, \(v\).

    Definition 9.0.1.

    A directed graph, \(G\), consists of a nonempty set, \(V(G)\), called the vertices of \(G\), and a set, \(E(G)\), called the edges of \(G\). An element of \(V(G)\) is called a vertex. A vertex is also called a node; the words “vertex” and “node” are used interchangeably. An element of \(E(G)\) is called a directed edge. A directed edge is also called an “arrow” or simply an “edge.” A directed edge starts at some vertex, \(u\), called the tail of the edge, and ends at some vertex, \(v\), called the head of the edge, as in Figure 9.4. Such an edge can be represented by the ordered pair \((u, v)\). The notation \(\langle u \rightarrow v\rangle\) denotes this edge.

    There is nothing new in Definition 9.0.1 except for a lot of vocabulary. Formally, a digraph \(G\) is the same as a binary relation on the set, \(V = V(G)\)—that is, a digraph is just a binary relation whose domain and codomain are the same set, \(V\). In fact, we’ve already referred to the arrows in a relation \(G\) as the “graph” of \(G\). For example, the divisibility relation on the integers in the interval \([1..12]\) could be pictured by the digraph in Figure 9.5.


    This page titled 9: Directed graphs and Partial Orders is shared under a CC BY-NC-SA license and was authored, remixed, and/or curated by Eric Lehman, F. Thomson Leighton, & Alberty R. Meyer (MIT OpenCourseWare) .

    • Was this article helpful?