- dfs-recursive.js: Implements DFS using recursion.
- dfs.js: Implements DFS without recursion, using a stack.
- bfs.js: Implements BFS using a queue.
- hasPath.js: Determines if there is a path between two nodes in a directed graph.
- hasPathUndir.js: Determines if there is a path between two nodes in an undirected graph.
- shortest-path.js: Finds the shortest path between two nodes in a graph.
- island-count.js: Counts the number of islands in a grid.
- largest-component.js: Finds the size of the largest island in a grid.
- min-island.js: Finds the size of the smallest island in a grid.
To clone this project, run:
git clone https://github.com/HilalKocak/graph-algorithms.git
- To traverse with dfs, run:
node dfs.js
- To traverse with dfs with recursive function, run:
node dfs-recursive.js
- To traverse with bfs, run:
node bfs.js
- To solve hasPath problem solution for directed graphs, run:
node hasPath.js
- To solve hasPath problem solution for undirected graphs, run:
node hasPathUndir.js
- To find count of components in a given graph, run:
node count-conn.js
- To find the size of largest component in a given graph, run:
node largest-component.js
- To solve shortest path problem
node shortest-path.js
- To count islands of 2D matrix(grid), run:
node island-count.js
- To find the size of the minimum island, run:
node min-island.js