- Its aims to calculate the shortest path in terms of total connection and duration between two nodes
- Here is the explanation of the project
- Implement the process of CRUD for both City and its Route
- Use Dijkstra Single-Source Shortest Path algorithm supported by Neo4j to calculate the path
Maven>
1 ) Download Neo4j Desktop 1.4.15
2 ) Create a new Project and then create a new local dmbs with its version 4.2.1
3 ) Click Start Button
4 ) Download your project from this link https://github.com/Rapter1990/SpringBootNeo4jShortestPath
5 ) Go to the project's home directory : cd SpringBootNeo4jShortestPath
6 ) Create a jar file though this command mvn clean install
7 ) Run the project though this command mvn spring-boot:run
Docker
1 ) Install Docker Desktop. Here is the installation link : https://docs.docker.com/docker-for-windows/install/
2 ) Open Terminal under resources folder to run Neo4j on Docker Container
docker-compose up -d
3 ) Open Neo4j Browser in the brower
http://localhost:7474/browser/
4 ) Rebuild image app if necessary
docker build -t springbootneo4jshortestpath .
Explore Rest APIs
Method | Url | Description | Valid Request Body | Valid Request Params | Valid Request Params and Body | No Request or Params |
---|---|---|---|---|---|---|
GET | getCityById | Get City By Id | Info | |||
GET | getAllCities | Get All Cities | Info | |||
GET | getCityByName | Get City By Name | Info | |||
POST | createCity | Create City | Info | |||
PUT | updateCity | Update City | Info | |||
DELETE | deleteCity | Delete City | Info | |||
GET | getByRouteId | Get Route By Id | Info | |||
GET | getAllRoutes | Get All Routes By City Id | Info | |||
POST | createRoute | Create Route by City Id and Destination City Id | Info | |||
PUT | updateRoute | Update Route by City Id and Destination City Id | Info | |||
DELETE | deleteRoute | Delete Route By City Id and Route City | Info | |||
GET | getShortestPath | Get Shortest Path by Total Connection | Info | |||
GET | getShortestPathInTime | Get Shortest Path by Total Hours | Info |
- Spring Boot Web
- Spring Boot Test
- Neo4j
- Docker
- Mapper
http://localhost:8077/api/v1/city
{
"name" : "İstanbul"
}
http://localhost:8077/api/v1/shortestpath/shortest-path
{
"from" : "İstanbul",
"destination" : "Ankara"
}
http://localhost:8077/api/v1/shortestpath/shortest-path-in-time
{
"from" : "İstanbul",
"destination" : "Ankara"
}
http://localhost:8077/api/v1/city/id/{cityId}
http://localhost:8077/api/v1/city/name/{cityName}
http://localhost:8077/api/v1/city/{cityId}
http://localhost:8077/api/v1/route/{routeId}
http://localhost:8077/api/v1/route/{cityId}/routes
http://localhost:8077/api/v1/route/{cityId}/routes
http://localhost:8077/api/v1/city/{cityId}
{
"name" : "Ankara"
}
http://localhost:8077/api/v1/route/{cityId}/{destinationCityId}/create-route
{
"from" : "İstanbul",
"destination" : "Ankara",
"departureTime" : "9:00",
"arriveTime" : "11:30"
}
http://localhost:8077/api/v1/route/{cityId}/update-route/{routeId}
{
"from" : "Ankara",
"destination" : "Antalya",
"departureTime" : "9:00",
"arriveTime" : "11:00"
}
http://localhost:8077/api/v1/city/cities