5. Suppose we are given an unweighted, directed graph G with n vertices (labelled 1 to...
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...
Let G (V, E) be a directed graph with n vertices and m edges. It is known that in dfsTrace of G the function dfs is called n times, once for each vertex It is also seen that dfs contains a loop whose body gets executed while visiting v once for each vertex w adjacent to v; that is the body gets executed once for each edge (v, w). In the worst case there are n adjacent vertices. What do...
Suppose that we are given a model of a city as a directed, weighted graph G = (V, E); w : E → R≥0, where we have n neighbourhoods and m streets, represented by the vertices and edges respectively. We will assume that the streets are one-way. We are also given that k of these neighbourhoods have fire stations installed. We want to find the nearest fire station for each neighbourhood, where we measure the distance from the fire station...
a directed graph has n+2 vertices: 2 of these are S and T. the rest have integer labels 1...n. for every vertex labelled i, 1 is smaller than or equal to i and i is smaller than or equal to n. there is an edge from S to i, and an edge from i to T. draw the graph. how many distinct dfs sequences are there starting at S. explain
1) Suppose that a directed graph contains the following edges. Find the strongly connected components. {(h, i), (i, j), (j, k), (k, h), (l, m), (m, n), (n, p), (p, l), (f, i), (c, e), (j, b), (k, l), (a, b), (b, c), (c, a), (d, e), (e, f), (f, g), (g, d)}. a) How many vertices are there in the component having the smallest number of vertices? b) How many vertices are there in the component having the second...
8, (10 pts) Show that given a directed graph G = (V,E) already stored in adjacency matrix form, determining if there is a vertex with in-degree n - 1 and out-degree 0 can be done in O(n) time where n is the number of vertices in V.
8, (10 pts) Show that given a directed graph G = (V,E) already stored in adjacency matrix form, determining if there is a vertex with in-degree n - 1 and out-degree 0 can...
Let G be a simple graph with 2n, n 2 vertices. Suppose there are at least n2 1 edges. Show that at least one triangle is formed. Hint: Check n 2 first and then use induction
Let G be a simple graph with 2n, n 2 vertices. Suppose there are at least n2 1 edges. Show that at least one triangle is formed. Hint: Check n 2 first and then use induction
Given the directed graph with vertices(A, B, C, D, E, F, G, H, I) Edges (AB=5, BF = 4, AC = 7, CD=3, EC = 4, DE = 5, EH = 2, HI = 4, GH = 10, GF = 3, IG = 3, BE = 2, HD= 7, EG= 9 1. What is the length of minimum spaning tree? 2. Which edges will not be included if we use Kruskal's algorithm to find minimum spaning tree?
Suppose we are given two sorted arrays (nondecreasing from index 1 to index n) X[1] · · · X[n] and Y [1] · · · Y [n] of integers. For simplicity, assume that n is a power of 2. Problem is to design an algorithm that determines if there is a number p in X and a number q in Y such that p + q is zero. If such numbers exist, the algorithm returns true; otherwise, it returns false....
5) Consider the simple linear regression model N(0, o2) i = 1,...,n Let g be the mean of the yi, and let â and ß be the MLES of a and B, respectively. Let yi = â-+ Bxi be the fitted values, and let e; = yi -yi be the residuals a) What is Cov(j, B) b) What is Cov(â, ß) c) Show that 1 ei = 0 d) Show that _1 x;e; = 0 e) Show that 1iei =...