• Home
  • Textbooks
  • Mathematical Structures for Computer Science
  • Graph Algorithms

Mathematical Structures for Computer Science

Judith L. Gersting

Chapter 6

Graph Algorithms - all with Video Answers

Educators


Chapter Questions

Problem 1

Find the adjacency matrix and adjacency relation for the graph in the figure.SHEET 78 +1

Check back soon!
03:57

Problem 1

Rework Example 3 of Chapter 2 using the theorem on Euler paths.

WZ
Wen Zheng
Numerade Educator

Problem 1

Decide by trial and error whether Hamiltonian circuits exist for the graphs of the given exercise.

Exercise 6

Check back soon!

Problem 1

Use the accompanying graph. Apply algorithm ShortestPath (Dijkstra's algorithm) for the pairs of nodes given; show the values for $p$ and $I N$ and the $d$-values and $s$-values for each pass through the while loop. Write out the nodes in the shortest path and its distance.

From 2 to 5

Check back soon!

Problem 1

Write the nodes in a depth-first search of the following graph, beginning with the node specified.
(GRAPH CANT COPY)

$a$

Check back soon!

Problem 1

Draw the depth-first search trees, where node $a$ is the starting node of the depth-first search. Identify the back arcs.

(GRAPH CANT COPY)

Check back soon!

Problem 2

Find the adjacency matrix and adjacency relation for the graph in the figure.(FIG CANT COPY)

Check back soon!

Problem 2

Determine whether the specified graph has an Euler path by using the theorem on Euler paths.

(FIG CANT COPY)

Check back soon!
01:01

Problem 2

Recall that $K_n$ denotes the simple, complete graph of order $n$.
a. For what values of $n$ does an Euler path exist in $K_n$ ?
b. For what values of $n$ does a Hamiltonian circuit exist in $K_n$ ?

WZ
Wen Zheng
Numerade Educator

Problem 2

Use the accompanying graph. Apply algorithm ShortestPath (Dijkstra's algorithm) for the pairs of nodes given; show the values for $p$ and $I N$ and the $d$-values and $s$-values for each pass through the while loop. Write out the nodes in the shortest path and its distance.

From 3 to 6

Check back soon!

Problem 2

Write the nodes in a depth-first search of the following graph, beginning with the node specified.
(GRAPH CANT COPY)

$c$

Check back soon!

Problem 2

Draw the depth-first search trees, where node $a$ is the starting node of the depth-first search. Identify the back arcs.

(GRAPH CANT COPY)

Check back soon!

Problem 3

Find the corresponding directed graph and adjacency relation for the following adjacency matrix.

$$
\mathbf{A}=\left[\begin{array}{lllll}
0 & 0 & 0 & 1 & 0 \\
0 & 0 & 0 & 0 & 1 \\
0 & 0 & 0 & 0 & 0 \\
0 & 1 & 0 & 0 & 0 \\
0 & 0 & 1 & 1 & 0
\end{array}\right]
$$

Check back soon!

Problem 3

Determine whether the specified graph has an Euler path by using the theorem on Euler paths.

(FIG CANT COPY)

Check back soon!

Problem 3

Use the accompanying graph. Apply algorithm ShortestPath (Dijkstra's algorithm) for the pairs of nodes given; show the values for $p$ and $I N$ and the $d$-values and $s$-values for each pass through the while loop. Write out the nodes in the shortest path and its distance.

From 1 to 5

Check back soon!

Problem 3

Write the nodes in a depth-first search of the following graph, beginning with the node specified.
(GRAPH CANT COPY)

$d$

Check back soon!

Problem 3

Draw the depth-first search trees, where node $a$ is the starting node of the depth-first search. Identify the back arcs.

(GRAPH CANT COPY)

Check back soon!

Problem 4

Find the corresponding directed graph and adjacency relation for the following adjacency matrix.

$$
\mathbf{A}=\left[\begin{array}{lllll}
0 & 0 & 0 & 0 & 0 \\
1 & 0 & 0 & 0 & 1 \\
0 & 1 & 0 & 1 & 0 \\
0 & 1 & 0 & 0 & 0 \\
0 & 0 & 0 & 1 & 0
\end{array}\right]
$$

Check back soon!

Problem 4

Determine whether the specified graph has an Euler path by using the theorem on Euler paths.

(FIG CANT COPY)

Check back soon!

Problem 4

Use the accompanying graph. Apply algorithm ShortestPath (Dijkstra's algorithm) for the pairs of nodes given; show the values for $p$ and $I N$ and the $d$-values and $s$-values for each pass through the while loop. Write out the nodes in the shortest path and its distance.

From 4 to 7

Check back soon!

Problem 4

Write the nodes in a depth-first search of the following graph, beginning with the node specified.
(GRAPH CANT COPY)

$g$

Check back soon!

Problem 4

Draw the depth-first search trees, where node $a$ is the starting node of the depth-first search. Identify the back arcs.

(GRAPH CANT COPY)

Check back soon!

Problem 5

Given the adjacency relation $\rho=\{(1,4),(1,5),(1,6),(6,2),(6,3),(6,5)\}$ on the set $N=\{1,2,3,4,5,6\}$, find the corresponding directed graph and adjacency matrix.

Check back soon!

Problem 5

Determine whether the specified graph has an Euler path by using the theorem on Euler paths.

(FIG CANT COPY)

Check back soon!

Problem 5

Use the accompanying graph. Apply algorithm ShortestPath (Dijkstra's algorithm) for the pairs of nodes given; show the values for $p$ and $I N$ and the $d$-values and $s$-values for each pass through the while loop. Write out the nodes in the shortest path and its distance.
(FIG CANT COPY)

From $a$ to $e$

Check back soon!

Problem 5

Write the nodes in a depth-first search of the following graph, beginning with the node specified.
(GRAPH CANT COPY)

$e$

Check back soon!

Problem 5

Draw the depth-first search trees, where node $a$ is the starting node of the depth-first search. Identify the back arcs.

(GRAPH CANT COPY)

Check back soon!

Problem 6

Given the adjacency relation $\rho=\{(2,1),(3,2),(3,3),(3,4),(4,5),(6,3),(6,6)\}$ on the set $N=\{1,2,3,4,5,6\}$, find the corresponding directed graph and adjacency matrix.

Check back soon!

Problem 6

Determine whether the specified graph has an Euler path by using the theorem on Euler paths.

(FIG CANT COPY)

Check back soon!

Problem 6

Use the accompanying graph. Apply algorithm ShortestPath (Dijkstra's algorithm) for the pairs of nodes given; show the values for $p$ and $I N$ and the $d$-values and $s$-values for each pass through the while loop. Write out the nodes in the shortest path and its distance.
(FIG CANT COPY)

From $d$ to $a$

Check back soon!

Problem 6

Write the nodes in a depth-first search of the following graph, beginning with the node specified.
(GRAPH CANT COPY)

$h$

Check back soon!

Problem 6

Draw the depth-first search trees, where node $a$ is the starting node of the depth-first search. Identify the back arcs.

(GRAPH CANT COPY)

Check back soon!
03:00

Problem 7

Describe a property of a directed graph whose adjacency matrix is symmetric.

Chris Trentman
Chris Trentman
Numerade Educator

Problem 7

Determine whether the specified graph has an Euler path by using the theorem on Euler paths.

(FIG CANT COPY)

Check back soon!

Problem 7

Use the following directed graph. Apply algorithm ShortestPath (Dijkstra's algorithm) to the nodes given; show the values for $p$ and $I N$ and the $d$-values and $s$-values for each pass through the while loop. Write out the nodes in the shortest path and its distance.

From 1 to 7

Check back soon!

Problem 7

Write the nodes in a depth-first search of the following graph, beginning with the node specified.
(GRAPH CANT COPY)

$a$

Check back soon!

Problem 7

Use algorithm ArtPoint to find the articulation points. Label the tree number and back number for each node, both as first assigned and as changed. Draw the biconnected components of the graph

(GRAPH CANT COPY)

Check back soon!
View

Problem 8

Describe the directed graph whose adjacency matrix has all $1 \mathrm{~s}$ in row 1 and column 1 , and 0 s elsewhere.

Nick Johnson
Nick Johnson
Numerade Educator

Problem 8

Determine whether the specified graph has an Euler path by using the theorem on Euler paths.

(FIG CANT COPY)

Check back soon!

Problem 8

Use the following directed graph. Apply algorithm ShortestPath (Dijkstra's algorithm) to the nodes given; show the values for $p$ and $I N$ and the $d$-values and $s$-values for each pass through the while loop. Write out the nodes in the shortest path and its distance.

From 3 to 1

Check back soon!

Problem 8

Write the nodes in a depth-first search of the following graph, beginning with the node specified.
(GRAPH CANT COPY)

$e $

Check back soon!

Problem 8

Use algorithm ArtPoint to find the articulation points. Label the tree number and back number for each node, both as first assigned and as changed. Draw the biconnected components of the graph

(GRAPH CANT COPY)

Check back soon!
View

Problem 9

Describe the directed graph whose adjacency matrix has $1 \mathrm{~s}$ in positions $(i, i+1)$ for $1 \leq i \leq n-1$, a 1 in position $(n, 1)$, and 0 s elsewhere.

Nick Johnson
Nick Johnson
Numerade Educator

Problem 9

Determine whether the specified graph has an Euler path by using the theorem on Euler paths.

(FIG CANT COPY)

Check back soon!
01:57

Problem 9

a. Modify algorithm ShortestPath so that it finds the shortest paths from $x$ to all other nodes in the graph.
b. Does this change the worst-case order of magnitude of the algorithm?

WZ
Wen Zheng
Numerade Educator

Problem 9

Write the nodes in a depth-first search of the following graph, beginning with the node specified.
(GRAPH CANT COPY)

$f$

Check back soon!

Problem 9

Use algorithm ArtPoint to find the articulation points. Label the tree number and back number for each node, both as first assigned and as changed. Draw the biconnected components of the graph

(GRAPH CANT COPY)

Check back soon!
00:37

Problem 10

Describe a property of a directed graph whose adjacency relation is irreflexive (see Exercise 19, Section 4.1).

Erika Bustos
Erika Bustos
Numerade Educator

Problem 10

Determine whether the specified graph has an Euler path by using the theorem on Euler paths.

(FIG CANT COPY)

Check back soon!
00:42

Problem 10

Give an example to show that algorithm ShortestPath does not work when negative weights are allowed.

WZ
Wen Zheng
Numerade Educator

Problem 10

Write the nodes in a depth-first search of the following graph, beginning with the node specified.
(GRAPH CANT COPY)

$h$

Check back soon!

Problem 10

Use algorithm ArtPoint to find the articulation points. Label the tree number and back number for each node, both as first assigned and as changed. Draw the biconnected components of the graph

(GRAPH CANT COPY)

Check back soon!
03:00

Problem 11

Describe a property of the adjacency matrix of a graph whose adjacency relation is antisymmetric.

Chris Trentman
Chris Trentman
Numerade Educator
06:21

Problem 11

Draw the adjacency matrix for the graph of Exercise 2. In applying algorithm EulerPath, what is the value of total after the second pass through the while loop?

Chris Trentman
Chris Trentman
Numerade Educator

Problem 11

Use algorithm AnotherShortestPath (the Bellman-Ford algorithm) to find the shortest path from the source node to any other node. Show the successive $d$-values and $s$-values.

Graph for Exercises 1-4, source node $=2$ (compare your answer to Exercise 1)

Check back soon!

Problem 11

Write the nodes in a breadth-first search of the graph in the figure for Exercises 1-6, beginning with the node specified.

$a$

Check back soon!

Problem 11

Use algorithm ArtPoint to find the articulation points. Label the tree number and back number for each node, both as first assigned and as changed. Draw the biconnected components of the graph

(GRAPH CANT COPY)

Check back soon!

Problem 12

Adjacency relations $\rho$ and $\sigma$ have the following associated adjacency matrices $\mathbf{R}$ and $\mathbf{S}$. Find the adjacency matrices associated with the relations $\rho \cup \sigma$ and $\rho \cap \sigma$.
$$
\mathbf{R}=\left[\begin{array}{llll}
0 & 1 & 1 & 0 \\
0 & 0 & 0 & 1 \\
1 & 1 & 0 & 0 \\
1 & 0 & 0 & 1
\end{array}\right] \quad \mathbf{S}=\left[\begin{array}{llll}
0 & 1 & 0 & 0 \\
0 & 0 & 1 & 0 \\
1 & 0 & 0 & 1 \\
1 & 0 & 0 & 0
\end{array}\right]
$$

Check back soon!
View

Problem 12

Draw the adjacency matrix for the graph of Exercise 4. In applying algorithm EulerPath, what is the value of total after the fourth pass through the while loop?

Nick Johnson
Nick Johnson
Numerade Educator

Problem 12

Use algorithm AnotherShortestPath (the Bellman-Ford algorithm) to find the shortest path from the source node to any other node. Show the successive $d$-values and $s$-values.

Graph for Exercises 1-4, source node $=1$ (compare your answer to Exercise 3)

Check back soon!

Problem 12

Write the nodes in a breadth-first search of the graph in the figure for Exercises 1-6, beginning with the node specified.

$c$

Check back soon!

Problem 12

Use algorithm ArtPoint to find the articulation points. Label the tree number and back number for each node, both as first assigned and as changed. Draw the biconnected components of the graph

(GRAPH CANT COPY)

Check back soon!
00:32

Problem 13

The two directed graphs that follow have adjacency relations $\rho$ and $\sigma$. Draw the graphs associated with the relations $\rho \cup \sigma$ and $\rho \cap \sigma$.

(FIG CANT COPY)

Subhadeepta Sahoo
Subhadeepta Sahoo
Numerade Educator
View

Problem 13

Draw the adjacency matrix for the graph of Exercise 6. In applying algorithm EulerPath, what is the value of $i$ after the while loop is exited?

Nick Johnson
Nick Johnson
Numerade Educator

Problem 13

Use algorithm AnotherShortestPath (the Bellman-Ford algorithm) to find the shortest path from the source node to any other node. Show the successive $d$-values and $s$-values.

Graph for Exercises 7 and 8, source node $=1$ (compare your answer to Exercise 7)

Check back soon!

Problem 13

Write the nodes in a breadth-first search of the graph in the figure for Exercises 1-6, beginning with the node specified.

$d$

Check back soon!

Problem 14

The following directed graph represents a binary relation $\rho$ on the nodes. Draw the directed graph that would represent the transitive closure of $\rho$.
(FIG CANT COPY)

Check back soon!
View

Problem 14

Draw the adjacency matrix for the graph of Exercise 7. In applying algorithm EulerPath, what is the value of $i$ after the while loop is exited?

Nick Johnson
Nick Johnson
Numerade Educator

Problem 14

Use algorithm AnotherShortestPath (the Bellman-Ford algorithm) to find the shortest path from the source node to any other node. Show the successive $d$-values and $s$-values.

Accompanying graph, source node $=1$ (compare your answer to Exercise 10)

Check back soon!

Problem 14

Write the nodes in a breadth-first search of the graph in the figure for Exercises 1-6, beginning with the node specified.

$g$

Check back soon!
01:51

Problem 15

Let $\mathbf{A}$ be the matrix
$$
\mathbf{A}=\left[\begin{array}{llll}
1 & 1 & 0 & 1 \\
0 & 0 & 1 & 0 \\
1 & 0 & 0 & 1 \\
1 & 0 & 1 & 0
\end{array}\right]
$$
$$
\text { Find the products } \mathbf{A}^2 \text { and } \mathbf{A}^{(2)} \text {. }
$$

Narayan Hari
Narayan Hari
Numerade Educator

Problem 15

Decide by trial and error whether Hamiltonian circuits exist for the graphs of the given exercise.

Exercise 2

Check back soon!

Problem 15

Use algorithm AllPairsShortestPath (Floyd's algorithm) to find the distances for all the shortest paths. Show the successive values of the A matrix for each pass through the outer loop.

Figure 6.10

Check back soon!

Problem 15

Write the nodes in a breadth-first search of the graph in the figure for Exercises 1-6, beginning with the node specified.

$e$

Check back soon!
03:00

Problem 16

The definition of a connected graph can be extended to directed graphs. Describe the reachability matrix $\mathbf{R}$ for a connected, directed graph.

Chris Trentman
Chris Trentman
Numerade Educator

Problem 16

Decide by trial and error whether Hamiltonian circuits exist for the graphs of the given exercise.

Exercise 3

Check back soon!

Problem 16

Use algorithm AllPairsShortestPath (Floyd's algorithm) to find the distances for all the shortest paths. Show the successive values of the A matrix for each pass through the outer loop.

Graph for Exercises 1-4

Check back soon!

Problem 16

Write the nodes in a breadth-first search of the graph in the figure for Exercises 1-6, beginning with the node specified.

$h$

Check back soon!
00:12

Problem 17

For the following graph, write the reachability matrix $\mathbf{R}$ by simply inspecting the graph.(FIG CANT COPY)

Brandon Fox
Brandon Fox
Numerade Educator

Problem 17

Decide by trial and error whether Hamiltonian circuits exist for the graphs of the given exercise.

Exercise 4

Check back soon!
07:51

Problem 17

Use Prim's algorithm to find a minimal spanning tree for the graph in the specified figure.

Graph for Exercises 1-4

Chris Trentman
Chris Trentman
Numerade Educator

Problem 17

Write the nodes in a breadth-first search of the graph in the figure for Exercises 7-10, beginning with the node specified.

$a$

Check back soon!
00:12

Problem 18

For the following graph, write the reachability matrix $\mathbf{R}$ by simply inspecting the graph.(FIG CANT COPY)

Brandon Fox
Brandon Fox
Numerade Educator

Problem 18

Decide by trial and error whether Hamiltonian circuits exist for the graphs of the given exercise.

Exercise 5

Check back soon!

Problem 18

Use Prim's algorithm to find a minimal spanning tree for the graph in the specified figure.

(GRAPH CANT COPY)

Check back soon!

Problem 18

Write the nodes in a breadth-first search of the graph in the figure for Exercises 7-10, beginning with the node specified.

$e$

Check back soon!

Problem 19

Compute the reachability matrix $\mathbf{R}$ by using the formula $\mathbf{R}=$ $\mathbf{A} \vee \mathbf{A}^{(2)} \vee \cdots \vee \mathbf{A}^{(n)}$

Exercise 1

Check back soon!

Problem 19

Use Prim's algorithm to find a minimal spanning tree for the graph in the specified figure.

(GRAPH CANT COPY)

Check back soon!

Problem 19

Write the nodes in a breadth-first search of the graph in the figure for Exercises 7-10, beginning with the node specified.

$f$

Check back soon!

Problem 20

Compute the reachability matrix $\mathbf{R}$ by using the formula $\mathbf{R}=$ $\mathbf{A} \vee \mathbf{A}^{(2)} \vee \cdots \vee \mathbf{A}^{(n)}$

Exercise 2

Check back soon!

Problem 20

Decide by trial and error whether Hamiltonian circuits exist for the graphs of the given exercise.

Exercise 7

Check back soon!

Problem 20

Use Prim's algorithm to find a minimal spanning tree for the graph in the specified figure.

(GRAPH CANT COPY)

Check back soon!

Problem 20

Write the nodes in a breadth-first search of the graph in the figure for Exercises 7-10, beginning with the node specified.

$h$

Check back soon!

Problem 21

Compute the reachability matrix $\mathbf{R}$ by using the formula $\mathbf{R}=$ $\mathbf{A} \vee \mathbf{A}^{(2)} \vee \cdots \vee \mathbf{A}^{(n)}$

Exercise 3

Check back soon!

Problem 21

Decide by trial and error whether Hamiltonian circuits exist for the graphs of the given exercise.

Exercise 8

Check back soon!
07:51

Problem 21

Use algorithm AnotherMST (Kruskal's algorithm) to find the minimal spanning tree.

Graph for Exercises 1-4

Chris Trentman
Chris Trentman
Numerade Educator

Problem 21

Write the nodes in a depth-first search of the following graph, beginning with the node specified.
(GRAPH CANT COPY)

$a$

Check back soon!

Problem 22

Compute the reachability matrix $\mathbf{R}$ by using the formula $\mathbf{R}=$ $\mathbf{A} \vee \mathbf{A}^{(2)} \vee \cdots \vee \mathbf{A}^{(n)}$

Exercise 4

Check back soon!

Problem 22

Decide by trial and error whether Hamiltonian circuits exist for the graphs of the given exercise.

Exercise 9

Check back soon!
05:12

Problem 22

Use algorithm AnotherMST (Kruskal's algorithm) to find the minimal spanning tree.

Graph for Exercise 18

Chris Trentman
Chris Trentman
Numerade Educator

Problem 22

Write the nodes in a depth-first search of the following graph, beginning with the node specified.
(GRAPH CANT COPY)

$g$

Check back soon!
04:38

Problem 23

Compute the reachability matrix $\mathbf{R}$ by using the formula $\mathbf{R}=$ $\mathbf{A} \vee \mathbf{A}^{(2)} \vee \cdots \vee \mathbf{A}^{(n)}$

Exercise 5

Amany Waheeb
Amany Waheeb
Numerade Educator

Problem 23

Find an example of an unconnected graph that has an Euler path.

Check back soon!
05:12

Problem 23

Use algorithm AnotherMST (Kruskal's algorithm) to find the minimal spanning tree.

Graph for Exercise 19

Chris Trentman
Chris Trentman
Numerade Educator

Problem 23

Write the nodes in a depth-first search of the following graph, beginning with the node specified.
(GRAPH CANT COPY)

$f$

Check back soon!
06:24

Problem 24

Compute the reachability matrix $\mathbf{R}$ by using the formula $\mathbf{R}=$ $\mathbf{A} \vee \mathbf{A}^{(2)} \vee \cdots \vee \mathbf{A}^{(n)}$

Exercise 6

Anthony Ramos
Anthony Ramos
Numerade Educator

Problem 24

Prove that any graph with a Hamiltonian circuit is connected.

Check back soon!
03:03

Problem 24

Use algorithm AnotherMST (Kruskal's algorithm) to find the minimal spanning tree.

Graph for Exercise 20

Chris Trentman
Chris Trentman
Numerade Educator

Problem 24

Write the nodes in a breadth-first search of the graph in the figure for Exercises 21-23, beginning with the node specified.

$a$

Check back soon!

Problem 25

Compute the reachability matrix $\mathbf{R}$ by using Warshall's algorithm.

Exercise 1

Check back soon!

Problem 25

Consider a simple, complete graph with $n$ nodes. Testing for a Hamiltonian circuit by trial and error could be done by selecting a fixed starting node and then generating all possible paths from that node of length $n$.
a. How many paths of length $n$ are there if repetition of arcs and nodes is allowed?
b. How many paths of length $n$ are there if repetition of arcs and nodes is allowed but an arc may not be used twice in succession?
c. How many paths of length $n$ are there if nodes and arcs cannot be repeated except for the starting node? (These are the Hamiltonian circuits.)

Check back soon!
05:24

Problem 25

Give an example to show that adding the node closest to $I N$ at each step, as is done in Prim's minimal spanning tree algorithm, will not guarantee a shortest path.

Chris Trentman
Chris Trentman
Numerade Educator

Problem 25

Write the nodes in a breadth-first search of the graph in the figure for Exercises 21-23, beginning with the node specified.

$g$

Check back soon!

Problem 26

Compute the reachability matrix $\mathbf{R}$ by using Warshall's algorithm.

Exercise 2

Check back soon!
00:50

Problem 26

Is it possible to walk in and out of each room in the house shown in the following figure so that each door of the house is used exactly once? Why or why not?

Ashley High
Ashley High
Numerade Educator
05:22

Problem 26

Let $a$ be the arc of lowest weight in a weighted graph. Show that $a$ must be an arc in any minimal spanning tree.

Chris Trentman
Chris Trentman
Numerade Educator

Problem 26

Write the nodes in a breadth-first search of the graph in the figure for Exercises 21-23, beginning with the node specified.

$f$

Check back soon!

Problem 27

Compute the reachability matrix $\mathbf{R}$ by using Warshall's algorithm.

Exercise 3

Check back soon!
08:13

Problem 27

A city plans to lay out bike paths connecting various city parks. A map with the distances between the parks is shown in the figure. (Some direct connections would have to cross major highways, so these distances are not shown in the map.) Find which paths to pave so that all parks are connected but the cost is minimal.
(GRAPH CANT COPY)

Jacquelyn Trost
Jacquelyn Trost
Numerade Educator

Problem 27

In the computer network in the accompanying figure, the same message is to be broadcast from node $C$ to nodes $A, E, F$, and $G$. One way to do this is to find the shortest path from $C$ to each of these nodes and send out multiple copies of the same message. A more efficient approach is to send one copy out from $C$ along a spanning tree for the subgraph containing the nodes involved. Use the depth-first search algorithm to find a spanning tree for the subgraph.

(GRAPH CANT COPY)

Check back soon!

Problem 28

Compute the reachability matrix $\mathbf{R}$ by using Warshall's algorithm.

Exercise 4

Check back soon!
01:01

Problem 28

Recall that $K_{m, n}$ denotes a bipartite, complete graph with $m+n$ nodes.
a. For what values of $m$ and $n$ does an Euler path exist in $K_{m, n}$ ?
b. For what values of $m$ and $n$ does a Hamiltonian circuit exist in $K_{m, n}$ ?

WZ
Wen Zheng
Numerade Educator

Problem 28

Assume that arc weights represent distance. Then adding new nodes and arcs to a graph may result in a spanning tree for the new graph that has less weight than a spanning tree for the original graph. (The new spanning tree could represent a minimal-cost network for communications between a group of cities obtained by adding a switch in a location outside any of the cities.)
a. Find a spanning tree of minimum weight for the following labeled graph. What is its weight?

(GRAPH CANT COPY)
b. Put a node in the center of the square. Add new arcs from the center to the corners. Find a spanning tree for the new graph, and compute its (approximate) weight.

Check back soon!

Problem 28

Use the depth-first search algorithm to do a topological sort on the following graph. Indicate the counting numbers on the graph. Also state the starting node or nodes for the search.

(GRAPH CANT COPY)

Check back soon!

Problem 29

Compute the reachability matrix $\mathbf{R}$ by using Warshall's algorithm.

Exercise 5

Check back soon!

Problem 29

Consider a connected graph with $2 n$ odd vertices, $n \geq 2$. By the theorem on Euler paths, an Euler path does not exist for this graph.
a. What is the minimum number of disjoint Euler paths, each traveling some of the arcs of the graph, necessary to travel each arc exactly once?
b. Show that the minimum number is sufficient.

Check back soon!

Problem 29

At the beginning of this chapter, you received the following assignment:
You realize that you can represent the network as a weighted graph, where the arcs are the connections between nodes and the weights of the arcs represent traffic on the connections.

Check back soon!

Problem 29

Use the depth-first search algorithm to do a topological sort on the following graph. Indicate the counting numbers on the graph. Also state the starting node or nodes for the search.

(GRAPH CANT COPY)

Check back soon!

Problem 30

Compute the reachability matrix $\mathbf{R}$ by using Warshall's algorithm.

Exercise 6

Check back soon!

Problem 30

Prove that a Hamiltonian circuit always exists in a connected graph where every node has degree 2 .

Check back soon!

Problem 30

Find a way to traverse a tree in level order, that is, so that all nodes at the same depth are listed from left to right for increasing depth. (Hint: We already have a way to do this.)

Check back soon!

Problem 31

Use regular matrix multiplication to obtain information about a graph.

Let $G$ be a directed graph, possibly with parallel arcs, and let $\mathbf{A}$ be its adjacency matrix. Then A may not be a Boolean matrix. Prove that the $i, j$ entry of matrix $\mathbf{A}^2$ is the number of paths of length 2 from node $i$ to node $j$.

Check back soon!

Problem 31

Ore's theorem (Oystein Ore, 1960) states that a Hamiltonian circuit exists in any graph $G$ with the following properties:
1. $G$ is a simple graph with $n$ nodes, $n \geq 3$.
2. For any two nonadjacent nodes $x$ and $y$, degree $(x)+\operatorname{degree}(y) \geq n$.
Ore's theorem is proved by contradiction in the following steps.
a. Assume that a graph $G$ with properties 1 and 2 above does not have a Hamiltonian circuit. Beginning with $G$, add new edges to produce a simple graph $H$ that does not have a Hamiltonian circuit but would have such a circuit with the addition of any single new arc. Describe a process for creating $H$.
b. Prove that $H$ has a Hamiltonian path, that is, a path that visits each node exactly once.
c. Denote the nodes on the Hamiltonian path by $p=x_1, x_2, x_3, \ldots, x_{n-1}, x_n=q$. Prove that for any node $x_i, 2 \leq i \leq n-1$, if $x_i-p$ is an arc in $H$, then $x_{i-1}-q$ is not an $\operatorname{arc}$ in $H$.
d. Using the result from part (c), prove that in graph $H$, degree $(p)+$ degree $(q)<n$.
e. Prove that in graph $G$, degree $(p)+$ degree $(q)<n$.
f. Conclude from part (e) that $G$ has a Hamiltonian circuit.

Check back soon!

Problem 32

Use regular matrix multiplication to obtain information about a graph.

Let $\mathbf{A}$ be the adjacency matrix of a directed graph $G$, possibly with parallel arcs. Prove that the $i, j$ entry of matrix $\mathbf{A}^n$ gives the number of paths of length $n$ from node $i$ to node $j$.

Check back soon!

Problem 32

Ore's theorem (Exercise 31) gives a sufficient condition for a Hamiltonian circuit to exist, but it is not a necessary condition. Find a simple graph $G$ with $n$ nodes, $n \geq 3$, that has a Hamiltonian circuit but for which condition (2) does not hold.

Check back soon!

Problem 33

Use regular matrix multiplication to obtain information about a graph.

For the following graph $G$, count the number of paths of length 2 from node 1 to node 3 . Check by computing $\mathbf{A}^2$.
(FIG CANT COPY)

Check back soon!

Problem 34

Use regular matrix multiplication to obtain information about a graph.

For the following graph $G$, count the number of paths of length 4 from node 1 to node 5 . Check by computing $\mathbf{A}^4$.
(FIG CANT COPY)

Check back soon!
01:33

Problem 35

Let $\rho$ be a binary relation defined on the set $\{0, \pm 1, \pm 2, \pm 4, \pm 16\}$ by $x \rho y \leftrightarrow y=x^2$. Draw the associated directed graph.

Teresa Fuston
Teresa Fuston
Numerade Educator