midGraph Theory
Detecting Cycles in Undirected Graphs
Updated Apr 28, 2026
Short answer
Using DFS/BFS or Disjoint Set Union (DSU) to check if an edge connects two already visited nodes.
Deep explanation
Mid-level Graph theory focuses on classic pathfinding and optimization algorithms. Using DFS/BFS or Disjoint Set Union (DSU) to check if an edge connects two already visited nodes.
Real-world example
Google Maps finding the fastest route to a destination.
Common mistakes
- Using Dijkstra on a graph with negative edge weights.
Follow-up questions
- Time complexity of Dijkstra?