Skip to content

Latest commit

 

History

4 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

graphs_basics README.md (Markdown)

graphs_basics

Build License: MIT

This repository contains clean and minimal implementations of classical graph algorithms in Java:

  • BFS / DFS — basic graph traversals (graphs_algorithms/)
  • Dijkstra's Algorithm — shortest path from a single source (dijkstra_shortest_path/)
  • Kruskal's Algorithm — Minimum Spanning Tree (KruskalMST/)

🧰 Requirements

  • JDK 17+ (the project uses plain Java, no build tools required)

🧪 How to Compile and Run

# 1. Compile all .java files into the out/ folder
mkdir -p out
find src -name "*.java" > sources.txt
javac -encoding UTF-8 -d out @sources.txt

# 2. Run a specific class with a main() method
# Example:
# java -cp out dijkstra_shortest_path.Dijkstra

Note: Replace the class name above with whichever algorithm’s entry point you want to test (e.g. graphs_algorithms.BFSGraph).

🧭 Project Structure

src/
 ├─ dijkstra_shortest_path/
 │   ├─ Dijkstra.java
 │   └─ Node.java
 ├─ graphs_algorithms/
 │   ├─ BFSGraph.java
 │   └─ DFSGraph.java
 └─ KruskalMST/
     ├─ Disjointset.java
     ├─ Edge.java
     └─ Kruskal.java

🧮 Complexity Overview

Algorithm Time Complexity Space Complexity
BFS / DFS O(V + E) O(V)
Dijkstra (naive) O(V²) O(V)
Kruskal (Union-Find) O(E log E) O(V)

V = number of vertices, E = number of edges

🚀 Future Improvements

  • Add priority queue implementation for Dijkstra (O((V+E) log V))
  • Add other MST algorithms (e.g. Prim)
  • Add unit tests and visualization examples

Author: CellaIoana

📄 License

This project is licensed under the MIT License.
You are free to use, modify, and distribute this code as long as the original copyright notice is included.

About

A collection of core graph algorithms implemented in Java, including BFS, DFS, Dijkstra’s shortest path, and Kruskal’s MST, with clean code and simple structure.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages