Graph Introduction
Here are some important topics related to graphs that are commonly covered in technical interviews:
- Graph representation: How to represent a graph in memory,
including
adjacency matrixandadjacency listrepresentations. - Traversal algorithms: How to traverse a graph, including
Depth-First Search (DFS)andBreadth-First Search (BFS). - Shortest path algorithms: How to find the shortest path between two nodes in a graph, including
Dijkstra's algorithmandA*. - Minimum spanning tree algorithms: How to find a minimum spanning tree in a graph, including
Kruskal's algorithmandPrim's algorithm. - Topological sorting: How to order the nodes in a directed acyclic graph (DAG) such that for every directed edge uv, vertex u comes before v in the ordering using DFS or Kahn's Algorithm.
- Disjoint Set Union (Union Find): Given an element, how to find the set that it belongs to and Given two sets, how to merge them into a single set.
- Strongly connected components: How to find the strongly connected components in a directed graph, using
Tarjan's algorithmandKosaraju's Algorithm. - Graph coloring: How to color the nodes in a graph such that no two adjacent nodes have the same color, using the
Welsh-Powell algorithmor theDSATUR algorithm. - Maximum flow: How to find the maximum flow in a flow network, using the
Ford-Fulkerson algorithmor theEdmonds-Karp algorithm. - Network flow: How to model and solve network flow problems, including the
max-flow min-cut theoremand theFord-Fulkerson algorithm. - Graph theory concepts: Understanding of basic graph theory concepts, such as
degrees of a node,connectedness, andbipartiteness.
It's also helpful to be familiar with various types of graphs, such as directed and undirected graphs, weighted and unweighted graphs, and tree and cycle graphs.
Standard Graph Problems
- Cycle Detection
- Directed Graph: Kahn's Algorithm
- Undirected Graph: BFS Approach, DFS Approach
- Articulation Point
- Disjoint Set Union
Topics
📄️ Connected Components
Practice Problems
🗃️ Bipartite Graph
1 items