Skip to content

Graph Algorithms are implemented by using Node.js. BFS and DFS methods, hasPath and shortestPath problems, counting islands and more

Notifications You must be signed in to change notification settings

HilalKocak/graph-algorithms

Repository files navigation

Graph Algorithms

Depth-First Search (DFS)
  • dfs-recursive.js: Implements DFS using recursion.
  • dfs.js: Implements DFS without recursion, using a stack.
Breadth-First Search (BFS)
  • bfs.js: Implements BFS using a queue.
Path Existence in Graphs
  • 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
  • shortest-path.js: Finds the shortest path between two nodes in a graph.
Island Problems
  • 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

About

Graph Algorithms are implemented by using Node.js. BFS and DFS methods, hasPath and shortestPath problems, counting islands and more

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published