Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

CS 141 Quiz 2: Graph Theory Questions, Quizzes of Computer Science

A quiz on graph theory for a university-level computer science course. It includes questions on drawing a graph, depth-first search (dfs) and breadth-first search (bfs) traversals, the difference between paths and cycles, and maximum number of edges in undirected and directed graphs. Students are required to order vertices, identify end points of edges, and answer short questions related to the graph.

Typology: Quizzes

2009/2010

Uploaded on 03/28/2010

koofers-user-v5z-1
koofers-user-v5z-1 🇺🇸

10 documents

1 / 2

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
CS 141
Quiz 2 A
Surname, Name: ……………………………………………..Student ID:…………….
Questions
1. Let G be a graph whose vertices are the integers 1 through 8, and let the adjacent
vertices of each vertex be given by the table below:
Vertex Adjacent Vertices
1 2, 3, 4
2 1, 3, 4
3 1, 2, 4
4 1, 2, 3, 6
5 6, 7, 8
6 4, 5, 7
7 5, 6, 8
8 5, 7
Assume that, in a traversal of G, the adjacent vertices of a given vertex are returned in the
same order as they are listed in the above table.
a. Draw G. (10 pts.)
b. Order the vertices as they are visited in a DFS traversal starting at vertex 1. (20 pts.)
c. Order the vertices as they are visited in a BFS traversal starting at vertex 1. (20 pts.)
2. What is the difference between a path and a cycle? (15 pts.)
3. Suppose a graph with 5 vertices with no self-loops. (15 pts. / 5 pts. each)
a. What is the maximum number of edges if graph is undirected?
b. What is the maximum number of edges if graph is directed?
c. Are the results of (a) and (b) different? Why or why not?
4. Give short answers for each question referencing the graph. (5 pts. each, total 30 pts.)
What are the end points of edge a?
What are the incident edges on vertex V?
Give any two adjacent vertices.
What is the degree of vertex X?
Are there any parallel edges? If yes, which
edges?
Are there any self-loops? If yes, which one?
pf2

Partial preview of the text

Download CS 141 Quiz 2: Graph Theory Questions and more Quizzes Computer Science in PDF only on Docsity!

CS 141

Quiz 2 A

Surname, Name: ……………………………………………..Student ID:……………. Questions

  1. Let G be a graph whose vertices are the integers 1 through 8, and let the adjacent vertices of each vertex be given by the table below: Vertex Adjacent Vertices 1 2, 3, 4 2 1, 3, 4 3 1, 2, 4 4 1, 2, 3, 6 5 6, 7, 8 6 4, 5, 7 7 5, 6, 8 8 5, 7 Assume that, in a traversal of G, the adjacent vertices of a given vertex are returned in the same order as they are listed in the above table. a. Draw G. (10 pts.) b. Order the vertices as they are visited in a DFS traversal starting at vertex 1. (20 pts.) c. Order the vertices as they are visited in a BFS traversal starting at vertex 1. (20 pts.)
  2. What is the difference between a path and a cycle? (15 pts.)
  3. Suppose a graph with 5 vertices with no self-loops. (15 pts. / 5 pts. each) a. What is the maximum number of edges if graph is undirected? b. What is the maximum number of edges if graph is directed? c. Are the results of (a) and (b) different? Why or why not?
  4. Give short answers for each question referencing the graph. (5 pts. each, total 30 pts.) What are the end points of edge a? What are the incident edges on vertex V? Give any two adjacent vertices. What is the degree of vertex X? Are there any parallel edges? If yes, which edges? Are there any self-loops? If yes, which one?