8 4 5 18 6 8 (a) Graph G 12 3 8 (E) 6 (b) Tree Ti 12 F E 5 18 6 (c) Tree T₂ B

Advanced Engineering Mathematics
10th Edition
ISBN:9780470458365
Author:Erwin Kreyszig
Publisher:Erwin Kreyszig
Chapter2: Second-order Linear Odes
Section: Chapter Questions
Problem 1RQ
icon
Related questions
Question
=
Question 1 (SPTree Verification
You are given a directed weighted graph G (V, E, W), a vertex s E V
and a tree T such that each vertex vi E V maps to a node in T. The root of T is s. For each node n in T we define the
predecessor n. as its parent in the tree. By definition, s. =Nil for the root node s. For any other node n₁.π =
n2, there
must be a direct edge (n2, n₁) EE. You need to develop an algorithm that tests whether T is a shortest-path tree from the
single-source s to all destinations in G. In particular, the algorithm should return true if T is a shortest path tree and false,
otherwise. Notice that your algorithm should be more efficient than the Bellman-Ford algorithm which runs in O(VE).
A
E
5
18
6
8
(a) Graph G
12
F
3
B
A
8
E
D
6
(b) Tree T₁
12
F
B
A
8
E
5
18
6
(c) Tree T₂
F
B
An example is given in the figure above. Assume that for the graph G we would like to test two trees rooted at A. The
first tree, Ti is a shortest path tree. Your algorithm should return true when running on G, T₁. On the other hand, the tree
T2 is not a shortest path tree and your algorithm should return false.
Transcribed Image Text:= Question 1 (SPTree Verification You are given a directed weighted graph G (V, E, W), a vertex s E V and a tree T such that each vertex vi E V maps to a node in T. The root of T is s. For each node n in T we define the predecessor n. as its parent in the tree. By definition, s. =Nil for the root node s. For any other node n₁.π = n2, there must be a direct edge (n2, n₁) EE. You need to develop an algorithm that tests whether T is a shortest-path tree from the single-source s to all destinations in G. In particular, the algorithm should return true if T is a shortest path tree and false, otherwise. Notice that your algorithm should be more efficient than the Bellman-Ford algorithm which runs in O(VE). A E 5 18 6 8 (a) Graph G 12 F 3 B A 8 E D 6 (b) Tree T₁ 12 F B A 8 E 5 18 6 (c) Tree T₂ F B An example is given in the figure above. Assume that for the graph G we would like to test two trees rooted at A. The first tree, Ti is a shortest path tree. Your algorithm should return true when running on G, T₁. On the other hand, the tree T2 is not a shortest path tree and your algorithm should return false.
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps

Blurred answer
Recommended textbooks for you
Advanced Engineering Mathematics
Advanced Engineering Mathematics
Advanced Math
ISBN:
9780470458365
Author:
Erwin Kreyszig
Publisher:
Wiley, John & Sons, Incorporated
Numerical Methods for Engineers
Numerical Methods for Engineers
Advanced Math
ISBN:
9780073397924
Author:
Steven C. Chapra Dr., Raymond P. Canale
Publisher:
McGraw-Hill Education
Introductory Mathematics for Engineering Applicat…
Introductory Mathematics for Engineering Applicat…
Advanced Math
ISBN:
9781118141809
Author:
Nathan Klingbeil
Publisher:
WILEY
Mathematics For Machine Technology
Mathematics For Machine Technology
Advanced Math
ISBN:
9781337798310
Author:
Peterson, John.
Publisher:
Cengage Learning,
Basic Technical Mathematics
Basic Technical Mathematics
Advanced Math
ISBN:
9780134437705
Author:
Washington
Publisher:
PEARSON
Topology
Topology
Advanced Math
ISBN:
9780134689517
Author:
Munkres, James R.
Publisher:
Pearson,