Algorithm is very simple. We will perform search analogous to Breadth First search where starting from vertex s we will explore the neighbours with the rule that we will include an edge (u,v) in BFS tree if and only if label of both u and v are not 1. Thus our explore method will explore every vertex v in the graph such that path from vertex s to vertex v will exist in BFS tree if and only if there is no sequence 11 in the path. Hence if we are able to cover vertex t at the end of algorithm, then return TRUE because there is path from s to t without any edge with label 11 and return FALSE otherwise.
Below is the algorithm.
FIND_PATH(G=(V,E),s,t)
1. For every vertex v in V, set Color[v] = "White".
2. Q.Enqueue(s); //Add vertex s into empty queue Q
3. While Q.NotEmpty() :-
4..........u = Q.Dequeue() //Dequeue the front element from the queue Q
5..........For all vertex v adjacent to u :-
6..................if (Color[v] != White) then continue //since vertex v has already been explored, so skip it
7..................else if (Label[v]==1 AND Label[u] ==1) then continue //since we cannot include edge (u,v) if both has Label 1
8..................else
9..........................Parent[v] = u //Edge (u,v) will be part of BFS tree with u being predecessor of v
10........................Color[v] = "Gray" //Since vertex v has been included in BFS tree
11........................Q.Enqueue(v) //Add vertex v into the queue Q
12........Color[u] = "Black" //Since this has been completely explored
13. If Color[t] == "White" //this means that t has not been included in BFS tree
14...........Return False //Since no path exist from s to t without edge label 11
15. Else
16...........Return Tree //since vertex t has been included in BFS tree
Proof of correctness : - Since our algorithm include a vertex v if and only if there is some path from s to v without any edge with label 11 in it. Hence if there exist some path from s to t without any edge with label 11 in it, then clearly all the nodes in the path from s to t will be in BFS tree and at the end vertex t will also be included. Hence our algorithm is correct.
Time complexity = Time complexity of BFS = O(V+E).
Please comment for any clarification.
3. Give an efficient algorithm that takes as input a directed graph G-(V,E) with edges labeled wi...
Give an efficient algorithm that takes a directed graph G = (V, E) and two vertices u, v E V, and determines if there are at least two edge-disjoint paths in G from u to v. i.e., your algorithm should determine whether there are at least two paths from u to v in G that have no edges in common. Argue your algorithm's correctness and analyze its time complexity.
Viterbi algorithm We can use dynamic programming on a directed graph G = (V, E) for speech recognition. Each edge (u, v) in E is labeled with a sound s(u, v) from a finite set S of sounds. The labeled graph is a formal model of a person speaking a restricted language. Each path in the graph starting from a distinguished vertex v0 in V corresponds to a possible sequence of sounds produced by the model. The label of a...
10. You are given a directed graph G(V, E) where every vertex vi E V is associated with a weight wi> 0. The length of a path is the sum of weights of all vertices along this path. Given s,t e V, suggest an O((n+ m) log n) time algorithm for finding the shortest path m s toO As usual, n = IVI and m = IEI.
5. Here are the vertices and edges of directed graph G: V= {2.6.c.de.f} E= {ab, ac, af ca. bc. be.bf. cd, ce, de, df). Weights: w(ab) = 2 w(ac) = 5, w(af) = 10, w(ca) = 2. w(be) = 2. w(be) = 10, w(bf) = 11. w(cd)= 9. w(ce) = 7. w(de) = 2. w(df) = 2. a. Draw the Graph. This is a directed, weighted graph so you need to include arrows and weights. You can insert a pic...
Consider a directed acyclic graph G = (V, E) without edge lengths and a start vertex s E V. (Recall, the length of a path in an graph without edge lengths is given by the number of edges on that path). Someone claims that the following greedy algorithm will always find longest path in the graph G starting from s. path = [8] Ucurrent = s topologically sort the vertices V of G. forall v EV in topological order do...
Input: a directed grid graph G, a set of target points S, and an integer k Output: true if there is a path through G that visits all points in S using at most k left turns A grid graph is a graph where the vertices are at integer coordinates from 0,0 to n,n. (So 0,0, 0,1, 0,2, ...0,n, 1,0, etc.) Also, all edges are between vertices at distance 1. (So 00->01, 00->10, but not 00 to any other vertex....
Problem 6 (20 points). Let G- (V,E) be a directed Let E' be another set of edges on V with edge length '(e) >0 for any e EE. Let s,t EV. Design an algorithm runs in O(lV+ E) time to find an edge e'e E' whose addition to G will result in the maximum decrease of the distance from s to t. Explain why your algorithms runs in O(V2+E') time. graph with edge length l(e) >0 for any e E...
Say that we have an undirected graph G(V, E) and a pair of vertices s, t and a vertex v that we call a a desired middle vertex . We wish to find out if there exists a simple path (every vertex appears at most once) from s to t that goes via v. Create a flow network by making v a source. Add a new vertex Z as a sink. Join s, t with two directed edges of capacity...
3. Let G=(V.E) be a weighted, directed graph with weight function w: E->{0,1,...,W} for some nonnegative integer W. Modify Dijkstra's algorithm to compute the shorted paths from a given source vertext s in O(WV+E) time. Hint: no path can have a weight larger than VW: use VW buskets, where each busket is a linked list for the vertices having same d value.
summatize the following info and break them into differeng key points. write them in yojr own words apartus 6.1 Introduction—The design of a successful hot box appa- ratus is influenced by many factors. Before beginning the design of an apparatus meeting this standard, the designer shall review the discussion on the limitations and accuracy, Section 13, discussions of the energy flows in a hot box, Annex A2, the metering box wall loss flow, Annex A3, and flanking loss, Annex...