M4

अब Quizwiz के साथ अपने होमवर्क और परीक्षाओं को एस करें!

Let p = <a, b, c, d, e, f> be the shortest path from a to f in the graph G=(V,E). Then,

(b,c) is an edge in E.

Consider a graph G=(V,E) with |V| = 6 and |E| = 9. Assume that BELLMAN-FORD(G,w,s) algorithm is executed. Assume that the path p = < s, a, b, c, d> is a shortest path from s to d. The attribute v.d for these vertices v in p could reach δ(s,v)δ(s,v) after ______ iteration(s) of the for loop (Lines 2-4).

1

Consider an acyclic directed graph G=(V, E). We assume that |V| = 5 and the out-degree of each vertex is 2. The for loop (Lines 5-7) is always executed in total ____________ time(s) for Graph G.

10

Consider an acyclic directed graph G=(V, E). We assume that |V| = 5 and the out-degree of each vertex was 2. During all iterations of the while loop, the function RELAX is always executed in total ___________ time(s) for Graph G.

10

Consider an acyclic directed graph G=(V, E). We assume that |V| = 8 and |E| = 12. During one iteration of the for loop (Lines 2-4), the function RELAX is always executed ___________ time(s) for Graph G.

12

During one iteration of the for loop (Lines 2-4), the function RELAX is always executed ___________ time(s) for Graph G.

12

Consider an acyclic directed graph G=(V, E). We assume that |V| = 8 and the out-degree of each vertex is 2. In total, the instruction RELAX(u, v, w) is always executed ____________ time(s) for Graph G.

16

Consider an acyclic directed graph G=(V, E). We assume that |V| = 8 and the out-degree of each vertex is 2. During one iteration of the while loop, the function RELAX is always executed ___________ time(s) for Graph G.

2

s=4 when it turns back in the long adjacency list

2 2 5 3 3 4 1 5

Consider a graph G=(V,E) with |V| = 6, |E| = 9, and weights of the edges are all positive. Assume that all vertices in V are reachable from Vertex s within 3 edges. Assume that BELLMAN-FORD(G,w,s) algorithm is executed. The attribute v.d for all vertices v in V will certainly reach δ(s,v)δ(s,v) after ______ iteration(s) of the for loop (Lines 2-4).

3

Assume that the path p = < s, a, b, c, d> is a shortest path from s to d. Suppose that edges are relaxed (for loop Lines 3-4) in the order (c,d), (b,c), (a,b), and (s,a). The attribute v.d for these vertices v in p will reach δ(s,v)δ(s,v) after ______ iteration(s) of the for loop (Lines 2-4).

4

Assume that the path p = < s, a, b, c, d> is a shortest path from s to d. Suppose that vertices are extracted from Q (while loop Lines 4-8) in the order s,a,b,c, and d. The attribute v.d for these vertices v in p will reach δ(s,v)δ(s,v) after ______ iteration(s) of the while loop (Lines 4-8).

4

Consider a graph G=(V,E) with |V| = 6 and |E| = 9. Assume that DIJKSTRA(G,w,s) algorithm is executed on G with non null weights. Assume that the path p = < s, a, b, c, d> is a shortest path from s to d. The attribute v.d for these vertices v in p could reach δ(s,v)δ(s,v) after ______ iteration(s) of the while loop .

4

Consider a graph G=(V,E). Assume that BELLMAN-FORD(G,w,s) algorithm is executed. Assume that the path p = < s, a, b, c, d> is a shortest path from s to d. Suppose that edges are relaxed (for loop Lines 3-4) in the order (c, b) (c,d), (b,c), (a,b), (s,b) and (s,a). The attribute v.d for these vertices v in p will reach δ(s,v)δ(s,v) after at most ______ iteration(s) of the for loop (Lines 2-4).

4

s=5 long adjacency list order turns black

4 2 1 3 2 4 3 5

Consider an acyclic directed graph G=(V, E). We assume that |V| = 20 and the out-degree of each vertex is 2. During the full execution of Disjkstra's algorithm, the for loop construct (Lines 7-8) is always executed in total ____________ time(s) for Graph G.

40

Consider a graph G=(V,E) with |V| = 6 and |E| = 9, and weights of the edges are all positive. Assume that all vertices are reachable from Vertex s. Assume that BELLMAN-FORD(G,w,s) algorithm is executed. The attribute v.d for all vertices v in V will certainly reach δ(s,v)δ(s,v) after at most ______ iteration(s) of the for loop (Lines 2-4).

5

Consider a graph G=(V,E) with |V| = 6 and |E| = 9. Assume that all vertices are reachable from Vertex s. Assume that DIJKSTRA(G,w,s) algorithm is executed. The attribute v.d for all vertices v in V will certainly reach δ(s,v)δ(s,v) after at most ______ iteration(s) of the while loop.

5

Consider a graph G=(V,E) with |V| = 6 and |E| = 9. Assume that all vertices in V are reachable from Vertex s within 3 edges. Assume that DIJKSTRA(G,w,s) algorithm is executed. The attribute v.d for all vertices v in V will certainly reach δ(s,v)δ(s,v) after ______ iteration(s) of the while loop.

5

Consider an acyclic directed graph G=(V, E). We assume that |V| = 8 and the in-degree of each vertex is 2. In total, the while loop is always executed ___________ time(s) for Graph G.

8

Let the path p = <a, b, c, d, e, f> the shortest path from a to f. Which of these subpaths are shortest paths.

<b, c, d> <d, e, f> <c, d, e>

Suppose that a graph G = (V, E) is represented by an adjacency-list where the lists (sets) Adj(u) for all vertices u are ordered alphabetically. Assume that the graph G is connected. Check all that apply about the queue Q during the execution of the Breadth-First Search (BFS) algorithm.

At the end of the execution of BFS, the queue Q is empty

Consider a graph G=(V,E) such that all edges have the same weight. The breadth-first search algorithm delivers/ completes these results/tasks on Graph G.

BFS delivers the shortest path on the BFS tree from the root to every vertex, BFS computes the distance (smallest number of edges) from Source s to every vertex v reachable from s, BFS produces a "breadth-first tree" containing all reachable vertices.

Consider a graph G=(V,E) with |V| = 6 and |E| = 9. We assume that all edges have nonnegative weights. Assume that DIJKSTRA(G,w,s) algorithm is executed and the while loop is executed only once. Assume that the path p = < s, t, x, y, z> is a shortest path from s to z. The table below shows on each column potential values of the attribute v.d. Check the columns that display values for v.d that could NOT be produced by the DIJKSTRA algorithm assuming that all edges have nonnegative weights. v.d C1 C2 C3 C4 C5 s.d 0 infinity 0 0 0 t.d 99 7 infinity 101 200 x.d 7 8 9 infinity infinity y.d infinity 13 11 infinity 99 z.d 12 21 14 infinity 10

C1, C2, C3, C5

Consider a graph G=(V,E) with |V| = 6 and |E| = 9. We assume that all edges have nonnegative weights. Assume that BELLMAN-FORD(G,w,s) algorithm is executed. Assume that the path p = < s, t, x, y, z> is a shortest path from s to z. The table below shows on each column potential values of the attribute v.d. Check the columns that display values for v.d that could NOT be produced by the BELLMAN-FORD algorithm assuming that all edges have nonnegative weights. v.d C1 C2 C3 C4 C5 s.d 0 2 0 0 0 t.d 5 7 3 1 5 x.d 7 8 8 5 8 y.d 3 13 11 2 9 z.d 12 21 14 14 10

C1, C2, C4

Consider a graph G=(V,E) with |V| = 6 and |E| = 9. We assume that all edges have nonnegative weights. Assume that DIJKSTRA(G,w,s) algorithm is executed. Assume that the path p = < s, t, x, y, z> is a shortest path from s to z. The table below shows on each column potential values of the attribute v.d. Check the columns that display values for v.d that could NOT be produced by DIJKSTRA's algorithm assuming that all edges have nonnegative weights. v.d C1 C2 C3 C4 C5 s.d 0 2 0 0 0 t.d 5 7 3 1 5 x.d 7 8 8 5 8 y.d 3 13 11 2 9 z.d 12 21 14 14 10

C1, C2, C4

Consider a graph G=(V,E) with |V| = 5 and |E| = 9. We assume that all edges have nonnegative weights. Assume that BELLMAN-FORD(G,w,s) algorithm is executed and the for loop (Lines 2-4) is executed only once. Assume that the path p = < s, t, x, y, z> is a shortest path from s to z. The table below shows on each column potential values of the attribute v.d. Check the columns that display values for v.d that could NOT be produced by the BELLMAN-FORD algorithm assuming that all edges have nonnegative weights. v.d C1 C2 C3 C4 C5 s.d 0 infinity 0 0 0 t.d 5 7 infinity 1 200 x.d 7 8 9 infinity infinity y.d infinity 13 11 infinity 210 z.d 12 21 14 infinity 215

C2, C3

Consider a graph G=(V,E) with |V| = 5 and |E| = 9. We assume that all edges have nonnegative weights. Assume that BELLMAN-FORD(G,w,s) algorithm is executed and the for loop (Lines 2-4) is executed only twice.Assume that the path p = < s, t, x, y, z> is a shortest path from s to z. The table below shows on each column potential values of the attribute v.d. Check the columns that display values for v.d that could NOT be produced by the BELLMAN-FORD algorithm assuming that all edges have nonnegative weights. v.d C1 C2 C3 C4 C5 s.d 0 0 0 0 0 t.d 5 8 infinity 1 5 x.d 7 7 9 infinity infinity y.d infinity 13 11 infinity 9 z.d 12 21 14 infinity 10

C2, C3, C4, C5

Assume that the path p = < s, a, b, c, d> is a shortest path from s to d and that no two edges have the same weight. The attribute v.d for these vertices v in p will certainly reach δ(s,v)δ(s,v)in some order. Match the vertices s, a, b, c, and d to the their sequence number. The node that reach first δ(s,v)δ(s,v) will be assigned 1. Note that we are ordering only s, a, b, c and d relatively to each other. This is not an ordering of all vertices v of V.

a 2 b 3 c 4 d 5 s 1

Consider a graph G=(V,E) with |V| = 6 and |E| = 9. Assume that BELLMAN-FORD(G,w,s) algorithm is executed. Assume that the path p = < s, a, b, c, d> is a shortest path. The attribute v.d for these vertices v in p will certainly reach δ(s,v)δ(s,v) after 2 iterations of the for loop (Lines 2-4). Check these vertices.

a, b

Consider a graph G=(V,E) with |V| = 6 and |E| = 9. Assume that DIJKSTRA(G,w,s) algorithm is executed. Assume that the path p = < s, a, b, c, d> is a shortest path. The attribute v.d for these vertices v in p will certainly reach δ(s,v)δ(s,v) after 2 iterations of the while loop. Check these vertices.

a, b

Consider the vertices u and v in a directed graph G = (V, E). a.d = 12, w(b,a) = 5, and b.d = 3. After Relax(b, a, w) is executed, apply all true statements. a.d = 6, w(b,a) = 4, and b.d = 3. After Relax(b, a, w) is executed, apply all true statements. u.d = 5, w(u,v) = 8, and v.d = 12. After Relax(u, v, w) is executed, apply all true statements.

a.d = 8, a.π=b none none

Consider a directed graph G=(V,E) and the predecessor subgraph Gπ=(Vπ,Eπ)Gπ=(Vπ,Eπ). If v=u.πv=u.π then there is

an edge (v, u) in E

Consider a directed graph G=(V, E). We assume that |V| = 5 and the out-degree of each vertex is 2. In total, the for loop (Lines 5-7) is always executed ____________ time(s) for Graph G.

at most 10

During execution, a vertex is _________ when it is in the queue Q.

gray

During execution, breadth-first search (BFS) "colors" the vertices. The BFS tree includes vertices that are ___________.

gray, black

Consider a graph G=(V,E) with |V| = 6 and |E| = 9. Assume that all vertices are reachable from Vertex s. Assume that BELLMAN-FORD(G,w,s) algorithm is executed. The attribute v.d for all vertices v in V will certainly reach δ(s,v)δ(s,v) after at most ______ iteration(s) of the for loop (Lines 2-4).

none

Consider a graph G=(V,E) with |V| = 6 and |E| = 9. Assume that all vertices in V are reachable from Vertex s within 3 edges. Assume that BELLMAN-FORD(G,w,s) algorithm is executed. The attribute v.d for all vertices v in V will certainly reach δ(s,v)δ(s,v) after ______ iteration(s) of the for loop (Lines 2-4).

none

Consider a graph G=(V,E) with |V| = 6 and |E| = 9. Assume that all vertices in V are reachable from Vertex s within n edges (n < 5). Assume that BELLMAN-FORD(G,w,s) algorithm is executed. The attribute v.d for all vertices v in V will certainly reach δ(s,v)δ(s,v) after ______ iteration(s) of the for loop (Lines 2-4).

none

Consider an acyclic directed graph G=(V, E). We assume that |V| = 8 and |E| = 12. During one iteration of the while loop, the function RELAX is always executed ___________ time(s) for Graph G.

none

Consider the vertices u and v in a directed graph G = (V, E). Suppose that: a.d = 6, w(b,a) = 4, and b.d = 3. After Relax(b, a, w) is executed, apply all true statements.

none

In the textbook, the shortest path from u to v is represented by

none

Suppose that we are interested in shortest paths that have at most 5 edges. Check which instructions you would modify. The objective is to modify the smallest number of instructions.

none

After the full execution of BFS on a connected graph, each vertex is turned black ________.

once

src= s

r 2 w 3 t 5 u 7 v 4

src = v

r 2 w 4 s 3 x 6 u 7

src = t

r 3 w 1 s 2 u 1 v 4

src = y

r 4 w 2 s 3 t 2 u 1

src = u

r 7 w 5 s 6 x 3 v 8

We want to find the shortest path from Vertex t to all nodes in V. This exercise is about tracing BELLMAN-FORD(G,w,t). Assume that the edges are stored in this order in the adjacency-list: (t, x), (t, y), (t, z), (x, t), (y, x), (y, z), (z, x), (z, s), (s, t), (s, y) After the first iteration of the for loop (Lines 2-4), match each vertex v with its value v.d.

s -2 t 0 x 3 y 5 z -4

We want to find the shortest path from Vertex y to all nodes in V. This exercise is about tracing BELLMAN-FORD(G,w,y). Assume that the edges are stored in this order in the adjacency-list: (t, x), (t, y), (t, z), (x, t), (y, x), (y, z), (z, x), (z, s), (s, t), (s, y) After the first iteration of the for loop (Lines 2-4), match each vertex v with its value v.d.

s 11 t 17 x -3 y 0 z 9

We want to find the shortest path from Vertex z to all nodes in V. This exercise is about tracing BELLMAN-FORD(G,w,z). Assume that the edges are stored in this order in the adjacency-list: (t, x), (t, y), (t, z), (x, t), (y, x), (y, z), (z, x), (z, s), (s, t), (s, y) After the first iteration of the for loop (Lines 2-4), match each vertex v with its value v.d.

s 2 t 8 x 7 y 9 z 0

We want to find the shortest path from Vertex z to all nodes in V. This exercise is about tracing DIJKSTRA(G,w,z). After the first iteration of the while loop, match each vertex v with its value v.d.

s 7 t infinity x 6 y infinity z 0

We want to find the shortest path from Vertex t to all nodes in V. This exercise is about tracing DIJKSTRA(G,w,t). After Line 1 is executed, match each vertex v with its value v.d.

s infinity t 0 x infinity y infinity z infinity

We want to find the shortest path from Vertex t to all nodes in V. This exercise is about tracing DIJKSTRA(G,w,t). After the first iteration of the while loop, match each vertex v with its value v.d.

s infinity t 0 x 1 y 2 z infinity

We want to find the shortest path from Vertex y to all nodes in V. This exercise is about tracing DIJKSTRA(G,w,y). After the first iteration of the while loop (Lines 4-8), match each vertex v with its value v.d.

s infinity t 3 x 9 y 0 z 2

We want to find the shortest path from Vertex z to all nodes in V. This exercise is about tracing BELLMAN-FORD(G,w,z). Assume that the edges are stored in this order in the adjacency-list: (t, x), (t, y), (t, z), (x, t), (y, x), (y, z), (z, x), (z, s), (s, t), (s, y) After Line 1 is executed, match each vertex v with its value v.d.

s infinity t infinity x infinity z 0 y infinity

These operations take O(|V|) time during the execution of BFS on a connected graph.

set a vertex: gray, black, or white

We want to find the shortest path from Vertex t to all nodes in V. This exercise is about tracing BELLMAN-FORD(G,w,t). After Line 1 is executed, match each vertex v with its value v.d.

t is 0 all others are infinity

Consider a graph G=(V,E). Assume that there is a shortest path p = <V1, V2, ..., Vk>. Assume that BELLMAN-FORD(G,w,s) algorithm is executed. The attribute v.d for all vertices v in p will certainly reach δ(s,v)δ(s,v) after N iterations of the for loop (Lines 2-4). The number N depends on _______.

the number of edges forming the path p The order in which edges in Path p are relaxed

src = r.

w 4 s 2 t 5 u 7 v 3

Let w the weight function and p the path <a, b, c, d>. w(p)

w(a, b), w(b, c), w(c, d)

We want to find the shortest path from Vertex x to all nodes in V. This exercise is about tracing DIJKSTRA(G,w,x). After the first iteration of the while loop, match each vertex v with its value v.d.

x is 0 all others are infinity

We want to find the shortest path from Vertex z to all nodes in V. This exercise is about tracing DIJKSTRA(G,w,z). After Line 1 is executed, match each vertex v with its value v.d.

z 0 all others are infinity

Consider a graph G = (V,E). Strictly speaking, the number of edges in the graph G is _______.

|E|

Consider a graph G = (V,E). Strictly speaking, the number of vertices in the graph G is

|V|

Consider a graph G=(V,E). Assume that there is a shortest path p = <V1, V2, ..., Vk>. Assume that DIJKSTRA(G,w,s) algorithm is executed. The attribute v.d for all vertices v in p will certainly reach δ(s,v)δ(s,v) after N iterations of the while loop. The number N depends on _______.

|V|

During the full execution of BFS on a connected graph G=(V,E), the dequeue operation will be executed __________ times.

|V|

During the full execution of BFS on a connected graph G=(V,E), the enqueue operation will be executed __________ times.

|V|

Consider a connected graph G = (V,E). Line 17 is executed _______ time(s) during the full execution of BFS

|V| - 1

Consider a connected graph G = (V,E). Line 17 is executed _______ time(s) during the full execution of BFS.

|V| - 1

During the full execution of BFS on a connected graph G=(V,E), the for loop (Lines 1-4) is executed ___________ times.

|V| - 1

Consider a graph G=(V,E) with |V| = 6 and |E| = 9. Assume that DIJKSTRA(G,w,s) algorithm is executed. The attribute v.d for all vertices v in V will certainly reach δ(s,v)δ(s,v) after ______ iteration(s) of the while loop.

|V|-1

Consider a graph G=(V,E). Assume that all vertices in V are reachable from Vertex s within 5 edges. Assume that DIJKSTRA(G,w,s) algorithm is executed. The attribute v.d for all vertices v in V will certainly reach δ(s,v)δ(s,v) after ______ iteration(s) of the while loop.

|V|-1

Consider a graph G=(V,E). Assume that all vertices in V are reachable from Vertex s within n edges (n < |V|). Assume that DIJKSTRA(G,w,s) algorithm is executed. The attribute v.d for all vertices v in V will certainly reach δ(s,v)δ(s,v) after ______ iteration(s) of the while loop .

|V|-1

Consider a graph G=(V,E). Assume that all vertices in V are reachable from Vertex s within one edge. Assume that DIJKSTRA(G,w,s) algorithm is executed. The attribute v.d for all vertices v in V will certainly reach δ(s,v)δ(s,v) after ______ iteration(s) of the while loop.

|V|-1

In the textbook, the weight of the shortest path from u to v is represented by

δ(u,v)

The weight of the shortest path is well defined as long as ____________ in the path.

There are no weight-negative cycles

During execution, breadth-first search (BFS) "colors" the vertices. Check the true statements about the vertex u after it turned gray.

If Vertex u's parent p exists on the BFS tree, then p is gray or black. it was discovered and some of its neighbors may still be white.

If all edges are reversed on a graph G=(V,E) to produce the graph G'=(V,E'), then the single-destination shortest-paths problem becomes on G' the _____________ problem.

Single-source shortest-paths


संबंधित स्टडी सेट्स

Unit 21 UNIT 21 Closing the Real Estate Transaction

View Set

Middle Mediastinum: Anatomy and Function of the Heart

View Set

Chapter 12 bio reading quesitons

View Set

Nursing analysis, assessment, planning, implement, and eval

View Set

Government-Funded Nutrition Programs

View Set

Unit 4: Set 1: Sensation and Perception

View Set