The test_graph web service handles HTTP requests to find the shortest path between 2 nodes based on the weighted network loaded from JSOM file. It supports in direct/undirect/multi-direct and multi-undirect graphs.
The graph's functionality is defined in GraphFunctions classes which its relevant functionalities are called from the accordance API in main. Upon starting, the web service loads the network nodes and edges and create the relevant graph. On short_path HTTP request, it returns the shortest path based on the weight of the edges. It uses the Dijkstra’s Method to compute the shortest weighted path between two nodes in a graph.
On update_weight HTTP request, it checks that there is an edge between the 2 nodes and updates its weight.
- Download the compressed file.
- Uncompress it on /tmp (tar -xzvf <tar_file>)
- The graph file, test-graph.json, is located under /tmp/via/docker/conf/
- Change directory to /tmp/via/docker/
- Run the command 'docker-compose up test_graph'
- The web service is listening on http://127.0.0.1:8000