Skip to content

Simple routing service based on Dijkstra's single-source shortest-path algorithm

Notifications You must be signed in to change notification settings

romromov/Routing

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Simple Routing Service

It is able to answer two type of queries:

  • Path. Find shortest path from station A to station B. Syntax is "path A -> B"
  • Nearby stations. Find stations reachable from A within 60. Syntax is "near A, 60".

It is based on Dijkstra single-source shortest-path algorithm, which asymptotically consumes O(E*logV) time for each query.

Execution

RoutingService.findPath(InputStream taskDescription, OutputStream outputStream) is an enrypoint. Below is an example of task description:

8
A -> B: 240
A -> C: 70
A -> D: 120
C -> B: 60
D -> E: 480
C -> E: 240
B -> E: 210
E -> A: 300
path A -> B
near A, 130

and output:

A -> C -> B: 130
C: 70, D: 120, B: 130

For more examples take a look on RoutingTest.

Workloads

There are 3 random workloads located in ./test/resources. Number in the name of the file is percent of edges (100% - when every node connected to every node).

  • test10.txt - sparse graph with 21 000 edges
  • test30.txt - sparse graph with 61 000 edges
  • test90.txt - dense graph with 190 000 edges

Each workload contains 5 path + 3 nearby queries. Each node name is a name of Berlin U-bahn or S-bahn station. The whole list of Berlin U-bahn or S-bahn stations can be found here ./test/resources.

About

Simple routing service based on Dijkstra's single-source shortest-path algorithm

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages