In this problem you will design an algorithm that takes as input a directed acyclic graph G two vertices s and t, and returns the number of simple paths from s tot in G. = (V,E) and For example, the directed acyclic graph below contains exactly four simple paths from vertex p to vertex v: pov, poryv, posryv, and psryv. Notice: your algorithm needs only to count the simple paths, not list them. m W

icon
Related questions
Question
In this problem you will design an algorithm that takes as input a directed acyclic graph G = (V,E) and
two vertices s and t, and returns the number of simple paths from s tot in G.
For example, the directed acyclic graph below contains exactly four simple paths from vertex p to vertex
v: pov, poryv, posryv, and psryv. Notice: your algorithm needs only to count the simple paths, not list
them.
m
y
W
Design a recursive backtracking (brute-force) algorithm that determines the number of
paths from s to t.
Write down the pseudocode of your algorithm and prove its correctness, i.e., convince us that it works
beyond any doubt. (Hint: using induction.).
Transcribed Image Text:In this problem you will design an algorithm that takes as input a directed acyclic graph G = (V,E) and two vertices s and t, and returns the number of simple paths from s tot in G. For example, the directed acyclic graph below contains exactly four simple paths from vertex p to vertex v: pov, poryv, posryv, and psryv. Notice: your algorithm needs only to count the simple paths, not list them. m y W Design a recursive backtracking (brute-force) algorithm that determines the number of paths from s to t. Write down the pseudocode of your algorithm and prove its correctness, i.e., convince us that it works beyond any doubt. (Hint: using induction.).
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 3 images

Blurred answer