Skip to content

moizaasghar/Graph-Algorithms

Repository files navigation

Graph-Theory

Find breadth first and depth first traversal in a graph. Detect cycle in a graph if exists any.

The code provides an efficient implementation of the algorithms for the problems given below in JAVA:

  1. Find a single source shortest path using Dijkstra and Bellman-Ford algorithm.
  2. Find a minimum spanning tree using Prims and Kruskal's algorithm.
  3. Find breadth-first and depth-first traversal in a graph.
  4. Find the diameter of a graph. The diameter of a graph G = (V, E) is defined as maxu, vєV ⸹(u,v), that is, the largest of all shortest-path distances in the graph.
  5. Detect the cycle in a graph if exists.

It also provides a complete trace of implementation in separate .txt files along with the results and execution time for each problem.

There is a sample graph added in the sorce code.