Suppose
is a
directed graph represented by a adjacency lists. Divise a linear
time algorithm that, given such a
, returns a list of all
the source vertices of
. (Note, this list may
be empty.) Prove your algorithm runs in
-time.
Hint: There is a simple solution that
does not involve any DFS’s or BFS’s.

Suppose is a directed graph represented by a adjacency lists. Divise a linear time algorithm that,...
Write in pseudocode an algorithm that receives a graph
and a set of vertices
and
remove
from
. Please note that no edge incident to vertices of
can exist after removal.
Analyze the execution time of your algorithm if the
implementation is done in both representations:
adjacency matrix and adjacency list
We were unable to transcribe this imageWe were unable to transcribe this imageWe were unable to transcribe this imageWe were unable to transcribe this imageWe were unable to transcribe...
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...
Given a plane graph represented as an ordered (clockwise) adjacency lists, as presented in class, give a detailed efficient algorithm that lists all regions of the plane embedding. Here each region is a sequence of vertices, ordered as one traverses the edges of its boundary. See the following example. Do analysis on the running-time of your algorithm. Note that all planar graphs have O(n) edges.
Dijkstra’s Algorithm: You have to implement the Dijkstra’s
algorithm and apply it on the graph provided below.
You have to take the input from the user as an adjacency matrix
representing the graph, the source, the destination. Then you have
to apply the Dijkstra’s algorithm to find the shortest path from
the source and the destination, and find the shortest
route between the source and the destination.
For the input you have to read it from a file. It will...
In prim’s algorithm, if a graph G(V,E) is represented by its adjacency list and the priority queue is implemented using min-heap data structure, find the time complexity of the algorithm using big-oh asymptotic notation. Justify your answer in detail how you get the time complexity
Let G = (V, E) be a directed acyclic graph with n vertices and m edges. Give an O(n + m) time algorithm that determines if G contains a directed path that touches every vertex in G exactly once. The graph G is given by its adjacency list representation.
4&5
0 1 2 3 1. Draw the undirected graph that corresponds to this adjacency matrix 0 0 1 1 0 1 1 1 1 0 1 1 1 2 1 1 1 0 1 3 1 0 1 1 0 1 2. Given the following directed graph, how would you represent it with an adjacency list? 3. We've seen two ways to store graphs - adjacency matrices, and adjacency lists. For a directed graph like the one shown above,...
Exercise (15 points) Consider an adjacency-list representation of a directed graph G=(V.E). a) Propose in pseudocode an algorithm A to compute the in-degree of each vertex in V. b) What is the time complexity of A? c) Propose in pseudocode an algorithm B to compute the out-degree of each vertex in V. d) What is the time complexity of B?
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
Give a linear-time algorithm to find an odd-length cycle in a directed graph. (Hint: First solve this problem under the assumption that the graph is strongly connected.)