Graph Data Structure And Algorithms

Introduction, DFS and BFS :

  1. Graph and its representations
  2. Breadth First Traversal for a Graph
  3. Depth First Traversal for a Graph
  4. Applications of Depth First Search
  5. Applications of Breadth First Traversal
  6. Graph representations using set and hash
  7. Find Mother Vertex in a Graph
  8. Transitive Closure of a Graph using DFS
  9. Find K cores of an undirected Graph
  10. Iterative Depth First Search
  11. Count the number of nodes at given level in a tree using BFS
  12. Count all possible paths between two vertices
  13. Minimum initial vertices to traverse whole matrix with given conditions
  14. Shortest path to reach one prime to other by changing single digit at a time
  15. Water Jug problem using BFS
  16. Count number of trees in a forest
  17. BFS using vectors & queue as per the algorithm of CLRS
  18. Level of Each node in a Tree from source node
  19. Construct binary palindrome by repeated appending and trimming
  20. Transpose graph
  21. Path in a Rectangle with Circles
  22. Height of a generic tree from parent array
  23. BFS using STL for competitive coding
  24. DFS for a n-ary tree (acyclic graph) represented as adjacency list
  25. Maximum number of edges to be added to a tree so that it stays a Bipartite graph
  26. A Peterson Graph Problem
  27. Implementation of Graph in JavaScript
  28. Print all paths from a given source to a destination using BFS
  29. Minimum number of edges between two vertices of a Graph
  30. Count nodes within K-distance from all nodes in a set
  31. Bidirectional Search
  32. Minimum edge reversals to make a root
  33. BFS for Disconnected Graph
  34. Move weighting scale alternate under given constraints
  35. Best First Search (Informed Search)
  36. Number of pair of positions in matrix which are not accessible
  37. Maximum product of two non-intersecting paths in a tree
  38. Delete Edge to minimize subtree sum difference
  39. Find the minimum number of moves needed to move from one cell of matrix to another
  40. Minimum steps to reach target by a Knight | Set 1
  41. Minimum number of operation required to convert number x into y
  42. Minimum steps to reach end of array under constraints
  43. Find the smallest binary digit multiple of given number
  44. Roots of a tree which give minimum height
  45. Stepping Numbers
  46. Clone an Undirected Graph
  47. Check if two nodes are on same path in a tree
  48. A matrix probability question
  49. Find length of the largest region in Boolean Matrix
  50. Iterative Deepening Search(IDS) or Iterative Deepening Depth First Search(IDDFS)

Graph Cycle :

Topological Sorting :

Minimum Spanning Tree :



BackTracking :

Shortest Paths :

Connectivity :

  1. Find if there is a path between two vertices in a directed graph
  2. Connectivity in a directed graph
  3. Articulation Points (or Cut Vertices) in a Graph
  4. Biconnected Components
  5. Biconnected graph
  6. Bridges in a graph
  7. Eulerian path and circuit
  8. Fleury’s Algorithm for printing Eulerian Path or Circuit
  9. Strongly Connected Components
  10. Transitive closure of a graph
  11. Find the number of islands
  12. Find the number of Islands | Set 2 (Using Disjoint Set)
  13. Count all possible walks from a source to a destination with exactly k edges
  14. Euler Circuit in a Directed Graph
  15. Count the number of non-reachable nodes
  16. Find the Degree of a Particular vertex in a Graph
  17. Check if a given graph is tree or not
  18. Minimum edges required to add to make Euler Circuit
  19. Eulerian Path in undirected graph
  20. Find if there is a path of more than k length
  21. Length of shortest chain to reach the target word
  22. Print all paths from a given source to destination
  23. Find minimum cost to reach destination using train
  24. Find if an array of strings can be chained to form a circle | Set 1
  25. Find if an array of strings can be chained to form a circle | Set 2
  26. Tarjan’s Algorithm to find strongly connected Components
  27. Number of loops of size k starting from a specific node
  28. Paths to travel each nodes using each edge (Seven Bridges of Königsberg)
  29. Number of cyclic elements in an array where we can jump according to value
  30. Number of groups formed in a graph of friends
  31. Minimum cost to connect weighted nodes represented as array
  32. Count single node isolated sub-graphs in a disconnected graph
  33. Calculate number of nodes between two vertices in an acyclic Graph by Disjoint Union method
  34. Dynamic Connectivity | Set 1 (Incremental)
  35. Check if a graph is strongly connected | Set 1 (Kosaraju using DFS)
  36. Check if a given directed graph is strongly connected | Set 2 (Kosaraju using BFS)
  37. Check if removing a given edge disconnects a graph
  38. Find all reachable nodes from every node present in a given set
  39. Connected Components in an undirected graph
  40. k’th heaviest adjacent node in a graph where each vertex has weight

Maximum Flow :

STL Implementation of Algorithms :

Hard Problems :

Misc :

Quick Links :

Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above.



Company Wise Coding Practice    Topic Wise Coding Practice