• retagged by
3,941 views

4 Answers

Best answer
5 5 votes

The matrix of the transitive closure of a relation on a set of n elements

can be found using $n2(2n-1)(n-1) + (n-1)n2$ bit operations, which gives the time complexity of $O(n4)$.

But using  Warshall's Algorithm: Transitive Closure we can do it in $O(n3)$ bit operations.

Hence $D$ is the correct answer.

• edited by
1 1 vote

ANSWER: D    O( n3 )

Transitive closure of a graph

Given a directed graph, find out if a vertex j is reachable from another vertex I for all vertex pairs (i, j) in the given graph. Here reachable means that there is a path from vertex I to j. The reach-ability matrix is called transitive closure of a graph.

transitiveclosure            

Transitive closure of above graphs is 
     1 1 1 1 
     1 1 1 1 
     1 1 1 1 
     0 0 0 1 

Floyd Warshall Algorithm can be used, we can calculate the distance matrix dist[V][V] using Floyd Warshall, if dist[i][j] is infinite, then j is not reachable from i, otherwise j is reachable and value of dist[i][j] will be less than V.

Time Complexity: O(V3) where V is the number of vertices in the given graph.

source: geeksforgeeks

Answer:
Position:
Show:

Related questions

12 12 votes
3 3 answers
7.7k
7.7k views
Arjun asked Apr 22, 2018
7,689 views
$(\text{G}, \ast )$ is an abelian group. Then$x= x^{-1}$ for any $x$ belonging to $\text{G}$$x=x^{2}$ for any $x$ belonging to $\text{G}$$\left( x \ast y \right )^{2}= x^...
10 10 votes
5 5 answers
11.7k
11.7k views
Arjun asked Apr 22, 2018
11,700 views
The running time of an algorithm is given by: $T(n) = T(n-1) + T(n-2) - T(n-3)$, if $n 3$ = $n$, otherwiseThen what...
9 9 votes
3 answers 3 answers
7.6k
7.6k views
Arjun asked Apr 22, 2018
7,586 views
Consider the following C code segmentint f(int x) { if(x<1) return 1; else return (f(x-1)+g(x)); } int g(int x) { if(x<2) return 2; else return (f(x-1)+g(x/2)); }Of the f...