Skip to content

Commit 0d4f28c

Browse files
committed
Edges weight defaults to 0 for non heuristic based search
1 parent c15d18d commit 0d4f28c

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

A_Star_Search/Lua/Yonaba/point_graph_handler.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ function handler.addNode(name) graph.nodes[name] = Node(name) end
5656
-- Adds a new edge between nodes labelled from and to
5757
function handler.addEdge(from, to, weight)
5858
table.insert(graph.edges,
59-
{from = graph.nodes[from], to = graph.nodes[to], weight = weight})
59+
{from = graph.nodes[from], to = graph.nodes[to], weight = weight or 0})
6060
end
6161

6262
-- Sets the weight of edge from -> to

0 commit comments

Comments
 (0)