Vertex t will only be reachable from vertex s if performing BFS(Breadth First Search) starting from vertex s will cover vertex t otherwise t will not be reachable from s.
Hence our algorithm will be as follows:-
CUT_VERTEX(G=(V,E),s,t)
1. Cut_vertex_set = {} //initially this set is empty
2. For each vertex in V:-
3..........Remove v from G
4..........Perform BFS in G with s as source vertex
5.................If BFS tree contains t then add vertex v back to graph G and continue //since v does not disconnect s and t
6................else //v is the cut vertex
7..........................Cut_vertex_set.Add(v) //add v into the solution set
8..........................Add vertex v back to graph G and continue
9. Return Cut_vertex_set //return the solution
Time complexity = |V|*( Time to remove vertex from G and adding back the vertex + Time to perform BFS)
=O( |V|*(|V|+|E| + |V|+|E|)) = O(|V|2 + |V||E|)
Please comment for any clarification
Suppose we are given a directed acyclic graph G with a unique source and a unique...
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...
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...
Problem 10. (10 marks) Let G- (V, E) be a directed graph with source s E V, sink t e V, and non- negative edge capacities ce. Give a polynomial time algorithm to decide whether G has a unique minimum s-t cut (i.e. an s -tof capacity strictly less than that of all other s-t cuts).
(Fill the blank) A Hamiltonian Path is a path in a directed graph that visits every vertex exactly once. Describe a linear time algorithm to determine whether a directed acyclic graph G=(V, E) contains a Hamiltonian path. (Hint: It might help to draw a DAG which contains a Hamiltonian path)_________.
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...
Given a directed graph G, give an algorithm that tests if G is acyclic. Analyze running time.
Problem 1: Dynamic Programming in DAG Let G(V,E), |V| = n, be a directed acyclic graph presented in adjacency list representation, where the vertices are labelled with numbers in the set {1, . . . , n}, and where (i, j) is and edge inplies i < j. Suppose also that each vertex has a positive value vi, 1 ≤ i ≤ n. Define the value of a path as the sum of the values of the vertices belonging to...
2. Design a deterministic algorithm to solve the following problem. input: A directed acyclic graph G = (V, E) stored using adjacency lists. output: A Hamiltonian path, if such a path exists. Otherwise, return NONE. Your algorithm must take O(|V| + |E|) time. You must describe your algorithm in plain English (no pseudocode) and you must explain why the running time of your algorithm is O(|V| + |E|). Maximum half a page
Given a directed graph with positive edge lengths and a specified vertex v in the graph, the "all-pairs" v-constrained shortest path problem" is the problem of computing for each pair of vertices i and j the shortest path from i to j that goes through the vertex v. If no such path exists, the answer is . Describe an algorithm that takes a graph G= (V; E) and vertex v as input parameters and computes values L(i; j) that represent...
(b) A source in a directed graph is a node with no incoming edges. A sink is a node with no outgoing edges. Assume that we know that every DAG has at least one sink. Use this fact to explain why every DAG must have at least one source. (c) Consider the following graph algorithm which takes a DAG G as input. function COMPUTESOMETHING(DAG G) Lempty linked list S stack of all source nodes in G while S is non-empty...