Graph Problems and Terminology
Here's a friendly overview of common graph problems, categorized by different aspects of graph terminology:
Traversal Problems
- Breadth-First Search (BFS):
- Find the shortest path in an unweighted graph.
- Level-order traversal in trees.
- Depth-First Search (DFS):
- Find connected components in a graph.
- Detect cycles in a graph.
- Topological sorting of a Directed Acyclic Graph (DAG).
Shortest Path Problems
- Dijkstra's Algorithm:
- Find the shortest path from a source vertex to all other vertices in a weighted graph with non-negative weights.
- Bellman-Ford Algorithm:
- Find the shortest path from a source vertex to all other vertices in a graph that may have negative weights.
- Floyd-Warshall Algorithm:
- Find shortest paths between all pairs of vertices in a weighted graph.
- A* Algorithm:
- Find the shortest path in a weighted graph using heuristics (used in pathfinding algorithms).
Minimum Spanning Tree (MST) Problems
- Kruskal’s Algorithm:
- Find the Minimum Spanning Tree (MST) of a graph using a union-find data structure.
- Prim’s Algorithm:
- Find the MST by growing the tree from an initial vertex using a priority queue.
Cycle Detection Problems
- Cycle Detection in Directed Graphs:
- Use DFS to detect cycles in a directed graph (e.g., to check if a graph is a DAG).
- Cycle Detection in Undirected Graphs:
- Use union-find data structure to detect cycles in an undirected graph.
Connectivity Problems
- Connected Components:
- Find all connected components in an undirected graph.
- Articulation Points:
- Find vertices whose removal increases the number of connected components.
- Bridges:
- Find edges whose removal increases the number of connected components.
Topological Sorting
- Topological Sorting:
- Order vertices in a Directed Acyclic Graph (DAG) such that for every directed edge (u, v), vertex u comes before v.
Graph Coloring
- Graph Coloring:
- Assign colors to vertices of a graph such that no two adjacent vertices share the same color (used in scheduling problems).
- Chromatic Number:
- Determine the minimum number of colors needed to color a graph.
Flow Problems
- Maximum Flow:
- Find the maximum flow from a source to a sink in a flow network (using algorithms like Ford-Fulkerson, Edmonds-Karp).
- Minimum Cut:
- Find the smallest cut (set of edges) that separates the source and sink in a flow network.
Matching Problems
- Maximum Bipartite Matching:
- Find the maximum matching in a bipartite graph (e.g., job assignment problems).
- Hungarian Algorithm:
- Solve the assignment problem where each task is assigned to exactly one worker to minimize cost.
Distance Problems
- Diameter of a Graph:
- Find the longest shortest path between any pair of vertices in a graph.
- K-Shortest Paths:
- Find multiple shortest paths between two vertices in a weighted graph.
These problems cover a broad spectrum of graph theory and are commonly encountered in various domains, including computer science, operations research, and optimization.