• ¿Documento equivocado? Cámbialo gratis
  • Escrito por estudiantes que aprobaron
  • Inmediatamente disponible después del pago
  • Leer en línea o como PDF
Vender
¿Dónde estudias?
Tu idioma
Document preview thumbnail
Vista previa 1 fuera de 2 páginas
Examen

CS 6515 Graph Algorithms Test Questions and Answers Solved Correctly

Document preview thumbnail
Vista previa 1 fuera de 2 páginas

CS 6515 Graph Algorithms Test Questions and Answers Solved Correctly DFS outputs - Answerspre array, post array, ccnum array, prev array BFS outputs - Answersdist array, prev array Explore outputs - Answersvisited array. When to use Dijkstra's? - AnswersWorks for both directed and undirected graphs. Must have only non-negative edge weights. Dijkstra's outputs - Answersdist array, prev array Dijkstra's runtime? - AnswersO((n+m) log n) log n is from using the min heap (to get the lowest cost weight) When to use Bellman Ford? - AnswersUse when there is a graph with negative edge weights. Gives us the shortest path from s to every other vertex v. Slower than Dijkstra's algorithm. Dijkstra's was O((n+m)logn), but this is O(n*m). Can also be used to detect negative weight cycles IF the cycle is reachable from sources. Bellman ford runtime - AnswersO(n*m) Remember, this uses a dynamic programming table. Will have found the shortest path distances after n - 1 iterations. If the distances keep updating, there is a negative weight cycle. Floyd Warshall output - AnswersReturns an n by n matrix of shortest path costs between EVERY pair of vertices. Floyd Warshall runtime - AnswersO(n^3) When to use SCC algorithm? - AnswersOnly useful for directed graphs. Use to get a metagraph of connected components. Each SCC is represented as a single node. The resulting metagraph is always a DAG. SCC algorithm time complexity - AnswersO(n+m) Uses topological sort (O(n+m)) on the reverse graph Complexity to find an MST - AnswersO(m log n) for both Kruskal's and for Prim's When to use Kruskal's or Prim's? - AnswersTo find the MST of an undirected graph Kruskal's vs. Prim's? Differences in approach? - AnswersKruskal's greedily takes the cheapest edges and adds them to our MST (if they don't create cycles). Checking for cycles is accomplished via the union find data structure. Prim's is similar to Dijkstra's, looking at nodes, and adds the lightest edge to connect between the subtree and any unconnected node. Ford Fulkerson main steps - Answers1. Start with f_e = 0 for all edges 2. Build the residual network for current flow. This means backward edges for edges that are

Vista previa del contenido

CS 6515 Graph Algorithms Test Questions and Answers Solved Correctly

DFS outputs - Answerspre array, post array, ccnum array, prev array

BFS outputs - Answersdist array, prev array

Explore outputs - Answersvisited array.

When to use Dijkstra's? - AnswersWorks for both directed and undirected graphs. Must have only non-
negative edge weights.

Dijkstra's outputs - Answersdist array, prev array

Dijkstra's runtime? - AnswersO((n+m) log n)

log n is from using the min heap (to get the lowest cost weight)

When to use Bellman Ford? - AnswersUse when there is a graph with negative edge weights. Gives us
the shortest path from s to every other vertex v. Slower than Dijkstra's algorithm. Dijkstra's was
O((n+m)logn), but this is O(n*m). Can also be used to detect negative weight cycles IF the cycle is
reachable from sources.

Bellman ford runtime - AnswersO(n*m)

Remember, this uses a dynamic programming table. Will have found the shortest path distances after n -
1 iterations. If the distances keep updating, there is a negative weight cycle.

Floyd Warshall output - AnswersReturns an n by n matrix of shortest path costs between EVERY pair of
vertices.

Floyd Warshall runtime - AnswersO(n^3)

When to use SCC algorithm? - AnswersOnly useful for directed graphs. Use to get a metagraph of
connected components. Each SCC is represented as a single node. The resulting metagraph is always a
DAG.

SCC algorithm time complexity - AnswersO(n+m)

Uses topological sort (O(n+m)) on the reverse graph

Complexity to find an MST - AnswersO(m log n) for both Kruskal's and for Prim's

When to use Kruskal's or Prim's? - AnswersTo find the MST of an undirected graph

Kruskal's vs. Prim's? Differences in approach? - AnswersKruskal's greedily takes the cheapest edges and
adds them to our MST (if they don't create cycles). Checking for cycles is accomplished via the union find
data structure.

Información del documento

Subido en
29 de julio de 2025
Número de páginas
2
Escrito en
2024/2025
Tipo
Examen
Contiene
Preguntas y respuestas
$10.49

¿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

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.
joshuawesonga22
3.6
(15)
Vendido
146
Seguidores
2
Artículos
16007
Última venta
3 días hace



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