{"id":23541,"library":"dijkstar","title":"Dijkstar","description":"Dijkstar is an implementation of Dijkstra's single-source shortest paths algorithm and the A* algorithm for weighted multigraphs. Current version 2.6.0 (release frequency: occasional). It is simple to use and allows custom graph structures.","status":"active","version":"2.6.0","language":"python","source_language":"en","source_url":"https://github.com/wylee/Dijkstar","tags":["dijkstra","a-star","shortest-path","graph","algorithm"],"install":[{"cmd":"pip install dijkstar","lang":"bash","label":"Default install"}],"dependencies":[],"imports":[{"note":"Correct import for the Graph class.","symbol":"Graph","correct":"from dijkstar import Graph"},{"note":"Correct import for the pathfinding function.","symbol":"find_path","correct":"from dijkstar import find_path"}],"quickstart":{"code":"from dijkstar import Graph, find_path\n\ngraph = Graph()\ngraph.add_edge(1, 2, 100)\ngraph.add_edge(2, 3, 200)\n\npath_info = find_path(graph, 1, 3)\nprint('Shortest path:', path_info.nodes)\nprint('Total cost:', path_info.total_cost)","lang":"python","description":"Create a weighted graph and find the shortest path between two nodes."},"warnings":[{"fix":"Ensure that duplicate edges with unintended costs are not added inadvertently.","message":"Graph is a multigraph; adding multiple edges between the same nodes with different costs is allowed and may lead to unexpected shortest paths if not careful.","severity":"gotcha","affected_versions":">=2.0.0"},{"fix":"Use hashable node types such as integers, strings, or tuples.","message":"Node IDs must be hashable; using unhashable types (like lists) as nodes will raise an error.","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Use: from dijkstar import Graph","cause":"Importing incorrectly (e.g., import dijkstar then dijkstar.Graph) or having a different version where Graph is not top-level.","error":"AttributeError: module 'dijkstar' has no attribute 'Graph'"},{"fix":"Ensure all nodes in the path query are present in the graph.","cause":"Attempting to find a path from or to a node that has not been added to the graph.","error":"KeyError: node not in graph"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}