{"id":29865663,"url":"https://github.com/hatixntsoa/dijkstra_solver","last_synced_at":"2025-07-30T11:13:46.030Z","repository":{"id":257811283,"uuid":"868061950","full_name":"hatixntsoa/dijkstra_solver","owner":"hatixntsoa","description":"A Simple Dijkstra's Algorithm Solver","archived":false,"fork":false,"pushed_at":"2024-10-05T11:30:42.000Z","size":5,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-07-23T23:14:26.952Z","etag":null,"topics":["dijkstra-algorithm","pypi","python"],"latest_commit_sha":null,"homepage":"https://pypi.org/project/dijkstra-solver","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hatixntsoa.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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":"2024-10-05T11:30:24.000Z","updated_at":"2025-06-29T10:45:36.000Z","dependencies_parsed_at":null,"dependency_job_id":"53675f3c-112f-481e-94ff-87f532ae115d","html_url":"https://github.com/hatixntsoa/dijkstra_solver","commit_stats":null,"previous_names":["h471x/dijkstra_solver"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/hatixntsoa/dijkstra_solver","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hatixntsoa%2Fdijkstra_solver","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hatixntsoa%2Fdijkstra_solver/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hatixntsoa%2Fdijkstra_solver/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hatixntsoa%2Fdijkstra_solver/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hatixntsoa","download_url":"https://codeload.github.com/hatixntsoa/dijkstra_solver/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hatixntsoa%2Fdijkstra_solver/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267858439,"owners_count":24155920,"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","status":"online","status_checked_at":"2025-07-30T02:00:09.044Z","response_time":70,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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","pypi","python"],"created_at":"2025-07-30T11:13:42.343Z","updated_at":"2025-07-30T11:13:46.015Z","avatar_url":"https://github.com/hatixntsoa.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Dijkstra's Algorithm Solver\n\nThis Python implementation solves the shortest path problem in a weighted graph using **Dijkstra's algorithm**. It allows you to create a graph, specify source and destination nodes, and compute the shortest path between them.\n\n## Features\n- **Graph Representation**: The graph is represented as a dictionary, where each node has a list of neighbors and their respective weights.\n- **Customizable Source and Destination**: If no source or destination is provided, the first and last nodes in the graph are chosen by default.\n- **Heap-based Priority Queue**: The algorithm uses a heap (priority queue) for efficient node selection.\n- **Shortest Path Calculation**: Returns both the shortest distance and the shortest path between two nodes.\n\n## Installation\n\n### From PyPI\n\nTo install the Dijkstra solver from PyPI, use the following command:\n\n```bash\npip install dijkstra-solver\n```\n\n### From Source\n\n1. Clone the repository:\n   ```bash\n   git clone https://github.com/h471x/dijkstra_solver.git\n   ```\n\n2. Navigate to the project directory:\n   ```bash\n   cd dijkstra_solver\n   ```\n\n3. Run the default code (just for testing):\n   ```bash\n   python dijkstra/main.py\n   ```\n\n4. Build the package:\n\n  ```bash\n  python setup.py sdist bdist_wheel\n  ```\n\n5. Install the package:\n\n  ```bash\n  pip install dist/pypass_tool-*.whl\n  ```\n\n## Usage\n\nTo use the Dijkstra solver, create a new python file, \nthen here is the sample example:\n\n1. Import the Dijkstra class and initialize the graph:\n   ```python\n   from dijkstra import Dijkstra\n   \n   # Define a weighted graph\n   graph = {\n       'A': {'B': 1, 'C': 4},\n       'B': {'C': 2, 'D': 5},\n       'C': {'D': 1},\n       'D': {}\n   }\n   \n   # Initialize the Dijkstra solver\n   dijkstra = Dijkstra(graph)\n   \n   # Solve for the shortest path from A to D\n   dijkstra.solve(source_node='A', destination_node='D')\n   ```\n\n2. The output will display the shortest distance and the path:\n   ```\n   Path: A -\u003e D\n   Shortest Distance: 4\n   Shortest Path: A -\u003e B -\u003e C -\u003e D\n   ```\n\n### Methods Overview\n\n- **`get_graph_size(graph: dict)`**: Returns the number of nodes in the graph.\n  \n- **`get_node_data(graph: dict)`**: Initializes each node with an infinite cost and an empty predecessor.\n\n- **`get_src_dest_node(graph: dict)`**: Returns a list of all nodes in the graph.\n\n- **`get_default_nodes(source: str, destination: str, keys: list[str])`**: Sets default source and destination if none are provided.\n\n- **`solve(graph: dict, source: str, destination: str)`**: Computes the shortest path from the source node to the destination node using Dijkstra's algorithm.\n\n### Example Graph\n\nHere is an example of a weighted graph:\n\n```python\ngraph = {\n    'A': {'B': 2, 'C': 5},\n    'B': {'C': 1, 'D': 4},\n    'C': {'D': 2},\n    'D': {}\n}\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhatixntsoa%2Fdijkstra_solver","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhatixntsoa%2Fdijkstra_solver","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhatixntsoa%2Fdijkstra_solver/lists"}