Input files are placed under input/
directory
- Install node.js
- Install dependencies:
npm install
- Build the project:
npm run build
- Run tests:
npm run test
- Run the program with input file:
node dist/index.js <path/to/file>
Graph
class is used store the input data.
Data structures:
- Adjacency list to retrieve neighbours of a vertex
- Set to iterate through all vertices
Train
class contains an instance of graph, and is used to compute the results of the various operations
Dijkstra's algorithm is used to find the shortest path from a source vertex to all other vertices
- Distance is a positive integer