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.
- 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 🌐
- 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.
Follow these steps to get the project running locally:
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.