2024-05-29 11:46:09 +00:00
|
|
|
|
# Graph Databases Homework 3
|
|
|
|
|
|
|
|
|
|
A simple route planning between cities with routes was implemented in Rust.
|
|
|
|
|
|
|
|
|
|
## Run yourself
|
|
|
|
|
The project has a minimum supported Rust version (MSRV) of 1.63.0.
|
|
|
|
|
|
2024-05-29 12:37:58 +00:00
|
|
|
|
The Neo4j database has to be started manually and run in background.
|
2024-05-29 11:46:09 +00:00
|
|
|
|
To start the project run:
|
|
|
|
|
|
|
|
|
|
`cargo run --package graphdbhue3 --bin graphdbhue3`
|
|
|
|
|
|
2024-05-29 12:35:50 +00:00
|
|
|
|
You can use the CLI interface to select the proper db credentials:
|
|
|
|
|
```
|
|
|
|
|
❯ ./graphdbhue3 --help
|
|
|
|
|
Simple Route planning application
|
|
|
|
|
|
|
|
|
|
Usage: graphdbhue3 [OPTIONS]
|
|
|
|
|
|
|
|
|
|
Options:
|
|
|
|
|
--host <HOST> host of db [default: 127.0.0.1]
|
|
|
|
|
--port <PORT> port of db [default: 7687]
|
|
|
|
|
--username <USERNAME> username of db [default: ]
|
|
|
|
|
--password <PASSWORD> password of db [default: ]
|
|
|
|
|
-h, --help Print help
|
|
|
|
|
-V, --version Print version
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
Appending cli parameters to the above `cargo run` command is as simple as:
|
|
|
|
|
|
|
|
|
|
`cargo run --package graphdbhue3 --bin graphdbhue3 -- --username <yourusername> --password <yourpwd>`
|
|
|
|
|
|
2024-05-29 11:46:09 +00:00
|
|
|
|
## Accessing Web Interface
|
|
|
|
|
The API is exposed on Port `8081`.
|
2024-05-29 11:46:34 +00:00
|
|
|
|
|
2024-05-29 12:35:50 +00:00
|
|
|
|
Access it through the Swagger Web UI: [http://localhost:8081/docs](http://localhost:8081/docs)
|
2024-05-29 11:49:02 +00:00
|
|
|
|
|
|
|
|
|
## Usage
|
|
|
|
|
|
|
|
|
|
### Adding cities and routes
|
|
|
|
|
|
|
|
|
|
With the `/addcity` and `/addroute` endpoints you can add cities and link them together through routes.
|
|
|
|
|
|
|
|
|
|
### Requesting shortest path
|
|
|
|
|
|
|
|
|
|
Afterwards you can plan a route from one city to another with `/shortestpath`.
|
|
|
|
|
This returns the shortest path between the two cities respecting the `distance` parameter of the ROAD edge.
|