Ch. 14 Computer Science 201: Data Structures & Algorithms

Pataasin ang iyong marka sa homework at exams ngayon gamit ang Quizwiz!

Which type of graph is the following? https://study.com/cimages/multimages/16/cyclic1.png

Cyclic graph

Which type of graph is this? https://study.com/cimages/multimages/16/cyclicquestion.png

Cyclic graph

In the graph shown, the vertices represent cities, and the edges represent flights between those cities. The weights of the edges represent the cost of the flights, in hundreds of dollars. Based on this, what two cities are the cheapest to fly between, and what is the cost? https://study.com/cimages/multimages/16/bb2b0dc8-55a0-49c1-ac28-ac7397bca305_qq5.jpg

Flight: City A and City E Cost: $200

How many bridges does this graph have? https://study.com/cimages/multimages/16/imagegraphconcepts_q1.jpg

1

How many edges does this graph have? https://study.com/cimages/multimages/16/647372707_graphtheory1.jpg

10

How many components does this graph have? https://study.com/cimages/multimages/16/imagegraphconcepts_q2.jpg

3

Suppose that a dating service is determining couples that would make a good match. In the graph shown, two sets of clients are represented with vertices, and the edges between the vertices indicate that the clients make a good match. Based on the graph, how many possible matches are there for Erin? https://study.com/cimages/multimages/16/93314204-8635-4333-a646-38c25e72f73a_graph2_1.jpeg

3

Suppose we just performed Dijkstra's algorithm on the graph shown to find the shortest path from vertex A to vertex C, so all of the vertices have been visited as indicated with the X ' s, including the starting vertex of A. Based on the graph and all of its final marks, what is the length of the shortest path from vertex A to vertex C? https://study.com/cimages/multimages/16/qq7.jpg

3

What is the shortest path length you can use to get from point 6 to point 2? https://study.com/cimages/multimages/16/440228236_graphtheory_q1.jpg

3

Which of the following will get you from point 3 to point 5? https://study.com/cimages/multimages/16/444518976_graphtheory_q1.jpg

3 to 2 to 5

How many vertices are in this graph? https://study.com/cimages/multimages/16/graphtheory_q2.jpg

5

How many vertices are in this graph? https://study.com/cimages/multimages/16/graphtheory_q1.jpg

6

How many vertices does this graph have? https://study.com/cimages/multimages/16/1876100718_imagegraphconcepts1.jpg

7

The following graph contains a negative edge. For this reason, the Dijkstra Algorithm will not compute the correct shortest path in one case. In which path would this error occur? (Let A be the source node)

A -> D -> B -> C

Which graph in discrete mathematics has a path of edges between every pair of vertices in the graph?

A connected graph

What is the difference between a directed and an undirected graph?

A directed graph uses arrows to indicate one-way relationships, but an undirected graph does not.

Which of the following does NOT describe a step in Dijkstra's algorithm?

Always replace a vertex's mark with the new calculated distance (even if it is larger than a previous mark).

Assume the following graph described in python code: graph = {'A': [('B', 2), ('C', 3)], 'B': [('A', 2), ('C', 2), ('D', 8)], 'C': [('A', 3), ('B', 2), ('D', 4)], 'D': [('B', 8), ('C', 4)]} After a Dijkstra execution, which are the values of the dist array? (Let A be the starting node.)

If you run the algorithm step-by-step, you get the values 0, 2, 3 and 7.

Assume the following graph described in python code: graph = {'A': [('B', 2), ('C', 3)], 'B': [('A', 2), ('C', 2), ('D', 8)], 'C': [('A', 3), ('B', 2), ('D', 4)], 'D': (['B', 8), ('C', 4)} After a Dijkstra execution, which are the values of the pred array? (Let A be the starting node.)

Running the algorithm step-by-step will result in -, A, A & C in the pred array.

A graph is said to be _____ if the number of edges is closer to the minimal number of edges.

Sparse

What is the shortest path problem?

The shortest path problem arises when we are trying to find the shortest distance from one vertex to another vertex in a weighted graph.

Which of the following statements is NOT true?

There are only three types of graphs in discrete mathematics.

Which of the following describes a loop?

This edge connects point C to point C.

What do we use Dijkstra's algorithm for?

We use Dijkstra's algorithm to find the shortest path between two vertices on a weighted graph.

The Dijkstra algorithm only finds the shortest path between:

a vertex (source node) to every other vertex of a graph.

The Dijkstra algorithm will fail if:

a weight in the path being computed is a negative number.

Graphs come under which category of data structures?

non-linear

The edges in directed graphs are _____?

unidirectional

Suppose we are using Dijkstra's algorithm to find the shortest path from A to D in the graph shown. The first step is to mark the ending vertex, D, with a 0, label it as current and put a circle around it as shown. In the next step, we identify E and C as vertices that are connected by an edge to the current vertex. What would we mark vertex E and vertex C with, and what vertex would be the next current vertex in the algorithm? https://study.com/cimages/multimages/16/141e02d9-b8b9-49e4-96a5-d60bb1c93284_qq4.jpg

vertex E = 7 vertex C = 5 next current vertex = C


Kaugnay na mga set ng pag-aaral

Week 1 Prep U Questions Chapters 2 & 3

View Set

The Lipids: Triglycerides, Phospholipids, & Sterols

View Set

European History Through Art TEST

View Set

Liver, Bile, Gallbladder, Pancreas

View Set

Social Statistics for exam 2 chapters

View Set

Marketing test 2 sample questions (ch 4, 5

View Set