MCQ IN COMPUTER SCIENCE & ENGINEERING

COMPUTER SCIENCE AND ENGINEERING

COMPILER DESIGN

Question [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
With V (greater than 1) vertices, how many edges at most can a Directed Acyclic Graph possess?
A
(V*(V-1))/2
B
(V*(V+1))/2
C
(V+1)C2
D
(V-1)C2
Explanation: 

Detailed explanation-1: -3. With V(greater than 1) vertices, how many edges at most can a Directed Acyclic Graph possess? Explanation: The first edge would have an outgoing degree of atmost V-1, the next edge would have V-2 and so on, hence V-1 + V-2…. +1 equals (V*(V-1))/2.

Detailed explanation-2: -The maximum number of edges in a DAG with n vertices is (n2).

Detailed explanation-3: -If it was any more than n-1, then there is one node which is in both the in-degree and out-degree implying a cycle. Therefore each node than can have n-1 edges adjacent on it and so the maximum number of edges in the graph is n(n−1)/2.

Detailed explanation-4: -For maximum number of edges each vertex connect to other vertex only if it does not from a cycle i.e. from a tree with n vertices, which has maximum n-1 edges.

Detailed explanation-5: -In a directed graph or a digraph, each edge is associated with a direction from a start vertex to an end vertex. If we traverse along the direction of the edges and we find that no closed loops are formed along any path, we say that there are no directed cycles. The graph formed is a directed acyclic graph.

There is 1 question to complete.