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.
✅ 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
- Language: Java
- Algorithmic Concepts:
- Dijkstra’s Algorithm (Shortest Path)
- Depth-First Search (DFS)
- Merge Sort
- Data Structures: Arrays, Lists, Graph (Adjacency List)
SmartConnect/
├── Main.java
└── README.mdThe 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)Used to sort all existing user accounts by age.
mergeSort(users, 0, users.length - 1);Finds the shortest path between the logged-in user’s location and another user’s location.
int[] shortestPaths = dijkstra(userLocation);Generates all possible paths between two users’ locations for exploration.
dfs(userLocation, destination, visited, currentPath, allPaths);javac Main.java
java Main
- To create an account
- To log in
- To input your personal and location details
- To view or sort user profiles
- To find paths and distances between locations
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
- Account details
- Shortest path between locations (via Dijkstra)
- All possible paths (via DFS)
- Option to view contact details
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)
- 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)
Anowarul Asif
📧 Reach Me Here
🌐 Portfolio | 🔗 LinkedIn | 🐙 GitHub
Contributions are welcome! Follow these steps:
- Fork the repository
- Create a new branch:
git checkout -b feature-name - Commit your changes:
git commit -m "Add feature" - Push to your fork:
git push origin feature-name - Open a Pull Request
This project is licensed under the MIT License — feel free to use and modify it.