Escrito por estudiantes que aprobaron Inmediatamente disponible después del pago Leer en línea o como PDF ¿Documento equivocado? Cámbialo gratis 4,6 TrustPilot
logo-home
Examen

Algorithms - Graph Algorithms Exam Questions and Answers Fully Solved Latest Version

Puntuación
-
Vendido
-
Páginas
4
Grado
A+
Subido en
03-08-2025
Escrito en
2025/2026

Algorithms - Graph Algorithms Exam Questions and Answers Fully Solved Latest Version How to get the connected components in undirected graphs? - AnswersRun DFS and keep track of component number What is the input and output of DFS when run on an undirected graph? - AnswersThe input is a graph of vertices and edges in adjacency list representation, and the output is the list of vertices labelled by connected components What does the Explore subroutine do when called by DFS? - AnswersThe DFS algorithm itself increments the connected component number. The explore subroutine sets each vertex to the current value of the connected component number and sets the visited flag to true on the vertex. It then repeats this routine on every vertex that it can reach from its current vertex. How do you find a path between connected vertices on undirected graphs? - AnswersUpdate the DFS and Explore subroutines to store a "prev" or "previous" variable for each vertex. DFS initializes the value to null for all vertices, and the explore sub routine updates this value after calling itself on each vertex that is reachable from the one it started from - sets it to the value of the input vertex How do you obtain connectivity info on directed graphs? - AnswersUpdate the DFS and Explore subroutines to use a "clock" variable that starts at 1. Each time the explore subroutine is run, it sets the pre order number to the current value of the clock and then increments the clock. When it finishes one full execution, it sets the post order number to the current value of the clock and then increments it. Why increment the clock in the Explore subroutine? - AnswersSo that no two vertices have the same pre order or post order number What are the different types of edges in a DFS graph? - AnswersTree edges, back edges, forward edges, cross edges How do the different types of edges in a DFS graph arise? - AnswersAn edge to a vertex that has already been explored. For back edges, the post order number of the ancestor is lower than that of the descendant. In all other edges, the ancestor has a higher post order number. In cross-edges, there is no apparent ancestor-descendent relation which can be observed with the pre order numbers. How can you determine a graph has a cycle using its DFS tree? - AnswersGraph G has a cycle if and only if its DFS tree has a back edge What is a DAG? - AnswersDirected Acyclic Graph (has no back edges) What is meant by a topological sorting of a DAG? - AnswersAn order of the vertices of the DAG such that all edges go from lower to higher How do you topologically sort a DAG? - AnswersRun DFS on DAG G. Since there are no back edges, all edges from z to w will have a higher post order number on z than w. After running DFS, order the vertices by decreasing post order number. What is the runtime of topologically sorting a DAG? - AnswersO(n+m) Define a source vertex in terms of edges and post order numbers - AnswersNo incoming edges and highest post-order number Define a sink vertex in terms of edges and post order numbers - AnswersNo outgoing edges and lowest post-order number Wen are two vertices v and w strongly connected? - AnswersWhen there is a path from v to w and w to v. Path implies that multiple edges can be involved.

Mostrar más Leer menos
Institución
Algorithms - Graph Algorithms
Grado
Algorithms - Graph Algorithms

Vista previa del contenido

Algorithms - Graph Algorithms Exam Questions and Answers Fully Solved Latest Version 2025-2026

How to get the connected components in undirected graphs? - AnswersRun DFS and keep track of
component number

What is the input and output of DFS when run on an undirected graph? - AnswersThe input is a graph of
vertices and edges in adjacency list representation, and the output is the list of vertices labelled by
connected components

What does the Explore subroutine do when called by DFS? - AnswersThe DFS algorithm itself increments
the connected component number. The explore subroutine sets each vertex to the current value of the
connected component number and sets the visited flag to true on the vertex. It then repeats this routine
on every vertex that it can reach from its current vertex.

How do you find a path between connected vertices on undirected graphs? - AnswersUpdate the DFS
and Explore subroutines to store a "prev" or "previous" variable for each vertex. DFS initializes the value
to null for all vertices, and the explore sub routine updates this value after calling itself on each vertex
that is reachable from the one it started from - sets it to the value of the input vertex

How do you obtain connectivity info on directed graphs? - AnswersUpdate the DFS and Explore
subroutines to use a "clock" variable that starts at 1. Each time the explore subroutine is run, it sets the
pre order number to the current value of the clock and then increments the clock. When it finishes one
full execution, it sets the post order number to the current value of the clock and then increments it.

Why increment the clock in the Explore subroutine? - AnswersSo that no two vertices have the same pre
order or post order number

What are the different types of edges in a DFS graph? - AnswersTree edges, back edges, forward edges,
cross edges

How do the different types of edges in a DFS graph arise? - AnswersAn edge to a vertex that has already
been explored. For back edges, the post order number of the ancestor is lower than that of the
descendant. In all other edges, the ancestor has a higher post order number. In cross-edges, there is no
apparent ancestor-descendent relation which can be observed with the pre order numbers.

How can you determine a graph has a cycle using its DFS tree? - AnswersGraph G has a cycle if and only
if its DFS tree has a back edge

What is a DAG? - AnswersDirected Acyclic Graph (has no back edges)

What is meant by a topological sorting of a DAG? - AnswersAn order of the vertices of the DAG such that
all edges go from lower to higher

How do you topologically sort a DAG? - AnswersRun DFS on DAG G. Since there are no back edges, all
edges from z to w will have a higher post order number on z than w. After running DFS, order the
vertices by decreasing post order number.

Escuela, estudio y materia

Institución
Algorithms - Graph Algorithms
Grado
Algorithms - Graph Algorithms

Información del documento

Subido en
3 de agosto de 2025
Número de páginas
4
Escrito en
2025/2026
Tipo
Examen
Contiene
Preguntas y respuestas

Temas

$10.89
Accede al documento completo:

¿Documento equivocado? Cámbialo gratis Dentro de los 14 días posteriores a la compra y antes de descargarlo, puedes elegir otro documento. Puedes gastar el importe de nuevo.
Escrito por estudiantes que aprobaron
Inmediatamente disponible después del pago
Leer en línea o como PDF


Documento también disponible en un lote

Conoce al vendedor

Seller avatar
Los indicadores de reputación están sujetos a la cantidad de artículos vendidos por una tarifa y las reseñas que ha recibido por esos documentos. Hay tres niveles: Bronce, Plata y Oro. Cuanto mayor reputación, más podrás confiar en la calidad del trabajo del vendedor.
TutorJosh Chamberlain College Of Nursing
Seguir Necesitas iniciar sesión para seguir a otros usuarios o asignaturas
Vendido
407
Miembro desde
1 año
Número de seguidores
16
Documentos
31237
Última venta
1 día hace
Tutor Joshua

Here You will find all Documents and Package Deals Offered By Tutor Joshua.

3.4

68 reseñas

5
23
4
15
3
13
2
1
1
16

Documentos populares

Recientemente visto por ti

Por qué los estudiantes eligen Stuvia

Creado por compañeros estudiantes, verificado por reseñas

Calidad en la que puedes confiar: escrito por estudiantes que aprobaron y evaluado por otros que han usado estos resúmenes.

¿No estás satisfecho? Elige otro documento

¡No te preocupes! Puedes elegir directamente otro documento que se ajuste mejor a lo que buscas.

Paga como quieras, empieza a estudiar al instante

Sin suscripción, sin compromisos. Paga como estés acostumbrado con tarjeta de crédito y descarga tu documento PDF inmediatamente.

Student with book image

“Comprado, descargado y aprobado. Así de fácil puede ser.”

Alisha Student

Preguntas frecuentes