All problems
› Graph problems
Graph problems
139 Graph DSA practice problems on CampusCode, each with statement, examples and constraints.
543. Minimum Number of Days to Disconnect Island
Hard
Binary Search
582. BFS Level Order Traversal Using Queue
Easy
Stack
683. Minimum Cost to Reach Destination in Time
Hard
Stack
905. All Nodes Distance K in Binary Tree
Medium
Trees
908. Time to Burn Binary Tree from a Node
Medium
Trees
914. Minimum Time to Collect All Apples
Medium
Trees
940. Time to Burn Tree — Multi-Source BFS
Hard
Trees
969. Build Adjacency List from Edge List
Easy
Graphs
970. Build Adjacency Matrix from Edge List
Easy
Graphs
971. Convert Adjacency Matrix to List
Easy
Graphs
972. Check if Edge Exists in Graph
Easy
Graphs
973. Count Degree of Each Vertex
Easy
Graphs
974. BFS Traversal of Undirected Graph
Easy
Graphs
975. DFS Traversal of Undirected Graph
Easy
Graphs
976. BFS Traversal of Directed Graph
Easy
Graphs
977. DFS Traversal of Directed Graph
Easy
Graphs
978. Find Shortest Path in Unweighted Graph
Easy
Graphs
979. Check if Path Exists Between Two Nodes
Easy
Graphs
980. Level of Each Node from Source
Easy
Graphs
981. Count Connected Components in Undirected Graph
Easy
Graphs
982. Multi-Source BFS — Minimum Distance to Any Source
Easy
Graphs
984. Detect Cycle in Undirected Graph (DFS)
Easy
Graphs
985. Detect Cycle in Directed Graph (DFS)
Easy
Graphs
986. Detect Cycle in Undirected Graph Using BFS
Easy
Graphs
987. Find All Neighbours of a Node
Easy
Graphs
988. Count Isolated Nodes in a Graph
Easy
Graphs
989. Number of Islands (DFS)
Easy
Graphs
991. Max Area of Island
Easy
Graphs
992. Count Islands Using BFS
Easy
Graphs
995. Rotting Oranges — Multi-Source BFS
Easy
Graphs
996. 01 Matrix — Distance to Nearest Zero
Easy
Graphs
997. Shortest Path in Binary Matrix
Easy
Graphs
999. Island Perimeter
Easy
Graphs
1000. Number of Closed Islands
Easy
Graphs
1001. Number of Enclaves
Easy
Graphs
1002. Count Sub Islands
Easy
Graphs
1003. Map of Highest Peak (BFS)
Easy
Graphs
1004. Walls and Gates — Multi-Source BFS
Easy
Graphs
1008. Check if Path Crosses Itself
Easy
Graphs
1009. Find Number of Connected Components Using DSU
Easy
Graphs
1010. Detect Cycle Using DSU
Easy
Graphs
1011. Check if Two Nodes are in Same Component
Easy
Graphs
1012. Topological Sort Using DFS
Easy
Graphs
1013. Topological Sort Using Kahn's Algorithm (BFS)
Easy
Graphs
1016. Find Mother Vertex in Directed Graph
Easy
Graphs
1017. Print All Paths Between Two Nodes
Easy
Graphs
1018. Check if Graph is Tree
Easy
Graphs
1019. Find All Articulation Points (Bridges Intro)
Easy
Graphs
1020. Minimum Moves to Reach Target in Knight Moves
Easy
Graphs
1021. Clone an Undirected Graph
Easy
Graphs
1022. Word Ladder I — Minimum Transformations
Easy
Graphs
1023. Redundant Connection
Easy
Graphs
1024. Minimum Steps to Reach End in Circular Array
Easy
Graphs
1025. Count Paths from Source to Destination in DAG
Easy
Graphs
1026. Dijkstra's Shortest Path Algorithm
Medium
Graphs
1027. Bellman-Ford Shortest Path
Medium
Graphs
1028. Shortest Path in DAG (Topo + Relax)
Medium
Graphs
1029. Floyd-Warshall All-Pairs Shortest Path
Medium
Graphs
1031. Network Delay Time (Dijkstra)
Medium
Graphs
1035. Find the City with Smallest Reachable Neighbours
Medium
Graphs
1036. Minimum Spanning Tree — Kruskal's Algorithm
Medium
Graphs
1037. Minimum Spanning Tree — Prim's Algorithm
Medium
Graphs
1038. Minimum Cost to Connect All Points
Medium
Graphs
1039. Critical Connections — Bridges in Graph
Medium
Graphs
1040. Minimum Spanning Tree — Number of Edges
Medium
Graphs
1041. Course Schedule II — Return Order
Medium
Graphs
1042. Alien Dictionary — Find Letter Order
Medium
Graphs
1043. Find All Ancestors of a Node in DAG
Medium
Graphs
1044. Parallel Courses — Minimum Semesters
Medium
Graphs
1045. Sequence Reconstruction Using Topo Sort
Medium
Graphs
1046. Kosaraju's Algorithm — Strongly Connected Components
Medium
Graphs
1047. Tarjan's Algorithm — SCC
Medium
Graphs
1048. Count Strongly Connected Components
Medium
Graphs
1049. Accounts Merge
Medium
Graphs
1050. Satisfiability of Equality Equations
Medium
Graphs
1051. Number of Islands II (Dynamic)
Medium
Graphs
1052. Largest Component Size by Common Factor
Medium
Graphs
1054. Word Ladder II — All Shortest Paths
Medium
Graphs
1055. Open the Lock — Minimum Turns
Medium
Graphs
1056. Minimum Jumps to Reach End (Jump Game BFS)
Medium
Graphs
1057. Snakes and Ladders
Medium
Graphs
1058. Bus Routes — Minimum Buses to Destination
Medium
Graphs
1059. Shortest Path Visiting All Nodes (Bitmask BFS)
Medium
Graphs
1060. Number of Provinces — Connected Components
Medium
Graphs
1061. Keys and Rooms
Medium
Graphs
1062. Find Eventual Safe States
Medium
Graphs
1063. Reconstruct Itinerary (Eulerian Path)
Medium
Graphs
1064. Graph Valid Tree
Medium
Graphs
1065. Maximal Network Rank
Medium
Graphs
1066. As Far from Land as Possible
Medium
Graphs
1067. Minimum Obstacles to Reach Corner (0-1 BFS)
Medium
Graphs
1068. Cut Off Trees for Golf Event
Medium
Graphs
1069. Minimum Cost to Make at Least One Valid Path
Medium
Graphs
1070. Reachable Nodes in Subdivided Graph
Medium
Graphs
1071. Graph Coloring — M-Coloring Problem
Medium
Graphs
1072. Check if Graph is Bipartite (BFS)
Medium
Graphs
1073. Number of Ways to Arrive at Destination
Medium
Graphs
1074. Minimum Weighted Sum to All Reachable Nodes
Medium
Graphs
1075. Check Connectivity After Node Removal
Medium
Graphs
1077. Bellman-Ford — Detect Negative Weight Cycle
Hard
Graphs
1078. Johnson's Algorithm — All-Pairs on Sparse Graph
Hard
Graphs
1079. Minimum Cost Path with At Most K Edges (DP+Graph)
Hard
Graphs
1080. Max Flow — Ford-Fulkerson Algorithm
Hard
Graphs
1081. Max Flow — Edmonds-Karp (BFS-based)
Hard
Graphs
1082. Minimum Cut in a Flow Network
Hard
Graphs
1083. Bipartite Matching — Maximum Matching
Hard
Graphs
1084. Minimum Path Cover in DAG
Hard
Graphs
1085. Minimum Edges to Make Graph Strongly Connected
Hard
Graphs
1086. Count Critical Nodes Whose Removal Disconnects Graph
Hard
Graphs
1087. 2-SAT Problem Using Implication Graph
Hard
Graphs
1088. Minimum Height Trees — Topological Trim
Hard
Graphs
1089. Parallel Courses III — Maximum Time with Dependencies
Hard
Graphs
1090. Second Best Minimum Spanning Tree
Hard
Graphs
1091. Maximum Spanning Tree
Hard
Graphs
1092. Connecting Cities With Minimum Cost
Hard
Graphs
1093. DSU with Rollback — Online Connectivity
Hard
Graphs
1094. Connected Components After Edge Removals (Offline)
Hard
Graphs
1095. Genetic Mutation — Minimum Mutations (BFS)
Hard
Graphs
1096. Shortest Bridge
Hard
Graphs
1098. Jump Game IV — BFS with Value Groups
Hard
Graphs
1099. Shortest Path with Obstacle Elimination
Hard
Graphs
1100. Cherry Pickup II — Two Robots
Hard
Graphs
1101. Minimum Days to Disconnect Island
Hard
Graphs
1103. Course Schedule IV — Reachability Queries
Hard
Graphs
1104. Find All Bridges Using Tarjan's Algorithm
Hard
Graphs
1105. Articulation Points Using Tarjan's Algorithm
Hard
Graphs
1106. Eulerian Circuit Using Hierholzer's Algorithm
Hard
Graphs
1107. Hamiltonian Path Existence (Bitmask DP)
Hard
Graphs
1108. Travelling Salesman Problem (Bitmask DP)
Hard
Graphs
1109. Count Hamiltonian Paths in DAG (Bitmask DP)
Hard
Graphs
1110. Minimum Jumps to Reach Home (Implicit BFS)
Hard
Graphs
1111. General Graph Maximum Matching
Hard
Graphs
1112. Max Stones Removed with Same Row or Column
Hard
Graphs
1113. Couples Holding Hands — Minimum Swaps
Hard
Graphs
1114. Minimum Equivalent Graph via Transitive Reduction
Hard
Graphs
1372. Travelling Salesman — Classic Bitmask DP
Hard
Bit Manipulation
1374. Cover All Nodes with Minimum Edges (Bitmask)
Hard
Bit Manipulation
1383. Shortest Path Visiting All Nodes
Hard
Bit Manipulation
1405. 2-SAT Problem — Implication Graph + Bits
Hard
Bit Manipulation