Skip to content

This project contains the implementation of basic graph theory algorithms like BFS, DFS, Kruskal's MST, Prim's MST, Dijkstras Shortest Path

Notifications You must be signed in to change notification settings

bish9oi/Graph-Theory-Implementations-in-Java

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

📊 Graph Theory Implementations in Java

Welcome to the Graph Theory Implementations in Java repository! This project contains a collection of Graph Theory algorithms implemented in Java, which include fundamental algorithms for Graph Traversal, Shortest Path, Minimum Spanning Tree, and more.


🚀 Features

  • Graph Traversal Algorithms:
    • Breadth-First Search (BFS) 🧠
    • Depth-First Search (DFS) 🔍
  • Shortest Path Algorithms:
    • Dijkstra’s Algorithm 🌐
  • Minimum Spanning Tree Algorithms:
    • Kruskal’s Algorithm 🛠️
    • Prim’s Algorithm 🌳
  • Cycle Detection & Graph Connectivity:
    • Detect cycles in both directed and undirected graphs 🔄
    • Identify connected components of a graph 🌐

🛠️ Technologies Used

  • Java: The programming language used to implement all the graph theory algorithms.
  • Graph Data Structures: Custom data structure to represent graphs, including vertices and edges.
  • Priority Queue: Utilized in Dijkstra and Prim’s algorithms for efficient edge selections.

📌 Getting Started

Follow these steps to get the project running locally:

Step 1: Clone the Repository

git clone https://github.com/bish9oi/Graph-Theory-Implementations-in-Java.git
cd Graph-Theory-Implementations-in-Java

📊 Algorithms Explained

1️⃣ Breadth-First Search (BFS) 🧠

-Time Complexity: O(V + E)

-Space Complexity: O(V)

Concept: Explores the graph level by level starting from the source node.

2️⃣ Depth-First Search (DFS) 🔍

-Time Complexity: O(V + E)

-Space Complexity: O(V)

Concept: Explores the graph by going as deep as possible before backtracking.

3️⃣ Dijkstra’s Algorithm 🌐

-Time Complexity: O(E + V log V)

-Space Complexity: O(V)

Concept: Finds the shortest path from a source node to all other nodes in a weighted graph.

5️⃣ Kruskal’s Algorithm 🛠️

-Time Complexity: O(E log E)

-Space Complexity: O(V)

Concept: Finds the Minimum Spanning Tree (MST) of a graph by sorting edges.

6️⃣ Prim’s Algorithm 🌳

-Time Complexity: O(E log V)

-Space Complexity: O(V)

Concept: Constructs a Minimum Spanning Tree (MST) by adding the shortest edge.

🎨 Visualizations & Demonstrations

--Graph Traversals: Watch BFS and DFS algorithms explore graphs step-by-step.

--Shortest Path: Visualize how Dijkstra’s and Bellman-Ford find the shortest path in weighted graphs.

--Minimum Spanning Trees: Observe how Kruskal’s and Prim’s algorithms build MSTs by selecting edges with minimum weights.

About

This project contains the implementation of basic graph theory algorithms like BFS, DFS, Kruskal's MST, Prim's MST, Dijkstras Shortest Path

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages