{"id":27355581,"url":"https://github.com/kirillsimin/astar_alphabet","last_synced_at":"2025-10-13T22:36:59.852Z","repository":{"id":49589101,"uuid":"376476516","full_name":"kirillsimin/astar_alphabet","owner":"kirillsimin","description":"A* Alphabet is an innovative exploration of the A* search algorithm, transforming the alphabet into a dynamic graph where customizable heuristics and intelligent pathfinding reveal the most efficient routes between letters.","archived":false,"fork":false,"pushed_at":"2025-02-11T16:11:59.000Z","size":29,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-12T22:16:07.793Z","etag":null,"topics":["astar-algorithm","astar-pathfinding","astar-search","astar-search-algorithm","search-algorithm"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kirillsimin.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}},"created_at":"2021-06-13T08:04:23.000Z","updated_at":"2025-02-11T16:15:04.000Z","dependencies_parsed_at":"2022-09-21T19:23:31.634Z","dependency_job_id":null,"html_url":"https://github.com/kirillsimin/astar_alphabet","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/kirillsimin%2Fastar_alphabet","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kirillsimin%2Fastar_alphabet/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kirillsimin%2Fastar_alphabet/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kirillsimin%2Fastar_alphabet/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kirillsimin","download_url":"https://codeload.github.com/kirillsimin/astar_alphabet/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248637787,"owners_count":21137538,"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":["astar-algorithm","astar-pathfinding","astar-search","astar-search-algorithm","search-algorithm"],"created_at":"2025-04-12T22:16:10.199Z","updated_at":"2025-10-13T22:36:54.821Z","avatar_url":"https://github.com/kirillsimin.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# A* Alphabet: Pathfinding Through Letters\n\n## Overview\n\n**A* Alphabet** is an implementation of the **A* search algorithm** applied to a graph where nodes represent letters of the alphabet. The goal is to find the optimal path from a starting letter to a target letter, leveraging heuristic functions to guide the search efficiently.\n\nA* (A-star) is a best-first search algorithm that finds the shortest path in a weighted graph using a combination of:\n\n\\[ f(n) = g(n) + h(n) \\]\n\nwhere:\n- **g(n)** is the cost from the start node to the current node.\n- **h(n)** is the heuristic estimate of the cost from the current node to the goal.\n- **f(n)** is the total estimated cost of the cheapest path.\n\nThis project explores different heuristic choices and path structures to optimize traversal through the alphabet.\n\n## Features\n\n- **Graph-Based Alphabet Representation**: Models the alphabet as a connected graph with custom edge weights.\n- **Multiple Heuristic Functions**:\n  - Euclidean Distance\n  - Manhattan Distance\n  - Custom Letter-Based Distance Functions\n- **Dynamic Path Visualization**: Provides insights into A*'s decision-making process.\n- **Customizable Parameters**: Modify heuristics and node connections for experimentation.\n\n## Installation\n\nEnsure you have **Python 3.7+** installed.\n\n```bash\n# Clone the repository\ngit clone https://github.com/kirillsimin/astar_alphabet.git\ncd astar_alphabet\n\n# Install dependencies\npip install -r requirements.txt\n```\n\n## Usage\n\nRun the script with the default configuration:\n```bash\npython main.py\n```\n\nOr specify custom parameters:\n```bash\npython main.py --start A --goal Z --heuristic manhattan\n```\n\n### Command-Line Arguments\n\n| Argument         | Description                                     | Default |\n|-----------------|-------------------------------------------------|---------|\n| `--start`       | Starting letter for pathfinding                | `A`     |\n| `--goal`        | Target letter                                  | `Z`     |\n| `--heuristic`   | Heuristic function (`euclidean`, `manhattan`) | `euclidean` |\n| `--verbose`     | Enable detailed output                         | `False`  |\n\n## Algorithm Implementation\n\nThe **A* search** operates as follows:\n\n1. Initialize the **open list** with the starting node.\n2. Maintain a **closed list** to track visited nodes.\n3. Iterate until the goal is reached or the open list is empty:\n   - Select the node with the lowest `f(n) = g(n) + h(n)`.\n   - Expand its neighbors and compute their tentative costs.\n   - Update paths if a better route is found.\n   - Repeat until the target node is reached.\n\n### Graph Representation\n\nEach letter is treated as a **graph node**. The adjacency rules can be customized, but the default setup assumes:\n\n- Letters are **connected sequentially** (`A → B → C ... → Z`).\n- Bi-directional edges with a base weight of **1**.\n- Additional graph structures can be introduced (e.g., diagonal movements).\n\n### Heuristic Functions\n\n| Heuristic   | Formula | Usage |\n|-------------|---------------------------------------------------------|--------------------------|\n| Euclidean   | \\[ h(n) = \\sqrt{(x_2 - x_1)^2 + (y_2 - y_1)^2} \\] | Straight-line distance |\n| Manhattan   | \\[ h(n) = |x_2 - x_1| + |y_2 - y_1| \\] | Grid-based movement |\n| Custom      | Letter distance based on ASCII values | Experimental |\n\n## Example Output\n\n```\nStarting A* search from A to Z using Euclidean heuristic...\nExpanded nodes: 15\nOptimal path found: A → C → F → K → M → Z\nTotal cost: 9.8\n```\n\n## Performance Considerations\n\n- **Time Complexity**: Worst-case **O(|E| + |V| log |V|)**, where `V` is nodes and `E` is edges.\n- **Memory Usage**: Proportional to the size of the open and closed lists.\n- **Heuristic Choice**: Manhattan is better suited for grid-like graphs, while Euclidean works for continuous spaces.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkirillsimin%2Fastar_alphabet","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkirillsimin%2Fastar_alphabet","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkirillsimin%2Fastar_alphabet/lists"}