Deck 12: Graphs
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
فتح الحزمة
قم بالتسجيل لفتح البطاقات في هذه المجموعة!
Unlock Deck
Unlock Deck
1/50
العب
ملء الشاشة (f)
Deck 12: Graphs
1
In a connected graph, there must be an edge from each vertex to every other vertex.
False
2
A a depth-first traversal cannot be implemented recursively.
False
3
A simple path in a graph is one in which a path passes through the same vertex at least twice.
False
4
A graph is a set of edges and vertices such that each edge connects two vertices.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
5
The adjacency matrix representation of a graph stores graph information in an array of lists.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
6
In a DAG, there are no cycles.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
7
In a digraph, each edge has a source vertex and destination vertex.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
8
Repeated application of finding the minimum spanning tree for all the components in a graph yields a minimum spanning forest for a graph.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
9
A spanning tree has the fewest number of edges possible while still retaining a connection between all the vertices in the component.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
10
When you traverse a graph, there is always a single direct link from one item to any other item.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
11
Dijkstra's algorithm consists of two steps: the initialization step and the execution step.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
12
To find the shortest path, you can use a wighted graph and sum the edge of the weights between two vertices.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
13
In an undirected graph, two or more edges connect the same pair of vertices.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
14
The depth-first traversal of a graph uses a queue as the collection in the generic algorithm.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
15
In a complete graph with six vertices, the degree of a vertex is five.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
16
In an adjacency matrix, a 1 is used to represent an edge between two vertices.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
17
A topological order assigns a rank to each edge such that the vertices go from lower-to higher-ranked edges.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
18
On a weighted graph, the vertices are labeled with numbers.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
19
The adjacency list supports finding all the vertices adjacent to a given vertex more efficiently than the adjacency matrix.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
20
An example of a process or model that can be graphed is the links between pages on the Internet.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
21
In a complete undirected graph consisting of 3 vertices, how many total adjacencies will there be?
A) 2
B) 6
C) 9
D) 4
A) 2
B) 6
C) 9
D) 4
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
22
Which of the following is NOT a process for which a graph can serve as a model?
A) a road map between hotels a town
B) a line at a movie theater
C) the paths that data can travel in a network
D) the routes between rooms in a building
A) a road map between hotels a town
B) a line at a movie theater
C) the paths that data can travel in a network
D) the routes between rooms in a building
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
23
Which of the following is true about graphs?
A) graphs consist of vertices and nodes
B) the edges between vertices are always labeled
C) an adjacency is when one vertex has a path to another vertex
D) the length of a path is the number of edges on the path
A) graphs consist of vertices and nodes
B) the edges between vertices are always labeled
C) an adjacency is when one vertex has a path to another vertex
D) the length of a path is the number of edges on the path
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
24
All graphs, except weighted graphs, are collections of vertices connected by edges.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
25
In Python, you need to define infinity as a long integer.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
26
Which term best describes a neighbor?
A) a path exist between vertices
B) a vertex is reachable from another vertex
C) two vertices have consecutive labels
D) two vertices are adjacent
A) a path exist between vertices
B) a vertex is reachable from another vertex
C) two vertices have consecutive labels
D) two vertices are adjacent
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
27
What are edges called that emanate from a given source vertex?
A) incident edges
B) directed edges
C) destination edges
D) cyclical edges
A) incident edges
B) directed edges
C) destination edges
D) cyclical edges
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
28
The number of edges connected to a vertex describes which of the following?
A) a complete graph
B) the neighbor of a vertex
C) the degree of a vertex
D) whether a graph is connected
A) a complete graph
B) the neighbor of a vertex
C) the degree of a vertex
D) whether a graph is connected
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
29
In the implementation of a graph, the len function returns the number of the graph's vertices.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
30
In a breadth-first traversal of a graph, what type of collection is used in the generic algorithm?
A) queue
B) set
C) stack
D) heap
A) queue
B) set
C) stack
D) heap
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
31
A graph has a single length attribute, similar to the lists, queues, and stacks.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
32
In graph terms, what is a path that begins and ends at the same vertex?
A) a simple path
B) an undirected path
C) a cycle
D) a directed path
A) a simple path
B) an undirected path
C) a cycle
D) a directed path
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
33
In a complete undirected graph with five vertices how many cells will contain a value of 1 in an adjacency matrix?
A) 15
B) 10
C) 25
D) 125
A) 15
B) 10
C) 25
D) 125
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
34
Which of the following is true about an undirected graph?
A) a graph-processing algorithm can move in only one direction along an edge that connects two vertices
B) their edges do not indicate direction
C) there can be multiple edges connecting any two vertices
D) there is a source vertex and a destination vertex
A) a graph-processing algorithm can move in only one direction along an edge that connects two vertices
B) their edges do not indicate direction
C) there can be multiple edges connecting any two vertices
D) there is a source vertex and a destination vertex
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
35
What makes a graph complete?
A) when there is an edge from each vertex to all other vertices
B) when there is a path from each vertex to all other vertices
C) when there is a path between at least half the vertices
D) when there are two or more edges between vertices
A) when there is an edge from each vertex to all other vertices
B) when there is a path from each vertex to all other vertices
C) when there is a path between at least half the vertices
D) when there are two or more edges between vertices
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
36
Which of the following is true about graph traversals?
A) a single path to each item is assumed
B) all algorithms are nonrecursive
C) the algorithm should find the shortest path to a given item
D) the type of collection used is irrelevant to the traversal algorithm
A) a single path to each item is assumed
B) all algorithms are nonrecursive
C) the algorithm should find the shortest path to a given item
D) the type of collection used is irrelevant to the traversal algorithm
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
37
If vertex Penguins can reach vertex Capitals and vertex Capitals can reach vertex Islanders, but none of them can reach vertices Sharks or Ducks, what can you say about the set of vertices Penguins, Capitals, and Islanders?
A) the set is a connected component
B) the set describes a complete graph
C) the vertices in the set are all adjacent to each other
D) the set describes a connected graph
A) the set is a connected component
B) the set describes a complete graph
C) the vertices in the set are all adjacent to each other
D) the set describes a connected graph
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
38
Removing a vertex also entails removing any edges connecting it to other vertices.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
39
What is the performance behavior of a linked adjacency list for determining whether an edge exists between two vertices?
A) constant time
B) O( N 2) where N is the number of vertices
C) linear with the length of the list
D) logarithmic with the total number of vertices
A) constant time
B) O( N 2) where N is the number of vertices
C) linear with the length of the list
D) logarithmic with the total number of vertices
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
40
Which of the following is NOT true about an adjacency matrix?
A) it stores information about the graph in a grid
B) the grid cell contains a 0 if there is no edge between vertices
C) a graph with four vertices contains 16 cells
D) it can be represented by an array of lists
A) it stores information about the graph in a grid
B) the grid cell contains a 0 if there is no edge between vertices
C) a graph with four vertices contains 16 cells
D) it can be represented by an array of lists
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
41
Which of the following is NOT true after the initialization step in Dijkstra's algorithm?
A) the cells in the included list are all False, except for the cell that corresponds to the row of the source vertex in the results grid
B) the distance in a row's distance cell is either 0, infinity, or a positive number
C) the shortest path from the source to a vertex is found and the vertex's cell is marked in the included list
D) the vertex in a row's parent cell is either the source vertex or undefined
A) the cells in the included list are all False, except for the cell that corresponds to the row of the source vertex in the results grid
B) the distance in a row's distance cell is either 0, infinity, or a positive number
C) the shortest path from the source to a vertex is found and the vertex's cell is marked in the included list
D) the vertex in a row's parent cell is either the source vertex or undefined
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
42
What is the output of Dijkstra's algorithm?
A) a three-dimensional array
B) a two-dimensional grid
C) a source vertex
D) the number of vertices in the graph
A) a three-dimensional array
B) a two-dimensional grid
C) a source vertex
D) the number of vertices in the graph
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
43
What can be described as the assignment of a rank to each vertex in a graph such that the edges go from lower-to higher-ranked vertices?
A) directed acyclic graph
B) sparse graph
C) topological order
D) shortest-path problem
A) directed acyclic graph
B) sparse graph
C) topological order
D) shortest-path problem
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
44
In the following code to add an edge in the LinkedDirectedGraph class, what is the missing code? def addEdge(self, fromLabel, toLabel, weight):
FromVertex = self.getVertex(fromLabel)
< missing code >
FromVertex.addEdgeTo(toVertex, weight)
Self.edgeCount += 1
A) self.getVertex(toLabel) = fromVertex
B) fromVertex.addEdgeTo(fromVertex, weight)
C) self.weight += 1
D) toVertex = self.getVertex(toLabel)
FromVertex = self.getVertex(fromLabel)
< missing code >
FromVertex.addEdgeTo(toVertex, weight)
Self.edgeCount += 1
A) self.getVertex(toLabel) = fromVertex
B) fromVertex.addEdgeTo(fromVertex, weight)
C) self.weight += 1
D) toVertex = self.getVertex(toLabel)
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
45
In a component with n vertices, how many edges are in the spanning tree?
A) n
B) n 2
C) n + 1
D) n - 1
A) n
B) n 2
C) n + 1
D) n - 1
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
46
In the __init__ method code for the LinkedVertex class, what is the missing code? def __init__(self, label):
Self.label = label
Self.edgeList = list()
< missing code >
A) self.size += 1
B) self.mark = False
C) return iter(result)
D) result = self.label
Self.label = label
Self.edgeList = list()
< missing code >
A) self.size += 1
B) self.mark = False
C) return iter(result)
D) result = self.label
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
47
What is the minimum sum of all weights in a spanning tree of a weighted graph?
A) spanning forest
B) minimum spanning tree
C) shortest path spanning tree
D) topological spanning tree
A) spanning forest
B) minimum spanning tree
C) shortest path spanning tree
D) topological spanning tree
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
48
In the LinkedDirectedGraph class, which of the following methods is an iterator?
A) incidentEdges
B) getEdge
C) containsEdge
D) sizeEdges
A) incidentEdges
B) getEdge
C) containsEdge
D) sizeEdges
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
49
The smallest sum of edge weights between two vertices describes which of the following?
A) the shortest path
B) topological order
C) topological sort
D) maximum spanning tree
A) the shortest path
B) topological order
C) topological sort
D) maximum spanning tree
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck
50
In the pseudocode for the dfs function for partitioning the vertices in a graph into disjointed components, what is the missing pseudocode statement? dfs(graph, v, s):
Mark v as visited
S.add(v)
For each vertex, w, adjacent to v:
If w is unvisited:
A) s.add(w)
B) dfs(graph, v, s)
C) s.add(v)
D) dfs(graph, w, s)
Mark v as visited
S.add(v)
For each vertex, w, adjacent to v:
If w is unvisited:
A) s.add(w)
B) dfs(graph, v, s)
C) s.add(v)
D) dfs(graph, w, s)
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 50 في هذه المجموعة.
فتح الحزمة
k this deck