Nielit Scientist-C 2016 march
October 3, 2023Web-Technologies
October 3, 2023GATE 2005
Question 7 |
The time complexity of computing the transitive closure of a binary relation on a set of n elements is known to be:
O(n) | |
O(n log n) | |
O(n3/2) | |
O(n3) |
Question 7 Explanation:
First of all, In mathematics the transitive closure of a binary relation R on a set X is defined as the smallest relation on X that contains R and is transitive. More formally, the transitive closure of a binary relation R on a set X is the transitive relation R+ on set X such that R+ contains R and R+ is minimal.
For example, if X is a set of airports and x R y means “there is a direct flight from airport x to airport y” (for x and y in X), then the transitive closure of R on X is the relation R+ such that x R+ y means “it is possible to fly from x to y in one or more flights”. Informally, the transitive closure gives you the set of all places you can get to from any starting place.
To find the transitive closure of given relation, we can represent the given relation by the graph such that if x R y then there should be directed edge between x and y in a graph. For this graph, we have to apply modified Floyd_Warshall Algorithm to find the transitive closure of the graph.
The time complexity of this algorithm is O(V3) where V is the number of vertices in the given graph. You can take here V as the number of elements is set i.e., N. Therefore time complexity for the given question is O(n3).
For example, if X is a set of airports and x R y means “there is a direct flight from airport x to airport y” (for x and y in X), then the transitive closure of R on X is the relation R+ such that x R+ y means “it is possible to fly from x to y in one or more flights”. Informally, the transitive closure gives you the set of all places you can get to from any starting place.
To find the transitive closure of given relation, we can represent the given relation by the graph such that if x R y then there should be directed edge between x and y in a graph. For this graph, we have to apply modified Floyd_Warshall Algorithm to find the transitive closure of the graph.
The time complexity of this algorithm is O(V3) where V is the number of vertices in the given graph. You can take here V as the number of elements is set i.e., N. Therefore time complexity for the given question is O(n3).
Correct Answer: D
Question 7 Explanation:
First of all, In mathematics the transitive closure of a binary relation R on a set X is defined as the smallest relation on X that contains R and is transitive. More formally, the transitive closure of a binary relation R on a set X is the transitive relation R+ on set X such that R+ contains R and R+ is minimal.
For example, if X is a set of airports and x R y means “there is a direct flight from airport x to airport y” (for x and y in X), then the transitive closure of R on X is the relation R+ such that x R+ y means “it is possible to fly from x to y in one or more flights”. Informally, the transitive closure gives you the set of all places you can get to from any starting place.
To find the transitive closure of given relation, we can represent the given relation by the graph such that if x R y then there should be directed edge between x and y in a graph. For this graph, we have to apply modified Floyd_Warshall Algorithm to find the transitive closure of the graph.
The time complexity of this algorithm is O(V3) where V is the number of vertices in the given graph. You can take here V as the number of elements is set i.e., N. Therefore time complexity for the given question is O(n3).
For example, if X is a set of airports and x R y means “there is a direct flight from airport x to airport y” (for x and y in X), then the transitive closure of R on X is the relation R+ such that x R+ y means “it is possible to fly from x to y in one or more flights”. Informally, the transitive closure gives you the set of all places you can get to from any starting place.
To find the transitive closure of given relation, we can represent the given relation by the graph such that if x R y then there should be directed edge between x and y in a graph. For this graph, we have to apply modified Floyd_Warshall Algorithm to find the transitive closure of the graph.
The time complexity of this algorithm is O(V3) where V is the number of vertices in the given graph. You can take here V as the number of elements is set i.e., N. Therefore time complexity for the given question is O(n3).
Subscribe
Login
0 Comments