Skip to main content
Mathematics LibreTexts

7.1: Basic Graphs and Graphs Structure

  • Page ID
    181987
  • \( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)

    \( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)

    \( \newcommand{\dsum}{\displaystyle\sum\limits} \)

    \( \newcommand{\dint}{\displaystyle\int\limits} \)

    \( \newcommand{\dlim}{\displaystyle\lim\limits} \)

    \( \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}}\)

    \( \newcommand{\vectorA}[1]{\vec{#1}}      % arrow\)

    \( \newcommand{\vectorAt}[1]{\vec{\text{#1}}}      % arrow\)

    \( \newcommand{\vectorB}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)

    \( \newcommand{\vectorC}[1]{\textbf{#1}} \)

    \( \newcommand{\vectorD}[1]{\overrightarrow{#1}} \)

    \( \newcommand{\vectorDt}[1]{\overrightarrow{\text{#1}}} \)

    \( \newcommand{\vectE}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash{\mathbf {#1}}}} \)

    \( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)

    \(\newcommand{\longvect}{\overrightarrow}\)

    \( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)

    \(\newcommand{\avec}{\mathbf a}\) \(\newcommand{\bvec}{\mathbf b}\) \(\newcommand{\cvec}{\mathbf c}\) \(\newcommand{\dvec}{\mathbf d}\) \(\newcommand{\dtil}{\widetilde{\mathbf d}}\) \(\newcommand{\evec}{\mathbf e}\) \(\newcommand{\fvec}{\mathbf f}\) \(\newcommand{\nvec}{\mathbf n}\) \(\newcommand{\pvec}{\mathbf p}\) \(\newcommand{\qvec}{\mathbf q}\) \(\newcommand{\svec}{\mathbf s}\) \(\newcommand{\tvec}{\mathbf t}\) \(\newcommand{\uvec}{\mathbf u}\) \(\newcommand{\vvec}{\mathbf v}\) \(\newcommand{\wvec}{\mathbf w}\) \(\newcommand{\xvec}{\mathbf x}\) \(\newcommand{\yvec}{\mathbf y}\) \(\newcommand{\zvec}{\mathbf z}\) \(\newcommand{\rvec}{\mathbf r}\) \(\newcommand{\mvec}{\mathbf m}\) \(\newcommand{\zerovec}{\mathbf 0}\) \(\newcommand{\onevec}{\mathbf 1}\) \(\newcommand{\real}{\mathbb R}\) \(\newcommand{\twovec}[2]{\left[\begin{array}{r}#1 \\ #2 \end{array}\right]}\) \(\newcommand{\ctwovec}[2]{\left[\begin{array}{c}#1 \\ #2 \end{array}\right]}\) \(\newcommand{\threevec}[3]{\left[\begin{array}{r}#1 \\ #2 \\ #3 \end{array}\right]}\) \(\newcommand{\cthreevec}[3]{\left[\begin{array}{c}#1 \\ #2 \\ #3 \end{array}\right]}\) \(\newcommand{\fourvec}[4]{\left[\begin{array}{r}#1 \\ #2 \\ #3 \\ #4 \end{array}\right]}\) \(\newcommand{\cfourvec}[4]{\left[\begin{array}{c}#1 \\ #2 \\ #3 \\ #4 \end{array}\right]}\) \(\newcommand{\fivevec}[5]{\left[\begin{array}{r}#1 \\ #2 \\ #3 \\ #4 \\ #5 \\ \end{array}\right]}\) \(\newcommand{\cfivevec}[5]{\left[\begin{array}{c}#1 \\ #2 \\ #3 \\ #4 \\ #5 \\ \end{array}\right]}\) \(\newcommand{\mattwo}[4]{\left[\begin{array}{rr}#1 \amp #2 \\ #3 \amp #4 \\ \end{array}\right]}\) \(\newcommand{\laspan}[1]{\text{Span}\{#1\}}\) \(\newcommand{\bcal}{\cal B}\) \(\newcommand{\ccal}{\cal C}\) \(\newcommand{\scal}{\cal S}\) \(\newcommand{\wcal}{\cal W}\) \(\newcommand{\ecal}{\cal E}\) \(\newcommand{\coords}[2]{\left\{#1\right\}_{#2}}\) \(\newcommand{\gray}[1]{\color{gray}{#1}}\) \(\newcommand{\lgray}[1]{\color{lightgray}{#1}}\) \(\newcommand{\rank}{\operatorname{rank}}\) \(\newcommand{\row}{\text{Row}}\) \(\newcommand{\col}{\text{Col}}\) \(\renewcommand{\row}{\text{Row}}\) \(\newcommand{\nul}{\text{Nul}}\) \(\newcommand{\var}{\text{Var}}\) \(\newcommand{\corr}{\text{corr}}\) \(\newcommand{\len}[1]{\left|#1\right|}\) \(\newcommand{\bbar}{\overline{\bvec}}\) \(\newcommand{\bhat}{\widehat{\bvec}}\) \(\newcommand{\bperp}{\bvec^\perp}\) \(\newcommand{\xhat}{\widehat{\xvec}}\) \(\newcommand{\vhat}{\widehat{\vvec}}\) \(\newcommand{\uhat}{\widehat{\uvec}}\) \(\newcommand{\what}{\widehat{\wvec}}\) \(\newcommand{\Sighat}{\widehat{\Sigma}}\) \(\newcommand{\lt}{<}\) \(\newcommand{\gt}{>}\) \(\newcommand{\amp}{&}\) \(\definecolor{fillinmathshade}{gray}{0.9}\)

     

    A close-up view of three people holding cell phones.
    Figure \(\PageIndex{1}\): Cell phone networks connect individuals. (credit: "Business people using their phones" by Rawpixel Ltd./Flickr, CC BY 2.0)

    Learning Objectives

    1. Identify parts of a graph.
    2. Model relationships with graphs.
    3. Describe and identify walks, trails, paths, and circuits.

    When you hear the word, graph, what comes to mind? You might think of the \(xy\)-coordinate system you learned about earlier in this course, or you might think of the line graphs and bar charts that are used to display data in news reports. The graphs we discuss in this chapter are probably very different from what you think of as a graph. They look like a bunch of dots connected by short-line segments. The dots represent a group of objects, and the line segments represent the connections, or relationships, between them. The objects might be bus stops, computers, Snapchat accounts, family members, or any other objects that have direct connections to each other. The connections can be physical or virtual, formal or casual, scientific or social. Regardless of the kind of connections, the purpose of the graph is to help us visualize the structure of the entire network to better understand the interactions of the objects within it.

    Parts of a Graph

    In a graph, the objects are represented with dots, and their connections are represented with lines like in Figure \(\PageIndex{2}\) displays a simple graph labeled G and a multigraph labeled H. The dots are called vertices; an individual dot is a vertex, which is one object of a set of objects, some of which may be connected. We often label vertices with letters. For example, Graph G has vertices a, b, c, and d, and Multigraph H has vertices e, f, g, and h. Each line segment or connection joining two vertices is referred to as an edge. H is considered a multigraph because it has a double edge between f and h and a double edge between h and g. Another reason H is called a multigraph is that it has a loop connecting vertex e to itself; a loop is an edge that joins a vertex to itself. Loops and double edges are not allowed in a simple graph.

    To sum up, a simple graph is a collection of vertices and any edges that may connect them, such that every edge connects two vertices with no loops and no two vertices are joined by more than one edge. A multigraph is a graph in which loops or pairs of vertices are joined by more than one edge. In this chapter, most of our work will be with simple graphs, which we will call graphs for convenience.

    Two graphs are labeled graph G and multigraph H. Graph G has four vertices, a, b, c, and d. Two edges connect a with b and c. Two edges connect c with b and d. Multigraph H has four vertices: e, f, g, and h. A double edge connects f and h. A double edge connects h and g. Two edges connect e with f and h. A loop connects vertex e to itself.

    Figure \(\PageIndex{2}\): A Graph and a Multigraph

     

    It is not necessary for the edges in a graph to be straight. In fact, you can draw an edge any way you want. Graph theory focuses on which vertices are connected, not how the connections are drawn. In a graph, each edge can be named by the two letters of the associated vertices. The four edges in Graph X in Figure \(\PageIndex{3}\) are ab, ac, ad, and ae. The order of the letters is not essential when you name the edge of a graph. For example, ab refers to the same edge as ba.

    Checkpoint: Edge Could be Straight Line or Curve

    A graph may have vertices that are not joined to other vertices by edges, such as vertex f in Graph X in Figure \(\PageIndex{3}\), but any edge must have a vertex at each end.

    Two graphs are labeled graph X. In each graph, six vertices are present: a, b, c, d, e, and f. Edges connect a with b, c, d, and e. In the first graph, the edges are straight lines. In the second graph, the edges are curved.
    Figure \(\PageIndex{3}:\) Different Representations of the Same Graph
    Example \(\PageIndex{1}\): Identifying Edges and Vertices

    Name all the vertices and edges of graph F in Figure \(\PageIndex{4}.\) Does this graph have a loop?

    A graph labeled graph F. The graph has five vertices: V, W, X, Y, and Z. Four edges connect X with V, W, Y, and Z. Two edges connect W with V and Z.Figure \(\PageIndex{4}\): Graph F
    Answer

    The vertices are v, w, x, y, and z. The edges are vw, vx, wx, wz, xy, and xz. The graph has no loop.

    Checkpoint

    When listing the vertices and edges in a graph, work in alphabetical order to avoid accidentally listing the same item twice. When you are finished, count the number of vertices or edges you listed and compare that to the number of vertices or edges on the graph to ensure you didn’t miss any.

    Your Turn \(\PageIndex{1}\)

    Name all the vertices and edges of Graph A.

    A graph labeled graph A. The graph has five vertices, p, q, r, s, and t. Edges connect p with q, r, and t. Edges connect r with q and s. Edges connect s with q and t. An edge connects q with t.
    Figure \(\PageIndex{5}\): Graph A
    Adjacent Vertices and Edges

    Two vertices in a graph are called adjacent if they are connected directly by an edge. Two edges are called adjacent if they share a common vertex.

    For example, in Figure \(\PageIndex{5}:\) Graph A, vertices s and t are adjacent, s and r are adjacent, s and q are adjacent, but vertices s and p are not, and also t and p are not adjacent.

    Similarly, edges st and sr are adjacent, but sr and tq are not adjacent edges.

    Example \(\PageIndex{2}\): Identifying Vertices That Are Not Adjacent

    Name all the pairs of vertices of graph F in Figure \(\PageIndex{4}\) that are not adjacent.

    Answer

    The vertices not adjacent in graph F are v and y, v and z, w and y, and y and z.

    Your Turn \( \PageIndex{2} \): Find Adjacent Vertex
    People in Mathematics: Sergey Brin and Laurence Page

    The “Google boys,” Sergey Brin and Laurence Page, transformed the World Wide Web in \(1998\) when they used the mathematics of graph theory to create an algorithm called Page Rank, which is known as the Google Search Engine today. The two computer scientists identified webpages as vertices and hyperlinks on those pages as edges because hyperlinks connect one website to the next. The number of edges influences the ranking of a website on the Google Search Engine because the websites with more links to “credible sources” are ranked higher. ("Page Rank: The Graph Theory-based Backbone of Google," September \(20, 2011,\) Cornell University, Networks Blog.

    Analyzing Geographical Maps with Graphs

     

    A map shows dots representing the flight connections from a particular airport.
    Figure \(\PageIndex{6}\): Commercial Airlines' Route Systems Create a Global Network.

    When graphs are used to model and analyze real-world applications, the number of edges that meet at a particular vertex is important. For example, a graph may represent the direct flight connections for a particular airport as in Figure \(\PageIndex{7}.\) Representing the connections with a graph rather than a map shifts the focus away from the relative positions and toward which airports are connected. In Figure \(\PageIndex{7},\) the vertices are the airports, and the edges are the direct flight paths. The number of flight connections between a particular airport and other South Florida airports is the number of edges meeting at a particular vertex. For example, Key West has direct flights to three of the five airports on the graph. In graph theory terms, we would say that vertex FYW has degree \(3.\) The degree of a vertex is the number of edges that connect to that vertex.

    FA graph represents the direct flights between South Florida airports. The graph has five vertices. Edges from the vertex, Tampa T P A connect with Key West E Y W, Miami M I A, Fort Lauderdale F L L, and West Palm Beach P B I. An edge connects Fort Lauderdale with Key West. An edge connects Miami with Key West.Figure \(\PageIndex{7}\): Direct Flights between South Florida Airport.
    Degree of a Vertex

    The degree of a vertex is the number of edges connected to it. The degree of a vertex can be either even or odd, depending on how many edges are connected to it. If a graph contains a loop, that loop contributes two to the degree of the vertex.

    Think about the intersection of two roads, Daniel Parkway and Summerline, near FSW.  That intersection is a vertex, and its degree is four.

    Example \(\PageIndex{3}\): Determining the Degree of a Vertex

    Determine the degree of each vertex of Graph J in Figure \(\PageIndex{8}.\) If Graph J represents direct flights between a set of airports, do any of the airports have direct flights to two or more of the other cities on the graph? Also, determine if the degree is even or odd.

    A graph labeled graph J. The graph has five vertices, a, b, c, d, and e. Edges connect a with b, c, and d. An edge connects c with d.
    Figure \(\PageIndex{8}\): Graph J
    Answer

    For each vertex, count the number of edges that meet at that vertex. This value is the degree of the vertex. In Figure \(\PageIndex{9},\) the dashed edges indicate the edges that meet at the marked vertex.

    Five graphs labeled graph J. In the first graph, vertex a has degree 3. The graph has five vertices, a, b, c, d, and e. Dotted edges from a connect with b, c, and d. An edge connects c with d. In the second graph vertex b has degree 1. The graph has five vertices, a, b, c, d, and e. Edges from a connect with b, c, and d. An edge connects c with d. The edge connecting b and a is dotted. In the third graph vertex c has degree 2. The graph has five vertices, a, b, c, d, and e. Edges from a connect with b, c, and d. An edge connects c with d. The edges connecting a and c and c and d are dotted. In the fourth graph vertex d has degree 2. The graph has five vertices, a, b, c, d, and e. Edges from a connect with b, c, and d. An edge connects c with d. The edges connecting c and d and a and d are dotted. In the fifth graph vertex e has degree 0. The graph has five vertices, a, b, c, d, and e. Edges from a connect with b, c, and d. An edge connects c with d.

     

     

     

     

     

     

     

     

     

     

     

    Figure \(\PageIndex{9}\): Degrees of Vertices of Graph J with their even and odd characteristic.

    The degree of \( a \) is \(3,\) indicating that \( a \) is ODD.
    The degree of \( b \) is \(1,\) meaning that \( b \) is also ODD.
    The degree of \( d \) is \(2,\) which classifies \( d \) as EVEN.
    The degree of \( e \) is \(0,\) so \( e\) is also considered EVEN.
    Finally, the degree of \( c\) is \(2,\) making \(c \) EVEN.

    Your Turn \( \PageIndex{3} \): Even or Odd Vertices?

    Representation of Graph as Boundaries.

    Graphs are also used to analyze regional boundaries. The states of Utah, Colorado, Arizona, and New Mexico all meet at a single point known as the “Four Corners,” which is shown in the map in figure \(\PageIndex{10}.\)

    A map of the USA with the four corners region highlighted. It includes Utah, Colorado, Arizona, and New Mexico.
    Figure \(\PageIndex{10}:\) Map of the Four Corners

    In Figure \(\PageIndex{11},\) each vertex represents one of these states, and each edge represents a shared border. States like Utah and New Mexico that meet at only a single point are not considered to have a shared border. By representing this map as a graph, where the connections are shared borders, we shift our perspective from physical attributes such as shape, size, and distance toward the existence of the relationship of having a shared boundary.

    A graph of four corner states. The graph shows four edges and four vertices forming a rectangle. The vertices are Utah, Colorado, Arizona, and New Mexico.
    Figure \(\PageIndex{11}\): Graph of the Shared Boundaries of Four Corners States
    Example \(\PageIndex{4}\): Graphing the Midwestern States

    A map of the Midwest is given in Figure \(\PageIndex{12}.\) Create a graph of the region in which each vertex represents a state and each edge represents a shared border.

    A partial map of the USA with the midwestern states. The Midwestern states are North Dakota, South Dakota, Nebraska, Kansas, Minnesota, Iowa, Missouri, Wisconsin, Illinois, Indiana, Michigan, and Ohio.
    Figure \(\PageIndex{12}\): Map of Midwestern States
    Answer

    For each state, draw and label a vertex. Draw edges between any two states that share a common land border as figure \(\PageIndex{14}.\)

    A partial map of the USA with the midwestern states. The Midwestern states are North Dakota (N D), South Dakota (S D), Nebraska (N E), Kansas (K S), Minnesota (M N), Iowa (I A), Missouri (M O), Wisconsin (W I), Illinois (I L), Indiana (I N), Michigan (M I), and Ohio (O H). Edges from N D connect with S D and M N. Edges from S D connect with N E, I A, and M N. Edges from M N connect with I A and W I. Edges from N E connect with K S, M O, and I A. Edges from I A connect with M O and I L. Edges from W I connect with I A and I L. An edge from K S connects with M O. An edge from M O connects with I L. An edge from I L connects with I N. Edges from I N connect with M I and O H. An edge from M I connects with O H.
    Figure \(\PageIndex{13}\): Edge Assigned to Each Pair of Midwestern States  with Common Border
    A graph represents common boundaries between midwestern states. Edges from M N connect with I A and W I. Edges from N E connect with K S, M O, and I A. Edges from I A connect with M O and I L. Edges from W I connect with I A and I L. An edge from K S connects with M O. An edge from M O connects with I L. An edge from I L connects with I N. Edges from I N connect with M I and O H. An edge from M I connects with O H.
    Figure \(\PageIndex{14}\): Final Graph Representing Common Boundaries between Midwestern States
    Your Turn \( \PageIndex{4} \): Model the Map to Graph
    Who Knew?: Using Graph Theory to Reduce Internet Fraud

    Could graphs be used to reduce Internet fraud? At least one researcher thinks so. Graph theory is used every day to analyze our behavior, particularly on social network sites. Alex Buetel, a computer scientist from Carnegie Mellon University in Pittsburgh, Pennsylvania, published a research paper in 2016 that discussed the possibilities of distinguishing the normal interactions from those that might be fraudulent using graph theory. Buetel wrote, “To more effectively model and detect abnormal behavior, we model how fraudsters work, catching previously undetected fraud on Facebook, Twitter, and Tencent Weibo and improving classification accuracy by up to \(68%\).” In the same paper, the researcher discusses how similar techniques can be used to model many other applications and even, “predict why you like a particular movie.” (Alex Beutel, "User Behavior Modeling with Large-Scale Graph Analysis," http://reports-archive.adm.cs.cmu.ed...-CS-16-105.pdf, May 2016, CMU-CS-16-105, Computer Science Department, School of Computer Science, Carnegie Mellon University, Pittsburgh, PA)

    Completeness and Subgraphs

    Suppose that there were five strangers in a room, A, B, C, D, and E, and each one would be introduced to each of the others. How many introductions are necessary? One way to begin to answer this question is to draw a graph with each vertex representing an individual in the room and each edge representing an introduction as in Figure \(\PageIndex{17}.\)

     

    Five graphs titled 4 edges, 3 more edges, 2 more edges, 1 more edge, and 4 plus 3 plus 2 plus 1 equals 10 edges. The first graph shows the edges connecting the following vertices: A E, A D, A C, and A B. The second graph shows the edges connecting the following vertices: A E, A B, A D, A C, E B, B C, and B D. The third graph shows the edges connecting the following vertices: A E, A B, A D, A C, E B, B C, B D, D C, and E C. The fourth graph shows the edges connecting the following vertices: A E, A B, A D, A C, E B, B C, B D, D C, E C, and E D. The fifth graph shows the edges connecting the following vertices: A E, A B, A D, A C, E B, B C, B D, D C, E C, and E D.
    Figure \(\PageIndex{15}\): Model of Introductions between Five Strangers

    Let's approach the problem by thinking about how many new people Person \(A\) would meet, then Person \(B,\) and so on, making sure not to repeat any introductions. The first graph in Figure \(\PageIndex{15}\) shows Person \(A\) meeting Persons \(B, C, D,\) and \(E,\) for a total of \(4\) introductions. The next graph shows that Person \(B\) still has to meet Persons \(C, D,\) and \(E,\) for a total of \(3\) more introductions. The next graph shows that Person \(C\) still has to meet Persons \(D\) and \(E,\) which is \(2\) more introductions. The next graph shows that Person \(D\) only remains to meet Person \(E,\) which is one more introduction. The final graph has \(4+3+2+1=10\) edges representing \(10\) introductions.

    Complete Graph

    A complete graph is one in which an edge connects every pair of distinct vertices.

    The last graph in Figure \(\PageIndex{17}\) is an example of a complete graph because an edge joins each pair of vertices. Another way of saying this is that the graph is complete because each vertex is adjacent to every other vertex. Figure \(\PageIndex{18}\) shows the complete graphs with three, four, five, and six vertices.

    Four graphs. The first graph shows three vertices, a, b, and c. The edges connect a c, a b, and c b. The second graph shows four vertices, a, b, c, and d. The edges connect a b, b c, c d, a d, a c, and b d. The third graph shows five vertices, a, b, c, d, and e. The edges connect a b, b c, c d, d e, e a, a d, a c, b e, b d, and c e. The fourth graph shows six vertices, a, b, c, d, e, and f. All the vertices are interconnected using 15 edges.
    Figure \(\PageIndex{16}\): Complete Graphs with Up to Six Vertices

    Subgraphs

    Sometimes, a graph is a part of a larger graph. For example, the graph of South Florida Airports from Figure \(\PageIndex{7}\) is part of a larger graph that includes Orlando International Airport in Central Florida, which is shown in Figure \(\PageIndex{17}.\) A subgraph is a smaller graph section comprising a subset of the vertices and edges from the original graph. Every edge and vertex of the subgraph must come from the original graph.

     
    FiA graph with six vertices. The edges connect Tampa T P A with Key West E Y W, Miami M I A, Fort Lauderdale F L L, and West Palm Beach P B I. An edge connects Key West with Miami. An edge connects Key West with Fort Lauderdale. Edges from Orlando M C O connect with Key West, Miami, and Fort Lauderdale.Figure \(\PageIndex{17}\): Orlando and South Florida Airports

    The graph in Figure \(\PageIndex{17}\) includes an additional vertex, MCO, and additional edges shown with dashed lines. The graph of direct flights between South Florida airports from Figure \(\PageIndex{7}\) is called a subgraph of the graph that also includes direct flights between Orlando and the same South Florida airports in Figure \(\PageIndex{17}.\) In general terms, if Graph B consists entirely of a set of edges and vertices from a larger Graph A, then B is called a subgraph of A.

    Example \(\PageIndex{5}\): Identifying a Subgraph

    Graph G and four diagrams are given in Figure \(\PageIndex{18}.\) Determine whether each diagram is or is not a subgraph of Graph G and explain why.

    Five graphs. Graph G has five vertices: a, b, c, d, and e. The edges connect a b, b c, c d, d e, e a, a d, and b e. Diagram J has five vertices: a, b, c, d, and e. The edges connect a b, a e, a d, e c, and c d. Diagram K has four vertices: a, e, c, and d. The edges connect a e, a d, and d c. Diagram L has four vertices: a, b, c, and d. The edges connect a d, d c, and b c. Diagram M has five vertices: a, b, c, d, and f. The edges connect a b, b c, c d, a f, and f d.
    Figure \(\PageIndex{18}\): Graph G and Potential Subgraphs
    Answer

    Diagram J is not a subgraph of Graph G because edge ec is not in Graph G.

    Diagram K is a subgraph of Graph G because all of its vertices and edges were part of Graph G.

    Diagram L is not a graph at all because there is a line extending from vertex a that does not connect a to another vertex. So, Diagram L cannot be a subgraph.

    Diagram M is not a subgraph of Graph G because it contains a vertex f, which is not part of G.

    Your Turn \( \PageIndex{5} \): Complete Graph

    Recognizing Isomorphic (Equivalent) Graphs

    Isomorphic graphs that represent the same pattern of connections can look very different despite having the same underlying structure. The edges can be stretched and twisted. The graph can be rotated or flipped. For example, in Figure \(\PageIndex{18},\) each diagram represents the same pattern of connections. The isomorphic graph is also called an equivalent graph.

    Equivalent Graph (Isomorphic Graph)

    Two graphs are said to be isomorphic if they are structurally the same, even if they look different in a drawing.

    Four representations of the same graph are displayed. The graphs are labeled graph A 1, graph A 2, graph A 3, and graph A 4. In the first graph, the four vertices are connected by edges to resemble a square. The bottom-left and top-right vertices are connected using an edge. The other graph represents the same in different forms.
    Figure \(\PageIndex{19}\): Four Representations of the Same Graph

    Looking at Figure \(\PageIndex{19},\) how can we know that these graphs are isomorphic? We will start by checking for any obvious differences. Each of the graphs in Figure \(\PageIndex{19}\) has four vertices and five edges, so there are no differences. Next, we will focus on the degrees of the vertices, which have been labeled in Figure \(\PageIndex{20}.\)

    Four representations of the same graph are displayed. The graphs are labeled graph A 1, graph A 2, graph A 3, and graph A 4. In the first graph, the four vertices are connected by edges to resemble a square. The bottom-left and top-right vertices are connected using an edge. The top-left, top-right, bottom-right, and bottom-left vertices are 2, 3, 2, and 3. The other graph represents the same in different forms.
    Figure \(\PageIndex{20}\): Graphs with Vertices of the Same Degrees

    As shown in Figure \(\PageIndex{20},\) each graph has two vertices of degree \(2\) and two vertices of degree \(3,\) so there are no differences.

    Checkpoint

    When you name isomorphisms, one way to check that your answer is reasonable is to make sure that the degrees of corresponding vertices are equal.

    Example \(\PageIndex{6}\): Identifying Isomorphisms

    Are the Graphs B1 and B2 in Figure \(\PageIndex{21}\) are isomorphic? Identify an isomorphism between them by listing corresponding pairs of vertices.

    Two graphs are labeled graph B 1 and graph B 2. Graph B 1 has four vertices: a, b, c, and d. The edges connect a c, b c, a d, and c d. Graph B 2 has four vertices: p, q, r, and s. The edges connect p q, q r, r s, and r p.
    Figure \(\PageIndex{21}\): Graphs B1 and B2
    Answer

    Figure \(\PageIndex{22}\) shows how to transform Graph B1 to get Graph B2.

    Vertex b corresponds to s, vertex c corresponds to r, vertex q corresponds to a, and vertex d corresponds to p.


    Graph B 1 is converted into graph B 2. Graph B 1 has four vertices: a, b, c, and d. The edges connect a c, b c, a d, and c d. Graph B 1 is rotated 90 degrees counterclockwise. Graph B 1 is again rotated 180 degrees clockwise to obtain graph B 2. Graph B 2 has four vertices: p, q, r, and s. The edges connect p q, q r, r s, and r p.
    Figure \(\PageIndex{22}\): Transform Graph B1 into Graph B2
    Your Turn \( \PageIndex{6} \): Equivalent Graphs

    Cycle 

    A cycle is a path that starts and ends at the same vertex, with no repeated edges or vertices (except the starting and ending vertex, which must be the same). All cycle are circuit but not all circuit are cycle.

    Looking at Cycle to Check Isomorphism

    Consider graph figure \(\PageIndex{23}.\) The graph G contains quadrilateral cycle \((b, f, d, c),\) but graph S contains a triangle cycle \((m, r, o.)\) Also, graph S contains a triangle cycle, but graph G has no triangle. This means that the graphs are not isomorphic.

    Two graphs are labeled graph G and graph S. Graph G has six vertices: a, b, c, d, e, and f. The edges connect a b, b c, c d, d e, f b, and f d. Graph S has six vertices: n, m, o, p, q, and r. The edges connect n m, m o, o p, p q, r m, a d r o.
    Figure \(\PageIndex{23}\): Graph G and Graph S

    Walk, Path, Trails, Circuit, and Cycle

    We know the basic parts of graphs, and we can distinguish one graph from another. It is time to really put our graphs to work for us. Many applications of graph theory involve navigating through a graph, very much like you would navigate through a maze. Imagine that you are at the entrance to a maze. Your goal is to get from one point to another as efficiently as possible. Maybe there are treasures hidden along the way that make straying from the shortest path worthwhile, or maybe you just need to get to the end fast. Either way, you definitely want to avoid any wrong turns that would cause unnecessary backtracking. Luckily, graph theory is here to help

    People walking through a maze of hedges.
    Figure \(\PageIndex{24}\): Visitors navigate a garden maze. (credit: “Longleat Maze” by Niki Odolphie/Wikimedia, CC BY 2.0)

    Definition: Walk, Trails, and Path

    1. A walk is a sequence of vertices and edges where both edges and vertices can be repeated.
    2. A trail is an open walk where no edge is repeated, though vertices may be repeated.
    3. A path is a trail in which neither vertices nor edges are repeated.

    A walk is the most basic way of navigating a graph, as it has no restrictions except for staying on it. We will call the walk by a different name when there are restrictions on which vertices or edges we can visit. For example, if we want to find a walk that avoids traveling the same edge twice, we will say we want to find a trail (or directed trail). If we want to find a walk that avoids visiting the same vertex twice, we will say we want to find a path (or directed path).

    Walks, trails, and paths are all related.

    1. All paths are trails, but trails that visit the same vertex twice are not paths.
    2. All trails are walks, but walks in which an edge is visited twice would not be trails.

    Since walks, trails, and paths are all related, closed walks, closed trails (circuits), and closed paths (directed cycles) are linked too.

    1. All circuits are closed walks, but closed walks that visit the same edge twice are not circuits.
    2. All directed cycles are circuits, but circuits in which a vertex is visited twice are not directed cycles.

    We can visualize the relationship as in Figure \(\PageIndex{25}\)  and Figure \(\PageIndex{26}.\)

     

     

    Three concentric ovals represent paths, trails, and walks. The first (inner) oval labeled paths reads, no repeated edges or vertices. The second oval labeled trails reads, no repeated edges. The third oval is labeled walks.
    Figure \(\PageIndex{25}\): Walks, Trails, and Paths
    Three concentric ovals represent directed cycles, circuits, and closed walks. The first (inner) oval labeled directed cycles (closed paths) reads, no repeated edges or vertices. The second oval labeled circuits (closed talks) reads with no repeated edges. The third oval is labeled closed walks.
    Figure \(\PageIndex{26}\): Closed Walks, Ccylce, and Circuits

    Term 

    Description

    Edges Repeated?

    Vertices Repeated?

    Walk

    A sequence of edges and vertices

    Yes

    Yes

    Trail

    A walk with no repeated edges

    No

    Yes

    Path

    A trail with no repeated vertices

    No

    No

    Circuit

    A closed trail

    No

    Yes

    Cycle

    A closed path

    No

    No (except start/end)

    In many applications of graph theory, such as creating efficient delivery routes that begin and end at the same location, this requirement is often necessary. When a walk, path, or trail ends at the same location or vertex where it began, we call it a closed path. Otherwise, we call it open (it does not begin and end at the same location or vertex). The following table provides examples of closed walks, trails, and paths.

    Closed Walks, Trails, and Paths
    DESCRIPTION EXAMPLE CHARACTERISTICS

     

     

     

     

    A closed walk is a walk that begins and ends at the same vertex.

    A graph has five vertices: b, c, d, e, and f. All the vertices are interconnected. An arrow labeled 1 flows from d to f. An arrow labeled 2 flows from f to b. An arrow labeled 3 flows from b to c. An arrow labeled 4 flows from c to f. An arrow labeled 5 flows from f to d.

    dfbcfd

     

     

     

    Alternating sequence of vertices and edges

    Begins and ends at the same vertex

     

     

     

     

    A closed trail is a trail that begins and ends at the same vertex. It is commonly called a circuit.

    A graph has five vertices b, c, d, e, and f. All the vertices are interconnected. An arrow labeled 1 flows from d to f. An arrow labeled 2 flows from f to b. An arrow labeled 3 flows from b to c. An arrow labeled 4 flows from c to f. An arrow labeled 5 flows from f to e. An arrow labeled 6 flows from e to d.

    dfbcfed

     

     

     

    No repeated edges

    Begins and ends at the same vertex

     

     

    A closed path is a path that begins and ends at the same vertex. It is also referred to as a directed cycle because it travels through a cyclic subgraph.

    A graph has five vertices b, c, d, e, and f. All the vertices are interconnected. An arrow labeled 1 flows from d to f. An arrow labeled 2 flows from f to b. An arrow labeled 3 flows from b to c. An arrow labeled 4 flows from c to d.

    dfbcd

     

     

    No repeated edges or vertices

    Begins and ends at the same vertex

    The same circuit can be named using any of its vertices as a starting point. For example, the circuit dfbcd can also be referred to in the following ways.

    abcda is the same as

    { bcdabcdabcdabcd{ bcdabcdabcdabcd

    Let’s practice working with closed walks, circuits (closed trails), and directed cycles (closed paths). In the graph in Figure \(\PageIndex{8},\) the vertices are major central and south Florida airports. The edges are direct flights between them

    Example \(\PageIndex{7}\): Determining a Closed Walk, Circuit, or Directed Cycle

    Suppose that you need to travel by air from Miami (MIA) to Orlando (MCO) and you are restricted to flights as represented on the graph. For the trip to Orlando, you decide to purchase tickets with a layover in Key West (EYW) as shown in Figure \(\PageIndex{27},\) but you still have to decide on the return trip. Determine if your round-trip itinerary is a closed walk, a circuit,/or a directed cycle based on the return trip described in each part.

     

    A graph represents the direct flights between Central and South Florida airports. The graph has six vertices: T P A, M C O, P B I, F L L, M I A, and E Y W. Edges from T P A lead to E Y W, M I A, F L L, and P B I. Edges from M C O lead to E Y W, M I A, and F L L. An edge from E Y W leads to F L L. An arrow from M I A points to E Y W. An arrow from E Y W points to M C O.
    Figure \(\PageIndex{27}\): MIA to EYW to MCO
    1. You returned to Miami (MIA) by reversing your route.
    2. Your direct flight back left Orlando (MCO) but was diverted to Fort Lauderdale (FLL)! You flew to Tampa (TPA) from there before returning to Miami (MIA).
    Answer
    1. The whole trip was MIAEYWMCOEYWMIA. This is a closed walk because it begins and ends at the same vertex. It is not a circuit because it repeats edges. If it is not a circuit, then it cannot be a directed cycle.
    2. The whole trip was MIAEYWMCOFLLTPAMIA. This is a closed walk because it begins and ends at the same vertex. It is a circuit because no edges were repeated. It is also a directed cycle because no vertices were repeated. So, it is all three!

    Example \(\PageIndex{8}\): Identifying Walks, Paths, and Trails

    Consider each sequence of vertices from Graph in Figure \(\PageIndex{28}.\) Determine if it is only a walk, both a walk and a path, both a walk and a trail, all three, or none of these.

    Two graphs are labeled graph A and graph K. Graph A has five vertices: b, c, d, e, and f. The edges connect b c, c f, b d, b e, d e, and e f. Graph K has five vertices: m, n, o, p, and q. The edges connect m n, n o, n q, q o, o p, n p, and m p.
    Figure \(\PageIndex{28}\)
    1. bcdef
    2. cbdbe
    3. cfedbc
    4. befcbd
    Answer

    \(1.\) First, check to see if the sequence of vertices is a walk by making sure that the vertices are consecutive. As you can see in Figure \(\PageIndex{27},\) there is no edge between vertex c and vertex d.

    Graph A has five vertices: b, c, d, e, and f. The edges connect b c, c f, b d, b e, d e, and e f. A sequence of arrows flows from b to c, c to d, d to e, and e to f.
    Figure \(\PageIndex{29}\)

    This means that the sequence is not a walk. If it is not a walk, then it can’t be a path, and it cannot be a trail, so it is none of these.

    \(2.\) First, check to see if the sequence is a walk. As you can see in Figure \(\PageIndex{30},\) the vertices are consecutive.

    Graph A has five vertices: b, c, d, e, and f. The edges connect b c, c f, b d, b e, d e, and e f. An arrow labeled 1 flows from c to b. An arrow labeled 2 flows from b to d. An arrow labeled 3 flows from d to e. An arrow labeled 4 flows from b to e.
    Figure \(\PageIndex{30}\)

    This means that the sequence is a walk. Since the vertex b is visited twice, this walk is not a path. Since edge bd is traveled twice, this walk is not a trail. So, the sequence is only a walk.

    \(3.\) First, check to see if the sequence is a walk. We can see in Figure \(\PageIndex{31}\) that the vertices are consecutive, which means it is a walk.

    Graph A has five vertices: b, c, d, e, and f. The edges connect b c, c f, b d, b e, d e, and e f. An arrow labeled 1 flows from c to f. An arrow labeled 2 flows from f to e. An arrow labeled 3 flows from e to d. An arrow labeled 4 flows from d to b. An arrow labeled 5 flows from b to c.
    Figure \(\PageIndex{31}\)

    Next, check to see if any vertex is visited twice. Remember, we do not consider beginning and ending at the same vertex to be visiting a vertex twice. So, no vertex was visited twice. This means we have a walk that is also a path. The next check was to see if any edge was visited twice; none were. So, the sequence is a walk, a path, and a trail.

    \(4.\) First, check to see if the sequence is a walk. We can see in Figure \(\PageIndex{32}\) that the vertices are consecutive, which means it is a walk.

    Graph A has five vertices: b, c, d, e, and f. The edges connect b c, c f, b d, b e, d e, and e f. An arrow labeled 1 flows from b to e. An arrow labeled 2 flows from e to f. An arrow labeled 3 flows from f to c. An arrow labeled 4 flows from c to b. An arrow labeled 5 flows from b to d.
    Figure \(\PageIndex{32}\)

    Next, check if any vertex has been visited twice. Since vertex b is visited twice, this is not a path. Finally, check to see if any edges are traveled twice. Since no edges are traveled twice, this is a trail. So, the sequence of vertices is a walk and a trail.

    Your Turn \( \PageIndex{8} \): Walk or Path?

    Example \(\PageIndex{9}\): Naming a Walk Through A House

    Figure \(\PageIndex{32\) shows the floor plan of a house. Use the floor plan to answer each question.

    A floor plan of a house includes the master bedroom, bedroom, kitchen, living room, hallway, garage, and restroom.
    Figure \(\PageIndex{33}\): Floor Plan of a House
    1. Draw a graph representing the floor plan in which each vertex represents a different room (or hallway), and edges represent doorways between rooms.
    2. Name a walk through the house that begins in the living room, ends in the garage, and visits each room (or hallway) at least once.
    Answer

    \(1.\) We will need a vertex for each room, and it is convenient to label them according to the names of the rooms. Visualize the scenario in your head as shown in Figure \(\PageIndex{34}.\) You don’t have to write this step on your paper.

    A floor plan of a house includes the master bedroom, bedroom, kitchen, living room, hallway, garage, and restroom. The following vertices are assigned to rooms: master bedroom, M; bedroom, B; kitchen, K; living room, L; hallway, H; garage, G; and restroom, R. Edges from H lead to M, B, L, and G. Edges from L lead to K and R.
    Figure \(\PageIndex{34}\): Assigning Vertices to Rooms

    Draw a graph to represent the scenario. Start with the vertices. Then, connect those vertices that share a doorway in the floor plan, as shown in Figure \(\PageIndex{35}.\)

    A graph of the floor plan. The graph has seven vertices: M, B, K, H, L, G, and R. Edges from H lead to M, B, and G. Edges from L lead to K and R. An edge connects H with L.
    Figure \(\PageIndex{35}\): Graph of the Floor plan

    Draw a walk that begins at vertex L, representing the living room, and ends at vertex G, representing the garage, making sure to visit every room at least once. There are many ways this can be done. You may want to number the edges to keep track of their order. One example is shown in Figure \(\PageIndex{36}.\)

    A graph of the floor plan. The graph has seven vertices: M, B, K, H, L, G, and R. Edge 1: L to R. Edge 2: R to L. Edge 3: L to K. Edge 4: K to L. Edge 5: L to H. Edge 6: H to B. Edge 7: B to H. Edge 8: H to M. Edge 9: M to H. Edge 10: H to G.
    Figure \(\PageIndex{36}\): Draw the walk from L to G

    \(2.\) Name the walk that you followed by listing the vertices in the order you visited them.

    LRLKLHBHMHG

    Your Turn \( \PageIndex{9} \): Draw a Graph to Model Given Floor plan

    Connectedness

    Before we can discuss finding the best delivery route, we must ensure that a route exists. For example, suppose that you were tasked with visiting every airport on the graph in Figure \(\PageIndex{37}\) by plane. Could you accomplish that task by only taking direct flight paths between airports listed on this graph? In other words, are all the airports connected by paths? Or are some of the airports disconnected from the others?

    A graph represents the direct flights between Central and South Florida airports. The graph has six vertices: T P A, M C O, P B I, F L L, M I A, and E Y W. Edges from T P A lead to E Y W, M I A, F L L, and P B I. Edges from M C O lead to E Y W, M I A, and F L L. An edge from E Y W leads to F L L.Figure \(\PageIndex{37}\): Major Central and South Florida Airports

    In Figure \(\PageIndex{37},\) we can see TPA is adjacent to PBI, FLL, MIA, and EYW. Also, there is a path between TPA and MCO through FLL. This indicates there is a path between each pair of vertices. So, it is possible to travel to each of these airports only by taking direct flight paths and visiting no other airports.

    Connectedness

    A graph is connected if there is a path joining every pair of vertices on the graph. If graphs are not connected, it is called disconnected.

    Let’s take a closer look at graph X in Figure \(\PageIndex{38}.\) Focus on vertex a. There is a path between vertices a and b, but there is no path between vertex a and vertex c. So, Graph X is disconnected. The graph Y is connected because of vertex g.

    Two graphs are labeled graph X and graph Y. Graph X has six vertices: a, b, c, d, e, and f. The vertices a, b, and e are connected by three edges and it resembles a triangle. The vertices, c, d, and f are connected by three edges and it resembles a triangle. These two triangles overlap and the point where they overlap has no vertex. Graph Y is the same as that of graph X. The point where they overlap has a vertex, g.
    Figure \(\PageIndex{38}\): Connected vs. Disconnected

    When you are working with a planar graph, you can also determine if a graph is connected by untangling it. If you draw it so that none of the edges are overlapping, as we did with Graph X in Figure \(\PageIndex{39}\), it is easier to see that the graph is disconnected.

    Three graphs. Graph X, version 1 has six vertices: a, b, c, d, e, and f. The vertices a, b, and e are connected by three edges and it resembles a triangle. The vertices, c, d, and f are connected by three edges and it resembles a triangle. These two triangles overlap and the point where they overlap has no vertex. Graph X, version 2 has 2 triangles. The vertices a, b, and e are connected by three edges and it resembles a triangle. The vertices, c, d, and f are connected by three edges and it resembles a triangle. Graph X, version 3 has two concentric triangles. Inner triangle: the vertices a, b, and e are connected by three edges. Outer triangle: the vertices, c, d, and f are connected by three edges.
    Figure \(\PageIndex{39}\): Untangling Graph X

    Versions \(2\) and \(3\) of Graph X in Figure \(\PageIndex{439},\) each have the same number of vertices, number of edges, degrees of the vertices, and pairs of adjacent vertices as in version \(1.\) In other words, each version retains the same structure as the original graph. Since versions \(2\) and \(3\) of Graph X, do not have overlapping edges, it is easier to identify pairs of vertices that do not have paths between them, and it is more obvious that Graph X is disconnected. In fact, there are two completely separate, disconnected subgraphs, one with the vertices in {a, b, e}, and the other with the vertices {c, d, f}

    Example \(\PageIndex{10}\): Determining If a Graph Is Connected or Disconnected

    Use Figure \(\PageIndex{41}\) to answer each question.

    Graph E has four vertices: a, b, c, and d. Edges connect d c, d a, and d b.
    Figure \(\PageIndex{40}\): Graph E
    1. Identify all the components of Graph E.
    2. Determine whether the graph is connected or disconnected, and explain your reasoning.
    Answer
    1. There is only one component in Graph E. It has the vertices {a, b, c, d}.
    2. The graph is connected because there is a path between vertex a and every other vertex. We can also see that Graph E is connected because it has only one component.
    Your Turn \( \PageIndex{10} \): Is Graph Connected?

    Definition: Bridge

    A bridge is an edge that, if removed, would disconnect the graph, meaning there would be at least two separate parts that are no longer connected.

    Example \(\PageIndex{11}\): Find Bridges

     

    Two graphs are labeled graph G and graph S. Graph G has six vertices: a, b, c, d, e, and f. The edges connect a b, b c, c d, d e, f b, and f d. Graph S has six vertices: n, m, o, p, q, and r. The edges connect n m, m o, o p, p q, r m, a d r o.
    Figure \(\PageIndex{41}\)

    Find the bridges in Graph G and Graph S

    Answer

    In G, bridges are ab and de.

    In S, bridges are nm, op, and pq.

    Your Turn \( \PageIndex{11} \): Idenfity Bridges
     
    Your Turn \( \PageIndex{12} \): Matching with Definition

    This page titled 7.1: Basic Graphs and Graphs Structure is shared under a CC BY 4.0 license and was authored, remixed, and/or curated by OpenStax via source content that was edited to the style and standards of the LibreTexts platform.