Question

In: Computer Science

. Provide a weighted directed graph G = (V, E, c) that includes three vertices a,...

. Provide a weighted directed graph G = (V, E, c) that includes three vertices a, b, and c, and for which the maximum-cost simple path P from a to b includes vertex c, but the subpath from a to c is not the maximum-cost path from a to c

Solutions

Expert Solution

the graph contains three vertices a,b,c.

Also it should satisfy two conditions according to the question. They are,

1. the maximum-cost simple path P from a to b includes vertex c.

2. the subpath from a to c is not the maximum-cost path from a to c.

Here the maximum cost simple path means, the path cost should be maximum and it should not have any repeating edges.

So lets assume a directed graph with given three vertices and let there exist four edges with certain costs as:

edge ac, with cost 2

edge ab with cost 1

edge bc with cost 4

edge cb with cost 3

so the graph look like this:

here all the given condtions are satisfied as:

condition 1. the maximum-cost simple path P from a to b includes vertex c.

so the found P is a------c--------b

the maximum cost path is found between a and b vertices and the maximum cost is:

cost of edge ac + cost of edge cb

=2 + 3 = 5

But this wont be the case when direct path from vertice a to b is chosen, we only get a cost less than 5, that is 1

so our maximum cost simple path always has vertex c included.

condition 2: the subpath from a to c is not the maximum-cost path from a to c.

this is also satisfied, because, the cost of subpath a to c is having the cost 2

while the path from a to c through b is a-----b------c

with cost, =

cost of edge ab + cost of edge bc = 1 +4 = 5 which is the maximum cost simple path.

So the maximum cost simple path is a-----b------c and NOT the subpath ac

Thus we obatined a weighted directed graph G = (V, E, c) that includes three vertices a, b, and c, and for which the maximum-cost simple path P from a to b includes vertex c, but the subpath from a to c is not the maximum-cost path from a to c.


Related Solutions

You are given a directed graph G(V,E) with n vertices and m edges. Let S be...
You are given a directed graph G(V,E) with n vertices and m edges. Let S be the subset of vertices in G that are able to reach some cycle in G. Design an O(n + m) time algorithm to compute the set S. You can assume that G is given to you in the adjacency-list representation.
A DAG is a directed graph that contains no directed cycles. Define G = (V, E)...
A DAG is a directed graph that contains no directed cycles. Define G = (V, E) in which V is the set of all nodes as {v1, v2, ..., vi , ...vn} and E is the set of edges E = {ei,j = (vi , vj ) | vi , vj ∈ V} . A topological order of a directed graph G = (V, E) is an ordering of its nodes as {v1, v2, ..., vi , ...vn} so that...
Let G = (V, E) be a directed graph, with source s ∈ V, sink t...
Let G = (V, E) be a directed graph, with source s ∈ V, sink t ∈ V, and nonnegative edge capacities {ce}. Give a polynomial-time algorithm to decide whether G has a unique minimum s-t cut (i.e., an s-t of capacity strictly less than that of all other s-t cuts).
Instructions: Question 1: A directed graph G consists of • vertices (V ) (also called nodes)...
Instructions: Question 1: A directed graph G consists of • vertices (V ) (also called nodes) • edges (E) (also called links). An edge can have extra data. The number of nodes |V | and the number of edges |E| are denoted by n and m respectively. An undirected graph is like a directed graph except the edges do not have direction. Some more definitions: • An undirected graph is connected if there exists a path between all u, v...
Problem 8. A bipartite graph G = (V,E) is a graph whose vertices can be partitioned...
Problem 8. A bipartite graph G = (V,E) is a graph whose vertices can be partitioned into two (disjoint) sets V1 and V2, such that every edge joins a vertex in V1 with a vertex in V2. This means no edges are within V1 or V2 (or symbolically: ∀u, v ∈ V1, {u,v} ∉ E and ∀u,v ∈ V2, {u,v} ∉ E). 8(a) Show that the complete graph K2 is a bipartite graph. 8(b) Prove that no complete graph Kn,...
# Problem Description Given a directed graph G = (V,E) with edge length l(e) > 0...
# Problem Description Given a directed graph G = (V,E) with edge length l(e) > 0 for any e in E, and a source vertex s. Use Dijkstra’s algorithm to calculate distance(s,v) for all of the vertices v in V. (You can implement your own priority queue or use the build-in function for C++/Python) # Input The graph has `n` vertices and `m` edges. There are m + 1 lines, the first line gives three numbers `n`,`m` and `s`(1 <=...
Given an undirected graph G = (V,E), consisting of n vertices and m edges, with each...
Given an undirected graph G = (V,E), consisting of n vertices and m edges, with each edge labeled from the set {0,1}. Describe and analyze the worst-case time complexity of an efficient algorithm to find any cycle consisting of edges whose labels alternate 0,1.
Let G = (V, E) be a directed acyclic graph modeling a communication network. Each link...
Let G = (V, E) be a directed acyclic graph modeling a communication network. Each link e in E is associated with two parameters, w(e) and d(e), where w(e) is a non-negative number representing the cost of sending a unit-sized packet through e, and d(e) is an integer between 1 and D representing the time (or delay) needed for transmitting a packet through e. Design an algorithm to find a route for sending a packet between a given pair of...
If G = (V, E) is a graph and x ∈ V , let G \...
If G = (V, E) is a graph and x ∈ V , let G \ x be the graph whose vertex set is V \ {x} and whose edges are those edges of G that don’t contain x. Show that every connected finite graph G = (V, E) with at least two vertices has at least two vertices x1, x2 ∈ V such that G \ xi is connected.
Question 1 a) Prove that if u and v are distinct vertices of a graph G,...
Question 1 a) Prove that if u and v are distinct vertices of a graph G, there exists a walk from u to v if and only if there exists a path (a walk with distinct vertices) from u to v. b) Prove that a graph is bipartite if and only if it contains no cycles of odd length. Please write legibly with step by step details. Many thanks!
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT