Skip to content

A Java console-based project that applies Dijkstra’s algorithm, DFS, and Merge Sort to simulate a user connection network with location-based shortest path finding and sorting features.

Notifications You must be signed in to change notification settings

StewieGriffin17/Smart-Connect-Algorithm-Project

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 

Repository files navigation

🌐 Smart Connect – User Network Path Finder

🧩 Overview

Smart Connect is a Java-based console application that combines graph algorithms, sorting algorithms, and basic user management to simulate a small city-based social connection system.

It allows users to:

  • Register and log in
  • View other user accounts
  • Sort accounts by age (using Merge Sort)
  • Find the shortest path and all possible paths between their location and another user's location (using Dijkstra’s Algorithm and Depth-First Search)

This project was developed as part of a 5th semester university Algorithm course to demonstrate the application of graph traversal, shortest path algorithms, and sorting techniques in an interactive Java program.


🚀 Features

✅ User registration and login system
✅ Displays user profiles with location-based connections
✅ Sorts users by age using Merge Sort
✅ Finds shortest path (Dijkstra’s Algorithm) between two locations
✅ Lists all possible paths (DFS Traversal)
✅ Simulates real-world distances between city areas
✅ Interactive console interface


⚙️ Technologies Used

  • Language: Java
  • Algorithmic Concepts:
    • Dijkstra’s Algorithm (Shortest Path)
    • Depth-First Search (DFS)
    • Merge Sort
  • Data Structures: Arrays, Lists, Graph (Adjacency List)

🧱 Project Structure

SmartConnect/
  ├── Main.java 
  └── README.md

🧭 Locations Map

The graph connects five major areas as nodes:

Location Index Area Name
0 Mohakhali
1 Mirpur
2 Cantornment
3 Ghulshan
4 Dhanmondi

Each area is connected to others with different distances (weights in kilometers).
For example:

Mohakhali -> Mirpur (3 km)
Mirpur -> Cantornment (1 km)
Ghulshan -> Dhanmondi (4 km)

🧠 Algorithms Implemented

🧩 1. Merge Sort

Used to sort all existing user accounts by age.

mergeSort(users, 0, users.length - 1);

🚗 2. Dijkstra’s Algorithm

Finds the shortest path between the logged-in user’s location and another user’s location.

int[] shortestPaths = dijkstra(userLocation);

🌐 3. Depth-First Search (DFS)

Generates all possible paths between two users’ locations for exploration.

dfs(userLocation, destination, visited, currentPath, allPaths);

💻 How to Run

▶️ Compile

javac Main.java

▶️ Execute

java Main

The program will prompt:

  1. To create an account
  2. To log in
  3. To input your personal and location details
  4. To view or sort user profiles
  5. To find paths and distances between locations

🧮 Sample Flow

Welcome! Let's create your account.
Enter username: asif
Enter password: ****

=== Login ===
Enter username: asif
Enter password: ****
Login Successful!

Choose an account to view:
1. Alice
2. Eve
3. Bob
4. David
5. Charlie
6. Sort accounts by age

When a user is selected, the program shows:

  • Account details
  • Shortest path between locations (via Dijkstra)
  • All possible paths (via DFS)
  • Option to view contact details

🧰 Example Output

Shortest path from user to chosen account: 4 km

All possible paths:
Path: Mohakhali -> Ghulshan -> Dhanmondi (Distance: 9 km)
Path: Mohakhali -> Mirpur -> Cantornment -> Dhanmondi (Distance: 12 km)

🪄 Future Enhancements

  • Add a GUI (Swing)
  • Store users in a file or database
  • Visualize paths using a graph visualization library
  • Allow dynamic addition/removal of nodes (locations)

📝Author

Anowarul Asif
📧 Reach Me Here
🌐 Portfolio | 🔗 LinkedIn | 🐙 GitHub


⭐ Contribute

Contributions are welcome! Follow these steps:

  1. Fork the repository
  2. Create a new branch: git checkout -b feature-name
  3. Commit your changes: git commit -m "Add feature"
  4. Push to your fork: git push origin feature-name
  5. Open a Pull Request

🛡️ License

This project is licensed under the MIT License — feel free to use and modify it.

About

A Java console-based project that applies Dijkstra’s algorithm, DFS, and Merge Sort to simulate a user connection network with location-based shortest path finding and sorting features.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages