{"id":19788805,"url":"https://github.com/hbarcelos/best-route","last_synced_at":"2026-06-04T20:31:22.068Z","repository":{"id":44523823,"uuid":"172427984","full_name":"hbarcelos/best-route","owner":"hbarcelos","description":"Finds the best (cheapest) route from a starting point towards a destination","archived":false,"fork":false,"pushed_at":"2023-04-30T12:55:41.000Z","size":434,"stargazers_count":1,"open_issues_count":3,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-01-11T03:53:44.820Z","etag":null,"topics":["dijkstra-algorithm","functional-programming","graph","graph-algorithms","graphs","javascript","ramda","tape"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hbarcelos.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-02-25T03:30:14.000Z","updated_at":"2024-03-18T03:25:21.000Z","dependencies_parsed_at":"2024-11-12T06:40:17.463Z","dependency_job_id":null,"html_url":"https://github.com/hbarcelos/best-route","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hbarcelos%2Fbest-route","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hbarcelos%2Fbest-route/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hbarcelos%2Fbest-route/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hbarcelos%2Fbest-route/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hbarcelos","download_url":"https://codeload.github.com/hbarcelos/best-route/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241125120,"owners_count":19913841,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["dijkstra-algorithm","functional-programming","graph","graph-algorithms","graphs","javascript","ramda","tape"],"created_at":"2024-11-12T06:28:52.913Z","updated_at":"2026-06-04T20:31:22.058Z","avatar_url":"https://github.com/hbarcelos.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Best Route\n\n## Summary\n\nGiven a file containing all available flight prices between different airports and the desired origin and destination, it gives you the best (cheapest) route.\n\n## Environment Setup\n\nThis project uses Node.js as runtime environment and Yarn as package manager.\n\nRequirements: \n\n- [Node.js](https://nodejs.org/dist/v11.10.0/) \u003e= 11.0.0\n- [Yarn](https://yarnpkg.com/en/docs/install) \u003e= 1.13.0\n\nAfter installing the packages above, clone this repository:\n\n```bash\ngit clone https://github.com/hbarcelos/best-route.git\n```\n\nSwitch to the project folder:\n\n```bash\ncd best-route\n```\n\n## Dependencies\n\nOnce in the project folder, run to install the project dependencies:\n\n```bash\nyarn install\n```\n\n## Usage\n\n```bash\nyarn start \u003cROUTES_FILE\u003e \"\u003cFROM\u003e - \u003cTO\u003e\"\n```\n\n## Testing\n\n```bash\nyarn test \u003cTEST_FILE\u003e\n```\n\n## Architectural Overview\n\n### File structure\n\n```\n./\n├── digraph/\n│   ├── digraph.js\n│   ├── digraph.test.js\n│   ├── edge-set.js\n│   ├── edge-set.test.js\n│   ├── edge.js\n│   ├── edge.test.js\n│   ├── index.js\n│   ├── priority-queue.js\n│   └── priority-queue.test.js\n├── csv.js\n├── index.js\n├── package.json\n├── parse-available-routes.js\n├── parse-query-route.js\n├── read-file.js\n├── sample-input.csv\n├── test-runner.js\n└── yarn.lock\n```\n\n### Remarks\n\n- Within the `digraph` folder lies the implementation of a Directed Graph, which provides a `.shortestPath()` method that is used to find the best route.\n    - `digraph.Digraph#shortestPath()` implements a slightly modified version of the [Dijkstra's Shortest Path First algorithm](https://en.wikipedia.org/wiki/Dijkstra%27s_algorithm).\n    - Instead of relying solely on arrays and maps, `digraph.EdgeSet` is a higher-level representation of graph edges.\n    - `digraph.PriorityQueue` is used by `digraph.Digraph#shortestPath()` to allow prioritization of the cheapest nodes during graph traversal.\n- `parseAvailableRoutes` is a pure functional pipeline to parse the routes CSV representation into a `digraph.Digraph` instance.\n- `parseQueryRoute` will parse the second CLI param: the desired route.\n- `csv` module is another pure functional pipeline to parse CSV text into JavaScript arrays.\n    - It works only with in-memory CSV. The file read is performed in the `main` function in `index.js` before calling this function.\n- `readFile` is a convenience wrapper around Node.js native `fs` module.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhbarcelos%2Fbest-route","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhbarcelos%2Fbest-route","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhbarcelos%2Fbest-route/lists"}