Explore tens of thousands of sets crafted by our community.
Graph Search Algorithms
8
Flashcards
0/8
Dijkstra's Algorithm
Finds the shortest paths from a single source to all other nodes in a weighted graph with non-negative weights. Time complexity: O(V^2) or O(E+V log V) with a priority queue.
A* Search Algorithm
Finds the shortest path in a weighted graph using heuristics to guide its search. Time complexity: O(E), where E is the number of edges, with the proper heuristic.
Bellman-Ford Algorithm
Computes shortest paths from a single source vertex to all other vertices in a weighted graph. Capable of handling negative weights. Time complexity: O(VE).
Prim's Algorithm
A greedy algorithm that finds a minimum spanning tree for a weighted undirected graph. Time complexity: O(V^2) or O(E+V log V) with a binary heap.
Breadth-First Search (BFS)
Explores the neighbor nodes at the present depth prior to moving on to nodes at the next depth level. Time complexity: O(V+E) for both adjacency list and matrix.
Floyd-Warshall Algorithm
Finds shortest paths between all pairs of vertices in a weighted graph with positive or negative edge weights (but no negative cycles). Time complexity: O(V^3).
Kruskal's Algorithm
A greedy algorithm that finds a minimum spanning tree for a connected weighted graph by adding increasing cost edges at each step. Time complexity: O(E log E) or O(E log V).
Depth-First Search (DFS)
Explores as far as possible along each branch before backtracking. Time complexity: O(V+E) for adjacency list, O(V^2) for adjacency matrix.
© Hypatia.Tech. 2024 All rights reserved.