Assignment 2 no late homework would be accepted 1 (Exercise XXXXXXXXXXLet G = (V,E) be a weighted, directed graph with nonnegaive weight function w : E → {0, 1, ...,W} for some nonnegative integer W ....

1 answer below »
This is an undergraduate Advanced Algorithms class. Stick to the undergraduate topics and only do what is said in the assignment sheet. I will attach an assignment pdf with the question solve those step by step and DONTOT COPY FROM INTERNET SOURCES SUCH AS CHEGG, COURSEHERO. I also have subscription and access to solution on those websites I want a 100% plagiarism free solution. I want the solution to have step by step and clear explanation to each question. Donot cut down on explanation.


Assignment 2 no late homework would be accepted 1 (Exercise 14.3-8) Let G = (V,E) be a weighted, directed graph with nonnegaive weight function w : E → {0, 1, ...,W} for some nonnegative integer W . Modify Dijkstra’s algorithm to compute the shortest paths from source vertex s in O(W · |V |+ |E|) time. 2 (Exercise 14.5-2) Give an example of a weighted directed graph G = (V,E) with weight function w : E → R and source vertex s such that G satisfies the following property: For every edge (u, v) ∈ E, there is a shortest-paths tree rooted at s that contains (u, v) and another shortest-paths tree rooted at s that does not contain (u, v). 3 (Exercise 25.1-9) Modify Faster-All-Pairs-Shortest-Paths so that it can determine whether the graph contains a negative-weight cycle. 4 Give a simple example of a directed graph with negative-weight edges for which Dijkstra’s algo- rithm produces incorrect answers. Why doesn’t the proof of correct of Dijkstra’s algorithm go through when negative-weight edges are allowed? 5 (Exercise 15.1-15) The Fibonacci number are defined by recurrence F0 = 0, F1 = 1, Fi = Fi−1 + Fi−2. Give a O(n)-time dynamic-programming algorithm to compute the nth Fibonacci number. Draw the subproblem graph. How many vertices and edges are in the graph? 6 (Exercise 15.4-5) Give an O(n2)-time algorithm to find the longest monotonically increasing subsequence of a sequence of n numbers. 7 (Exercise 24.2-4) Give an efficient algorithm to count the total number of paths in a directed acyclic graph. Analyze your algorithm. 8 How can we use the output of the Floyd-Warshall algorithm to detect the presence of a negative- weight cycle? 1
Answered 2 days AfterFeb 15, 2022

Answer To: Assignment 2 no late homework would be accepted 1 (Exercise XXXXXXXXXXLet G = (V,E) be a weighted,...

Tanisha answered on Feb 17 2022
108 Votes
Assignment – 2
1. According to the Dijkstra’s algorithm where Q depicts queue and S signifies a state, the following are the sequential steps:
a. Till the Q is not empty, we will follow up the iteration, remove node signified with v, which is not present at all in S from Q having at least distance (v). Initially initialize the state, s to 0
b. When we
visit a node, we add that node v to S.
c. Update the values of distance of all adjacent nodes of the given node v and for every new upcoming adjacent node called as u.
d. Check the following distance condition:
If dist(v) + weight(u,y) < dist(u), then do the updating of new distance u which should be minimum else no need of updating and iteration will keep on going till all nodes are visited or it is terminated.
    The time complexity is on the execution time of Min-Priority queue used as a data structure here. Adjacent vertices which are quite close to the source vertex get evaluated first. Each node or vertex will definitely have its weight W. Highest value counted for the longest path of any graph is given up by (v – 1) * W. So in the queue, we can process the vertices which are available, here dist (v) will suggest us the shortest path from source to any other vertex v.
Taking into consideration that queue here has (v – 1 ) * W buckets, from these buckets , we can extract node v from the bucket d[v]. From source to vertex v, the value ranges between 1 and ( v – 1) * W as nodes can be found in buckets 1,2…. ( v – 1 ) * W. Now, for a start, we have initialized from the bucket[0] where start is given by 0 or S and this keeps on going till all the nodes are discovered.
So now, we will be having buckets from 0 to (v -1) * W. After initializing all nodes with that, we will go on traversing it, and when the bucket is found which is not empty, its first vertex will be taken out and the rest of its adjacent nodes will be reset. So from this step, we can count that the time complexity till O(WV) and when we are traversing through all edges given by E, as the vertices will be connected through edges, so we can count out that O(WV + E) as the time complexity.
Given D as Dijkstra’s algorithm with G as graph, W as weight, S as state
D (G, W, S)
1. Initialize the (G, S)
2. Initialize S as empty, S { }
3. Initialize Q where Q V[G]
4. Iterate through the given loop
While Q != empty
{
    Execution of the code till Q = { }
}
Let u min( Q)
Let S S U {u}
for each vertex v which belongs to adj[u]
    reset(u, v, W) // compute the weight
2. Suppose the weighted directed graph is given by G = (V, E) where weights are depicted with
w: E → R and V depicts the collection of vertices and E gives edges list.
So for each edge given as (u, v) belonging to E, there is a shortest path from the source vertex s which has edge given by (u, v) and there is a presence of one more shortest path which does not contain the same edge (u, v) in its traversed path.
Basically as we know that graphs in which we have directed edges with arrow symbols which predicts the direction of movement from one vertex to another and there are other type of graphs which does not have these symbols called as undirected graphs.
The given property mentioned above cannot be valid for the acyclic graphs as they comprised of unique edges connecting one vertex to another
So, coming to the cyclic graphs, we can have a look over the given example
Lets suppose Q → T , we will find out the path from Q to R vertex so in the given graph we have
Two ways
1. Q → R , we can reach R through Q → T ...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here