Graph Algorithms Flashcards

1
Q

Graph Algorithms

A

Graph algorithms deal with problems related to graphs, which consist of nodes (vertices) connected by edges. Examples include Shortest Path algorithms (Dijkstra’s and Bellman-Ford), Minimum Spanning Tree algorithms (Prim’s and Kruskal’s), and Topological Sorting.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Shortest Path Algorithms (Dijkstra’s, Bellman-Ford)

A

Shortest Path Algorithms are used to find the shortest path from a source node to all other nodes in a weighted graph. Two common algorithms for this purpose are:
Dijkstra’s Algorithm: It finds the shortest path in a graph with non-negative edge weights and produces the shortest paths from a single source to all other nodes.
Bellman-Ford Algorithm: It can handle graphs with negative edge weights and detects negative weight cycles. It finds the shortest paths from a single source to all other nodes.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Minimum Spanning Tree (Prim’s, Kruskal’s)

A

Minimum Spanning Tree (MST) Algorithms are used to find a subset of edges that connects all nodes in a graph with minimum total edge weight. Two common MST algorithms are:
Prim’s Algorithm: It starts with an arbitrary node and grows the MST by adding the nearest node at each step.
Kruskal’s Algorithm: It builds the MST by iteratively selecting the smallest edge that doesn’t create a cycle.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Topological Sorting

A

Topological Sorting is a linear ordering of nodes in a directed acyclic graph (DAG) such that for every directed edge (u, v), node u comes before node v in the ordering. It is commonly used in tasks such as scheduling and dependency resolution, where tasks or dependencies must be executed in a specific order.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly