Directed Graphs
This quiz covers fundamental concepts and properties of directed graphs, including their representation, connectivity, and applications.
Questions
In a directed graph, what is the in-degree of a vertex?
- The number of edges entering the vertex
- The number of edges leaving the vertex
- The sum of the in-degrees and out-degrees of the vertex
- The number of vertices adjacent to the vertex
What is the out-degree of a vertex in a directed graph?
- The number of edges entering the vertex
- The number of edges leaving the vertex
- The sum of the in-degrees and out-degrees of the vertex
- The number of vertices adjacent to the vertex
Which of the following is a necessary condition for a directed graph to be strongly connected?
- Every vertex has an in-degree and out-degree of at least 1
- Every vertex has a path to every other vertex
- The graph is acyclic
- The graph has no cycles
What is a directed acyclic graph (DAG)?
- A graph with no cycles
- A graph with no directed cycles
- A graph with no edges
- A graph with no vertices
Which of the following is an application of directed graphs?
- Modeling computer networks
- Representing state machines
- Scheduling tasks in a project
- All of the above
What is the topological sorting of a directed acyclic graph?
- A linear ordering of the vertices such that for every directed edge (u, v), u comes before v in the ordering
- A linear ordering of the vertices such that for every directed edge (u, v), v comes before u in the ordering
- A linear ordering of the vertices such that every vertex has an in-degree of 0
- A linear ordering of the vertices such that every vertex has an out-degree of 0
What is the minimum number of edges required in a directed graph with n vertices to ensure that it is strongly connected?
- n - 1
- n
- n + 1
- 2n - 1
What is the maximum number of edges that can be added to a directed graph with n vertices without creating a cycle?
- n - 1
- n
- n + 1
- 2n - 1
Which of the following algorithms can be used to find a topological sorting of a directed acyclic graph?
- Depth-First Search (DFS)
- Breadth-First Search (BFS)
- Dijkstra's algorithm
- Floyd-Warshall algorithm
Which of the following algorithms can be used to find the strongly connected components of a directed graph?
- Depth-First Search (DFS)
- Breadth-First Search (BFS)
- Dijkstra's algorithm
- Floyd-Warshall algorithm
What is the time complexity of finding the topological sorting of a directed acyclic graph using Depth-First Search (DFS)?
- O(V + E)
- O(V^2)
- O(E log V)
- O(V^3)
What is the time complexity of finding the strongly connected components of a directed graph using Depth-First Search (DFS)?
- O(V + E)
- O(V^2)
- O(E log V)
- O(V^3)
Which of the following is a directed graph data structure?
- Adjacency list
- Adjacency matrix
- Incidence matrix
- All of the above
Which of the following is an application of directed graphs in computer science?
- Modeling computer networks
- Representing state machines
- Scheduling tasks in a project
- All of the above
What is the difference between a directed graph and an undirected graph?
- In a directed graph, edges have a direction, while in an undirected graph, edges do not have a direction
- In a directed graph, vertices can have multiple edges between them, while in an undirected graph, vertices can only have one edge between them
- In a directed graph, cycles are allowed, while in an undirected graph, cycles are not allowed
- In a directed graph, the number of edges is always greater than or equal to the number of vertices, while in an undirected graph, the number of edges is always less than or equal to the number of vertices